am bb8326d0: am f03ad443: am f65209d8: am e2cd8419: Merge "Fix pattern lock for accessibility" into mnc-dev
* commit 'bb8326d0cc1a15d7f78978d28646708eac107a2d': Fix pattern lock for accessibility
This commit is contained in:
@@ -94,7 +94,7 @@ public class LockPatternView extends View {
|
|||||||
*/
|
*/
|
||||||
private static final float DRAG_THRESHHOLD = 0.0f;
|
private static final float DRAG_THRESHHOLD = 0.0f;
|
||||||
public static final int VIRTUAL_BASE_VIEW_ID = 1;
|
public static final int VIRTUAL_BASE_VIEW_ID = 1;
|
||||||
public static final boolean DEBUG_A11Y = true;
|
public static final boolean DEBUG_A11Y = false;
|
||||||
private static final String TAG = "LockPatternView";
|
private static final String TAG = "LockPatternView";
|
||||||
|
|
||||||
private OnPatternListener mOnPatternListener;
|
private OnPatternListener mOnPatternListener;
|
||||||
@@ -568,9 +568,11 @@ public class LockPatternView extends View {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean dispatchHoverEvent(MotionEvent event) {
|
protected boolean dispatchHoverEvent(MotionEvent event) {
|
||||||
// Give TouchHelper first right of refusal
|
// Dispatch to onHoverEvent first so mPatternInProgress is up to date when the
|
||||||
boolean handled = mExploreByTouchHelper.dispatchHoverEvent(event);
|
// helper gets the event.
|
||||||
return super.dispatchHoverEvent(event) || handled;
|
boolean handled = super.dispatchHoverEvent(event);
|
||||||
|
handled |= mExploreByTouchHelper.dispatchHoverEvent(event);
|
||||||
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -877,7 +879,7 @@ public class LockPatternView extends View {
|
|||||||
return true;
|
return true;
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
if (mPatternInProgress) {
|
if (mPatternInProgress) {
|
||||||
mPatternInProgress = false;
|
setPatternInProgress(false);
|
||||||
resetPattern();
|
resetPattern();
|
||||||
notifyPatternCleared();
|
notifyPatternCleared();
|
||||||
}
|
}
|
||||||
@@ -892,6 +894,11 @@ public class LockPatternView extends View {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setPatternInProgress(boolean progress) {
|
||||||
|
mPatternInProgress = progress;
|
||||||
|
mExploreByTouchHelper.invalidateRoot();
|
||||||
|
}
|
||||||
|
|
||||||
private void handleActionMove(MotionEvent event) {
|
private void handleActionMove(MotionEvent event) {
|
||||||
// Handle all recent motion events so we don't skip any cells even when the device
|
// Handle all recent motion events so we don't skip any cells even when the device
|
||||||
// is busy...
|
// is busy...
|
||||||
@@ -905,7 +912,7 @@ public class LockPatternView extends View {
|
|||||||
Cell hitCell = detectAndAddHit(x, y);
|
Cell hitCell = detectAndAddHit(x, y);
|
||||||
final int patternSize = mPattern.size();
|
final int patternSize = mPattern.size();
|
||||||
if (hitCell != null && patternSize == 1) {
|
if (hitCell != null && patternSize == 1) {
|
||||||
mPatternInProgress = true;
|
setPatternInProgress(true);
|
||||||
notifyPatternStarted();
|
notifyPatternStarted();
|
||||||
}
|
}
|
||||||
// note current x and y for rubber banding of in progress patterns
|
// note current x and y for rubber banding of in progress patterns
|
||||||
@@ -963,7 +970,7 @@ public class LockPatternView extends View {
|
|||||||
private void handleActionUp() {
|
private void handleActionUp() {
|
||||||
// report pattern detected
|
// report pattern detected
|
||||||
if (!mPattern.isEmpty()) {
|
if (!mPattern.isEmpty()) {
|
||||||
mPatternInProgress = false;
|
setPatternInProgress(false);
|
||||||
cancelLineAnimations();
|
cancelLineAnimations();
|
||||||
notifyPatternDetected();
|
notifyPatternDetected();
|
||||||
invalidate();
|
invalidate();
|
||||||
@@ -994,11 +1001,11 @@ public class LockPatternView extends View {
|
|||||||
final float y = event.getY();
|
final float y = event.getY();
|
||||||
final Cell hitCell = detectAndAddHit(x, y);
|
final Cell hitCell = detectAndAddHit(x, y);
|
||||||
if (hitCell != null) {
|
if (hitCell != null) {
|
||||||
mPatternInProgress = true;
|
setPatternInProgress(true);
|
||||||
mPatternDisplayMode = DisplayMode.Correct;
|
mPatternDisplayMode = DisplayMode.Correct;
|
||||||
notifyPatternStarted();
|
notifyPatternStarted();
|
||||||
} else if (mPatternInProgress) {
|
} else if (mPatternInProgress) {
|
||||||
mPatternInProgress = false;
|
setPatternInProgress(false);
|
||||||
notifyPatternCleared();
|
notifyPatternCleared();
|
||||||
}
|
}
|
||||||
if (hitCell != null) {
|
if (hitCell != null) {
|
||||||
@@ -1315,6 +1322,9 @@ public class LockPatternView extends View {
|
|||||||
@Override
|
@Override
|
||||||
protected void getVisibleVirtualViews(IntArray virtualViewIds) {
|
protected void getVisibleVirtualViews(IntArray virtualViewIds) {
|
||||||
if (DEBUG_A11Y) Log.v(TAG, "getVisibleVirtualViews(len=" + virtualViewIds.size() + ")");
|
if (DEBUG_A11Y) Log.v(TAG, "getVisibleVirtualViews(len=" + virtualViewIds.size() + ")");
|
||||||
|
if (!mPatternInProgress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (int i = VIRTUAL_BASE_VIEW_ID; i < VIRTUAL_BASE_VIEW_ID + 9; i++) {
|
for (int i = VIRTUAL_BASE_VIEW_ID; i < VIRTUAL_BASE_VIEW_ID + 9; i++) {
|
||||||
if (!mItems.containsKey(i)) {
|
if (!mItems.containsKey(i)) {
|
||||||
VirtualViewContainer item = new VirtualViewContainer(getTextForVirtualView(i));
|
VirtualViewContainer item = new VirtualViewContainer(getTextForVirtualView(i));
|
||||||
@@ -1336,6 +1346,16 @@ public class LockPatternView extends View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
|
||||||
|
super.onPopulateAccessibilityEvent(host, event);
|
||||||
|
if (!mPatternInProgress) {
|
||||||
|
CharSequence contentDescription = getContext().getText(
|
||||||
|
com.android.internal.R.string.lockscreen_access_pattern_area);
|
||||||
|
event.setContentDescription(contentDescription);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfo node) {
|
protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfo node) {
|
||||||
if (DEBUG_A11Y) Log.v(TAG, "onPopulateNodeForVirtualView(view=" + virtualViewId + ")");
|
if (DEBUG_A11Y) Log.v(TAG, "onPopulateNodeForVirtualView(view=" + virtualViewId + ")");
|
||||||
@@ -1345,10 +1365,14 @@ public class LockPatternView extends View {
|
|||||||
node.setText(getTextForVirtualView(virtualViewId));
|
node.setText(getTextForVirtualView(virtualViewId));
|
||||||
node.setContentDescription(getTextForVirtualView(virtualViewId));
|
node.setContentDescription(getTextForVirtualView(virtualViewId));
|
||||||
|
|
||||||
if (isClickable(virtualViewId)) {
|
if (mPatternInProgress) {
|
||||||
// Mark this node of interest by making it clickable.
|
node.setFocusable(true);
|
||||||
node.addAction(AccessibilityAction.ACTION_CLICK);
|
|
||||||
node.setClickable(isClickable(virtualViewId));
|
if (isClickable(virtualViewId)) {
|
||||||
|
// Mark this node of interest by making it clickable.
|
||||||
|
node.addAction(AccessibilityAction.ACTION_CLICK);
|
||||||
|
node.setClickable(isClickable(virtualViewId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute bounds for this object
|
// Compute bounds for this object
|
||||||
|
|||||||
@@ -1919,6 +1919,8 @@
|
|||||||
Cell <xliff:g id="cell_index" example="3">%1$s</xliff:g> added</string>
|
Cell <xliff:g id="cell_index" example="3">%1$s</xliff:g> added</string>
|
||||||
<!-- Accessibility description sent when user completes drawing a pattern. [CHAR LIMIT=NONE] -->
|
<!-- Accessibility description sent when user completes drawing a pattern. [CHAR LIMIT=NONE] -->
|
||||||
<string name="lockscreen_access_pattern_detected">Pattern completed</string>
|
<string name="lockscreen_access_pattern_detected">Pattern completed</string>
|
||||||
|
<!-- Accessibility description of the unlock pattern area. [CHAR_LIMIT=none] -->
|
||||||
|
<string name="lockscreen_access_pattern_area" msgid="">Pattern area.</string>
|
||||||
|
|
||||||
<!-- Accessibility description sent when user changes the current lock screen widget. [CHAR_LIMIT=none] -->
|
<!-- Accessibility description sent when user changes the current lock screen widget. [CHAR_LIMIT=none] -->
|
||||||
<string name="keyguard_accessibility_widget_changed">%1$s. Widget %2$d of %3$d.</string>
|
<string name="keyguard_accessibility_widget_changed">%1$s. Widget %2$d of %3$d.</string>
|
||||||
|
|||||||
@@ -2310,6 +2310,8 @@
|
|||||||
<java-symbol type="plurals" name="selected_count" />
|
<java-symbol type="plurals" name="selected_count" />
|
||||||
<java-symbol type="drawable" name="ic_dialog_alert_material" />
|
<java-symbol type="drawable" name="ic_dialog_alert_material" />
|
||||||
|
|
||||||
|
<java-symbol type="string" name="lockscreen_access_pattern_area" />
|
||||||
|
|
||||||
<java-symbol type="bool" name="allow_stacked_button_bar" />
|
<java-symbol type="bool" name="allow_stacked_button_bar" />
|
||||||
<java-symbol type="bool" name="config_eap_sim_based_auth_supported" />
|
<java-symbol type="bool" name="config_eap_sim_based_auth_supported" />
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,6 @@
|
|||||||
android:layout_marginStart="8dip"
|
android:layout_marginStart="8dip"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:contentDescription="@string/keyguard_accessibility_pattern_area"
|
|
||||||
android:focusable="true"
|
|
||||||
android:focusableInTouchMode="true"
|
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false" />
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
<!-- Accessibility description of the password lock. [CHAR_LIMIT=none] -->
|
<!-- Accessibility description of the password lock. [CHAR_LIMIT=none] -->
|
||||||
<string name="keyguard_accessibility_password_unlock">Password unlock.</string>
|
<string name="keyguard_accessibility_password_unlock">Password unlock.</string>
|
||||||
<!-- Accessibility description of the unlock pattern area. [CHAR_LIMIT=none] -->
|
<!-- Accessibility description of the unlock pattern area. [CHAR_LIMIT=none] -->
|
||||||
<string name="keyguard_accessibility_pattern_area">Pattern area.</string>
|
<string name="keyguard_accessibility_pattern_area" msgid="7679891324509597904">Pattern area.</string>
|
||||||
<!-- Accessibility description of the unlock slide area. [CHAR_LIMIT=none] -->
|
<!-- Accessibility description of the unlock slide area. [CHAR_LIMIT=none] -->
|
||||||
<string name="keyguard_accessibility_slide_area">Slide area.</string>
|
<string name="keyguard_accessibility_slide_area">Slide area.</string>
|
||||||
<!-- Accessibility description of the PIN password view. [CHAR_LIMIT=none] -->
|
<!-- Accessibility description of the PIN password view. [CHAR_LIMIT=none] -->
|
||||||
|
|||||||
Reference in New Issue
Block a user