Getoffyourphone icon indicating copy to clipboard operation
Getoffyourphone copied to clipboard

Usage Stats are wrong

Open Vel-San opened this issue 7 years ago • 5 comments

Dear Users,

I've found a bug in the newly implemented usage stats ( in Selected Apps screen ), i'll be updating it with the new release.

Bug: Numbers sometimes do not update, or stay the same from 1 day to another. Expected: Numbers should reset every day, stats should be saved/shown second by second.

Vel-San avatar Oct 07 '18 10:10 Vel-San

Hello, it very good apps. and as you mention this bug for "usage stats ( in Selected Apps screen )" , i resolved that as using following code

public class UStats { ........ ........ private static void printUsageStats(List<UsageStats> usageStatsList, int j) { .......... ....... /add following code/ long TimeInforground=usageStatsList.get(i).getTotalTimeInForeground(); int minutes = (int) ((TimeInforground / (100060)) % 60); int seconds = (int) (TimeInforground / 1000) % 60 ; int hours = (int) ((TimeInforground / (10006060)) % 24); String result = String.format("%02d h, %02d min, %02d sec", hours, minutes, seconds ); /*****************************************/

 /***remove following old code*******/
 /***String result = String.format("%02d h, %02d min, %02d sec",
                    TimeUnit.MILLISECONDS.toHours(usageStatsList.get(i).getTotalTimeInForeground()),
                    TimeUnit.MILLISECONDS.toMinutes(usageStatsList.get(i).getTotalTimeInForeground()) -
                            TimeUnit.MILLISECONDS.toMinutes(TimeUnit.MILLISECONDS.toHours(usageStatsList.get(i).getTotalTimeInForeground())),
                    TimeUnit.MILLISECONDS.toSeconds(usageStatsList.get(i).getTotalTimeInForeground()) -
                            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(usageStatsList.get(i).getTotalTimeInForeground()))
            );***/

NOTE: hope this is the correct way to do this as i test its working fine

rey501 avatar Mar 07 '19 05:03 rey501

@rey501 Hey!

Thankyou so much for your contribution. I'll test this whenever i can this evening. Can you make a pull request? If not, I'll add you to the list of contributors when i replace my code with yours :)

Vel-San avatar Mar 07 '19 07:03 Vel-San

Thank you. As i am not very much aware of able to do pull request or not. Could you please test this code and replace if all working fine ?

rey501 avatar Mar 07 '19 10:03 rey501

@rey501

I have a lot of things happening in life right now and i'm not going to be able to do changes and publish them. I will try and work as much as i can in my free time and will give feedback.

Thanks again!

Vel-San avatar Mar 08 '19 12:03 Vel-San

Thank you. As i am not very much aware of able to do pull request or not. Could you please test this code and replace if all working fine ?

Unfortunalty the stats are a little off still ( couple of minutes or so , and sometimes correct. ) I'll have to leave this for a later time.

Vel-San avatar Nov 06 '19 13:11 Vel-San