Loading services/java/com/android/server/pm/PackageManagerService.java +27 −7 Original line number Diff line number Diff line Loading @@ -1063,19 +1063,25 @@ public class PackageManagerService extends IPackageManager.Stub { mInstaller.moveFiles(); // Prune any system packages that no longer exist. final List<String> possiblyDeletedSystemApps = new ArrayList<String>(); 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)) { if ((ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0 || mPackages.containsKey(ps.name)) { continue; } if (!mSettings.isDisabledSystemPackageLPr(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); sUserManager.removePackageForAllUsers(ps.name); } else { possiblyDeletedSystemApps.add(ps.name); } } } Loading Loading @@ -1104,6 +1110,21 @@ public class PackageManagerService extends IPackageManager.Stub { mDrmAppInstallObserver.startWatching(); scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK, scanMode, 0); /** * Remove disable package settings for any system apps * that were removed via an OTA. */ for (String deletedAppName : possiblyDeletedSystemApps) { PackageParser.Package deletedPkg = mPackages.get(deletedAppName); if (deletedPkg != null) { mSettings.removeDisabledSystemPackageLPw(deletedAppName); deletedPkg.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM; PackageSetting deletedPs = mSettings.mPackages.get(deletedAppName); deletedPs.pkgFlags &= ~ApplicationInfo.FLAG_SYSTEM; } } } else { mAppInstallObserver = null; mDrmAppInstallObserver = null; Loading Loading @@ -3043,8 +3064,7 @@ public class PackageManagerService extends IPackageManager.Stub { // Check to see if this package could be hiding/updating a system // package. Must look for it either under the original or real // package name depending on our state. updatedPkg = mSettings.mDisabledSysPackages.get( ps != null ? ps.name : pkg.packageName); updatedPkg = mSettings.getDisabledSystemPkgLPr(ps != null ? ps.name : pkg.packageName); } // First check if this is a system package that may involve an update if (updatedPkg != null && (parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) { Loading Loading @@ -3523,7 +3543,7 @@ public class PackageManagerService extends IPackageManager.Stub { mTransferedPackages.add(pkg.packageName); } if (mSettings.mDisabledSysPackages.get(pkg.packageName) != null) { if (mSettings.isDisabledSystemPackageLPr(pkg.packageName)) { pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP; } Loading services/java/com/android/server/pm/Settings.java +9 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ final class Settings { final HashMap<String, PackageSetting> mPackages = new HashMap<String, PackageSetting>(); // List of replaced system applications final HashMap<String, PackageSetting> mDisabledSysPackages = private final HashMap<String, PackageSetting> mDisabledSysPackages = new HashMap<String, PackageSetting>(); // These are the last platform API version we were using for Loading Loading @@ -280,6 +280,14 @@ final class Settings { return ret; } boolean isDisabledSystemPackageLPr(String name) { return mDisabledSysPackages.containsKey(name); } void removeDisabledSystemPackageLPw(String name) { mDisabledSysPackages.remove(name); } PackageSetting addPackageLPw(String name, String realName, File codePath, File resourcePath, String nativeLibraryPathString, int uid, int vc, int pkgFlags) { PackageSetting p = mPackages.get(name); Loading Loading
services/java/com/android/server/pm/PackageManagerService.java +27 −7 Original line number Diff line number Diff line Loading @@ -1063,19 +1063,25 @@ public class PackageManagerService extends IPackageManager.Stub { mInstaller.moveFiles(); // Prune any system packages that no longer exist. final List<String> possiblyDeletedSystemApps = new ArrayList<String>(); 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)) { if ((ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0 || mPackages.containsKey(ps.name)) { continue; } if (!mSettings.isDisabledSystemPackageLPr(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); sUserManager.removePackageForAllUsers(ps.name); } else { possiblyDeletedSystemApps.add(ps.name); } } } Loading Loading @@ -1104,6 +1110,21 @@ public class PackageManagerService extends IPackageManager.Stub { mDrmAppInstallObserver.startWatching(); scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK, scanMode, 0); /** * Remove disable package settings for any system apps * that were removed via an OTA. */ for (String deletedAppName : possiblyDeletedSystemApps) { PackageParser.Package deletedPkg = mPackages.get(deletedAppName); if (deletedPkg != null) { mSettings.removeDisabledSystemPackageLPw(deletedAppName); deletedPkg.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM; PackageSetting deletedPs = mSettings.mPackages.get(deletedAppName); deletedPs.pkgFlags &= ~ApplicationInfo.FLAG_SYSTEM; } } } else { mAppInstallObserver = null; mDrmAppInstallObserver = null; Loading Loading @@ -3043,8 +3064,7 @@ public class PackageManagerService extends IPackageManager.Stub { // Check to see if this package could be hiding/updating a system // package. Must look for it either under the original or real // package name depending on our state. updatedPkg = mSettings.mDisabledSysPackages.get( ps != null ? ps.name : pkg.packageName); updatedPkg = mSettings.getDisabledSystemPkgLPr(ps != null ? ps.name : pkg.packageName); } // First check if this is a system package that may involve an update if (updatedPkg != null && (parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) { Loading Loading @@ -3523,7 +3543,7 @@ public class PackageManagerService extends IPackageManager.Stub { mTransferedPackages.add(pkg.packageName); } if (mSettings.mDisabledSysPackages.get(pkg.packageName) != null) { if (mSettings.isDisabledSystemPackageLPr(pkg.packageName)) { pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP; } Loading
services/java/com/android/server/pm/Settings.java +9 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ final class Settings { final HashMap<String, PackageSetting> mPackages = new HashMap<String, PackageSetting>(); // List of replaced system applications final HashMap<String, PackageSetting> mDisabledSysPackages = private final HashMap<String, PackageSetting> mDisabledSysPackages = new HashMap<String, PackageSetting>(); // These are the last platform API version we were using for Loading Loading @@ -280,6 +280,14 @@ final class Settings { return ret; } boolean isDisabledSystemPackageLPr(String name) { return mDisabledSysPackages.containsKey(name); } void removeDisabledSystemPackageLPw(String name) { mDisabledSysPackages.remove(name); } PackageSetting addPackageLPw(String name, String realName, File codePath, File resourcePath, String nativeLibraryPathString, int uid, int vc, int pkgFlags) { PackageSetting p = mPackages.get(name); Loading