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

Commit af597830 authored by Varun Shah's avatar Varun Shah Committed by Android (Google) Code Review
Browse files

Merge "Allow only Recents to query app usage limit info."

parents 47bfb774 e9abb755
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+2 −6
Original line number Diff line number Diff line
@@ -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 =