@@ -111,7 +111,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
111111
112112 // TODO: This is arbitrary. When there is time implement this by watching
113113 // when that accessibility services are bound.
114- private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 5000 ;
114+ private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 3000 ;
115115
116116 private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE =
117117 "registerUiTestAutomationService" ;
@@ -659,16 +659,22 @@ private void switchUser(int userId) {
659659 oldUserState .mUserId , 0 ).sendToTarget ();
660660 }
661661
662+ // Announce user changes only if more that one exist.
663+ UserManager userManager = (UserManager ) mContext .getSystemService (Context .USER_SERVICE );
664+ final boolean announceNewUser = userManager .getUsers ().size () > 1 ;
665+
662666 // The user changed.
663667 mCurrentUserId = userId ;
664668
665669 // Recreate the internal state for the new user.
666670 mMainHandler .obtainMessage (MainHandler .MSG_SEND_RECREATE_INTERNAL_STATE ,
667671 mCurrentUserId , 0 ).sendToTarget ();
668672
669- // Schedule announcement of the current user if needed.
670- mMainHandler .sendEmptyMessageDelayed (MainHandler .MSG_ANNOUNCE_NEW_USER_IF_NEEDED ,
671- WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS );
673+ if (announceNewUser ) {
674+ // Schedule announcement of the current user if needed.
675+ mMainHandler .sendEmptyMessageDelayed (MainHandler .MSG_ANNOUNCE_NEW_USER_IF_NEEDED ,
676+ WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS );
677+ }
672678 }
673679 }
674680
0 commit comments