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

Commit 56f06b4d authored by Robert Berry's avatar Robert Berry
Browse files

Remove packageName from getRecoveryStatus

This parameter is unused.

Bug: 73757432
Test: runtest frameworks-services -p
      com.android.server.locksettings.recoverablekeystore

Change-Id: I153a84d71b0ebaed8ce3a1f0f33c70036dd960b2
parent 24257520
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -4293,12 +4293,11 @@ package android.security.keystore.recovery {

  public class RecoveryController {
    method public byte[] generateAndStoreKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
    method public java.util.List<java.lang.String> getAliases(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public java.util.List<java.lang.String> getAliases() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public static android.security.keystore.recovery.RecoveryController getInstance(android.content.Context);
    method public int[] getPendingRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public android.security.keystore.recovery.KeyChainSnapshot getRecoveryData() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int[] getRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int getRecoveryStatus(java.lang.String, java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int getRecoveryStatus(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void initRecoveryService(java.lang.String, byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void recoverySecretAvailable(android.security.keystore.recovery.KeyChainProtectionParams) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void removeKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
+3 −0
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@ package android.os {
package android.security.keystore.recovery {

  public class RecoveryController {
    method public deprecated java.util.List<java.lang.String> getAliases(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public deprecated android.security.keystore.recovery.KeyChainSnapshot getRecoveryData() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public deprecated int getRecoveryStatus(java.lang.String, java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public deprecated void setRecoveryStatus(java.lang.String, java.lang.String, int) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.content.pm.PackageManager.NameNotFoundException;
  }

+1 −1
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public class RecoveryController {
            // IPC doesn't support generic Maps.
            @SuppressWarnings("unchecked")
            Map<String, Integer> result =
                    (Map<String, Integer>) mBinder.getRecoveryStatus(/*packageName=*/ null);
                    (Map<String, Integer>) mBinder.getRecoveryStatus();
            return result;
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
+30 −38
Original line number Diff line number Diff line
@@ -175,28 +175,13 @@ 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.
     *
     * @return Data necessary to recover keystore.
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     *     service.
     * @deprecated Use {@link #getKeyChainSnapshot()}
     * @removed
     */
    @Deprecated
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    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);
        }
    public @Nullable KeyChainSnapshot getRecoveryData() throws InternalRecoveryServiceException {
        return getKeyChainSnapshot();
    }

    /**
@@ -268,17 +253,21 @@ public class RecoveryController {
    }

    /**
     * Gets aliases of recoverable keys for the application.
     *
     * @param packageName which recoverable keys' aliases will be returned.
     *
     * @return {@code List} of all aliases.
     * @deprecated Use {@link #getAliases()}.
     * @removed
     */
    @Deprecated
    public List<String> getAliases(@Nullable String packageName)
            throws InternalRecoveryServiceException {
        return getAliases();
    }

    /**
     * Returns a list of aliases of keys belonging to the application.
     */
    public List<String> getAliases() throws InternalRecoveryServiceException {
        try {
            // TODO: update aidl
            Map<String, Integer> allStatuses = mBinder.getRecoveryStatus(packageName);
            Map<String, Integer> allStatuses = mBinder.getRecoveryStatus();
            return new ArrayList<>(allStatuses.keySet());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
@@ -323,28 +312,31 @@ public class RecoveryController {
    }

    /**
     * Returns recovery status for Application's KeyStore key.
     * Negative status values are reserved for recovery agent specific codes. List of common codes:
     * @deprecated Use {@link #getRecoveryStatus(String)}.
     * @removed
     */
    @Deprecated
    public int getRecoveryStatus(String packageName, String alias)
            throws InternalRecoveryServiceException {
        return getRecoveryStatus(alias);
    }

    /**
     * Returns the recovery status for the key with the given {@code alias}.
     *
     * <ul>
     *   <li>{@link #RECOVERY_STATUS_SYNCED}
     *   <li>{@link #RECOVERY_STATUS_SYNC_IN_PROGRESS}
     *   <li>{@link #RECOVERY_STATUS_MISSING_ACCOUNT}
     *   <li>{@link #RECOVERY_STATUS_PERMANENT_FAILURE}
     * </ul>
     *
     * @param packageName Application whose recoverable key status is returned.
     * @param alias Application-specific key alias.
     * @return Recovery status.
     * @see #setRecoveryStatus
     * @see #setRecoveryStatus(String, int)
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     *     service.
     */
    public int getRecoveryStatus(String packageName, String alias)
            throws InternalRecoveryServiceException {
    public int getRecoveryStatus(String alias) throws InternalRecoveryServiceException {
        try {
            // TODO: update aidl
            Map<String, Integer> allStatuses = mBinder.getRecoveryStatus(packageName);
            Map<String, Integer> allStatuses = mBinder.getRecoveryStatus();
            Integer status = allStatuses.get(alias);
            if (status == null) {
                return RecoveryController.RECOVERY_STATUS_PERMANENT_FAILURE;
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ interface ILockSettings {
    Map getRecoverySnapshotVersions();
    void setServerParams(in byte[] serverParams);
    void setRecoveryStatus(in String alias, int status);
    Map getRecoveryStatus(in String packageName);
    Map getRecoveryStatus();
    void setRecoverySecretTypes(in int[] secretTypes);
    int[] getRecoverySecretTypes();
    int[] getPendingRecoverySecretTypes();
Loading