Make sure we're locked

Before calling a method ending with LPw, we need to have the mPackages lock.
Make sure we do that.

Also, ditch the iterator for traversing an ArraySet.

Bug: 29356333
Change-Id: I67df971f2961b577f31153cef46fb153458d6965
This commit is contained in:
Todd Kennedy
2016-06-15 09:54:28 -07:00
parent 68dd6233bd
commit 3d5604dc90

View File

@@ -4753,10 +4753,8 @@ public class PackageManagerService extends IPackageManager.Stub {
final SharedUserSetting sus = (SharedUserSetting) obj;
final int N = sus.packages.size();
final String[] res = new String[N];
final Iterator<PackageSetting> it = sus.packages.iterator();
int i = 0;
while (it.hasNext()) {
res[i++] = it.next().name;
for (int i = 0; i < N; i++) {
res[i] = sus.packages.valueAt(i).name;
}
return res;
} else if (obj instanceof PackageSetting) {
@@ -14478,7 +14476,9 @@ public class PackageManagerService extends IPackageManager.Stub {
// Remove existing system package
removePackageLI(deletedPackage, true);
disabledSystem = disableSystemPackageLPw(deletedPackage, pkg);
synchronized (mPackages) {
disabledSystem = disableSystemPackageLPw(deletedPackage, pkg);
}
if (!disabledSystem) {
// We didn't need to disable the .apk as a current system package,
// which means we are replacing another update that is already