RESTRICT AUTOMERGE

Fix CDM package check

CDM was using a pckage check that returns a value intead of throwing,
resulting in failing to throw on querying other package's associations

Test: ensure attached bug no longer reproduces
Bug: 167244818
Change-Id: I21319b6f5495dcae681541c76b847aad0c00b8ab
This commit is contained in:
Eugene Susla
2020-10-12 16:23:15 -07:00
committed by Sterling Huber
parent b7eef50878
commit 30b022a8d2

View File

@@ -372,7 +372,10 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
checkArgument(getCallingUserId() == userId,
"Must be called by either same user or system");
mAppOpsManager.checkPackage(Binder.getCallingUid(), pkg);
int callingUid = Binder.getCallingUid();
if (mAppOpsManager.checkPackage(callingUid, pkg) != AppOpsManager.MODE_ALLOWED) {
throw new SecurityException(pkg + " doesn't belong to uid " + callingUid);
}
}
@Override