*/
public @NonNull Map<byte[], Integer> getRecoverySnapshotVersions()
throws InternalRecoveryServiceException {
- try {
- // IPC doesn't support generic Maps.
- @SuppressWarnings("unchecked")
- Map<byte[], Integer> result =
- (Map<byte[], Integer>) mBinder.getRecoverySnapshotVersions();
- return result;
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- } catch (ServiceSpecificException e) {
- throw wrapUnexpectedServiceSpecificException(e);
- }
+ throw new UnsupportedOperationException();
}
/**
@NonNull
public @KeychainProtectionParams.UserSecretType int[] getPendingRecoverySecretTypes()
throws InternalRecoveryServiceException {
- try {
- return mBinder.getPendingRecoverySecretTypes();
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- } catch (ServiceSpecificException e) {
- throw wrapUnexpectedServiceSpecificException(e);
- }
+ throw new UnsupportedOperationException();
}
/**
String getKey(String alias);
void removeKey(String alias);
void setSnapshotCreatedPendingIntent(in PendingIntent intent);
- Map getRecoverySnapshotVersions();
void setServerParams(in byte[] serverParams);
void setRecoveryStatus(in String alias, int status);
Map getRecoveryStatus();
void setRecoverySecretTypes(in int[] secretTypes);
int[] getRecoverySecretTypes();
- int[] getPendingRecoverySecretTypes();
byte[] startRecoverySession(in String sessionId,
in byte[] verifierPublicKey, in byte[] vaultParams, in byte[] vaultChallenge,
in List<KeyChainProtectionParams> secrets);
}
@Override
- public KeyChainSnapshot getKeyChainSnapshot() throws RemoteException {
+ public @NonNull KeyChainSnapshot getKeyChainSnapshot() throws RemoteException {
return mRecoverableKeyStoreManager.getKeyChainSnapshot();
}
+ @Override
public void setSnapshotCreatedPendingIntent(@Nullable PendingIntent intent)
throws RemoteException {
mRecoverableKeyStoreManager.setSnapshotCreatedPendingIntent(intent);
}
- public Map getRecoverySnapshotVersions() throws RemoteException {
- return mRecoverableKeyStoreManager.getRecoverySnapshotVersions();
- }
-
@Override
public void setServerParams(byte[] serverParams) throws RemoteException {
mRecoverableKeyStoreManager.setServerParams(serverParams);
mRecoverableKeyStoreManager.setRecoveryStatus(alias, status);
}
- public Map getRecoveryStatus() throws RemoteException {
+ @Override
+ public @NonNull Map getRecoveryStatus() throws RemoteException {
return mRecoverableKeyStoreManager.getRecoveryStatus();
}
}
@Override
- public int[] getRecoverySecretTypes() throws RemoteException {
+ public @NonNull int[] getRecoverySecretTypes() throws RemoteException {
return mRecoverableKeyStoreManager.getRecoverySecretTypes();
}
@Override
- public int[] getPendingRecoverySecretTypes() throws RemoteException {
- throw new SecurityException("Not implemented");
- }
-
- @Override
public byte[] startRecoverySession(@NonNull String sessionId,
@NonNull byte[] verifierPublicKey, @NonNull byte[] vaultParams,
@NonNull byte[] vaultChallenge, @NonNull List<KeyChainProtectionParams> secrets)
}
@Override
- public byte[] startRecoverySessionWithCertPath(@NonNull String sessionId,
+ public @NonNull byte[] startRecoverySessionWithCertPath(@NonNull String sessionId,
@NonNull String rootCertificateAlias, @NonNull RecoveryCertPath verifierCertPath,
@NonNull byte[] vaultParams, @NonNull byte[] vaultChallenge,
@NonNull List<KeyChainProtectionParams> secrets)
secrets);
}
+ @Override
public void closeSession(@NonNull String sessionId) throws RemoteException {
mRecoverableKeyStoreManager.closeSession(sessionId);
}
}
@Override
- public Map<String, byte[]> recoverKeys(@NonNull String sessionId,
+ public @NonNull Map<String, byte[]> recoverKeys(@NonNull String sessionId,
@NonNull byte[] recoveryKeyBlob, @NonNull List<WrappedApplicationKey> applicationKeys)
throws RemoteException {
return mRecoverableKeyStoreManager.recoverKeys(sessionId, recoveryKeyBlob, applicationKeys);
}
@Override
- public String generateKey(@NonNull String alias) throws RemoteException {
+ public @Nullable String generateKey(@NonNull String alias) throws RemoteException {
return mRecoverableKeyStoreManager.generateKey(alias);
}
@Override
- public String importKey(@NonNull String alias, byte[] keyBytes) throws RemoteException {
+ public @Nullable String importKey(@NonNull String alias, byte[] keyBytes) throws RemoteException {
return mRecoverableKeyStoreManager.importKey(alias, keyBytes);
}
@Override
- public String getKey(@NonNull String alias) throws RemoteException {
+ public @Nullable String getKey(@NonNull String alias) throws RemoteException {
return mRecoverableKeyStoreManager.getKey(alias);
}
mListenersStorage.setSnapshotListener(uid, intent);
}
- /**
- * Gets recovery snapshot versions for all accounts. Note that snapshot may have 0 application
- * keys, but it still needs to be synced, if previous versions were not empty.
- *
- * @return Map from Recovery agent account to snapshot version.
- */
- public @NonNull Map<byte[], Integer> getRecoverySnapshotVersions()
- throws RemoteException {
- checkRecoverKeyStorePermission();
- throw new UnsupportedOperationException();
- }
-
public void setServerParams(@NonNull byte[] serverParams) throws RemoteException {
checkRecoverKeyStorePermission();
int userId = UserHandle.getCallingUserId();
}
/**
- * Gets secret types RecoveryManagers is waiting for to create new Recovery Data.
- *
- * @return secret types
- * @hide
- */
- public @NonNull int[] getPendingRecoverySecretTypes() throws RemoteException {
- checkRecoverKeyStorePermission();
- throw new UnsupportedOperationException();
- }
-
- public void recoverySecretAvailable(
- @NonNull KeyChainProtectionParams recoverySecret) throws RemoteException {
- int uid = Binder.getCallingUid();
- if (recoverySecret.getLockScreenUiFormat() == KeyChainProtectionParams.TYPE_LOCKSCREEN) {
- throw new SecurityException(
- "Caller " + uid + " is not allowed to set lock screen secret");
- }
- checkRecoverKeyStorePermission();
- // TODO: add hook from LockSettingsService to set lock screen secret.
- throw new UnsupportedOperationException();
- }
-
- /**
* Initializes recovery session given the X509-encoded public key of the recovery service.
*
* @param sessionId A unique ID to identify the recovery session.
* @return Map from alias to raw key material.
* @throws RemoteException if an error occurred recovering the keys.
*/
- public Map<String, byte[]> recoverKeys(
+ public @NonNull Map<String, byte[]> recoverKeys(
@NonNull String sessionId,
@NonNull byte[] encryptedRecoveryKey,
@NonNull List<WrappedApplicationKey> applicationKeys)
* @param alias The alias of the key.
* @return The alias in the calling process's keystore.
*/
- private String getAlias(int userId, int uid, String alias) {
+ private @Nullable String getAlias(int userId, int uid, String alias) {
return mApplicationKeyStorage.getGrantAlias(userId, uid, alias);
}
*
* @hide
*/
- public String importKey(@NonNull String alias, @NonNull byte[] keyBytes)
+ public @Nullable String importKey(@NonNull String alias, @NonNull byte[] keyBytes)
throws RemoteException {
checkRecoverKeyStorePermission();
Preconditions.checkNotNull(alias, "alias is null");
*
* @return grant alias, which caller can use to access the key.
*/
- public String getKey(@NonNull String alias) throws RemoteException {
+ public @Nullable String getKey(@NonNull String alias) throws RemoteException {
checkRecoverKeyStorePermission();
Preconditions.checkNotNull(alias, "alias is null");
int uid = Binder.getCallingUid();
* @return Map from alias to raw key material.
* @throws RemoteException if an error occurred decrypting the keys.
*/
- private Map<String, byte[]> recoverApplicationKeys(
+ private @NonNull Map<String, byte[]> recoverApplicationKeys(
@NonNull byte[] recoveryKey,
@NonNull List<WrappedApplicationKey> applicationKeys) throws RemoteException {
HashMap<String, byte[]> keyMaterialByAlias = new HashMap<>();