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

Commit ed432c41 authored by Stanislav Zholnin's avatar Stanislav Zholnin Committed by Android (Google) Code Review
Browse files

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

parents c391c730 edeba528
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 {