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

Commit 30c201a3 authored by Stanislav Zholnin's avatar Stanislav Zholnin Committed by Automerger Merge Worker
Browse files

Merge "Enable HistoricalRegistry API and getHistoricalOps for self-requests."...

Merge "Enable HistoricalRegistry API and getHistoricalOps for self-requests." into sc-dev am: ed432c41

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13787677

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3ffbe12e95788914bf525d194061728106fa5261
parents 90ddc829 ed432c41
Loading
Loading
Loading
Loading
+19 −17
Original line number Diff line number Diff line
@@ -2098,8 +2098,9 @@ public class AppOpsService extends IAppOpsService.Stub {
        ensureHistoricalOpRequestIsValid(uid, packageName, attributionTag, opNames, filter,
                beginTimeMillis, endTimeMillis, flags);
        Objects.requireNonNull(callback, "callback cannot be null");

        ActivityManagerInternal ami = LocalServices.getService(ActivityManagerInternal.class);
        boolean isSelfRequest = (filter & FILTER_BY_UID) != 0 && uid == Binder.getCallingUid();
        if (!isSelfRequest) {
            boolean isCallerInstrumented = ami.isUidCurrentlyInstrumented(Binder.getCallingUid());
            boolean isCallerSystem = Binder.getCallingPid() == Process.myPid();
            boolean isCallerPermissionController;
@@ -2118,6 +2119,7 @@ public class AppOpsService extends IAppOpsService.Stub {

            mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS,
                    Binder.getCallingPid(), Binder.getCallingUid(), "getHistoricalOps");
        }

        final String[] opNamesArray = (opNames != null)
                ? opNames.toArray(new String[opNames.size()]) : null;
+1 −1
Original line number Diff line number Diff line
@@ -795,7 +795,7 @@ final class HistoricalRegistry {
    private static boolean isApiEnabled() {
        return Binder.getCallingUid() == Process.myUid()
                || DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
                PROPERTY_PERMISSIONS_HUB_ENABLED, false);
                PROPERTY_PERMISSIONS_HUB_ENABLED, true);
    }

    private static final class Persistence {