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

Commit 9ec059ac authored by Jeongik Cha's avatar Jeongik Cha
Browse files

Support /system_ext partition

This commit is mainly from I7a6a30bf8e8db9f2738594d187bb9148f138b8da, so
test cases and features are mostly same.

We change product_services partition name to "system_ext" because this
partition's purpose changes.

 - installing a RRO package for framework from /system_ext/overlay
 - installing apps from /system_ext/app
 - installing priv-apps from /system_ext/priv-app
 - installing permissions from
   /system_ext/etc/[default-permissions|permissions|sysconfig]

Bug: 134359158
Test: `mma` under frameworks/base/tests/[libs|privapp]-permissions
      adb sync && adb reboot
      adb shell cmd package list libraries
        => confirmed com.android.test.libs.system_ext library
      adb shell cmd package dump \
        com.android.framework.permission.privapp.tests.system_ext
        => confirmed that the package is a priv-app

Change-Id: Ibbccbba64156a7bc464ffb3785fb8fe69ebb973c
parent 658c88a6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5169,7 +5169,8 @@ package android.os {
    method @NonNull public static java.io.File getOdmDirectory();
    method @NonNull public static java.io.File getOemDirectory();
    method @NonNull public static java.io.File getProductDirectory();
    method @NonNull public static java.io.File getProductServicesDirectory();
    method @Deprecated @NonNull public static java.io.File getProductServicesDirectory();
    method @NonNull public static java.io.File getSystemExtDirectory();
    method @NonNull public static java.io.File getVendorDirectory();
  }
+5 −5
Original line number Diff line number Diff line
@@ -614,10 +614,10 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {

    /**
     * Value for {@link #privateFlags}: whether this app is pre-installed on the
     * google partition of the system image.
     * system_ext partition of the system image.
     * @hide
     */
    public static final int PRIVATE_FLAG_PRODUCT_SERVICES = 1 << 21;
    public static final int PRIVATE_FLAG_SYSTEM_EXT = 1 << 21;

    /**
     * Indicates whether this package requires access to non-SDK APIs.
@@ -713,7 +713,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
            PRIVATE_FLAG_USE_EMBEDDED_DEX,
            PRIVATE_FLAG_PRIVILEGED,
            PRIVATE_FLAG_PRODUCT,
            PRIVATE_FLAG_PRODUCT_SERVICES,
            PRIVATE_FLAG_SYSTEM_EXT,
            PRIVATE_FLAG_PROFILEABLE_BY_SHELL,
            PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
            PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY,
@@ -2047,8 +2047,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    }

    /** @hide */
    public boolean isProductServices() {
        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
    public boolean isSystemExt() {
        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
    }

    /** @hide */
+2 −2
Original line number Diff line number Diff line
@@ -6897,8 +6897,8 @@ public class PackageParser {
        }

        /** @hide */
        public boolean isProductServices() {
            return applicationInfo.isProductServices();
        public boolean isSystemExt() {
            return applicationInfo.isSystemExt();
        }

        /** @hide */
+1 −1
Original line number Diff line number Diff line
@@ -1191,7 +1191,7 @@ public class Build {
        ArrayList<Partition> partitions = new ArrayList();

        String[] names = new String[] {
            "bootimage", "odm", "product", "product_services", Partition.PARTITION_NAME_SYSTEM,
            "bootimage", "odm", "product", "system_ext", Partition.PARTITION_NAME_SYSTEM,
            "vendor"
        };
        for (String name : names) {
+19 −4
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class Environment {
    private static final String ENV_ODM_ROOT = "ODM_ROOT";
    private static final String ENV_VENDOR_ROOT = "VENDOR_ROOT";
    private static final String ENV_PRODUCT_ROOT = "PRODUCT_ROOT";
    private static final String ENV_PRODUCT_SERVICES_ROOT = "PRODUCT_SERVICES_ROOT";
    private static final String ENV_SYSTEM_EXT_ROOT = "SYSTEM_EXT_ROOT";

    /** {@hide} */
    public static final String DIR_ANDROID = "Android";
@@ -77,8 +77,8 @@ public class Environment {
    private static final File DIR_ODM_ROOT = getDirectory(ENV_ODM_ROOT, "/odm");
    private static final File DIR_VENDOR_ROOT = getDirectory(ENV_VENDOR_ROOT, "/vendor");
    private static final File DIR_PRODUCT_ROOT = getDirectory(ENV_PRODUCT_ROOT, "/product");
    private static final File DIR_PRODUCT_SERVICES_ROOT = getDirectory(ENV_PRODUCT_SERVICES_ROOT,
                                                           "/product_services");
    private static final File DIR_SYSTEM_EXT_ROOT = getDirectory(ENV_SYSTEM_EXT_ROOT,
                                                           "/system_ext");

    @UnsupportedAppUsage
    private static UserEnvironment sCurrentUser;
@@ -222,11 +222,26 @@ public class Environment {
     * Return root directory of the "product_services" partition holding middleware
     * services if any. If present, the partition is mounted read-only.
     *
     * @deprecated This directory is not guaranteed to exist.
     *             Its name is changed to "system_ext" because the partition's purpose is changed.
     *             {@link #getSystemExtDirectory()}
     * @hide
     */
    @SystemApi
    @Deprecated
    public static @NonNull File getProductServicesDirectory() {
        return DIR_PRODUCT_SERVICES_ROOT;
        return getDirectory("PRODUCT_SERVICES_ROOT", "/product_services");
    }

    /**
     * Return root directory of the "system_ext" partition holding system partition's extension
     * If present, the partition is mounted read-only.
     *
     * @hide
     */
    @SystemApi
    public static @NonNull File getSystemExtDirectory() {
        return DIR_SYSTEM_EXT_ROOT;
    }

    /**
Loading