Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c790a296 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz
Browse files

Only start tracking usage on first activity resume

Fixes: 122937104
Test: manual (open two apps in splitscreen and bring each into focus
multiple times, close both apps, check "adb shell dumpsys usagestats
apptimelimit")

Change-Id: I3ea30d55291d37d156cb3573074ada7f9ed18171
parent 0b4ab1f1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -491,6 +491,8 @@ public class UsageStatsService extends SystemService implements
            switch (event.mEventType) {
                case Event.ACTIVITY_RESUMED:
                    synchronized (mVisibleActivities) {
                        // check if this activity has already been resumed
                        if (mVisibleActivities.get(event.mInstanceId) != null) break;
                        mVisibleActivities.put(event.mInstanceId, event.getClassName());
                        try {
                            mAppTimeLimit.noteUsageStart(packageName, userId);