Fix typo in PID check.
Fixes: 272021728
Test: presubmit
Change-Id: Id5f84a2985e5451c7ad92178715c21d441825afd
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 65a704b..4eeb741 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -2318,19 +2318,20 @@
}
private void enforceGetAppOpsStatsPermissionIfNeeded(int uid, String packageName) {
- final int callingUid = Binder.getCallingUid();
// We get to access everything
- if (callingUid == Process.myPid()) {
+ final int callingPid = Binder.getCallingPid();
+ if (callingPid == Process.myPid()) {
return;
}
// Apps can access their own data
+ final int callingUid = Binder.getCallingUid();
if (uid == callingUid && packageName != null
&& checkPackage(uid, packageName) == MODE_ALLOWED) {
return;
}
// Otherwise, you need a permission...
- mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS,
- Binder.getCallingPid(), callingUid, null);
+ mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS, callingPid,
+ callingUid, null);
}
/**