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

Commit 9bcc4065 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Do not call into system server with sLock held

This is not necessary and causes lock issues.

Fixes: 140536454
Test: atest CtsAppOpsTestCases
Change-Id: I3d1c10f784fd18f82ddfc895ecf6e68711929fba
parent fe163c6f
Loading
Loading
Loading
Loading
+33 −30
Original line number Diff line number Diff line
@@ -5845,8 +5845,13 @@ public class AppOpsManager {
                    ActivityThread.currentOpPackageName())) {
                // This app is noting an app-op for itself. Deliver immediately.
                sNotedAppOpsCollector.onSelfNoted(new SyncNotedAppOp(code));
            } else if (binderUid != null && binderUid == uid) {
                // We are inside of a two-way binder call. Delivered to caller via

                return;
            }
        }

        if (binderUid != null && binderUid == uid) {
            // If this is inside of a two-way binder call: Delivered to caller via
            // {@link #prefixParcelWithAppOpsIfNeeded}
            long[] appOpsNotedInThisBinderTransaction;

@@ -5862,7 +5867,7 @@ public class AppOpsManager {
                appOpsNotedInThisBinderTransaction[1] |= 1L << (code - 64);
            }
        } else {
                // We cannot deliver the note synchronous. Hence send it to the system server to
            // Cannot deliver the note synchronous: Hence send it to the system server to
            // notify the noted process.
            if (message == null) {
                // Default message is a stack trace
@@ -5871,8 +5876,7 @@ public class AppOpsManager {

            long token = Binder.clearCallingIdentity();
            try {
                    mService.noteAsyncOp(mContext.getOpPackageName(), uid, packageName, code,
                            message);
                mService.noteAsyncOp(mContext.getOpPackageName(), uid, packageName, code, message);
            } catch (RemoteException e) {
                e.rethrowFromSystemServer();
            } finally {
@@ -5880,7 +5884,6 @@ public class AppOpsManager {
            }
        }
    }
    }

    /**
     * Append app-ops noted in the current two-way binder transaction to parcel.