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

Commit b4fb9877 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Rename RecoveryController.getRecoveryData() to getKeyChainSnapshot.

Bug: 72299798
Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I1a530414d255867786142fa2e01e50469379e295
parent 761a89df
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();