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

Commit 8eb783b2 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

FBE devices now fully support adoptable storage.

We've finished all the underlying work to support adoptable storage
on FBE devices, so remove the code that was disabling it by default.

Introduce feature flag to make it easier to detect devices that
support adoptable storage.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 29923055, 25861755, 33252673, 37289651
Change-Id: I3630d690c9e66c7e41e316a4263ea2eb1e752ad3
parent f262c7f2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -165,6 +165,8 @@ package android.content.pm {
    method public abstract int getInstallReason(java.lang.String, android.os.UserHandle);
    method public abstract java.lang.String getPermissionControllerPackageName();
    method public abstract boolean isPermissionReviewModeEnabled();
    field public static final java.lang.String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
    field public static final java.lang.String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
  }

  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+1 −15
Original line number Diff line number Diff line
@@ -16,16 +16,10 @@

package com.android.commands.sm;

import static android.os.storage.StorageManager.PROP_ADOPTABLE_FBE;
import static android.os.storage.StorageManager.PROP_HAS_ADOPTABLE;
import static android.os.storage.StorageManager.PROP_VIRTUAL_DISK;

import android.os.IBinder;
import android.os.IVoldTaskListener;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.DiskInfo;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
@@ -145,15 +139,7 @@ public final class Sm {
    }

    public void runHasAdoptable() {
        final boolean hasHardware = SystemProperties.getBoolean(PROP_HAS_ADOPTABLE, false)
                || SystemProperties.getBoolean(PROP_VIRTUAL_DISK, false);
        final boolean hasSoftware;
        if (StorageManager.isFileEncryptedNativeOnly()) {
            hasSoftware = SystemProperties.getBoolean(PROP_ADOPTABLE_FBE, false);
        } else {
            hasSoftware = true;
        }
        System.out.println(hasHardware && hasSoftware);
        System.out.println(StorageManager.hasAdoptable());
    }

    public void runGetPrimaryStorageUuid() throws RemoteException {
+7 −0
Original line number Diff line number Diff line
@@ -2480,10 +2480,17 @@ public abstract class PackageManager {
            = "android.software.securely_removes_users";

    /** {@hide} */
    @TestApi
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_FILE_BASED_ENCRYPTION
            = "android.software.file_based_encryption";

    /** {@hide} */
    @TestApi
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_ADOPTABLE_STORAGE
            = "android.software.adoptable_storage";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
     * The device has a full implementation of the android.webkit.* APIs. Devices
+5 −2
Original line number Diff line number Diff line
@@ -123,8 +123,6 @@ public class StorageManager {
    public static final String PROP_SDCARDFS = "persist.sys.sdcardfs";
    /** {@hide} */
    public static final String PROP_VIRTUAL_DISK = "persist.sys.virtual_disk";
    /** {@hide} */
    public static final String PROP_ADOPTABLE_FBE = "persist.sys.adoptable_fbe";

    /** {@hide} */
    public static final String UUID_PRIVATE_INTERNAL = null;
@@ -1475,6 +1473,11 @@ public class StorageManager {
               || isFileEncryptedEmulatedOnly();
    }

    /** {@hide} */
    public static boolean hasAdoptable() {
        return SystemProperties.getBoolean(PROP_HAS_ADOPTABLE, false);
    }

    /** {@hide} */
    public static File maybeTranslateEmulatedPathToInternal(File path) {
        // Disabled now that FUSE has been replaced by sdcardfs
+5 −0
Original line number Diff line number Diff line
@@ -633,6 +633,11 @@ public class SystemConfig {
            addFeature(PackageManager.FEATURE_SECURELY_REMOVES_USERS, 0);
        }

        // Help legacy devices that may not have updated their static config
        if (StorageManager.hasAdoptable()) {
            addFeature(PackageManager.FEATURE_ADOPTABLE_STORAGE, 0);
        }

        if (ActivityManager.isLowRamDeviceStatic()) {
            addFeature(PackageManager.FEATURE_RAM_LOW, 0);
        } else {
Loading