Skip to content

Commit 2ecce34

Browse files
joshbartelGarmin Android technology group
authored andcommitted
Synchronize access to *Locked() functions
Several places were calling *Locked() functions without properly synchronizing. Change-Id: Ie39b6592da8bb5f4a5a1e738c45f228256116ec4
1 parent 7f20874 commit 2ecce34

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4931,9 +4931,11 @@ public boolean clearApplicationUserData(final String packageName,
49314931
Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
49324932
Uri.fromParts("package", packageName, null));
49334933
intent.putExtra(Intent.EXTRA_UID, pkgUid);
4934-
broadcastIntentLocked(null, null, intent,
4935-
null, null, 0, null, null, null,
4936-
false, false, MY_PID, Process.SYSTEM_UID);
4934+
synchronized (this) {
4935+
broadcastIntentLocked(null, null, intent,
4936+
null, null, 0, null, null, null,
4937+
false, false, MY_PID, Process.SYSTEM_UID);
4938+
}
49374939
} catch (RemoteException e) {
49384940
}
49394941
} finally {
@@ -5668,7 +5670,9 @@ final void finishBooting() {
56685670
ArrayList<ProcessRecord> procs =
56695671
new ArrayList<ProcessRecord>(mProcessesOnHold);
56705672
for (int ip=0; ip<NP; ip++) {
5671-
this.startProcessLocked(procs.get(ip), "on-hold", null);
5673+
synchronized (this) {
5674+
this.startProcessLocked(procs.get(ip), "on-hold", null);
5675+
}
56725676
}
56735677
}
56745678
if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
@@ -7879,9 +7883,14 @@ public final void publishContentProviders(IApplicationThread caller,
78797883
}
78807884

78817885
public static final void installSystemProviders() {
7882-
ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID);
7883-
List providers = mSelf.generateApplicationProvidersLocked(app);
7884-
mSystemThread.installSystemProviders(providers);
7886+
List providers = null;
7887+
synchronized (mSelf) {
7888+
ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID);
7889+
providers = mSelf.generateApplicationProvidersLocked(app);
7890+
}
7891+
if (providers != null) {
7892+
mSystemThread.installSystemProviders(providers);
7893+
}
78857894
}
78867895

78877896
// =========================================================
@@ -8156,11 +8165,15 @@ public void setActivityController(IActivityController controller) {
81568165
}
81578166

81588167
public void registerActivityWatcher(IActivityWatcher watcher) {
8159-
mWatchers.register(watcher);
8168+
synchronized (this) {
8169+
mWatchers.register(watcher);
8170+
}
81608171
}
81618172

81628173
public void unregisterActivityWatcher(IActivityWatcher watcher) {
8163-
mWatchers.unregister(watcher);
8174+
synchronized (this) {
8175+
mWatchers.unregister(watcher);
8176+
}
81648177
}
81658178

81668179
public final void enterSafeMode() {

0 commit comments

Comments
 (0)