Loading services/core/java/com/android/server/AppOpsService.java +31 −21 Original line number Diff line number Diff line Loading @@ -875,7 +875,7 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_IGNORED; } synchronized (this) { if (isOpRestricted(uid, code, resolvedPackageName)) { if (isOpRestrictedLocked(uid, code, resolvedPackageName)) { return AppOpsManager.MODE_IGNORED; } code = AppOpsManager.opToSwitch(code); Loading Loading @@ -1024,7 +1024,7 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_ERRORED; } Op op = getOpLocked(ops, code, true); if (isOpRestricted(uid, code, packageName)) { if (isOpRestrictedLocked(uid, code, packageName)) { return AppOpsManager.MODE_IGNORED; } if (op.duration == -1) { Loading Loading @@ -1082,7 +1082,7 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_ERRORED; } Op op = getOpLocked(ops, code, true); if (isOpRestricted(uid, code, resolvedPackageName)) { if (isOpRestrictedLocked(uid, code, resolvedPackageName)) { return AppOpsManager.MODE_IGNORED; } final int switchCode = AppOpsManager.opToSwitch(code); Loading Loading @@ -1308,7 +1308,7 @@ public class AppOpsService extends IAppOpsService.Stub { return op; } private boolean isOpRestricted(int uid, int code, String packageName) { private boolean isOpRestrictedLocked(int uid, int code, String packageName) { int userHandle = UserHandle.getUserId(uid); final int restrictionSetCount = mOpUserRestrictions.size(); Loading Loading @@ -2210,6 +2210,9 @@ public class AppOpsService extends IAppOpsService.Stub { private void setUserRestrictionNoCheck(int code, boolean restricted, IBinder token, int userHandle, String[] exceptionPackages) { boolean notifyChange = false; synchronized (AppOpsService.this) { ClientRestrictionState restrictionState = mOpUserRestrictions.get(token); if (restrictionState == null) { Loading @@ -2222,7 +2225,7 @@ public class AppOpsService extends IAppOpsService.Stub { } if (restrictionState.setRestriction(code, restricted, exceptionPackages, userHandle)) { notifyWatchersOfChange(code); notifyChange = true; } if (restrictionState.isDefault()) { Loading @@ -2231,6 +2234,11 @@ public class AppOpsService extends IAppOpsService.Stub { } } if (notifyChange) { notifyWatchersOfChange(code); } } private void notifyWatchersOfChange(int code) { final ArrayList<Callback> clonedCallbacks; synchronized (this) { Loading Loading @@ -2263,12 +2271,14 @@ public class AppOpsService extends IAppOpsService.Stub { @Override public void removeUser(int userHandle) throws RemoteException { checkSystemUid("removeUser"); synchronized (AppOpsService.this) { final int tokenCount = mOpUserRestrictions.size(); for (int i = tokenCount - 1; i >= 0; i--) { ClientRestrictionState opRestrictions = mOpUserRestrictions.valueAt(i); opRestrictions.removeUser(userHandle); } } } private void checkSystemUid(String function) { int uid = Binder.getCallingUid(); Loading Loading
services/core/java/com/android/server/AppOpsService.java +31 −21 Original line number Diff line number Diff line Loading @@ -875,7 +875,7 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_IGNORED; } synchronized (this) { if (isOpRestricted(uid, code, resolvedPackageName)) { if (isOpRestrictedLocked(uid, code, resolvedPackageName)) { return AppOpsManager.MODE_IGNORED; } code = AppOpsManager.opToSwitch(code); Loading Loading @@ -1024,7 +1024,7 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_ERRORED; } Op op = getOpLocked(ops, code, true); if (isOpRestricted(uid, code, packageName)) { if (isOpRestrictedLocked(uid, code, packageName)) { return AppOpsManager.MODE_IGNORED; } if (op.duration == -1) { Loading Loading @@ -1082,7 +1082,7 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_ERRORED; } Op op = getOpLocked(ops, code, true); if (isOpRestricted(uid, code, resolvedPackageName)) { if (isOpRestrictedLocked(uid, code, resolvedPackageName)) { return AppOpsManager.MODE_IGNORED; } final int switchCode = AppOpsManager.opToSwitch(code); Loading Loading @@ -1308,7 +1308,7 @@ public class AppOpsService extends IAppOpsService.Stub { return op; } private boolean isOpRestricted(int uid, int code, String packageName) { private boolean isOpRestrictedLocked(int uid, int code, String packageName) { int userHandle = UserHandle.getUserId(uid); final int restrictionSetCount = mOpUserRestrictions.size(); Loading Loading @@ -2210,6 +2210,9 @@ public class AppOpsService extends IAppOpsService.Stub { private void setUserRestrictionNoCheck(int code, boolean restricted, IBinder token, int userHandle, String[] exceptionPackages) { boolean notifyChange = false; synchronized (AppOpsService.this) { ClientRestrictionState restrictionState = mOpUserRestrictions.get(token); if (restrictionState == null) { Loading @@ -2222,7 +2225,7 @@ public class AppOpsService extends IAppOpsService.Stub { } if (restrictionState.setRestriction(code, restricted, exceptionPackages, userHandle)) { notifyWatchersOfChange(code); notifyChange = true; } if (restrictionState.isDefault()) { Loading @@ -2231,6 +2234,11 @@ public class AppOpsService extends IAppOpsService.Stub { } } if (notifyChange) { notifyWatchersOfChange(code); } } private void notifyWatchersOfChange(int code) { final ArrayList<Callback> clonedCallbacks; synchronized (this) { Loading Loading @@ -2263,12 +2271,14 @@ public class AppOpsService extends IAppOpsService.Stub { @Override public void removeUser(int userHandle) throws RemoteException { checkSystemUid("removeUser"); synchronized (AppOpsService.this) { final int tokenCount = mOpUserRestrictions.size(); for (int i = tokenCount - 1; i >= 0; i--) { ClientRestrictionState opRestrictions = mOpUserRestrictions.valueAt(i); opRestrictions.removeUser(userHandle); } } } private void checkSystemUid(String function) { int uid = Binder.getCallingUid(); Loading