Avoid passing in null String.

IAppOpsCallback.opChanged can be passed in a null value for the package
name. Avoid calling synchronizePackagePermissionsAndAppOpsAsyncForUser
when that happens since it expects a NonNull value.

Bug: 247127880
Test: N/A
Change-Id: I532289e116b4d7b884fac7e1358120e98fecf342
This commit is contained in:
Kweku Adams
2022-11-07 18:59:48 +00:00
parent 0cea16dce2
commit ecd677ad82

View File

@@ -223,9 +223,11 @@ public final class PermissionPolicyService extends SystemService {
this::synchronizePackagePermissionsAndAppOpsAsyncForUser);
mAppOpsCallback = new IAppOpsCallback.Stub() {
public void opChanged(int op, int uid, String packageName) {
synchronizePackagePermissionsAndAppOpsAsyncForUser(packageName,
UserHandle.getUserId(uid));
public void opChanged(int op, int uid, @Nullable String packageName) {
if (packageName != null) {
synchronizePackagePermissionsAndAppOpsAsyncForUser(packageName,
UserHandle.getUserId(uid));
}
resetAppOpPermissionsIfNotRequestedForUidAsync(uid);
}
};