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

Commit 16c3196e authored by Ethan Chen's avatar Ethan Chen Committed by Michael Bestas
Browse files

Check for null callerPackage in getStorageEncryptionStatus

* This function assumes that callerPackage is always valid,
  even though the parameter is annotated nullable. Check
  and assume the function was called by the system if the
  callerPackage was null.

Change-Id: Ie936d401f666ac8022635fb49d9ab2adfb5916c4
parent 4037370c
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -7866,6 +7866,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        enforceFullCrossUsersPermission(userHandle);
        boolean legacyApp = false;
        // callerPackage can only be null if we were called from within the system,
        // which means that we are not a legacy app.
        if (callerPackage != null) {
            // It's not critical here, but let's make sure the package name is correct, in case
            // we start using it for different purposes.
            ensureCallerPackage(callerPackage);
@@ -7877,10 +7881,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                throw new SecurityException(e);
            }
        boolean legacyApp = false;
            if (ai.targetSdkVersion <= Build.VERSION_CODES.M) {
                legacyApp = true;
            }
        }
        final int rawStatus = getEncryptionStatus();
        if ((rawStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER) && legacyApp) {