Skip to content

Commit e303c5c

Browse files
committed
Send LockPatternView accessibility announcements before callbacks
This allows the pattern's listener to optionally send accessibility announcements that interrupt the defaults, rather than the view always interrupting the listener. Bug: 7256500 Change-Id: Ief2f5cc2fae76a3becc1321d14d46f97b3092215
1 parent 031e9d2 commit e303c5c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

core/java/com/android/internal/widget/LockPatternView.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,31 +375,31 @@ public void setDisplayMode(DisplayMode displayMode) {
375375
}
376376

377377
private void notifyCellAdded() {
378+
sendAccessEvent(R.string.lockscreen_access_pattern_cell_added);
378379
if (mOnPatternListener != null) {
379380
mOnPatternListener.onPatternCellAdded(mPattern);
380381
}
381-
sendAccessEvent(R.string.lockscreen_access_pattern_cell_added);
382382
}
383383

384384
private void notifyPatternStarted() {
385+
sendAccessEvent(R.string.lockscreen_access_pattern_start);
385386
if (mOnPatternListener != null) {
386387
mOnPatternListener.onPatternStart();
387388
}
388-
sendAccessEvent(R.string.lockscreen_access_pattern_start);
389389
}
390390

391391
private void notifyPatternDetected() {
392+
sendAccessEvent(R.string.lockscreen_access_pattern_detected);
392393
if (mOnPatternListener != null) {
393394
mOnPatternListener.onPatternDetected(mPattern);
394395
}
395-
sendAccessEvent(R.string.lockscreen_access_pattern_detected);
396396
}
397397

398398
private void notifyPatternCleared() {
399+
sendAccessEvent(R.string.lockscreen_access_pattern_cleared);
399400
if (mOnPatternListener != null) {
400401
mOnPatternListener.onPatternCleared();
401402
}
402-
sendAccessEvent(R.string.lockscreen_access_pattern_cleared);
403403
}
404404

405405
/**
@@ -799,9 +799,7 @@ private void handleActionMove(MotionEvent event) {
799799
}
800800

801801
private void sendAccessEvent(int resId) {
802-
setContentDescription(mContext.getString(resId));
803-
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
804-
setContentDescription(null);
802+
announceForAccessibility(mContext.getString(resId));
805803
}
806804

807805
private void handleActionUp(MotionEvent event) {

0 commit comments

Comments
 (0)