diff options
| author | 2019-03-05 05:23:57 +0000 | |
|---|---|---|
| committer | 2019-03-05 05:23:57 +0000 | |
| commit | af597830ffe9ef27a27c19ffd5218e760f61eebc (patch) | |
| tree | 685d15395793d44032aad2b0c71fbede36e7a88b | |
| parent | 47bfb774af695617be3bd69d5e8c52ba6b935686 (diff) | |
| parent | e9abb7551f2df4dac1926cc773880043b94a946e (diff) | |
Merge "Allow only Recents to query app usage limit info."
| -rw-r--r-- | core/java/android/content/pm/LauncherApps.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/LauncherAppsService.java | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java index 38ea43e0219b..0cc5f3931487 100644 --- a/core/java/android/content/pm/LauncherApps.java +++ b/core/java/android/content/pm/LauncherApps.java @@ -792,7 +792,7 @@ public class LauncherApps { * * @return an {@link AppUsageLimit} object describing the app time limit containing * the given package with the smallest time remaining, or {@code null} if none exist. - * @throws SecurityException when the caller is not the active launcher. + * @throws SecurityException when the caller is not the recents app. */ @Nullable public LauncherApps.AppUsageLimit getAppUsageLimit(@NonNull String packageName, diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java index 9e9128430e01..05af13ab9eec 100644 --- a/services/core/java/com/android/server/pm/LauncherAppsService.java +++ b/services/core/java/com/android/server/pm/LauncherAppsService.java @@ -744,12 +744,8 @@ public class LauncherAppsService extends SystemService { if (!canAccessProfile(user.getIdentifier(), "Cannot access usage limit")) { return null; } - - final PackageManagerInternal pmi = - LocalServices.getService(PackageManagerInternal.class); - final ComponentName cn = pmi.getDefaultHomeActivity(user.getIdentifier()); - if (!cn.getPackageName().equals(callingPackage)) { - throw new SecurityException("Caller is not the active launcher"); + if (!mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid())) { + throw new SecurityException("Caller is not the recents app"); } final UsageStatsManagerInternal.AppUsageLimitData data = |