summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Phil Weaver <pweaver@google.com> 2018-02-23 00:31:48 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-02-23 00:31:48 +0000
commitcfd17093cd9cb092a7c3c31eb8afb7e91525a06c (patch)
tree5eec4deae7c2e4c52c43e2aa8d7ca660acc5a62f
parent436b5461b3b1b92a5bc3c8cdfa4f37d03f3ec60d (diff)
parent7d847b037525075cdff92d5e52665d9a9761a8e9 (diff)
Merge "Use accessibility pane API in keyguard"
-rw-r--r--core/java/android/view/View.java2
-rw-r--r--core/res/res/values/strings.xml4
-rw-r--r--core/res/res/values/symbols.xml5
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java14
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java6
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java6
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java6
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java15
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityView.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java9
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java6
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java2
13 files changed, 64 insertions, 25 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1e4f5686a117..3c7624225eb9 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 e61860232abd..f4be888e06ee 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2106,6 +2106,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] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index ab4c12b7229b..fc4d4e71e24c 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3234,6 +3234,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" />
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java
index f1a5ca9fba93..474fc90a1c3f 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 ff5f5e77b3f9..75c52d8ead65 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 cb066a10a9c9..651831eea517 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 6539ccffc61b..1d3f9a13c631 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 8dc4609f1b9d..c3413d9d76bb 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 360dba3bc0ea..6e445ff0e26d 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 a2ff8f7896aa..3aede569147a 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
@@ -173,6 +173,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 703b20531390..c71c433bb016 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 347c9792ec95..1b61568276ce 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 699e8cf145bc..380c08eb1738 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) {