summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/content/pm/PackageParser.java35
-rw-r--r--core/res/AndroidManifest.xml2
-rwxr-xr-xpackages/DefaultContainerService/AndroidManifest.xml2
-rw-r--r--packages/SettingsProvider/AndroidManifest.xml1
-rw-r--r--packages/SystemUI/AndroidManifest.xml1
-rw-r--r--services/java/com/android/server/SystemServer.java3
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java67
7 files changed, 71 insertions, 40 deletions
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index c61e32f..e7b844c 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -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,18 +438,22 @@ public class PackageParser {
if (pkg == null) {
- if (errorException != null) {
- Slog.w(TAG, mArchiveSourcePath, errorException);
- } else {
- Slog.w(TAG, mArchiveSourcePath + " (at "
- + parser.getPositionDescription()
- + "): " + errorText[0]);
+ // 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 {
+ Slog.w(TAG, mArchiveSourcePath + " (at "
+ + parser.getPositionDescription()
+ + "): " + errorText[0]);
+ }
+ if (mParseError == PackageManager.INSTALL_SUCCEEDED) {
+ mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
+ }
}
parser.close();
assmgr.close();
- if (mParseError == PackageManager.INSTALL_SUCCEEDED) {
- mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
- }
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;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 72863a2..9f2eef5 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -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">
<!-- ================================================ -->
diff --git a/packages/DefaultContainerService/AndroidManifest.xml b/packages/DefaultContainerService/AndroidManifest.xml
index 0f47482..319eb8d 100755
--- a/packages/DefaultContainerService/AndroidManifest.xml
+++ b/packages/DefaultContainerService/AndroidManifest.xml
@@ -1,5 +1,5 @@
<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"/>
diff --git a/packages/SettingsProvider/AndroidManifest.xml b/packages/SettingsProvider/AndroidManifest.xml
index dd0d064..0719426 100644
--- a/packages/SettingsProvider/AndroidManifest.xml
+++ b/packages/SettingsProvider/AndroidManifest.xml
@@ -1,5 +1,6 @@
<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"
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index d10911f..a2452c4 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui"
+ coreApp="true"
android:sharedUserId="android.uid.system"
android:process="system"
>
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 2714fc5..7e28c4f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -148,7 +148,8 @@ class ServerThread extends Thread {
Slog.i(TAG, "Package Manager");
pm = PackageManagerService.main(context,
- factoryTest != SystemServer.FACTORY_TEST_OFF);
+ factoryTest != SystemServer.FACTORY_TEST_OFF,
+ false);
ActivityManagerService.setSystemProcess();
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index bfb244b..4e5ca8e 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -221,6 +221,7 @@ public class PackageManagerService extends IPackageManager.Stub {
final Context mContext;
final boolean mFactoryTest;
+ final boolean mOnlyCore;
final boolean mNoDexOpt;
final DisplayMetrics mMetrics;
final int mDefParseFlags;
@@ -809,8 +810,9 @@ public class PackageManagerService extends IPackageManager.Stub {
return false;
}
- public static final IPackageManager main(Context context, boolean factoryTest) {
- PackageManagerService m = new PackageManagerService(context, factoryTest);
+ public static final IPackageManager main(Context context, boolean factoryTest,
+ boolean onlyCore) {
+ PackageManagerService m = new PackageManagerService(context, factoryTest, onlyCore);
ServiceManager.addService("package", m);
return m;
}
@@ -837,7 +839,7 @@ public class PackageManagerService extends IPackageManager.Stub {
return res;
}
- public PackageManagerService(Context context, boolean factoryTest) {
+ public PackageManagerService(Context context, boolean factoryTest, boolean onlyCore) {
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_START,
SystemClock.uptimeMillis());
@@ -847,6 +849,7 @@ public class PackageManagerService extends IPackageManager.Stub {
mContext = context;
mFactoryTest = factoryTest;
+ mOnlyCore = onlyCore;
mNoDexOpt = "eng".equals(SystemProperties.get("ro.build.type"));
mMetrics = new DisplayMetrics();
mSettings = new Settings();
@@ -1051,18 +1054,20 @@ public class PackageManagerService extends IPackageManager.Stub {
mInstaller.moveFiles();
// Prune any system packages that no longer exist.
- Iterator<PackageSetting> psit = mSettings.mPackages.values().iterator();
- while (psit.hasNext()) {
- PackageSetting ps = psit.next();
- if ((ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) != 0
- && !mPackages.containsKey(ps.name)
- && !mSettings.mDisabledSysPackages.containsKey(ps.name)) {
- psit.remove();
- String msg = "System package " + ps.name
- + " no longer exists; wiping its data";
- reportSettingsProblem(Log.WARN, msg);
- mInstaller.remove(ps.name, 0);
- mUserManager.removePackageForAllUsers(ps.name);
+ if (!mOnlyCore) {
+ Iterator<PackageSetting> psit = mSettings.mPackages.values().iterator();
+ while (psit.hasNext()) {
+ PackageSetting ps = psit.next();
+ if ((ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) != 0
+ && !mPackages.containsKey(ps.name)
+ && !mSettings.mDisabledSysPackages.containsKey(ps.name)) {
+ psit.remove();
+ String msg = "System package " + ps.name
+ + " no longer exists; wiping its data";
+ reportSettingsProblem(Log.WARN, msg);
+ mInstaller.remove(ps.name, 0);
+ mUserManager.removePackageForAllUsers(ps.name);
+ }
}
}
@@ -1077,18 +1082,23 @@ public class PackageManagerService extends IPackageManager.Stub {
//delete tmp files
deleteTempPackageFiles();
- EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
- SystemClock.uptimeMillis());
- mAppInstallObserver = new AppDirObserver(
- mAppInstallDir.getPath(), OBSERVER_EVENTS, false);
- mAppInstallObserver.startWatching();
- scanDirLI(mAppInstallDir, 0, scanMode, 0);
-
- mDrmAppInstallObserver = new AppDirObserver(
- mDrmAppPrivateInstallDir.getPath(), OBSERVER_EVENTS, false);
- mDrmAppInstallObserver.startWatching();
- scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK,
- scanMode, 0);
+ if (!mOnlyCore) {
+ EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
+ SystemClock.uptimeMillis());
+ mAppInstallObserver = new AppDirObserver(
+ mAppInstallDir.getPath(), OBSERVER_EVENTS, false);
+ mAppInstallObserver.startWatching();
+ scanDirLI(mAppInstallDir, 0, scanMode, 0);
+
+ mDrmAppInstallObserver = new AppDirObserver(
+ mDrmAppPrivateInstallDir.getPath(), OBSERVER_EVENTS, false);
+ mDrmAppInstallObserver.startWatching();
+ scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK,
+ scanMode, 0);
+ } else {
+ mAppInstallObserver = null;
+ mDrmAppInstallObserver = null;
+ }
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SCAN_END,
SystemClock.uptimeMillis());
@@ -2749,6 +2759,7 @@ public class PackageManagerService extends IPackageManager.Stub {
parseFlags |= mDefParseFlags;
PackageParser pp = new PackageParser(scanPath);
pp.setSeparateProcesses(mSeparateProcesses);
+ pp.setOnlyCoreApps(mOnlyCore);
final PackageParser.Package pkg = pp.parsePackage(scanFile,
scanPath, mMetrics, parseFlags);
if (pkg == null) {
@@ -4044,7 +4055,7 @@ public class PackageManagerService extends IPackageManager.Stub {
+ " info=" + bp.pendingInfo);
if (bp.packageSetting == null && bp.pendingInfo != null) {
final BasePermission tree = findPermissionTreeLP(bp.name);
- if (tree != null) {
+ if (tree != null && tree.perm != null) {
bp.packageSetting = tree.packageSetting;
bp.perm = new PackageParser.Permission(tree.perm.owner,
new PermissionInfo(bp.pendingInfo));