Merge "Add @NonNull annotation to RecoveryController Builders"
This commit is contained in:
committed by
Android (Google) Code Review
commit
53c533baad
@@ -6221,10 +6221,10 @@ package android.security.keystore.recovery {
|
||||
public static class KeyChainProtectionParams.Builder {
|
||||
ctor public KeyChainProtectionParams.Builder();
|
||||
method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams build();
|
||||
method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setKeyDerivationParams(@NonNull android.security.keystore.recovery.KeyDerivationParams);
|
||||
method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setLockScreenUiFormat(int);
|
||||
method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setSecret(@NonNull byte[]);
|
||||
method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setUserSecretType(int);
|
||||
method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setKeyDerivationParams(@NonNull android.security.keystore.recovery.KeyDerivationParams);
|
||||
method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setLockScreenUiFormat(int);
|
||||
method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setSecret(@NonNull byte[]);
|
||||
method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setUserSecretType(int);
|
||||
}
|
||||
|
||||
public final class KeyChainSnapshot implements android.os.Parcelable {
|
||||
@@ -6305,9 +6305,9 @@ package android.security.keystore.recovery {
|
||||
public static class WrappedApplicationKey.Builder {
|
||||
ctor public WrappedApplicationKey.Builder();
|
||||
method @NonNull public android.security.keystore.recovery.WrappedApplicationKey build();
|
||||
method public android.security.keystore.recovery.WrappedApplicationKey.Builder setAlias(@NonNull String);
|
||||
method public android.security.keystore.recovery.WrappedApplicationKey.Builder setEncryptedKeyMaterial(@NonNull byte[]);
|
||||
method public android.security.keystore.recovery.WrappedApplicationKey.Builder setMetadata(@Nullable byte[]);
|
||||
method @NonNull public android.security.keystore.recovery.WrappedApplicationKey.Builder setAlias(@NonNull String);
|
||||
method @NonNull public android.security.keystore.recovery.WrappedApplicationKey.Builder setEncryptedKeyMaterial(@NonNull byte[]);
|
||||
method @NonNull public android.security.keystore.recovery.WrappedApplicationKey.Builder setMetadata(@Nullable byte[]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public final class KeyChainProtectionParams implements Parcelable {
|
||||
* @param userSecretType The secret type
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setUserSecretType(@UserSecretType int userSecretType) {
|
||||
public @NonNull Builder setUserSecretType(@UserSecretType int userSecretType) {
|
||||
mInstance.mUserSecretType = userSecretType;
|
||||
return this;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public final class KeyChainProtectionParams implements Parcelable {
|
||||
* @param lockScreenUiFormat The UI format
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setLockScreenUiFormat(@LockScreenUiFormat int lockScreenUiFormat) {
|
||||
public @NonNull Builder setLockScreenUiFormat(@LockScreenUiFormat int lockScreenUiFormat) {
|
||||
mInstance.mLockScreenUiFormat = lockScreenUiFormat;
|
||||
return this;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public final class KeyChainProtectionParams implements Parcelable {
|
||||
* @param keyDerivationParams Key derivation parameters
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setKeyDerivationParams(@NonNull KeyDerivationParams
|
||||
public @NonNull Builder setKeyDerivationParams(@NonNull KeyDerivationParams
|
||||
keyDerivationParams) {
|
||||
mInstance.mKeyDerivationParams = keyDerivationParams;
|
||||
return this;
|
||||
@@ -202,7 +202,7 @@ public final class KeyChainProtectionParams implements Parcelable {
|
||||
* @param secret The secret.
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setSecret(@NonNull byte[] secret) {
|
||||
public @NonNull Builder setSecret(@NonNull byte[] secret) {
|
||||
mInstance.mSecret = secret;
|
||||
return this;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public final class KeyChainProtectionParams implements Parcelable {
|
||||
* @return new instance
|
||||
* @throws NullPointerException if some required fields were not set.
|
||||
*/
|
||||
@NonNull public KeyChainProtectionParams build() {
|
||||
public @NonNull KeyChainProtectionParams build() {
|
||||
if (mInstance.mUserSecretType == null) {
|
||||
mInstance.mUserSecretType = TYPE_LOCKSCREEN;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public final class KeyChainProtectionParams implements Parcelable {
|
||||
Arrays.fill(mSecret, (byte) 0);
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<KeyChainProtectionParams> CREATOR =
|
||||
public static final @NonNull Parcelable.Creator<KeyChainProtectionParams> CREATOR =
|
||||
new Parcelable.Creator<KeyChainProtectionParams>() {
|
||||
public KeyChainProtectionParams createFromParcel(Parcel in) {
|
||||
return new KeyChainProtectionParams(in);
|
||||
|
||||
@@ -147,7 +147,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
return mEncryptedRecoveryKeyBlob;
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Creator<KeyChainSnapshot> CREATOR =
|
||||
public static final @NonNull Creator<KeyChainSnapshot> CREATOR =
|
||||
new Creator<KeyChainSnapshot>() {
|
||||
public KeyChainSnapshot createFromParcel(Parcel in) {
|
||||
return new KeyChainSnapshot(in);
|
||||
@@ -171,7 +171,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param snapshotVersion The snapshot version
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setSnapshotVersion(int snapshotVersion) {
|
||||
public @NonNull Builder setSnapshotVersion(int snapshotVersion) {
|
||||
mInstance.mSnapshotVersion = snapshotVersion;
|
||||
return this;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param maxAttempts The maximum number of guesses.
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setMaxAttempts(int maxAttempts) {
|
||||
public @NonNull Builder setMaxAttempts(int maxAttempts) {
|
||||
mInstance.mMaxAttempts = maxAttempts;
|
||||
return this;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param counterId The counter id.
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setCounterId(long counterId) {
|
||||
public @NonNull Builder setCounterId(long counterId) {
|
||||
mInstance.mCounterId = counterId;
|
||||
return this;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param serverParams The server parameters
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setServerParams(byte[] serverParams) {
|
||||
public @NonNull Builder setServerParams(byte[] serverParams) {
|
||||
mInstance.mServerParams = serverParams;
|
||||
return this;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @throws CertificateException if the given certificate path cannot be encoded properly
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setTrustedHardwareCertPath(@NonNull CertPath certPath)
|
||||
public @NonNull Builder setTrustedHardwareCertPath(@NonNull CertPath certPath)
|
||||
throws CertificateException {
|
||||
mInstance.mCertPath = RecoveryCertPath.createRecoveryCertPath(certPath);
|
||||
return this;
|
||||
@@ -230,7 +230,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param keyChainProtectionParams The UI and key derivation parameters
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setKeyChainProtectionParams(
|
||||
public @NonNull Builder setKeyChainProtectionParams(
|
||||
@NonNull List<KeyChainProtectionParams> keyChainProtectionParams) {
|
||||
mInstance.mKeyChainProtectionParams = keyChainProtectionParams;
|
||||
return this;
|
||||
@@ -242,7 +242,8 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param entryRecoveryData List of application keys
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setWrappedApplicationKeys(List<WrappedApplicationKey> entryRecoveryData) {
|
||||
public @NonNull Builder setWrappedApplicationKeys(
|
||||
@NonNull List<WrappedApplicationKey> entryRecoveryData) {
|
||||
mInstance.mEntryRecoveryData = entryRecoveryData;
|
||||
return this;
|
||||
}
|
||||
@@ -253,7 +254,8 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @param encryptedRecoveryKeyBlob The recovery key blob.
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setEncryptedRecoveryKeyBlob(@NonNull byte[] encryptedRecoveryKeyBlob) {
|
||||
public @NonNull Builder setEncryptedRecoveryKeyBlob(
|
||||
@NonNull byte[] encryptedRecoveryKeyBlob) {
|
||||
mInstance.mEncryptedRecoveryKeyBlob = encryptedRecoveryKeyBlob;
|
||||
return this;
|
||||
}
|
||||
@@ -265,7 +267,7 @@ public final class KeyChainSnapshot implements Parcelable {
|
||||
* @return new instance
|
||||
* @throws NullPointerException if some of the required fields were not set.
|
||||
*/
|
||||
@NonNull public KeyChainSnapshot build() {
|
||||
public @NonNull KeyChainSnapshot build() {
|
||||
Preconditions.checkCollectionElementsNotNull(mInstance.mKeyChainProtectionParams,
|
||||
"keyChainProtectionParams");
|
||||
Preconditions.checkCollectionElementsNotNull(mInstance.mEntryRecoveryData,
|
||||
|
||||
@@ -140,7 +140,7 @@ public final class KeyDerivationParams implements Parcelable {
|
||||
return mMemoryDifficulty;
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<KeyDerivationParams> CREATOR =
|
||||
public static final @NonNull Parcelable.Creator<KeyDerivationParams> CREATOR =
|
||||
new Parcelable.Creator<KeyDerivationParams>() {
|
||||
public KeyDerivationParams createFromParcel(Parcel in) {
|
||||
return new KeyDerivationParams(in);
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class RecoveryCertPath implements Parcelable {
|
||||
mEncodedCertPath = in.createByteArray();
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<RecoveryCertPath> CREATOR =
|
||||
public static final @NonNull Parcelable.Creator<RecoveryCertPath> CREATOR =
|
||||
new Parcelable.Creator<RecoveryCertPath>() {
|
||||
public RecoveryCertPath createFromParcel(Parcel in) {
|
||||
return new RecoveryCertPath(in);
|
||||
|
||||
@@ -283,6 +283,7 @@ public class RecoveryController {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
|
||||
@NonNull public static RecoveryController getInstance(@NonNull Context context) {
|
||||
// lockSettings may be null.
|
||||
ILockSettings lockSettings =
|
||||
ILockSettings.Stub.asInterface(ServiceManager.getService("lock_settings"));
|
||||
return new RecoveryController(lockSettings, KeyStore.getInstance());
|
||||
|
||||
@@ -193,7 +193,7 @@ public class RecoverySession implements AutoCloseable {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
String getSessionId() {
|
||||
@NonNull String getSessionId() {
|
||||
return mSessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class WrappedApplicationKey implements Parcelable {
|
||||
* @param alias The alias.
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setAlias(@NonNull String alias) {
|
||||
public @NonNull Builder setAlias(@NonNull String alias) {
|
||||
mInstance.mAlias = alias;
|
||||
return this;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public final class WrappedApplicationKey implements Parcelable {
|
||||
* @param encryptedKeyMaterial The key material
|
||||
* @return This builder
|
||||
*/
|
||||
public Builder setEncryptedKeyMaterial(@NonNull byte[] encryptedKeyMaterial) {
|
||||
public @NonNull Builder setEncryptedKeyMaterial(@NonNull byte[] encryptedKeyMaterial) {
|
||||
mInstance.mEncryptedKeyMaterial = encryptedKeyMaterial;
|
||||
return this;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public final class WrappedApplicationKey implements Parcelable {
|
||||
* @param metadata The metadata
|
||||
* @return This builder
|
||||
*/
|
||||
public Builder setMetadata(@Nullable byte[] metadata) {
|
||||
public @NonNull Builder setMetadata(@Nullable byte[] metadata) {
|
||||
mInstance.mMetadata = metadata;
|
||||
return this;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public final class WrappedApplicationKey implements Parcelable {
|
||||
* @return new instance
|
||||
* @throws NullPointerException if some required fields were not set.
|
||||
*/
|
||||
@NonNull public WrappedApplicationKey build() {
|
||||
public @NonNull WrappedApplicationKey build() {
|
||||
Preconditions.checkNotNull(mInstance.mAlias);
|
||||
Preconditions.checkNotNull(mInstance.mEncryptedKeyMaterial);
|
||||
return mInstance;
|
||||
@@ -143,7 +143,7 @@ public final class WrappedApplicationKey implements Parcelable {
|
||||
return mMetadata;
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<WrappedApplicationKey> CREATOR =
|
||||
public static final @NonNull Parcelable.Creator<WrappedApplicationKey> CREATOR =
|
||||
new Parcelable.Creator<WrappedApplicationKey>() {
|
||||
public WrappedApplicationKey createFromParcel(Parcel in) {
|
||||
return new WrappedApplicationKey(in);
|
||||
|
||||
Reference in New Issue
Block a user