Merge "New accessibility string for multi-user switch" into sc-dev

This commit is contained in:
Peter Kalauskas
2021-03-15 22:34:03 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 0 deletions

View File

@@ -2295,6 +2295,9 @@
<!-- accessibility label for button to select user [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_user">Signed in as <xliff:g name="user" example="John">%s</xliff:g></string>
<!-- Accessibility description (not shown on the screen) of action to open user switcher when the multi-user icon is clicked. It will read as "Double-tap to choose user" in screen readers [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_choose_user_action">choose user</string>
<!-- Content description for no internet connection [CHAR LIMIT=NONE] -->
<string name="data_connection_no_internet">No internet</string>

View File

@@ -26,6 +26,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import com.android.internal.logging.UiEventLogger;
import com.android.keyguard.KeyguardConstants;
@@ -143,6 +144,16 @@ public class KeyguardQsUserSwitchController extends ViewController<UserAvatarVie
openQsUserPanel();
});
mView.setAccessibilityDelegate(new View.AccessibilityDelegate() {
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(
AccessibilityNodeInfo.ACTION_CLICK,
mContext.getString(
R.string.accessibility_quick_settings_choose_user_action)));
}
});
updateView(true /* forceUpdate */);
}