diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 1e4f5686a1179..3c7624225eb95 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -7309,7 +7309,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } private boolean isAccessibilityPane() { - return !TextUtils.isEmpty(mAccessibilityPaneTitle); + return mAccessibilityPaneTitle != null; } /** diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index e61860232abdc..f4be888e06ee7 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -2106,6 +2106,10 @@ Face unlock. Pin unlock. + + Sim Pin unlock. + + Sim Puk unlock. Password unlock. diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ab4c12b7229b7..fc4d4e71e24c5 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3234,6 +3234,11 @@ + + + + + diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java index f1a5ca9fba937..474fc90a1c3f6 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java @@ -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(); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index ff5f5e77b3f91..75c52d8ead659 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -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); + } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java index cb066a10a9c94..651831eea5173 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -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); + } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java index 6539ccffc61b8..1d3f9a13c631a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java @@ -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); + } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 8dc4609f1b9db..c3413d9d76bb3 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -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) { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityView.java index 360dba3bc0ea3..6e445ff0e26d2 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityView.java @@ -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(); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java index a2ff8f7896aae..3aede569147a7 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java @@ -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; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java index 703b20531390a..c71c433bb0163 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java @@ -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); + } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java index 347c9792ec95b..1b61568276ce6 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java @@ -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); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 699e8cf145bce..380c08eb17382 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -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) {