From 0f23660488737dfd901365edcc0be9c000ebc5a9 Mon Sep 17 00:00:00 2001 From: Dmitry Dementyev Date: Tue, 3 Apr 2018 00:16:20 +0000 Subject: [PATCH] Revert "Throw invalid cert exception when deprecated initRecoveryService method" This reverts commit 50bc7e42d73c9ca8d77dcd538619c6d6eeaf6dea. Reason for revert: API is still used by old binary Change-Id: I3c8348211baa26245786abda6360a8df96e2d223 Bug: 77293264 --- .../keystore/recovery/RecoveryController.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/java/android/security/keystore/recovery/RecoveryController.java b/core/java/android/security/keystore/recovery/RecoveryController.java index ab3ed915ed5ff..281822a342f98 100644 --- a/core/java/android/security/keystore/recovery/RecoveryController.java +++ b/core/java/android/security/keystore/recovery/RecoveryController.java @@ -285,7 +285,17 @@ public class RecoveryController { public void initRecoveryService( @NonNull String rootCertificateAlias, @NonNull byte[] signedPublicKeyList) throws CertificateException, InternalRecoveryServiceException { - throw new CertificateException("Deprecated initRecoveryService method called"); + try { + mBinder.initRecoveryService(rootCertificateAlias, signedPublicKeyList); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } catch (ServiceSpecificException e) { + if (e.errorCode == ERROR_BAD_CERTIFICATE_FORMAT + || e.errorCode == ERROR_INVALID_CERTIFICATE) { + throw new CertificateException("Invalid certificate for recovery service", e); + } + throw wrapUnexpectedServiceSpecificException(e); + } } /**