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

Commit 0bbaf189 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Add more NonNull annotations to RecoveryController API

Bug: 73959762
Test: none
Change-Id: I648c20a099d4ac1c002f4f467d7189a8bc019560
parent 9cd3e43d
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -496,7 +496,7 @@ public class RecoveryController {
     *     screen is required to generate recoverable keys.
     *     screen is required to generate recoverable keys.
     */
     */
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    public Key generateKey(@NonNull String alias) throws InternalRecoveryServiceException,
    public @NonNull Key generateKey(@NonNull String alias) throws InternalRecoveryServiceException,
            LockScreenRequiredException {
            LockScreenRequiredException {
        try {
        try {
            String grantAlias = mBinder.generateKey(alias);
            String grantAlias = mBinder.generateKey(alias);
@@ -527,7 +527,7 @@ public class RecoveryController {
     *
     *
     */
     */
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    @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 {
            throws InternalRecoveryServiceException, LockScreenRequiredException {
        try {
        try {
            String grantAlias = mBinder.importKey(alias, keyBytes);
            String grantAlias = mBinder.importKey(alias, keyBytes);
@@ -575,7 +575,7 @@ public class RecoveryController {
    /**
    /**
     * Returns the key with the given {@code grantAlias}.
     * 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(
        return AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(
                mKeyStore,
                mKeyStore,
                grantAlias,
                grantAlias,
@@ -611,7 +611,7 @@ public class RecoveryController {
    }
    }


    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
    public Map<String, X509Certificate> getRootCertificates() {
    public @NonNull Map<String, X509Certificate> getRootCertificates() {
        return TrustedRootCertificates.getRootCertificates();
        return TrustedRootCertificates.getRootCertificates();
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -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. */
    /** Given a map from alias to grant alias, returns a map from alias to a {@link Key} handle. */
    private @NonNull Map<String, Key> getKeysFromGrants(Map<String, String> grantAliases)
    private @NonNull Map<String, Key> getKeysFromGrants(@NonNull Map<String, String> grantAliases)
            throws InternalRecoveryServiceException {
            throws InternalRecoveryServiceException {
        ArrayMap<String, Key> keysByAlias = new ArrayMap<>(grantAliases.size());
        ArrayMap<String, Key> keysByAlias = new ArrayMap<>(grantAliases.size());
        for (String alias : grantAliases.keySet()) {
        for (String alias : grantAliases.keySet()) {