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

Commit 000b8e82 authored by Jing Ji's avatar Jing Ji
Browse files

Safe guard the service type in the app fgs tracker.

Bug: 219542109
Test: Manual - start an instant app with FGS.
Change-Id: I1715bf18462c7a02233cfe662be0a74abf6a8bcd
parent fe0f81e2
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -560,6 +560,7 @@ final class AppFGSTracker extends BaseAppStateDurationsTracker<AppFGSPolicy, Pac
            int changes = serviceTypes ^ mForegroundServiceTypes;
            for (int serviceType = Integer.highestOneBit(changes); serviceType != 0;) {
                final int i = foregroundServiceTypeToIndex(serviceType);
                if (i < mEvents.length) {
                    if ((serviceTypes & serviceType) != 0) {
                        // Start this type.
                        if (mEvents[i] == null) {
@@ -576,6 +577,7 @@ final class AppFGSTracker extends BaseAppStateDurationsTracker<AppFGSPolicy, Pac
                            notifyListenersOnStateChangeIfNecessary(false, now, serviceType);
                        }
                    }
                }
                changes &= ~serviceType;
                serviceType = Integer.highestOneBit(changes);
            }