diff options
| -rw-r--r-- | core/java/android/app/AppOpsManager.java | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 1f283eafde0c..bb87d96b742c 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -5845,39 +5845,42 @@ 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 - // {@link #prefixParcelWithAppOpsIfNeeded} - long[] appOpsNotedInThisBinderTransaction; - - appOpsNotedInThisBinderTransaction = sAppOpsNotedInThisBinderTransaction.get(); - if (appOpsNotedInThisBinderTransaction == null) { - appOpsNotedInThisBinderTransaction = new long[2]; - sAppOpsNotedInThisBinderTransaction.set(appOpsNotedInThisBinderTransaction); - } - if (code < 64) { - appOpsNotedInThisBinderTransaction[0] |= 1L << code; - } else { - appOpsNotedInThisBinderTransaction[1] |= 1L << (code - 64); - } + return; + } + } + + if (binderUid != null && binderUid == uid) { + // If this is inside of a two-way binder call: Delivered to caller via + // {@link #prefixParcelWithAppOpsIfNeeded} + long[] appOpsNotedInThisBinderTransaction; + + appOpsNotedInThisBinderTransaction = sAppOpsNotedInThisBinderTransaction.get(); + if (appOpsNotedInThisBinderTransaction == null) { + appOpsNotedInThisBinderTransaction = new long[2]; + sAppOpsNotedInThisBinderTransaction.set(appOpsNotedInThisBinderTransaction); + } + + if (code < 64) { + appOpsNotedInThisBinderTransaction[0] |= 1L << code; } else { - // We 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 - message = getFormattedStackTrace(); - } + appOpsNotedInThisBinderTransaction[1] |= 1L << (code - 64); + } + } else { + // 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 + message = getFormattedStackTrace(); + } - long token = Binder.clearCallingIdentity(); - try { - mService.noteAsyncOp(mContext.getOpPackageName(), uid, packageName, code, - message); - } catch (RemoteException e) { - e.rethrowFromSystemServer(); - } finally { - Binder.restoreCallingIdentity(token); - } + long token = Binder.clearCallingIdentity(); + try { + mService.noteAsyncOp(mContext.getOpPackageName(), uid, packageName, code, message); + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } finally { + Binder.restoreCallingIdentity(token); } } } |