am ef89d33f: am 30ed33b1: Merge "Owner should not be announces as a user switch." into jb-mr1-dev

* commit 'ef89d33f5bc90e3a0527ac91e00385f47937612c':
  Owner should not be announces as a user switch.
This commit is contained in:
Svetoslav Ganov
2012-10-01 23:38:30 -07:00
committed by Android Git Automerger
2 changed files with 11 additions and 5 deletions

View File

@@ -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>

View File

@@ -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);
}
}
}