Polish user selector accessibility.

1. The current user was not announced as such.

2. The event for a user switch was not sent.

Change-Id: Ib3caf1f9e93ea1f0b5450246601bc37f416be6da
This commit is contained in:
Svetoslav Ganov
2012-11-02 11:49:22 -07:00
parent febea58c92
commit fc9c4cd51b
3 changed files with 17 additions and 0 deletions

View File

@@ -167,6 +167,17 @@ public class AccessibilityRecord {
mSourceNodeId, GET_SOURCE_PREFETCH_FLAGS);
}
/**
* Sets the window id.
*
* @param windowId The window id.
*
* @hide
*/
public void setWindowId(int windowId) {
mSourceWindowId = windowId;
}
/**
* Gets the id of the window from which the event comes from.
*

View File

@@ -150,6 +150,11 @@ class KeyguardMultiUserAvatar extends FrameLayout {
if (active) {
KeyguardLinearLayout parent = (KeyguardLinearLayout) getParent();
parent.setTopChild(this);
// TODO: Create an appropriate asset when string changes are possible.
setContentDescription(mUserName.getText()
+ ". " + mContext.getString(R.string.user_switched, ""));
} else {
setContentDescription(mUserName.getText());
}
}
updateVisualsForActive(mActive, animate, SWITCH_ANIMATION_DURATION, onComplete);

View File

@@ -1330,6 +1330,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
AccessibilityEvent event = AccessibilityEvent.obtain(
AccessibilityEvent.TYPE_ANNOUNCEMENT);
event.getText().add(message);
event.setWindowId(mSecurityPolicy.getRetrievalAllowingWindowLocked());
sendAccessibilityEvent(event, mCurrentUserId);
}
}