Workaround for IllegalArgumentException in SyncManager
* There is a race condition in which the AccountManager listener isn't properly unregistered when SyncManager is shut down * In this case, SyncManager tries to register a new listener (i.e. registering again), which causes an IllegalArgumentException * The quick workaround is simply to catch and ignore this exception, as it's really more of a warning than a true error * A bug will be filed for the underlying issue Bug: 2631561 Change-Id: I139d24ae045d402d4d8cb006406ef96ccc768566
This commit is contained in:
parent
47a59d883f
commit
14812a50a8
@ -1811,8 +1811,14 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS,
|
ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS,
|
||||||
mSyncStatusObserver);
|
mSyncStatusObserver);
|
||||||
mAccountsUpdatedListener = new EasAccountsUpdatedListener();
|
mAccountsUpdatedListener = new EasAccountsUpdatedListener();
|
||||||
AccountManager.get(getApplication())
|
// TODO Find and fix root cause of duplication
|
||||||
.addOnAccountsUpdatedListener(mAccountsUpdatedListener, mHandler, true);
|
try {
|
||||||
|
AccountManager.get(getApplication())
|
||||||
|
.addOnAccountsUpdatedListener(mAccountsUpdatedListener, mHandler, true);
|
||||||
|
} catch (IllegalStateException e1) {
|
||||||
|
// This exception is more of a warning; we shouldn't be in the state in which we
|
||||||
|
// already have a listener.
|
||||||
|
}
|
||||||
|
|
||||||
// Set up receivers for ConnectivityManager
|
// Set up receivers for ConnectivityManager
|
||||||
mConnectivityReceiver = new ConnectivityReceiver();
|
mConnectivityReceiver = new ConnectivityReceiver();
|
||||||
|
Loading…
Reference in New Issue
Block a user