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;
mSeparateProcesses = procs;
}
+ public void setOnlyCoreApps(boolean onlyCoreApps) {
+ mOnlyCoreApps = onlyCoreApps;
+ }
+
private static final boolean isPackageFilename(String name) {
return name.endsWith(".apk");
}
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;
}
}
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;
final Context mContext;
final boolean mFactoryTest;
+ final boolean mOnlyCore;
final boolean mNoDexOpt;
final DisplayMetrics mMetrics;
final int mDefParseFlags;
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;
}
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());
mContext = context;
mFactoryTest = factoryTest;
+ mOnlyCore = onlyCore;
mNoDexOpt = "eng".equals(SystemProperties.get("ro.build.type"));
mMetrics = new DisplayMetrics();
mSettings = new Settings();
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);
+ }
}
}
//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());
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) {
+ " 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));