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

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

Log metric when generateKeyPair throws exception

Bug: 181758899
Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest
      atest android.devicepolicy.cts.CredentialManagementAppTest
Change-Id: Ib6f73ed1fcb1d7364281b5bd13523eafec30c729
parent 02abb5b9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5684,6 +5684,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                if (generationResult != KeyChain.KEY_GEN_SUCCESS) {
                    Log.e(LOG_TAG, String.format(
                            "KeyChain failed to generate a keypair, error %d.", generationResult));
                    logGenerateKeyPairFailure(caller, isCredentialManagementApp);
                    switch (generationResult) {
                        case KeyChain.KEY_GEN_STRONGBOX_UNAVAILABLE:
                            throw new ServiceSpecificException(
@@ -5693,7 +5694,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                            throw new UnsupportedOperationException(
                                "Device does not support Device ID attestation.");
                        default:
                            logGenerateKeyPairFailure(caller, isCredentialManagementApp);
                            return false;
                    }
                }