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

Commit 9cc69243 authored by Steve Kondik's avatar Steve Kondik
Browse files

dpm: Fix crash when invoked by system

 * ApplicationInfo will be null in this case, skip the legacyApp
   check to avoid crashing of system_server.

Change-Id: Ifcbc2528a6d0e9e6bd5df1ad4fcd8d65341ce052
parent 449a60eb
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -5095,6 +5095,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }

        boolean legacyApp = false;
        if (ai != null) {
            if (ai.targetSdkVersion <= Build.VERSION_CODES.M) {
                legacyApp = true;
            } else if ("com.google.android.apps.enterprise.dmagent".equals(ai.packageName)
@@ -5102,6 +5103,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                // TODO: STOPSHIP remove this (revert ag/895987) once a new prebuilt is dropped
                legacyApp = true;
            }
        }

        final int rawStatus = getEncryptionStatus();
        if ((rawStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER) && legacyApp) {