Always check roles for non-blockability

Test: NotificationBackendTest
Fixes: 194833441
Change-Id: I72af524c56178077caef8fedfac592f8b5df3371
This commit is contained in:
Julia Reynolds
2022-01-10 13:40:45 -05:00
parent 928cb9006e
commit 6689b81b82
2 changed files with 31 additions and 0 deletions

View File

@@ -123,6 +123,13 @@ public class NotificationBackend {
} catch (RemoteException e) {
Log.w(TAG, "Error calling NMS", e);
}
// The permission system cannot make role permissions 'fixed', so check for these
// roles explicitly
List<String> roles = rm.getHeldRolesFromController(app.packageName);
if (roles.contains(RoleManager.ROLE_DIALER)
|| roles.contains(RoleManager.ROLE_EMERGENCY)) {
row.systemApp = row.lockedImportance = true;
}
} else {
row.systemApp = Utils.isSystemPackage(context.getResources(), pm, app);
List<String> roles = rm.getHeldRolesFromController(app.packageName);