Olauncher icon indicating copy to clipboard operation
Olauncher copied to clipboard

[BUG]: Incorrect screen time

Open OndrejKulhavy opened this issue 1 year ago • 33 comments

I've noticed that my screen time is unusually high. On 00:01 midnight, I have over an hour of screen time, which doesn't seem logical.

Here's an example from just now: Digital Wellbeing is displaying 55 minutes, which seems realistic, while OLauncher is indicating 3 hours and 12 minutes.

Image 1 Image 2

OndrejKulhavy avatar Nov 20 '24 10:11 OndrejKulhavy

Screenshot_20241121-000449.png

Ya mine says 7 hours when it's just past midnight.

I think its calculating the past 24 hours not resetting at midnight.

CreativeCodeCat avatar Nov 21 '24 00:11 CreativeCodeCat

That's stupid, I guess you are right!

OndrejKulhavy avatar Nov 21 '24 09:11 OndrejKulhavy

I have the same problem. Samsung galaxy S23 with Android 14

daaanny90 avatar Nov 26 '24 20:11 daaanny90

To be honest, since it probably only counts the last 24 hours, it's a somewhat useless indicator. I'm spending time on my phone, yet the time displayed is either stagnant or decreasing. 💀

OndrejKulhavy avatar Nov 26 '24 21:11 OndrejKulhavy

https://github.com/tanujnotes/Olauncher/blob/fbcc721e9c97368c5b621270cc4e183920febea2/app/src/main/java/app/olauncher/MainViewModel.kt#L255-L273

It seems like the intention was to show the screen time from the start of the current day until 24h after. Which seems correct. But there must be a bug somewhere. Might also be time zone related, but that's just a wild guess.

eddex avatar Nov 27 '24 07:11 eddex

https://github.com/tanujnotes/Olauncher/blob/fbcc721e9c97368c5b621270cc4e183920febea2/app/src/main/java/app/olauncher/MainViewModel.kt#L255-L273

It seems like the intention was to show the screen time from the start of the current day until 24h after. Which seems correct. But there must be a bug somewhere. Might also be time zone related, but that's just a wild guess.

Ya that is how it is meant to work but some reason it doesn't take the current time even changing the 0 for hour to 9 for 9am it still displays the same data so the hour is not affecting anything. I have been playing with that part of the code for 3 days now and can't figure out why the hour isn't effected

CreativeCodeCat avatar Nov 27 '24 09:11 CreativeCodeCat

It has something to do with the UTC timezone but I haven't been able to figure out a solution. The response Android provides for the screen time is all over the place. I tried different screen time apps and they all show different values, although not as wrong as Olauncher. Working on it.

tanujnotes avatar Nov 29 '24 07:11 tanujnotes

It has something to do with the UTC timezone but I haven't been able to figure out a solution. The response Android provides for the screen time is all over the place. I tried different screen time apps and they all show different values, although not as wrong as Olauncher. Working on it.

Take a look at usageDirect they seem to do a pretty good job with it.

CreativeCodeCat avatar Nov 29 '24 07:11 CreativeCodeCat

Hello, Having the same issue here on a fairphone.

Evertvz avatar Feb 09 '25 09:02 Evertvz

Hello, Having the same issue here on a fairphone.

FairPhone 5 Crew :)

CreativeCodeCat avatar Feb 09 '25 16:02 CreativeCodeCat

@ArchUsr64 sadly that doesn't fix the issue at all.

CreativeCodeCat avatar Feb 22 '25 18:02 CreativeCodeCat

@ArchUsr64 sadly that doesn't fix the issue at all.

Yeah, it's very strange. It worked on my phone for a few days and then broke again. Likely an issue with the underlying android API.

ArchUsr64 avatar Feb 23 '25 12:02 ArchUsr64

ya i have spent hours trying to work out why it is not working and even tried to look at how usagedirect does it but no luck sadly :(

CreativeCodeCat avatar Feb 23 '25 17:02 CreativeCodeCat

I found a fix by filtering today’s values.

However, it also counts the time spent in the launcher, so the time differs a little bit compared to the Digital Wellbeing time.

OndrejKulhavy avatar Feb 23 '25 18:02 OndrejKulhavy

However, it also counts the time spent in the launcher, so the time differs a little bit compared to the Digital Wellbeing time.

I tried this along with a blacklist of apps using the code below but it still shows 2 hours where as Digital Wellbeing is showing 3 mins and the old way shows 12 mins

private fun parseBlacklistXML(context: Context): List<String> {
        val packageNames = mutableListOf<String>()

        // Obtain an XmlPullParser for the blacklist.xml file
        context.resources.getXml(R.xml.blacklist).use { parser ->
            while (parser.eventType != XmlPullParser.END_DOCUMENT) {
                if (parser.eventType == XmlPullParser.START_TAG && parser.name == "app") {
                    val packageName = parser.getAttributeValue(null, "packageName")
                    packageNames.add(packageName)
                }
                parser.next()
            }
        }

        return packageNames
    }
Old Way Your Way
Old Way Your Way

CreativeCodeCat avatar Feb 23 '25 20:02 CreativeCodeCat

Interesting. After filtering out the launcher app, I have a difference of ±5 minutes. I will test the behavior after midnight.

OndrejKulhavy avatar Feb 23 '25 21:02 OndrejKulhavy

I will give it a test tomorrow too and see if them new changes fix it.

CreativeCodeCat avatar Feb 23 '25 21:02 CreativeCodeCat

For reference

Original version:
After My Changes:
Reference (Digital Wellbeing):

OndrejKulhavy avatar Feb 23 '25 21:02 OndrejKulhavy

Try this: https://github.com/tanujnotes/Olauncher/releases/tag/v5.2.28

tanujnotes avatar Feb 28 '25 11:02 tanujnotes

Hi everybody, i know that works was done on screen time - thank you ! - but since Olauncher update 5.3.2 (today) the screen time is worse than before in my case.

Image

Image

23 min is correct (well-being calculation) 14h21 is of course wrong (14h00 more !)

Is there a problem with time settings, time zone (UTC -4, Atlantic time) ?

Image

Npa972 avatar Mar 03 '25 14:03 Npa972

Interesting. Can you please share your weekly wellbeing stats?

OndrejKulhavy avatar Mar 03 '25 17:03 OndrejKulhavy

Image

Npa972 avatar Mar 03 '25 18:03 Npa972

The new screen time calculation method seems to be failing on Samsung devices. Fixing it.

tanujnotes avatar Mar 04 '25 07:03 tanujnotes

Yesterday at midnight time screen reset to 0. This morning time screen seems OK. I don't understand, It's beyond my skills. There is a difference of a few minutes compared to well being calculation. Thank you.

Image

Npa972 avatar Mar 04 '25 12:03 Npa972

Just chiming in to say that there is still a bug for my screen time display on a Google Pixel 8.

nmariano9 avatar Mar 19 '25 17:03 nmariano9

This is still an issue for me as well. I'm on a Samsung Galaxy S25 Ultra.

ConnorMooneyhan avatar Apr 20 '25 19:04 ConnorMooneyhan

It started to become an issue in the last weeks for me too.. I now often wake up with Screen Time values way higher than the hours of the day elapsed (with actual 0 min). I also reach 25+hours of screen time. A couple weeks ago, the values were identical to the Digital Well Being App on my S24.

adrianjost avatar Apr 22 '25 08:04 adrianjost

Same issue here on a Huawei At 8:05am - OLauncher is showing 8h 52m Actual = 7 mins Last 7 Days: 7 min, 56 min, 1h 10m, 2h 21m, 3h 24m, 56m, 3h 52m

RyanGaudion avatar May 08 '25 07:05 RyanGaudion

Also experiencing this issue on Pixel 6.

Would be nice if there was an option to just hide the amount, if it's not functioning... It would also be nice to be able to blacklist some apps, like navigation.

I guess there is no API inside Android to request this value, instead of calculating it yourself?

kruinkriebel avatar Jun 25 '25 04:06 kruinkriebel

This is a known issue with no known solution at the moment. If anyone can help, that'd be great. Thank you.

tanujnotes avatar Jul 07 '25 18:07 tanujnotes