File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
core/java/android/content Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,12 @@ public void onReceive(Context context, Intent intent) {
203203 }
204204 };
205205
206+ private BroadcastReceiver mAccountsUpdatedReceiver = new BroadcastReceiver () {
207+ public void onReceive (Context context , Intent intent ) {
208+ onAccountsUpdated (null );
209+ }
210+ };
211+
206212 private final PowerManager mPowerManager ;
207213
208214 // Use this as a random offset to seed all periodic syncs
@@ -456,8 +462,11 @@ public void onStatusChanged(int which) {
456462 });
457463
458464 if (!factoryTest ) {
459- AccountManager .get (mContext ).addOnAccountsUpdatedListener (SyncManager .this ,
460- mSyncHandler , false /* updateImmediately */ );
465+ // Register for account list updates for all users
466+ mContext .registerReceiverAsUser (mAccountsUpdatedReceiver ,
467+ UserHandle .ALL ,
468+ new IntentFilter (AccountManager .LOGIN_ACCOUNTS_CHANGED_ACTION ),
469+ null , null );
461470 // do this synchronously to ensure we have the accounts before this call returns
462471 onAccountsUpdated (null );
463472 }
You can’t perform that action at this time.
0 commit comments