Synchronize access to *Locked() functions

Several places were calling *Locked() functions without properly
synchronizing.

Change-Id: Ie39b6592da8bb5f4a5a1e738c45f228256116ec4
This commit is contained in:
Josh Bartel
2010-02-25 10:55:48 -06:00
committed by Garmin Android technology group
parent 7f2087435e
commit 2ecce34f2f

View File

@ -4931,9 +4931,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED, Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
Uri.fromParts("package", packageName, null)); Uri.fromParts("package", packageName, null));
intent.putExtra(Intent.EXTRA_UID, pkgUid); intent.putExtra(Intent.EXTRA_UID, pkgUid);
synchronized (this) {
broadcastIntentLocked(null, null, intent, broadcastIntentLocked(null, null, intent,
null, null, 0, null, null, null, null, null, 0, null, null, null,
false, false, MY_PID, Process.SYSTEM_UID); false, false, MY_PID, Process.SYSTEM_UID);
}
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} finally { } finally {
@ -5668,9 +5670,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
ArrayList<ProcessRecord> procs = ArrayList<ProcessRecord> procs =
new ArrayList<ProcessRecord>(mProcessesOnHold); new ArrayList<ProcessRecord>(mProcessesOnHold);
for (int ip=0; ip<NP; ip++) { for (int ip=0; ip<NP; ip++) {
synchronized (this) {
this.startProcessLocked(procs.get(ip), "on-hold", null); this.startProcessLocked(procs.get(ip), "on-hold", null);
} }
} }
}
if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
// Tell anyone interested that we are done booting! // Tell anyone interested that we are done booting!
synchronized (this) { synchronized (this) {
@ -7879,10 +7883,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
} }
public static final void installSystemProviders() { public static final void installSystemProviders() {
List providers = null;
synchronized (mSelf) {
ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID); ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID);
List providers = mSelf.generateApplicationProvidersLocked(app); providers = mSelf.generateApplicationProvidersLocked(app);
}
if (providers != null) {
mSystemThread.installSystemProviders(providers); mSystemThread.installSystemProviders(providers);
} }
}
// ========================================================= // =========================================================
// GLOBAL MANAGEMENT // GLOBAL MANAGEMENT
@ -8156,12 +8165,16 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
} }
public void registerActivityWatcher(IActivityWatcher watcher) { public void registerActivityWatcher(IActivityWatcher watcher) {
synchronized (this) {
mWatchers.register(watcher); mWatchers.register(watcher);
} }
}
public void unregisterActivityWatcher(IActivityWatcher watcher) { public void unregisterActivityWatcher(IActivityWatcher watcher) {
synchronized (this) {
mWatchers.unregister(watcher); mWatchers.unregister(watcher);
} }
}
public final void enterSafeMode() { public final void enterSafeMode() {
synchronized(this) { synchronized(this) {