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

Commit d2509fd8 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Add boot mode where only "core apps" are started.

A core app is one that has coreApp="true" in its manifest tag.

The system can successfully boot (though a little painfully) with
only framework-res.apk, SettingsProvider.apk, SystemUI.apk,
DefaultContainerService.apk, and Launcher2.apk set as core apps.

Currently this boot mode is always turned off.

Change-Id: Ieaa4a8031c2c391a12996aa8d8b1d65fc2b09d6b
parent d61a3a1b
Loading
Loading
Loading
Loading
+26 −9
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class PackageParser {

    private String mArchiveSourcePath;
    private String[] mSeparateProcesses;
    private boolean mOnlyCoreApps;
    private static final int SDK_VERSION = Build.VERSION.SDK_INT;
    private static final String SDK_CODENAME = "REL".equals(Build.VERSION.CODENAME)
            ? null : Build.VERSION.CODENAME;
@@ -180,6 +181,10 @@ public class PackageParser {
        mSeparateProcesses = procs;
    }

    public void setOnlyCoreApps(boolean onlyCoreApps) {
        mOnlyCoreApps = onlyCoreApps;
    }

    private static final boolean isPackageFilename(String name) {
        return name.endsWith(".apk");
    }
@@ -433,6 +438,9 @@ public class PackageParser {


        if (pkg == null) {
            // If we are only parsing core apps, then a null with INSTALL_SUCCEEDED
            // just means to skip this app so don't make a fuss about it.
            if (!mOnlyCoreApps || mParseError != PackageManager.INSTALL_SUCCEEDED) {
                if (errorException != null) {
                    Slog.w(TAG, mArchiveSourcePath, errorException);
                } else {
@@ -440,11 +448,12 @@ public class PackageParser {
                            + parser.getPositionDescription()
                            + "): " + errorText[0]);
                }
            parser.close();
            assmgr.close();
                if (mParseError == PackageManager.INSTALL_SUCCEEDED) {
                    mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
                }
            }
            parser.close();
            assmgr.close();
            return null;
        }

@@ -782,6 +791,14 @@ public class PackageParser {
        }
        int type;

        if (mOnlyCoreApps) {
            boolean core = attrs.getAttributeBooleanValue(null, "coreApp", false);
            if (!core) {
                mParseError = PackageManager.INSTALL_SUCCEEDED;
                return null;
            }
        }

        final Package pkg = new Package(pkgName);
        boolean foundApp = false;
        
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="android" android:sharedUserId="android.uid.system"
    package="android" coreApp="true" android:sharedUserId="android.uid.system"
    android:sharedUserLabel="@string/android_system_label">

    <!-- ================================================ -->
+1 −1
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.defcontainer">
        package="com.android.defcontainer" coreApp="true">
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
    <uses-permission android:name="android.permission.ACCESS_ALL_DOWNLOADS"/>
    <uses-permission android:name="android.permission.ASEC_ACCESS"/>
+1 −0
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.providers.settings"
        coreApp="true"
        android:sharedUserId="android.uid.system">

    <application android:allowClearUserData="false"
+1 −0
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.systemui"
        coreApp="true"
        android:sharedUserId="android.uid.system"
        android:process="system"
        >
Loading