From 0bbaf189c259f7d3154737c4284023921dc821b0 Mon Sep 17 00:00:00 2001 From: Dmitry Dementyev Date: Fri, 23 Mar 2018 17:36:58 -0700 Subject: [PATCH] Add more NonNull annotations to RecoveryController API Bug: 73959762 Test: none Change-Id: I648c20a099d4ac1c002f4f467d7189a8bc019560 --- .../security/keystore/recovery/RecoveryController.java | 8 ++++---- .../security/keystore/recovery/RecoverySession.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/java/android/security/keystore/recovery/RecoveryController.java b/core/java/android/security/keystore/recovery/RecoveryController.java index 843b9da9a8287..61b4dd883b584 100644 --- a/core/java/android/security/keystore/recovery/RecoveryController.java +++ b/core/java/android/security/keystore/recovery/RecoveryController.java @@ -496,7 +496,7 @@ public class RecoveryController { * screen is required to generate recoverable keys. */ @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) - public Key generateKey(@NonNull String alias) throws InternalRecoveryServiceException, + public @NonNull Key generateKey(@NonNull String alias) throws InternalRecoveryServiceException, LockScreenRequiredException { try { String grantAlias = mBinder.generateKey(alias); @@ -527,7 +527,7 @@ public class RecoveryController { * */ @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) - public Key importKey(@NonNull String alias, byte[] keyBytes) + public @NonNull Key importKey(@NonNull String alias, @NonNull byte[] keyBytes) throws InternalRecoveryServiceException, LockScreenRequiredException { try { String grantAlias = mBinder.importKey(alias, keyBytes); @@ -575,7 +575,7 @@ public class RecoveryController { /** * Returns the key with the given {@code grantAlias}. */ - Key getKeyFromGrant(String grantAlias) throws UnrecoverableKeyException { + @NonNull Key getKeyFromGrant(@NonNull String grantAlias) throws UnrecoverableKeyException { return AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore( mKeyStore, grantAlias, @@ -611,7 +611,7 @@ public class RecoveryController { } @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) - public Map getRootCertificates() { + public @NonNull Map getRootCertificates() { return TrustedRootCertificates.getRootCertificates(); } diff --git a/core/java/android/security/keystore/recovery/RecoverySession.java b/core/java/android/security/keystore/recovery/RecoverySession.java index ff49ca3f005c6..0690bd5fb6126 100644 --- a/core/java/android/security/keystore/recovery/RecoverySession.java +++ b/core/java/android/security/keystore/recovery/RecoverySession.java @@ -257,7 +257,7 @@ public class RecoverySession implements AutoCloseable { } /** Given a map from alias to grant alias, returns a map from alias to a {@link Key} handle. */ - private @NonNull Map getKeysFromGrants(Map grantAliases) + private @NonNull Map getKeysFromGrants(@NonNull Map grantAliases) throws InternalRecoveryServiceException { ArrayMap keysByAlias = new ArrayMap<>(grantAliases.size()); for (String alias : grantAliases.keySet()) {