Use accessibility pane API in keyguard
Using the new accessibility pane title API to identify the pattern, pin, and password unlock screens. Bug: 73131182 Test: Verified that accessibility events are properly sent when unlocking the phone with each of the lock methods. Change-Id: I32594f4736b503e7f9e3be96e9f77a84ffcadc54
This commit is contained in:
@@ -7309,7 +7309,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
}
|
||||
|
||||
private boolean isAccessibilityPane() {
|
||||
return !TextUtils.isEmpty(mAccessibilityPaneTitle);
|
||||
return mAccessibilityPaneTitle != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2104,6 +2104,10 @@
|
||||
<string name="keyguard_accessibility_face_unlock">Face unlock.</string>
|
||||
<!-- Accessibility description of the pin lock. [CHAR_LIMIT=none] -->
|
||||
<string name="keyguard_accessibility_pin_unlock">Pin unlock.</string>
|
||||
<!-- Accessibility description of the sim pin lock. [CHAR_LIMIT=none] -->
|
||||
<string name="keyguard_accessibility_sim_pin_unlock">Sim Pin unlock.</string>
|
||||
<!-- Accessibility description of the sim puk lock. [CHAR_LIMIT=none] -->
|
||||
<string name="keyguard_accessibility_sim_puk_unlock">Sim Puk unlock.</string>
|
||||
<!-- Accessibility description of the password lock. [CHAR_LIMIT=none] -->
|
||||
<string name="keyguard_accessibility_password_unlock">Password unlock.</string>
|
||||
<!-- Accessibility description of the unlock pattern area. [CHAR_LIMIT=none] -->
|
||||
|
||||
@@ -3226,6 +3226,11 @@
|
||||
<java-symbol type="string" name="unsupported_compile_sdk_check_update" />
|
||||
|
||||
<java-symbol type="string" name="battery_saver_warning_title" />
|
||||
<java-symbol type="string" name="keyguard_accessibility_pattern_unlock" />
|
||||
<java-symbol type="string" name="keyguard_accessibility_pin_unlock" />
|
||||
<java-symbol type="string" name="keyguard_accessibility_sim_pin_unlock" />
|
||||
<java-symbol type="string" name="keyguard_accessibility_sim_puk_unlock" />
|
||||
<java-symbol type="string" name="keyguard_accessibility_password_unlock" />
|
||||
|
||||
<java-symbol type="string" name="global_action_logout" />
|
||||
<java-symbol type="string" name="config_mainBuiltInDisplayCutout" />
|
||||
|
||||
@@ -197,16 +197,6 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
event.getText().add(mSecurityContainer.getCurrentSecurityModeContentDescription());
|
||||
return true;
|
||||
} else {
|
||||
return super.dispatchPopulateAccessibilityEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
protected KeyguardSecurityContainer getSecurityContainer() {
|
||||
return mSecurityContainer;
|
||||
}
|
||||
@@ -255,6 +245,10 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
|
||||
}
|
||||
}
|
||||
|
||||
public CharSequence getAccessibilityTitleForCurrentMode() {
|
||||
return mSecurityContainer.getTitle();
|
||||
}
|
||||
|
||||
public void userActivity() {
|
||||
if (mViewMediatorCallback != null) {
|
||||
mViewMediatorCallback.userActivity();
|
||||
|
||||
@@ -361,4 +361,10 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
return getContext().getString(
|
||||
com.android.internal.R.string.keyguard_accessibility_password_unlock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,4 +491,10 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
return getContext().getString(
|
||||
com.android.internal.R.string.keyguard_accessibility_pattern_unlock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,4 +252,10 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
return getContext().getString(
|
||||
com.android.internal.R.string.keyguard_accessibility_pin_unlock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,19 +119,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
return false;
|
||||
}
|
||||
|
||||
public void announceCurrentSecurityMethod() {
|
||||
View v = (View) getSecurityView(mCurrentSecuritySelection);
|
||||
if (v != null) {
|
||||
v.announceForAccessibility(v.getContentDescription());
|
||||
}
|
||||
}
|
||||
|
||||
public CharSequence getCurrentSecurityModeContentDescription() {
|
||||
View v = (View) getSecurityView(mCurrentSecuritySelection);
|
||||
if (v != null) {
|
||||
return v.getContentDescription();
|
||||
}
|
||||
return "";
|
||||
public CharSequence getTitle() {
|
||||
return mSecurityViewFlipper.getTitle();
|
||||
}
|
||||
|
||||
private KeyguardSecurityView getSecurityView(SecurityMode securityMode) {
|
||||
|
||||
@@ -127,4 +127,12 @@ public interface KeyguardSecurityView {
|
||||
* animation started and {@code finishRunnable} will not be run
|
||||
*/
|
||||
boolean startDisappearAnimation(Runnable finishRunnable);
|
||||
|
||||
/**
|
||||
* The localized name of the security view, provided to accessibility. This may be the content
|
||||
* description, but content descriptions have other implications, so the title is kept separate.
|
||||
*
|
||||
* @return The View's title.
|
||||
*/
|
||||
CharSequence getTitle();
|
||||
}
|
||||
|
||||
@@ -172,6 +172,15 @@ public class KeyguardSecurityViewFlipper extends ViewFlipper implements Keyguard
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
KeyguardSecurityView ksv = getSecurityView();
|
||||
if (ksv != null) {
|
||||
return ksv.getTitle();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return p instanceof LayoutParams;
|
||||
|
||||
@@ -390,5 +390,11 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
||||
public boolean startDisappearAnimation(Runnable finishRunnable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
return getContext().getString(
|
||||
com.android.internal.R.string.keyguard_accessibility_sim_pin_unlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -460,6 +460,12 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
||||
public boolean startDisappearAnimation(Runnable finishRunnable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
return getContext().getString(
|
||||
com.android.internal.R.string.keyguard_accessibility_sim_puk_unlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +152,6 @@ public class KeyguardBouncer {
|
||||
mKeyguardView.requestLayout();
|
||||
}
|
||||
mShowingSoon = false;
|
||||
mKeyguardView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -264,6 +263,7 @@ public class KeyguardBouncer {
|
||||
mStatusBarHeight = mRoot.getResources().getDimensionPixelOffset(
|
||||
com.android.systemui.R.dimen.status_bar_height);
|
||||
mRoot.setVisibility(View.INVISIBLE);
|
||||
mRoot.setAccessibilityPaneTitle(mKeyguardView.getAccessibilityTitleForCurrentMode());
|
||||
|
||||
final WindowInsets rootInsets = mRoot.getRootWindowInsets();
|
||||
if (rootInsets != null) {
|
||||
|
||||
Reference in New Issue
Block a user