am 0f8ec44b: Merge "Prune shared users that the system declares but does not use" into klp-dev

* commit '0f8ec44b13487f5726cab77eb79cac016e090b25':
  Prune shared users that the system declares but does not use
This commit is contained in:
Christopher Tate
2013-09-13 17:22:24 -07:00
committed by Android Git Automerger
2 changed files with 16 additions and 0 deletions

View File

@@ -1349,6 +1349,9 @@ public class PackageManagerService extends IPackageManager.Stub {
//delete tmp files
deleteTempPackageFiles();
// Remove any shared userIDs that have no associated packages
mSettings.pruneSharedUsersLPw();
if (!mOnlyCore) {
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
SystemClock.uptimeMillis());

View File

@@ -351,6 +351,19 @@ final class Settings {
return null;
}
void pruneSharedUsersLPw() {
ArrayList<String> removeStage = new ArrayList<String>();
for (Map.Entry<String,SharedUserSetting> entry : mSharedUsers.entrySet()) {
final SharedUserSetting sus = entry.getValue();
if (sus == null || sus.packages.size() == 0) {
removeStage.add(entry.getKey());
}
}
for (int i = 0; i < removeStage.size(); i++) {
mSharedUsers.remove(removeStage.get(i));
}
}
// Transfer ownership of permissions from one package to another.
void transferPermissionsLPw(String origPkg, String newPkg) {
// Transfer ownership of permissions to the new package.