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

Commit 4826edca authored by Xin Guan's avatar Xin Guan
Browse files

UsageStats: use the correct calling user ID for instant apps check

Also dump the flag value out and minor fix.

Bug: 194321117
Test: manual
Change-Id: I8816493ae82d83e9d6e4a7d28484201d57b3e888
parent c0a474ca
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -332,6 +332,7 @@ public class UsageStatsService extends SystemService implements
                        mUsageEventListeners.valueAt(i).onUsageEvent(userId, event);
                    }
                }
                return true;
            }
        }
        return false;
@@ -1973,6 +1974,8 @@ public class UsageStatsService extends SystemService implements
                + ": " + Flags.userInteractionTypeApi());
        pw.println("    " + Flags.FLAG_USE_PARCELED_LIST
                + ": " + Flags.useParceledList());
        pw.println("    " + Flags.FLAG_FILTER_BASED_EVENT_QUERY_API
                + ": " + Flags.filterBasedEventQueryApi());

        final int[] userIds;
        synchronized (mLock) {
@@ -2245,7 +2248,7 @@ public class UsageStatsService extends SystemService implements
            final int callingUid = Binder.getCallingUid();
            final int callingPid = Binder.getCallingPid();
            final boolean obfuscateInstantApps = shouldObfuscateInstantAppsForCaller(
                    callingUid, userId);
                    callingUid, UserHandle.getCallingUserId());

            final long token = Binder.clearCallingIdentity();
            try {
@@ -2384,6 +2387,7 @@ public class UsageStatsService extends SystemService implements
            if (!hasQueryPermission(callingPackage)) {
                return null;
            }

            return queryEventsHelper(UserHandle.getCallingUserId(), query.getBeginTimeMillis(),
                    query.getEndTimeMillis(), callingPackage, query.getEventTypeFilter());
        }