am 3de07024: Merge change 26456 into eclair

Merge commit '3de07024c80fb8a983d4a804ff6d14a49b3f7979' into eclair-plus-aosp

* commit '3de07024c80fb8a983d4a804ff6d14a49b3f7979':
  - make an AccountManager per context, not one per process
This commit is contained in:
Fred Quintana
2009-09-22 20:26:12 -07:00
committed by Android Git Automerger
2 changed files with 9 additions and 5 deletions

View File

@@ -807,6 +807,10 @@ public class AccountManager {
* Add a {@link OnAccountsUpdatedListener} to this instance of the {@link AccountManager}. * Add a {@link OnAccountsUpdatedListener} to this instance of the {@link AccountManager}.
* The listener is guaranteed to be invoked on the thread of the Handler that is passed * The listener is guaranteed to be invoked on the thread of the Handler that is passed
* in or the main thread's Handler if handler is null. * in or the main thread's Handler if handler is null.
* <p>
* You must remove this listener before the context that was used to retrieve this
* {@link AccountManager} instance goes away. This generally means when the Activity
* or Service you are running is stopped.
* @param listener the listener to add * @param listener the listener to add
* @param handler the Handler whose thread will be used to invoke the listener. If null * @param handler the Handler whose thread will be used to invoke the listener. If null
* the AccountManager context's main thread will be used. * the AccountManager context's main thread will be used.

View File

@@ -153,7 +153,6 @@ class ApplicationContext extends Context {
private final static boolean DEBUG_ICONS = false; private final static boolean DEBUG_ICONS = false;
private static final Object sSync = new Object(); private static final Object sSync = new Object();
private static AccountManager sAccountManager;
private static AlarmManager sAlarmManager; private static AlarmManager sAlarmManager;
private static PowerManager sPowerManager; private static PowerManager sPowerManager;
private static ConnectivityManager sConnectivityManager; private static ConnectivityManager sConnectivityManager;
@@ -186,6 +185,7 @@ class ApplicationContext extends Context {
private boolean mIsBluetoothAdapterCached = false; private boolean mIsBluetoothAdapterCached = false;
private BluetoothAdapter mBluetoothAdapter; private BluetoothAdapter mBluetoothAdapter;
private boolean mRestricted; private boolean mRestricted;
private AccountManager mAccountManager; // protected by mSync
private final Object mSync = new Object(); private final Object mSync = new Object();
@@ -908,14 +908,14 @@ class ApplicationContext extends Context {
} }
private AccountManager getAccountManager() { private AccountManager getAccountManager() {
synchronized (sSync) { synchronized (mSync) {
if (sAccountManager == null) { if (mAccountManager == null) {
IBinder b = ServiceManager.getService(ACCOUNT_SERVICE); IBinder b = ServiceManager.getService(ACCOUNT_SERVICE);
IAccountManager service = IAccountManager.Stub.asInterface(b); IAccountManager service = IAccountManager.Stub.asInterface(b);
sAccountManager = new AccountManager(this, service); mAccountManager = new AccountManager(this, service);
} }
return mAccountManager;
} }
return sAccountManager;
} }
private ActivityManager getActivityManager() { private ActivityManager getActivityManager() {