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

Commit 9d098467 authored by Nate Myren's avatar Nate Myren
Browse files

RESTRICT AUTOMERGE Use chain start token in performOpTransaction

Bug: 258672042
Test: atest CtsPermission4TestCases
Change-Id: I1d484ed7c72d4ae73f4cbec47522a18ae9088f6e
parent 31fc4ee2
Loading
Loading
Loading
Loading
+13 −9
Original line number Original line Diff line number Diff line
@@ -8888,8 +8888,9 @@ public class AppOpsManager {
     */
     */
    public int startProxyOpNoThrow(int op, @NonNull AttributionSource attributionSource,
    public int startProxyOpNoThrow(int op, @NonNull AttributionSource attributionSource,
            @Nullable String message, boolean skipProxyOperation) {
            @Nullable String message, boolean skipProxyOperation) {
        return startProxyOpNoThrow(op, attributionSource, message, skipProxyOperation,
        return startProxyOpNoThrow(attributionSource.getToken(), op, attributionSource, message,
                ATTRIBUTION_FLAGS_NONE, ATTRIBUTION_FLAGS_NONE, ATTRIBUTION_CHAIN_ID_NONE);
                skipProxyOperation, ATTRIBUTION_FLAGS_NONE, ATTRIBUTION_FLAGS_NONE,
                ATTRIBUTION_CHAIN_ID_NONE);
    }
    }


    /**
    /**
@@ -8901,7 +8902,8 @@ public class AppOpsManager {
     *
     *
     * @hide
     * @hide
     */
     */
    public int startProxyOpNoThrow(int op, @NonNull AttributionSource attributionSource,
    public int startProxyOpNoThrow(@NonNull IBinder clientId, int op,
            @NonNull AttributionSource attributionSource,
            @Nullable String message, boolean skipProxyOperation, @AttributionFlags
            @Nullable String message, boolean skipProxyOperation, @AttributionFlags
            int proxyAttributionFlags, @AttributionFlags int proxiedAttributionFlags,
            int proxyAttributionFlags, @AttributionFlags int proxiedAttributionFlags,
            int attributionChainId) {
            int attributionChainId) {
@@ -8919,7 +8921,7 @@ public class AppOpsManager {
                }
                }
            }
            }


            SyncNotedAppOp syncOp = mService.startProxyOperation(op,
            SyncNotedAppOp syncOp = mService.startProxyOperation(clientId, op,
                    attributionSource, false, collectionMode == COLLECT_ASYNC, message,
                    attributionSource, false, collectionMode == COLLECT_ASYNC, message,
                    shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                    shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                    proxiedAttributionFlags, attributionChainId);
                    proxiedAttributionFlags, attributionChainId);
@@ -9017,9 +9019,10 @@ public class AppOpsManager {
     */
     */
    public void finishProxyOp(@NonNull String op, int proxiedUid,
    public void finishProxyOp(@NonNull String op, int proxiedUid,
            @NonNull String proxiedPackageName, @Nullable String proxiedAttributionTag) {
            @NonNull String proxiedPackageName, @Nullable String proxiedAttributionTag) {
        finishProxyOp(op, new AttributionSource(mContext.getAttributionSource(),
        IBinder token = mContext.getAttributionSource().getToken();
        finishProxyOp(token, op, new AttributionSource(mContext.getAttributionSource(),
                new AttributionSource(proxiedUid, proxiedPackageName,  proxiedAttributionTag,
                new AttributionSource(proxiedUid, proxiedPackageName,  proxiedAttributionTag,
                        mContext.getAttributionSource().getToken())), /*skipProxyOperation*/ false);
                        token)), /*skipProxyOperation*/ false);
    }
    }


    /**
    /**
@@ -9034,10 +9037,11 @@ public class AppOpsManager {
     *
     *
     * @hide
     * @hide
     */
     */
    public void finishProxyOp(@NonNull String op, @NonNull AttributionSource attributionSource,
    public void finishProxyOp(@NonNull IBinder clientId, @NonNull String op,
            boolean skipProxyOperation) {
            @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
        try {
        try {
            mService.finishProxyOperation(strOpToOp(op), attributionSource, skipProxyOperation);
            mService.finishProxyOperation(clientId, strOpToOp(op), attributionSource,
                    skipProxyOperation);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+14 −9
Original line number Original line Diff line number Diff line
@@ -26,13 +26,11 @@ import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.SparseIntArray;


import com.android.internal.app.IAppOpsCallback;
import com.android.internal.app.IAppOpsCallback;
import com.android.internal.util.function.DecFunction;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.QuadFunction;
import com.android.internal.util.function.QuadFunction;
import com.android.internal.util.function.QuintConsumer;
import com.android.internal.util.function.QuintConsumer;
import com.android.internal.util.function.QuintFunction;
import com.android.internal.util.function.QuintFunction;
import com.android.internal.util.function.TriFunction;
import com.android.internal.util.function.UndecFunction;
import com.android.internal.util.function.UndecFunction;


/**
/**
@@ -135,6 +133,7 @@ public abstract class AppOpsManagerInternal {
        /**
        /**
         * Allows overriding start proxy operation behavior.
         * Allows overriding start proxy operation behavior.
         *
         *
         * @param clientId The client calling start, represented by an IBinder
         * @param code The op code to start.
         * @param code The op code to start.
         * @param attributionSource The permission identity of the caller.
         * @param attributionSource The permission identity of the caller.
         * @param startIfModeDefault Whether to start the op of the mode is default.
         * @param startIfModeDefault Whether to start the op of the mode is default.
@@ -148,11 +147,12 @@ public abstract class AppOpsManagerInternal {
         * @param superImpl The super implementation.
         * @param superImpl The super implementation.
         * @return The app op note result.
         * @return The app op note result.
         */
         */
        SyncNotedAppOp startProxyOperation(int code, @NonNull AttributionSource attributionSource,
        SyncNotedAppOp startProxyOperation(@NonNull IBinder clientId, int code,
                boolean startIfModeDefault, boolean shouldCollectAsyncNotedOp, String message,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                boolean shouldCollectMessage, boolean skipProxyOperation, @AttributionFlags
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                int proxyAttributionFlags, @AttributionFlags int proxiedAttributionFlags,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                int attributionChainId, @NonNull DecFunction<Integer, AttributionSource, Boolean,
                @AttributionFlags int proxiedAttributionFlags, int attributionChainId,
                @NonNull UndecFunction<IBinder, Integer, AttributionSource, Boolean,
                        Boolean, String, Boolean, Boolean, Integer, Integer, Integer,
                        Boolean, String, Boolean, Boolean, Integer, Integer, Integer,
                        SyncNotedAppOp> superImpl);
                        SyncNotedAppOp> superImpl);


@@ -176,10 +176,15 @@ public abstract class AppOpsManagerInternal {
         *
         *
         * @param code The op code to finish.
         * @param code The op code to finish.
         * @param attributionSource The permission identity of the caller.
         * @param attributionSource The permission identity of the caller.
         * @param skipProxyOperation Whether to skip the proxy in the proxy/proxied operation
         * @param clientId The client calling finishProxyOperation
         * @param superImpl The "standard" implementation to potentially call
         */
         */
        void finishProxyOperation(int code, @NonNull AttributionSource attributionSource,
        void finishProxyOperation(@NonNull IBinder clientId, int code,
                @NonNull AttributionSource attributionSource,
                boolean skipProxyOperation,
                boolean skipProxyOperation,
                @NonNull TriFunction<Integer, AttributionSource, Boolean, Void> superImpl);
                @NonNull QuadFunction<IBinder, Integer, AttributionSource, Boolean,
                        Void> superImpl);
    }
    }


    /**
    /**
+6 −5
Original line number Original line Diff line number Diff line
@@ -58,11 +58,12 @@ interface IAppOpsService {
    SyncNotedAppOp noteProxyOperation(int code, in AttributionSource attributionSource,
    SyncNotedAppOp noteProxyOperation(int code, in AttributionSource attributionSource,
            boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
            boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
            boolean skipProxyOperation);
            boolean skipProxyOperation);
    SyncNotedAppOp startProxyOperation(int code, in AttributionSource attributionSource,
    SyncNotedAppOp startProxyOperation(IBinder clientId, int code,
            boolean startIfModeDefault, boolean shouldCollectAsyncNotedOp, String message,
            in AttributionSource attributionSource, boolean startIfModeDefault,
            boolean shouldCollectMessage, boolean skipProxyOperation, int proxyAttributionFlags,
            boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
            int proxiedAttributionFlags, int attributionChainId);
            boolean skipProxyOperation, int proxyAttributionFlags, int proxiedAttributionFlags,
    void finishProxyOperation(int code, in AttributionSource attributionSource,
            int attributionChainId);
    void finishProxyOperation(IBinder clientId, int code, in AttributionSource attributionSource,
            boolean skipProxyOperation);
            boolean skipProxyOperation);


    // Remaining methods are only used in Java.
    // Remaining methods are only used in Java.
+12 −12
Original line number Original line Diff line number Diff line
@@ -348,12 +348,10 @@ import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.MemInfoReader;
import com.android.internal.util.MemInfoReader;
import com.android.internal.util.Preconditions;
import com.android.internal.util.Preconditions;
import com.android.internal.util.function.DecFunction;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.QuadFunction;
import com.android.internal.util.function.QuadFunction;
import com.android.internal.util.function.QuintFunction;
import com.android.internal.util.function.QuintFunction;
import com.android.internal.util.function.TriFunction;
import com.android.internal.util.function.UndecFunction;
import com.android.internal.util.function.UndecFunction;
import com.android.server.AlarmManagerInternal;
import com.android.server.AlarmManagerInternal;
import com.android.server.DeviceIdleInternal;
import com.android.server.DeviceIdleInternal;
@@ -17062,19 +17060,20 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        }
        @Override
        @Override
        public SyncNotedAppOp startProxyOperation(int code,
        public SyncNotedAppOp startProxyOperation(@NonNull IBinder clientId, int code,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                @AttributionFlags int proxiedAttributionFlags, int attributionChainId,
                @AttributionFlags int proxiedAttributionFlags, int attributionChainId,
                @NonNull DecFunction<Integer, AttributionSource, Boolean, Boolean, String, Boolean,
                @NonNull UndecFunction<IBinder, Integer, AttributionSource,
                        Boolean, Integer, Integer, Integer, SyncNotedAppOp> superImpl) {
                        Boolean, Boolean, String, Boolean, Boolean, Integer, Integer, Integer,
                        SyncNotedAppOp> superImpl) {
            if (attributionSource.getUid() == mTargetUid && isTargetOp(code)) {
            if (attributionSource.getUid() == mTargetUid && isTargetOp(code)) {
                final int shellUid = UserHandle.getUid(UserHandle.getUserId(
                final int shellUid = UserHandle.getUid(UserHandle.getUserId(
                        attributionSource.getUid()), Process.SHELL_UID);
                        attributionSource.getUid()), Process.SHELL_UID);
                final long identity = Binder.clearCallingIdentity();
                final long identity = Binder.clearCallingIdentity();
                try {
                try {
                    return superImpl.apply(code, new AttributionSource(shellUid,
                    return superImpl.apply(clientId, code, new AttributionSource(shellUid,
                            "com.android.shell", attributionSource.getAttributionTag(),
                            "com.android.shell", attributionSource.getAttributionTag(),
                            attributionSource.getToken(), attributionSource.getNext()),
                            attributionSource.getToken(), attributionSource.getNext()),
                            startIfModeDefault, shouldCollectAsyncNotedOp, message,
                            startIfModeDefault, shouldCollectAsyncNotedOp, message,
@@ -17084,21 +17083,22 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Binder.restoreCallingIdentity(identity);
                    Binder.restoreCallingIdentity(identity);
                }
                }
            }
            }
            return superImpl.apply(code, attributionSource, startIfModeDefault,
            return superImpl.apply(clientId, code, attributionSource, startIfModeDefault,
                    shouldCollectAsyncNotedOp, message, shouldCollectMessage, skipProxyOperation,
                    shouldCollectAsyncNotedOp, message, shouldCollectMessage, skipProxyOperation,
                    proxyAttributionFlags, proxiedAttributionFlags, attributionChainId);
                    proxyAttributionFlags, proxiedAttributionFlags, attributionChainId);
        }
        }
        @Override
        @Override
        public void finishProxyOperation(int code, @NonNull AttributionSource attributionSource,
        public void finishProxyOperation(@NonNull IBinder clientId, int code,
                boolean skipProxyOperation, @NonNull TriFunction<Integer, AttributionSource,
                @NonNull AttributionSource attributionSource, boolean skipProxyOperation,
                        Boolean, Void> superImpl) {
                @NonNull QuadFunction<IBinder, Integer, AttributionSource, Boolean,
                        Void> superImpl) {
            if (attributionSource.getUid() == mTargetUid && isTargetOp(code)) {
            if (attributionSource.getUid() == mTargetUid && isTargetOp(code)) {
                final int shellUid = UserHandle.getUid(UserHandle.getUserId(
                final int shellUid = UserHandle.getUid(UserHandle.getUserId(
                        attributionSource.getUid()), Process.SHELL_UID);
                        attributionSource.getUid()), Process.SHELL_UID);
                final long identity = Binder.clearCallingIdentity();
                final long identity = Binder.clearCallingIdentity();
                try {
                try {
                    superImpl.apply(code, new AttributionSource(shellUid,
                    superImpl.apply(clientId, code, new AttributionSource(shellUid,
                            "com.android.shell", attributionSource.getAttributionTag(),
                            "com.android.shell", attributionSource.getAttributionTag(),
                            attributionSource.getToken(), attributionSource.getNext()),
                            attributionSource.getToken(), attributionSource.getNext()),
                            skipProxyOperation);
                            skipProxyOperation);
@@ -17106,7 +17106,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Binder.restoreCallingIdentity(identity);
                    Binder.restoreCallingIdentity(identity);
                }
                }
            }
            }
            superImpl.apply(code, attributionSource, skipProxyOperation);
            superImpl.apply(clientId, code, attributionSource, skipProxyOperation);
        }
        }
        private boolean isTargetOp(int code) {
        private boolean isTargetOp(int code) {
+29 −32
Original line number Original line Diff line number Diff line
@@ -3839,18 +3839,18 @@ public class AppOpsService extends IAppOpsService.Stub {
    }
    }


    @Override
    @Override
    public SyncNotedAppOp startProxyOperation(int code,
    public SyncNotedAppOp startProxyOperation(@NonNull IBinder clientId, int code,
            @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
            @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
            boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
            boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
            boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
            boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
            @AttributionFlags int proxiedAttributionFlags, int attributionChainId) {
            @AttributionFlags int proxiedAttributionFlags, int attributionChainId) {
        return mCheckOpsDelegateDispatcher.startProxyOperation(code, attributionSource,
        return mCheckOpsDelegateDispatcher.startProxyOperation(clientId, code, attributionSource,
                startIfModeDefault, shouldCollectAsyncNotedOp, message, shouldCollectMessage,
                startIfModeDefault, shouldCollectAsyncNotedOp, message, shouldCollectMessage,
                skipProxyOperation, proxyAttributionFlags, proxiedAttributionFlags,
                skipProxyOperation, proxyAttributionFlags, proxiedAttributionFlags,
                attributionChainId);
                attributionChainId);
    }
    }


    private SyncNotedAppOp startProxyOperationImpl(int code,
    private SyncNotedAppOp startProxyOperationImpl(@NonNull IBinder clientId, int code,
            @NonNull AttributionSource attributionSource,
            @NonNull AttributionSource attributionSource,
            boolean startIfModeDefault, boolean shouldCollectAsyncNotedOp, String message,
            boolean startIfModeDefault, boolean shouldCollectAsyncNotedOp, String message,
            boolean shouldCollectMessage, boolean skipProxyOperation, @AttributionFlags
            boolean shouldCollectMessage, boolean skipProxyOperation, @AttributionFlags
@@ -3859,11 +3859,9 @@ public class AppOpsService extends IAppOpsService.Stub {
        final int proxyUid = attributionSource.getUid();
        final int proxyUid = attributionSource.getUid();
        final String proxyPackageName = attributionSource.getPackageName();
        final String proxyPackageName = attributionSource.getPackageName();
        final String proxyAttributionTag = attributionSource.getAttributionTag();
        final String proxyAttributionTag = attributionSource.getAttributionTag();
        final IBinder proxyToken = attributionSource.getToken();
        final int proxiedUid = attributionSource.getNextUid();
        final int proxiedUid = attributionSource.getNextUid();
        final String proxiedPackageName = attributionSource.getNextPackageName();
        final String proxiedPackageName = attributionSource.getNextPackageName();
        final String proxiedAttributionTag = attributionSource.getNextAttributionTag();
        final String proxiedAttributionTag = attributionSource.getNextAttributionTag();
        final IBinder proxiedToken = attributionSource.getNextToken();


        verifyIncomingProxyUid(attributionSource);
        verifyIncomingProxyUid(attributionSource);
        verifyIncomingOp(code);
        verifyIncomingOp(code);
@@ -3902,7 +3900,7 @@ public class AppOpsService extends IAppOpsService.Stub {


        if (!skipProxyOperation) {
        if (!skipProxyOperation) {
            // Test if the proxied operation will succeed before starting the proxy operation
            // Test if the proxied operation will succeed before starting the proxy operation
            final SyncNotedAppOp testProxiedOp = startOperationUnchecked(proxiedToken, code,
            final SyncNotedAppOp testProxiedOp = startOperationUnchecked(clientId, code,
                    proxiedUid, resolvedProxiedPackageName, proxiedAttributionTag, proxyUid,
                    proxiedUid, resolvedProxiedPackageName, proxiedAttributionTag, proxyUid,
                    resolvedProxyPackageName, proxyAttributionTag, proxiedFlags, startIfModeDefault,
                    resolvedProxyPackageName, proxyAttributionTag, proxiedFlags, startIfModeDefault,
                    shouldCollectAsyncNotedOp, message, shouldCollectMessage,
                    shouldCollectAsyncNotedOp, message, shouldCollectMessage,
@@ -3914,7 +3912,7 @@ public class AppOpsService extends IAppOpsService.Stub {
            final int proxyFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXY
            final int proxyFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXY
                    : AppOpsManager.OP_FLAG_UNTRUSTED_PROXY;
                    : AppOpsManager.OP_FLAG_UNTRUSTED_PROXY;


            final SyncNotedAppOp proxyAppOp = startOperationUnchecked(proxyToken, code, proxyUid,
            final SyncNotedAppOp proxyAppOp = startOperationUnchecked(clientId, code, proxyUid,
                    resolvedProxyPackageName, proxyAttributionTag, Process.INVALID_UID, null, null,
                    resolvedProxyPackageName, proxyAttributionTag, Process.INVALID_UID, null, null,
                    proxyFlags, startIfModeDefault, !isProxyTrusted, "proxy " + message,
                    proxyFlags, startIfModeDefault, !isProxyTrusted, "proxy " + message,
                    shouldCollectMessage, proxyAttributionFlags, attributionChainId,
                    shouldCollectMessage, proxyAttributionFlags, attributionChainId,
@@ -3924,7 +3922,7 @@ public class AppOpsService extends IAppOpsService.Stub {
            }
            }
        }
        }


        return startOperationUnchecked(proxiedToken, code, proxiedUid, resolvedProxiedPackageName,
        return startOperationUnchecked(clientId, code, proxiedUid, resolvedProxiedPackageName,
                proxiedAttributionTag, proxyUid, resolvedProxyPackageName, proxyAttributionTag,
                proxiedAttributionTag, proxyUid, resolvedProxyPackageName, proxyAttributionTag,
                proxiedFlags, startIfModeDefault, shouldCollectAsyncNotedOp, message,
                proxiedFlags, startIfModeDefault, shouldCollectAsyncNotedOp, message,
                shouldCollectMessage, proxiedAttributionFlags, attributionChainId,
                shouldCollectMessage, proxiedAttributionFlags, attributionChainId,
@@ -4065,22 +4063,20 @@ public class AppOpsService extends IAppOpsService.Stub {
    }
    }


    @Override
    @Override
    public void finishProxyOperation(int code, @NonNull AttributionSource attributionSource,
    public void finishProxyOperation(@NonNull IBinder clientId, int code,
            boolean skipProxyOperation) {
            @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
        mCheckOpsDelegateDispatcher.finishProxyOperation(code, attributionSource,
        mCheckOpsDelegateDispatcher.finishProxyOperation(clientId, code, attributionSource,
                skipProxyOperation);
                skipProxyOperation);
    }
    }


    private Void finishProxyOperationImpl(int code, @NonNull AttributionSource attributionSource,
    private Void finishProxyOperationImpl(IBinder clientId, int code,
            boolean skipProxyOperation) {
            @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
        final int proxyUid = attributionSource.getUid();
        final int proxyUid = attributionSource.getUid();
        final String proxyPackageName = attributionSource.getPackageName();
        final String proxyPackageName = attributionSource.getPackageName();
        final String proxyAttributionTag = attributionSource.getAttributionTag();
        final String proxyAttributionTag = attributionSource.getAttributionTag();
        final IBinder proxyToken = attributionSource.getToken();
        final int proxiedUid = attributionSource.getNextUid();
        final int proxiedUid = attributionSource.getNextUid();
        final String proxiedPackageName = attributionSource.getNextPackageName();
        final String proxiedPackageName = attributionSource.getNextPackageName();
        final String proxiedAttributionTag = attributionSource.getNextAttributionTag();
        final String proxiedAttributionTag = attributionSource.getNextAttributionTag();
        final IBinder proxiedToken = attributionSource.getNextToken();


        skipProxyOperation = skipProxyOperation
        skipProxyOperation = skipProxyOperation
                && isCallerAndAttributionTrusted(attributionSource);
                && isCallerAndAttributionTrusted(attributionSource);
@@ -4097,7 +4093,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        }
        }


        if (!skipProxyOperation) {
        if (!skipProxyOperation) {
            finishOperationUnchecked(proxyToken, code, proxyUid, resolvedProxyPackageName,
            finishOperationUnchecked(clientId, code, proxyUid, resolvedProxyPackageName,
                    proxyAttributionTag);
                    proxyAttributionTag);
        }
        }


@@ -4107,7 +4103,7 @@ public class AppOpsService extends IAppOpsService.Stub {
            return null;
            return null;
        }
        }


        finishOperationUnchecked(proxiedToken, code, proxiedUid, resolvedProxiedPackageName,
        finishOperationUnchecked(clientId, code, proxiedUid, resolvedProxiedPackageName,
                proxiedAttributionTag);
                proxiedAttributionTag);


        return null;
        return null;
@@ -7642,42 +7638,42 @@ public class AppOpsService extends IAppOpsService.Stub {
                    attributionFlags, attributionChainId, AppOpsService.this::startOperationImpl);
                    attributionFlags, attributionChainId, AppOpsService.this::startOperationImpl);
        }
        }


        public SyncNotedAppOp startProxyOperation(int code,
        public SyncNotedAppOp startProxyOperation(@NonNull IBinder clientId, int code,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                @AttributionFlags int proxiedAttributionFlags, int attributionChainId) {
                @AttributionFlags int proxiedAttributionFlags, int attributionChainId) {
            if (mPolicy != null) {
            if (mPolicy != null) {
                if (mCheckOpsDelegate != null) {
                if (mCheckOpsDelegate != null) {
                    return mPolicy.startProxyOperation(code, attributionSource,
                    return mPolicy.startProxyOperation(clientId, code, attributionSource,
                            startIfModeDefault, shouldCollectAsyncNotedOp, message,
                            startIfModeDefault, shouldCollectAsyncNotedOp, message,
                            shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                            shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                            proxiedAttributionFlags, attributionChainId,
                            proxiedAttributionFlags, attributionChainId,
                            this::startDelegateProxyOperationImpl);
                            this::startDelegateProxyOperationImpl);
                } else {
                } else {
                    return mPolicy.startProxyOperation(code, attributionSource,
                    return mPolicy.startProxyOperation(clientId, code, attributionSource,
                            startIfModeDefault, shouldCollectAsyncNotedOp, message,
                            startIfModeDefault, shouldCollectAsyncNotedOp, message,
                            shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                            shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                            proxiedAttributionFlags, attributionChainId,
                            proxiedAttributionFlags, attributionChainId,
                            AppOpsService.this::startProxyOperationImpl);
                            AppOpsService.this::startProxyOperationImpl);
                }
                }
            } else if (mCheckOpsDelegate != null) {
            } else if (mCheckOpsDelegate != null) {
                return startDelegateProxyOperationImpl(code, attributionSource,
                return startDelegateProxyOperationImpl(clientId, code, attributionSource,
                        startIfModeDefault, shouldCollectAsyncNotedOp, message,
                        startIfModeDefault, shouldCollectAsyncNotedOp, message,
                        shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                        shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
                        proxiedAttributionFlags, attributionChainId);
                        proxiedAttributionFlags, attributionChainId);
            }
            }
            return startProxyOperationImpl(code, attributionSource, startIfModeDefault,
            return startProxyOperationImpl(clientId, code, attributionSource, startIfModeDefault,
                    shouldCollectAsyncNotedOp, message, shouldCollectMessage, skipProxyOperation,
                    shouldCollectAsyncNotedOp, message, shouldCollectMessage, skipProxyOperation,
                    proxyAttributionFlags, proxiedAttributionFlags, attributionChainId);
                    proxyAttributionFlags, proxiedAttributionFlags, attributionChainId);
        }
        }


        private SyncNotedAppOp startDelegateProxyOperationImpl(int code,
        private SyncNotedAppOp startDelegateProxyOperationImpl(@NonNull IBinder clientId, int code,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
                @AttributionFlags int proxiedAttributionFlsgs, int attributionChainId) {
                @AttributionFlags int proxiedAttributionFlsgs, int attributionChainId) {
            return mCheckOpsDelegate.startProxyOperation(code, attributionSource,
            return mCheckOpsDelegate.startProxyOperation(clientId, code, attributionSource,
                    startIfModeDefault, shouldCollectAsyncNotedOp, message, shouldCollectMessage,
                    startIfModeDefault, shouldCollectAsyncNotedOp, message, shouldCollectMessage,
                    skipProxyOperation, proxyAttributionFlags, proxiedAttributionFlsgs,
                    skipProxyOperation, proxyAttributionFlags, proxiedAttributionFlsgs,
                    attributionChainId, AppOpsService.this::startProxyOperationImpl);
                    attributionChainId, AppOpsService.this::startProxyOperationImpl);
@@ -7706,27 +7702,28 @@ public class AppOpsService extends IAppOpsService.Stub {
                    AppOpsService.this::finishOperationImpl);
                    AppOpsService.this::finishOperationImpl);
        }
        }


        public void finishProxyOperation(int code,
        public void finishProxyOperation(@NonNull IBinder clientId, int code,
                @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
                @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
            if (mPolicy != null) {
            if (mPolicy != null) {
                if (mCheckOpsDelegate != null) {
                if (mCheckOpsDelegate != null) {
                    mPolicy.finishProxyOperation(code, attributionSource,
                    mPolicy.finishProxyOperation(clientId, code, attributionSource,
                            skipProxyOperation, this::finishDelegateProxyOperationImpl);
                            skipProxyOperation, this::finishDelegateProxyOperationImpl);
                } else {
                } else {
                    mPolicy.finishProxyOperation(code, attributionSource,
                    mPolicy.finishProxyOperation(clientId, code, attributionSource,
                            skipProxyOperation, AppOpsService.this::finishProxyOperationImpl);
                            skipProxyOperation, AppOpsService.this::finishProxyOperationImpl);
                }
                }
            } else if (mCheckOpsDelegate != null) {
            } else if (mCheckOpsDelegate != null) {
                finishDelegateProxyOperationImpl(code, attributionSource, skipProxyOperation);
                finishDelegateProxyOperationImpl(clientId, code, attributionSource,
                        skipProxyOperation);
            } else {
            } else {
                finishProxyOperationImpl(code, attributionSource, skipProxyOperation);
                finishProxyOperationImpl(clientId, code, attributionSource, skipProxyOperation);
            }
            }
        }
        }


        private Void finishDelegateProxyOperationImpl(int code,
        private Void finishDelegateProxyOperationImpl(@NonNull IBinder clientId, int code,
                @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
                @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
            mCheckOpsDelegate.finishProxyOperation(code, attributionSource, skipProxyOperation,
            mCheckOpsDelegate.finishProxyOperation(clientId, code, attributionSource,
                    AppOpsService.this::finishProxyOperationImpl);
                    skipProxyOperation, AppOpsService.this::finishProxyOperationImpl);
            return null;
            return null;
        }
        }
    }
    }
Loading