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

Commit 5f135410 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "In addition to checking for GET_APP_OPS_STATS permission, require...

Merge "In addition to checking for GET_APP_OPS_STATS permission, require running in the same process or being instrumented to access stack trace collection API."
parents 553fb27d a01eaf57
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6143,6 +6143,12 @@ public class AppOpsService extends IAppOpsService.Stub {
    /** Pulls current AppOps access report and resamples package and app op to watch */
    @Override
    public @Nullable RuntimeAppOpAccessMessage collectRuntimeAppOpAccessMessage() {
        ActivityManagerInternal ami = LocalServices.getService(ActivityManagerInternal.class);
        boolean isCallerInstrumented = ami.isUidCurrentlyInstrumented(Binder.getCallingUid());
        boolean isCallerSystem = Binder.getCallingPid() == Process.myPid();
        if (!isCallerSystem && !isCallerInstrumented) {
            return null;
        }
        mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS,
                Binder.getCallingPid(), Binder.getCallingUid(), null);
        RuntimeAppOpAccessMessage result;