From 4826edca49a5be7908d725e0a64ec0a5aa918785 Mon Sep 17 00:00:00 2001 From: Xin Guan Date: Wed, 6 Dec 2023 13:44:12 -0600 Subject: 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 --- services/usage/java/com/android/server/usage/UsageStatsService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index 0e1e0c8e3ad3..3d2340cca378 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -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()); } -- cgit v1.2.3-59-g8ed1b