am 30ed33b1: Merge "Owner should not be announces as a user switch." into jb-mr1-dev
* commit '30ed33b141dd1add916466c193b6735cd0bf8315': Owner should not be announces as a user switch.
This commit is contained in:
@@ -3933,6 +3933,6 @@
|
||||
<!-- Text spoken when the user stops preforming a gesture that would enable accessibility. [CHAR LIMIT=none] -->
|
||||
<string name="enable_accessibility_canceled">Accessibility canceled.</string>
|
||||
<!-- Text spoken when the current user is switched if accessibility is enabled. [CHAR LIMIT=none] -->
|
||||
<string name="user_switched">Switched to user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>
|
||||
<string name="user_switched">Current user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -111,7 +111,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
|
||||
// TODO: This is arbitrary. When there is time implement this by watching
|
||||
// when that accessibility services are bound.
|
||||
private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 5000;
|
||||
private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 3000;
|
||||
|
||||
private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE =
|
||||
"registerUiTestAutomationService";
|
||||
@@ -659,6 +659,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
oldUserState.mUserId, 0).sendToTarget();
|
||||
}
|
||||
|
||||
// Announce user changes only if more that one exist.
|
||||
UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
|
||||
final boolean announceNewUser = userManager.getUsers().size() > 1;
|
||||
|
||||
// The user changed.
|
||||
mCurrentUserId = userId;
|
||||
|
||||
@@ -666,9 +670,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
mMainHandler.obtainMessage(MainHandler.MSG_SEND_RECREATE_INTERNAL_STATE,
|
||||
mCurrentUserId, 0).sendToTarget();
|
||||
|
||||
// Schedule announcement of the current user if needed.
|
||||
mMainHandler.sendEmptyMessageDelayed(MainHandler.MSG_ANNOUNCE_NEW_USER_IF_NEEDED,
|
||||
WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS);
|
||||
if (announceNewUser) {
|
||||
// Schedule announcement of the current user if needed.
|
||||
mMainHandler.sendEmptyMessageDelayed(MainHandler.MSG_ANNOUNCE_NEW_USER_IF_NEEDED,
|
||||
WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user