Stop using FDE-related constants from IVold
IVold.ENCRYPTION_STATE_* and IVold.PASSWORD_TYPE_* are values returned
by or accepted by FDE-specific vold methods, which are no longer used.
Stop using these constants so that we can remove them from IVold.aidl.
Notes on specific constants:
- Some constants have @UnsupportedAppUsage. There is no reason why a
non-system app should have been using these. However, to avoid
possibly breaking apps I just left these with hardcoded values.
- StorageManager.CRYPT_TYPE_* are used by
LockscreenCredential.getStorageCryptType(). However, the caller of
this method was removed by an earlier CL, so just remove this method.
- StorageManager.CRYPT_TYPE_* also have a user in
packages/apps/Settings, but it is obsolete code that I'm removing in
another CL.
Bug: 208476087
Change-Id: I41c684b69a97dbafac65d8f55db2c284d7a8dd70
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 6dd878c..134cfa1 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -286,28 +286,7 @@
/** @hide The volume is not encrypted. */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static final int ENCRYPTION_STATE_NONE =
- IVold.ENCRYPTION_STATE_NONE;
-
- /** @hide The volume has been encrypted succesfully. */
- public static final int ENCRYPTION_STATE_OK =
- IVold.ENCRYPTION_STATE_OK;
-
- /** @hide The volume is in a bad state. */
- public static final int ENCRYPTION_STATE_ERROR_UNKNOWN =
- IVold.ENCRYPTION_STATE_ERROR_UNKNOWN;
-
- /** @hide Encryption is incomplete */
- public static final int ENCRYPTION_STATE_ERROR_INCOMPLETE =
- IVold.ENCRYPTION_STATE_ERROR_INCOMPLETE;
-
- /** @hide Encryption is incomplete and irrecoverable */
- public static final int ENCRYPTION_STATE_ERROR_INCONSISTENT =
- IVold.ENCRYPTION_STATE_ERROR_INCONSISTENT;
-
- /** @hide Underlying data is corrupt */
- public static final int ENCRYPTION_STATE_ERROR_CORRUPT =
- IVold.ENCRYPTION_STATE_ERROR_CORRUPT;
+ public static final int ENCRYPTION_STATE_NONE = 1;
private static volatile IStorageManager sStorageManager = null;
@@ -2893,15 +2872,10 @@
@GuardedBy("mFuseAppLoopLock")
private @Nullable FuseAppLoop mFuseAppLoop = null;
- /// Consts to match the password types in cryptfs.h
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static final int CRYPT_TYPE_PASSWORD = IVold.PASSWORD_TYPE_PASSWORD;
+ public static final int CRYPT_TYPE_PASSWORD = 0;
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static final int CRYPT_TYPE_DEFAULT = IVold.PASSWORD_TYPE_DEFAULT;
- /** @hide */
- public static final int CRYPT_TYPE_PATTERN = IVold.PASSWORD_TYPE_PATTERN;
- /** @hide */
- public static final int CRYPT_TYPE_PIN = IVold.PASSWORD_TYPE_PIN;
+ public static final int CRYPT_TYPE_DEFAULT = 1;
}
diff --git a/core/java/com/android/internal/widget/LockscreenCredential.java b/core/java/com/android/internal/widget/LockscreenCredential.java
index 361ba95..1074004 100644
--- a/core/java/com/android/internal/widget/LockscreenCredential.java
+++ b/core/java/com/android/internal/widget/LockscreenCredential.java
@@ -175,27 +175,6 @@
return mCredential;
}
- /**
- * Returns the credential type recognized by {@link StorageManager}. Can be one of
- * {@link StorageManager#CRYPT_TYPE_DEFAULT}, {@link StorageManager#CRYPT_TYPE_PATTERN},
- * {@link StorageManager#CRYPT_TYPE_PIN} or {@link StorageManager#CRYPT_TYPE_PASSWORD}.
- */
- public int getStorageCryptType() {
- if (isNone()) {
- return StorageManager.CRYPT_TYPE_DEFAULT;
- }
- if (isPattern()) {
- return StorageManager.CRYPT_TYPE_PATTERN;
- }
- if (isPin()) {
- return StorageManager.CRYPT_TYPE_PIN;
- }
- if (isPassword()) {
- return StorageManager.CRYPT_TYPE_PASSWORD;
- }
- throw new IllegalStateException("Unhandled credential type");
- }
-
/** Returns whether this is an empty credential */
public boolean isNone() {
ensureNotZeroized();
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 9f32888..d214b53 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -595,12 +595,6 @@
}
}
- /** List of crypto types.
- * These must match CRYPT_TYPE_XXX in cryptfs.h AND their
- * corresponding commands in CommandListener.cpp */
- public static final String[] CRYPTO_TYPES
- = { "password", "default", "pattern", "pin" };
-
private final Context mContext;
private final ContentResolver mResolver;