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 Original line Diff line number Diff line
@@ -167,7 +167,7 @@ public class RecoveryController {
    public @NonNull KeychainSnapshot getRecoveryData(@NonNull byte[] account)
    public @NonNull KeychainSnapshot getRecoveryData(@NonNull byte[] account)
            throws InternalRecoveryServiceException {
            throws InternalRecoveryServiceException {
        try {
        try {
            return BackwardsCompat.toLegacyKeychainSnapshot(mBinder.getRecoveryData(account));
            return BackwardsCompat.toLegacyKeychainSnapshot(mBinder.getKeyChainSnapshot());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        } catch (ServiceSpecificException e) {
        } catch (ServiceSpecificException e) {
+29 −2
Original line number Original line 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
     * Returns data necessary to store all recoverable keys. Key material is
     * encrypted with user secret and recovery public key.
     * encrypted with user secret and recovery public key.
     *
     *
@@ -179,10 +181,35 @@ public class RecoveryController {
     *     service.
     *     service.
     */
     */
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    @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 {
            throws InternalRecoveryServiceException {
        try {
        try {
            return mBinder.getRecoveryData(/*account=*/ new byte[]{});
            return mBinder.getKeyChainSnapshot();
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        } catch (ServiceSpecificException e) {
        } catch (ServiceSpecificException e) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ interface ILockSettings {
    // {@code ServiceSpecificException} may be thrown to signal an error, which caller can
    // {@code ServiceSpecificException} may be thrown to signal an error, which caller can
    // convert to  {@code RecoveryManagerException}.
    // convert to  {@code RecoveryManagerException}.
    void initRecoveryService(in String rootCertificateAlias, in byte[] signedPublicKeyList);
    void initRecoveryService(in String rootCertificateAlias, in byte[] signedPublicKeyList);
    KeyChainSnapshot getRecoveryData(in byte[] account);
    KeyChainSnapshot getKeyChainSnapshot();
    byte[] generateAndStoreKey(String alias);
    byte[] generateAndStoreKey(String alias);
    void removeKey(String alias);
    void removeKey(String alias);
    void setSnapshotCreatedPendingIntent(in PendingIntent intent);
    void setSnapshotCreatedPendingIntent(in PendingIntent intent);
+2 −2
Original line number Original line Diff line number Diff line
@@ -1982,8 +1982,8 @@ public class LockSettingsService extends ILockSettings.Stub {
    }
    }


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


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