Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04eedff9 authored by Hai Zhang's avatar Hai Zhang
Browse files

Throw a more helpful exception upon invalid split permission configuration.

Previously we would just crash with a plain NullPointerException, so the message isn't very helpful for correcting the configuration.

Bug: 183960277
Test: presubmit
Change-Id: I916e1ce2b5c2754df9a5603f19e8826708db5856
parent 7ff8faf4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3125,6 +3125,10 @@ public class PermissionManagerService extends IPermissionManager.Stub {

            if (sourcePerms != null) {
                Permission bp = mRegistry.getPermission(newPerm);
                if (bp == null) {
                    throw new IllegalStateException("Unknown new permission in split permission: "
                            + newPerm);
                }
                if (bp.isRuntime()) {

                    if (!newPerm.equals(Manifest.permission.ACTIVITY_RECOGNITION)) {
@@ -3140,6 +3144,10 @@ public class PermissionManagerService extends IPermissionManager.Stub {
                                sourcePermNum++) {
                            final String sourcePerm = sourcePerms.valueAt(sourcePermNum);
                            Permission sourceBp = mRegistry.getPermission(sourcePerm);
                            if (sourceBp == null) {
                                throw new IllegalStateException("Unknown source permission in split"
                                        + " permission: " + sourcePerm);
                            }
                            if (!sourceBp.isRuntime()) {
                                inheritsFromInstallPerm = true;
                                break;