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

Commit c9cbc3e5 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "FBE devices now fully support adoptable storage."

parents cc74ecb2 8eb783b2
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line 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 int getInstallReason(java.lang.String, android.os.UserHandle);
    method public abstract java.lang.String getPermissionControllerPackageName();
    method public abstract java.lang.String getPermissionControllerPackageName();
    method public abstract boolean isPermissionReviewModeEnabled();
    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 {
  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+1 −15
Original line number Original line Diff line number Diff line
@@ -16,16 +16,10 @@


package com.android.commands.sm;
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.IVoldTaskListener;
import android.os.PersistableBundle;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.DiskInfo;
import android.os.storage.DiskInfo;
import android.os.storage.IStorageManager;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.storage.StorageManager;
@@ -145,15 +139,7 @@ public final class Sm {
    }
    }


    public void runHasAdoptable() {
    public void runHasAdoptable() {
        final boolean hasHardware = SystemProperties.getBoolean(PROP_HAS_ADOPTABLE, false)
        System.out.println(StorageManager.hasAdoptable());
                || 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);
    }
    }


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


    /** {@hide} */
    /** {@hide} */
    @TestApi
    @SdkConstant(SdkConstantType.FEATURE)
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_FILE_BASED_ENCRYPTION
    public static final String FEATURE_FILE_BASED_ENCRYPTION
            = "android.software.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}:
     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
     * The device has a full implementation of the android.webkit.* APIs. Devices
     * The device has a full implementation of the android.webkit.* APIs. Devices
+5 −2
Original line number Original line Diff line number Diff line
@@ -123,8 +123,6 @@ public class StorageManager {
    public static final String PROP_SDCARDFS = "persist.sys.sdcardfs";
    public static final String PROP_SDCARDFS = "persist.sys.sdcardfs";
    /** {@hide} */
    /** {@hide} */
    public static final String PROP_VIRTUAL_DISK = "persist.sys.virtual_disk";
    public static final String PROP_VIRTUAL_DISK = "persist.sys.virtual_disk";
    /** {@hide} */
    public static final String PROP_ADOPTABLE_FBE = "persist.sys.adoptable_fbe";


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


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

    /** {@hide} */
    /** {@hide} */
    public static File maybeTranslateEmulatedPathToInternal(File path) {
    public static File maybeTranslateEmulatedPathToInternal(File path) {
        // Disabled now that FUSE has been replaced by sdcardfs
        // Disabled now that FUSE has been replaced by sdcardfs
+5 −0
Original line number Original line Diff line number Diff line
@@ -633,6 +633,11 @@ public class SystemConfig {
            addFeature(PackageManager.FEATURE_SECURELY_REMOVES_USERS, 0);
            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()) {
        if (ActivityManager.isLowRamDeviceStatic()) {
            addFeature(PackageManager.FEATURE_RAM_LOW, 0);
            addFeature(PackageManager.FEATURE_RAM_LOW, 0);
        } else {
        } else {
Loading