Allow non-system server code to AppOpsManager.checkOp and NoteOp

1. Allow checkOp from any caller, not only callers with
  android.permission.UPDATE_APP_OPS_STATS. This is ok as checkOp does not
  update any stats
2. Clear the binder identity when calling noteOp so that it is checked
  if the service can perform the operation, not the caller.

Test: Verified that RecognitionService can be used by third party apps
Fixes: 152436092
Change-Id: Ie6fe90b5737a1cd24e45446ea91560940b41c8fc
This commit is contained in:
Philip P. Moltmann
2020-04-09 16:31:05 -07:00
parent 232ffbfe8f
commit b093a01a4a

View File

@@ -2830,7 +2830,6 @@ public class AppOpsService extends IAppOpsService.Stub {
private int checkOperationImpl(int code, int uid, String packageName,
boolean raw) {
verifyIncomingUid(uid);
verifyIncomingOp(code);
String resolvedPackageName = resolvePackageName(uid, packageName);
if (resolvedPackageName == null) {