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

Commit 11e45075 authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Define targetSandboxVersion

The new attribute allows both ephemeral and non-ephemeral apps to
opt into a new, tighter security model.

Test: Manual; built app w/ targetSandboxVersion and verified the security domain
Change-Id: I8fcaf84e25f0519b438ba51302f79790e680e025
parent c5d45893
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1268,6 +1268,7 @@ package android {
    field public static final int targetId = 16843740; // 0x10103dc
    field public static final int targetName = 16843853; // 0x101044d
    field public static final int targetPackage = 16842785; // 0x1010021
    field public static final int targetSandboxVersion = 16844110; // 0x101054e
    field public static final int targetSdkVersion = 16843376; // 0x1010270
    field public static final int taskAffinity = 16842770; // 0x1010012
    field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be
+1 −0
Original line number Diff line number Diff line
@@ -1383,6 +1383,7 @@ package android {
    field public static final int targetId = 16843740; // 0x10103dc
    field public static final int targetName = 16843853; // 0x101044d
    field public static final int targetPackage = 16842785; // 0x1010021
    field public static final int targetSandboxVersion = 16844110; // 0x101054e
    field public static final int targetSdkVersion = 16843376; // 0x1010270
    field public static final int taskAffinity = 16842770; // 0x1010012
    field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be
+1 −0
Original line number Diff line number Diff line
@@ -1268,6 +1268,7 @@ package android {
    field public static final int targetId = 16843740; // 0x10103dc
    field public static final int targetName = 16843853; // 0x101044d
    field public static final int targetPackage = 16842785; // 0x1010021
    field public static final int targetSandboxVersion = 16844110; // 0x101054e
    field public static final int targetSdkVersion = 16843376; // 0x1010270
    field public static final int taskAffinity = 16842770; // 0x1010012
    field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be
+12 −1
Original line number Diff line number Diff line
@@ -826,6 +826,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public int networkSecurityConfigRes;

    /**
     * Version of the sandbox the application wants to run in.
     * @hide
     */
    public int targetSandboxVersion;

    /**
     * The category of this app. Categories are used to cluster multiple apps
     * together into meaningful groups, such as when summarizing battery,
@@ -1007,7 +1013,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        pw.println(prefix + "enabled=" + enabled
                + " minSdkVersion=" + minSdkVersion
                + " targetSdkVersion=" + targetSdkVersion
                + " versionCode=" + versionCode);
                + " versionCode=" + versionCode
                + " targetSandboxVersion=" + targetSandboxVersion);
        if ((flags&DUMP_FLAG_DETAILS) != 0) {
            if (manageSpaceActivityName != null) {
                pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName);
@@ -1122,6 +1129,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        fullBackupContent = orig.fullBackupContent;
        networkSecurityConfigRes = orig.networkSecurityConfigRes;
        category = orig.category;
        targetSandboxVersion = orig.targetSandboxVersion;
    }

    public String toString() {
@@ -1182,6 +1190,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeInt(fullBackupContent);
        dest.writeInt(networkSecurityConfigRes);
        dest.writeInt(category);
        dest.writeInt(targetSandboxVersion);
    }

    public static final Parcelable.Creator<ApplicationInfo> CREATOR
@@ -1242,6 +1251,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        fullBackupContent = source.readInt();
        networkSecurityConfigRes = source.readInt();
        category = source.readInt();
        targetSandboxVersion = source.readInt();
    }

    /**
@@ -1310,6 +1320,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        } else {
            dataDir = credentialProtectedDataDir;
        }
        // TODO: modify per-user ephemerality
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@ public class PackageParser {
    private static boolean sCompatibilityModeEnabled = true;
    private static final int PARSE_DEFAULT_INSTALL_LOCATION =
            PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
    private static final int PARSE_DEFAULT_TARGET_SANDBOX = 1;

    static class ParsePackageItemArgs {
        final Package owner;
@@ -1996,6 +1997,10 @@ public class PackageParser {
                PARSE_DEFAULT_INSTALL_LOCATION);
        pkg.applicationInfo.installLocation = pkg.installLocation;

        final int targetSandboxVersion = sa.getInteger(
                com.android.internal.R.styleable.AndroidManifest_targetSandboxVersion,
                PARSE_DEFAULT_TARGET_SANDBOX);
        pkg.applicationInfo.targetSandboxVersion = targetSandboxVersion;

        /* Set the global "forward lock" flag */
        if ((flags & PARSE_FORWARD_LOCK) != 0) {
Loading