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

Commit bd13f841 authored by Eric Biggers's avatar Eric Biggers
Browse files

Remove more FDE methods from StorageManager

Now that these methods are no longer called, and none of them are a
public API or have @UnsupportedAppUsage, they can be removed.

inCryptKeeperBounce() actually had one known app user via reflection,
despite the method not having @UnsupportedAppUsage.  However, that user
only made the call if Build.VERSION.SDK_INT < VERSION_CODES.P, so it is
not being used anymore.

Bug: 208476087
Change-Id: Idc218e5f355bb61257b07cf5b5b6df5f4c6ece11
parent 234ee35c
Loading
Loading
Loading
Loading
+8 −61
Original line number Diff line number Diff line
@@ -1578,18 +1578,13 @@ public class StorageManager {
    }

    /** {@hide}
     * Is this device encryptable or already encrypted?
     * @return true for encryptable or encrypted
     *         false not encrypted and not encryptable
     */
    public static boolean isEncryptable() {
        return RoSystemProperties.CRYPTO_ENCRYPTABLE;
    }

    /** {@hide}
     * Is this device already encrypted?
     * @return true for encrypted. (Implies isEncryptable() == true)
     *         false not encrypted
     * Is this device encrypted?
     * <p>
     * Note: all devices launching with Android 10 (API level 29) or later are
     * required to be encrypted.  This should only ever return false for
     * in-development devices on which encryption has not yet been configured.
     *
     * @return true if encrypted, false if not encrypted
     */
    public static boolean isEncrypted() {
        return RoSystemProperties.CRYPTO_ENCRYPTED;
@@ -1598,7 +1593,7 @@ public class StorageManager {
    /** {@hide}
     * Is this device file encrypted?
     * @return true for file encrypted. (Implies isEncrypted() == true)
     *         false not encrypted or block encrypted
     *         false not encrypted or using "managed" encryption
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static boolean isFileEncryptedNativeOnly() {
@@ -1608,54 +1603,6 @@ public class StorageManager {
        return RoSystemProperties.CRYPTO_FILE_ENCRYPTED;
    }

    /** {@hide}
     * Is this device block encrypted?
     * @return true for block encrypted. (Implies isEncrypted() == true)
     *         false not encrypted or file encrypted
     */
    public static boolean isBlockEncrypted() {
        return false;
    }

    /** {@hide}
     * Is this device block encrypted with credentials?
     * @return true for crediential block encrypted.
     *         (Implies isBlockEncrypted() == true)
     *         false not encrypted, file encrypted or default block encrypted
     */
    public static boolean isNonDefaultBlockEncrypted() {
        return false;
    }

    /** {@hide}
     * Is this device in the process of being block encrypted?
     * @return true for encrypting.
     *         false otherwise
     * Whether device isEncrypted at this point is undefined
     * Note that only system services and CryptKeeper will ever see this return
     * true - no app will ever be launched in this state.
     * Also note that this state will not change without a teardown of the
     * framework, so no service needs to check for changes during their lifespan
     */
    public static boolean isBlockEncrypting() {
        return false;
    }

    /** {@hide}
     * Is this device non default block encrypted and in the process of
     * prompting for credentials?
     * @return true for prompting for credentials.
     *         (Implies isNonDefaultBlockEncrypted() == true)
     *         false otherwise
     * Note that only system services and CryptKeeper will ever see this return
     * true - no app will ever be launched in this state.
     * Also note that this state will not change without a teardown of the
     * framework, so no service needs to check for changes during their lifespan
     */
    public static boolean inCryptKeeperBounce() {
        return false;
    }

    /** {@hide} */
    public static boolean isFileEncryptedEmulatedOnly() {
        return SystemProperties.getBoolean(StorageManager.PROP_EMULATE_FBE, false);
+0 −4
Original line number Diff line number Diff line
@@ -60,14 +60,10 @@ public class RoSystemProperties {
    public static final CryptoProperties.type_values CRYPTO_TYPE =
            CryptoProperties.type().orElse(CryptoProperties.type_values.NONE);
    // These are pseudo-properties
    public static final boolean CRYPTO_ENCRYPTABLE =
            CRYPTO_STATE != CryptoProperties.state_values.UNSUPPORTED;
    public static final boolean CRYPTO_ENCRYPTED =
            CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED;
    public static final boolean CRYPTO_FILE_ENCRYPTED =
            CRYPTO_TYPE == CryptoProperties.type_values.FILE;
    public static final boolean CRYPTO_BLOCK_ENCRYPTED =
            CRYPTO_TYPE == CryptoProperties.type_values.BLOCK;

    public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG =
            "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);