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

Commit be8ebd65 authored by Alex Johnston's avatar Alex Johnston
Browse files

DPMS isCredentialManagementApp add null check

* Check if policy is null before checking if
  an alias is contained in the policy

Bug: 174666058
Test: atest android.admin.cts.DevicePolicyManagerTest#testGenerateKeyPair_failIfNotProfileOwner
      atest android.admin.cts.DevicePolicyManagerTest#testSetKeyPairCertificate_failIfNotProfileOwner
Change-Id: I2e1e0d550cc5131c6042c0aa628b00abe7f04077
parent 66a294b6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -5839,7 +5839,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        // Should include alias in authentication policy
        try (KeyChainConnection connection = KeyChain.bindAsUser(mContext,
                caller.getUserHandle())) {
            if (!containsAlias(connection.getService().getCredentialManagementAppPolicy(), alias)) {
            // The policy will be null if there is no credential management app
            AppUriAuthenticationPolicy policy =
                    connection.getService().getCredentialManagementAppPolicy();
            if (policy == null || policy.getAppAndUriMappings().isEmpty()
                    || !containsAlias(policy, alias)) {
                return false;
            }
        } catch (RemoteException | InterruptedException e) {