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

Commit 0f06d061 authored by Dmitry Dementyev's avatar Dmitry Dementyev Committed by Android (Google) Code Review
Browse files

Merge "Rename RecoveryController.getRecoveryData() to getKeyChainSnapshot."

parents 4e854a54 b4fb9877
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ public class RecoveryController {
    public @NonNull KeychainSnapshot getRecoveryData(@NonNull byte[] account)
            throws InternalRecoveryServiceException {
        try {
            return BackwardsCompat.toLegacyKeychainSnapshot(mBinder.getRecoveryData(account));
            return BackwardsCompat.toLegacyKeychainSnapshot(mBinder.getKeyChainSnapshot());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        } catch (ServiceSpecificException e) {
+29 −2
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@ public class RecoveryController {
    }

    /**
     * Deprecated - use getKeyChainSnapshot.
     *
     * Returns data necessary to store all recoverable keys. Key material is
     * encrypted with user secret and recovery public key.
     *
@@ -179,10 +181,35 @@ public class RecoveryController {
     *     service.
     */
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    public @NonNull KeyChainSnapshot getRecoveryData()
    public @Nullable KeyChainSnapshot getRecoveryData()
            throws InternalRecoveryServiceException {
        try {
            return mBinder.getKeyChainSnapshot();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        } catch (ServiceSpecificException e) {
            if (e.errorCode == ERROR_NO_SNAPSHOT_PENDING) {
                return null;
            }
            throw wrapUnexpectedServiceSpecificException(e);
        }
    }

    /**
     * Returns data necessary to store all recoverable keys. Key material is
     * encrypted with user secret and recovery public key.
     *
     * @return Data necessary to recover keystore or {@code null} if snapshot is not available.
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     *     service.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    public @Nullable KeyChainSnapshot getKeyChainSnapshot()
            throws InternalRecoveryServiceException {
        try {
            return mBinder.getRecoveryData(/*account=*/ new byte[]{});
            return mBinder.getKeyChainSnapshot();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        } catch (ServiceSpecificException e) {
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ interface ILockSettings {
    // {@code ServiceSpecificException} may be thrown to signal an error, which caller can
    // convert to  {@code RecoveryManagerException}.
    void initRecoveryService(in String rootCertificateAlias, in byte[] signedPublicKeyList);
    KeyChainSnapshot getRecoveryData(in byte[] account);
    KeyChainSnapshot getKeyChainSnapshot();
    byte[] generateAndStoreKey(String alias);
    void removeKey(String alias);
    void setSnapshotCreatedPendingIntent(in PendingIntent intent);
+2 −2
Original line number Diff line number Diff line
@@ -1982,8 +1982,8 @@ public class LockSettingsService extends ILockSettings.Stub {
    }

    @Override
    public KeyChainSnapshot getRecoveryData(@NonNull byte[] account) throws RemoteException {
        return mRecoverableKeyStoreManager.getRecoveryData(account);
    public KeyChainSnapshot getKeyChainSnapshot() throws RemoteException {
        return mRecoverableKeyStoreManager.getKeyChainSnapshot();
    }

    public void setSnapshotCreatedPendingIntent(@Nullable PendingIntent intent)
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ public class RecoverableKeyStoreManager {
     * @hide
     */
    public @NonNull
    KeyChainSnapshot getRecoveryData(@NonNull byte[] account)
    KeyChainSnapshot getKeyChainSnapshot()
            throws RemoteException {
        checkRecoverKeyStorePermission();
        int uid = Binder.getCallingUid();