Skip to content

Commit a90a18d

Browse files
committed
Make partially visible widget pages not important for accessibility.
1. If the lockscreen has more than one widet, the left and right widget pages are partially on the screen and visible. Therefore they may take accessibility focus so the user will hear a prompt that he is on the partially visible widget page but will not be able to interact with it - confusing. This change makes partially shown windget frames not important for accessibility. bug:7454355 Change-Id: I475b21e215474a4421acaec485cde64dc4e2aee5
1 parent 11f19f1 commit a90a18d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,22 @@ public void sendAccessibilityEvent(int eventType) {
167167
}
168168
}
169169

170+
private void updateWidgetFramesImportantForAccessibility() {
171+
final int pageCount = getPageCount();
172+
for (int i = 0; i < pageCount; i++) {
173+
KeyguardWidgetFrame frame = getWidgetPageAt(i);
174+
updateWidgetFrameImportantForAccessibility(frame);
175+
}
176+
}
177+
178+
private void updateWidgetFrameImportantForAccessibility(KeyguardWidgetFrame frame) {
179+
if (frame.getContentAlpha() <= 0) {
180+
frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
181+
} else {
182+
frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
183+
}
184+
}
185+
170186
private void userActivity() {
171187
if (mCallbacks != null) {
172188
mCallbacks.onUserActivityTimeoutChanged();
@@ -276,6 +292,7 @@ public void addWidget(View widget, int pageIndex) {
276292
content.getContentDescription());
277293
frame.setContentDescription(contentDescription);
278294
}
295+
updateWidgetFrameImportantForAccessibility(frame);
279296
}
280297

281298
/**
@@ -512,6 +529,12 @@ public void showInitialPageHints() {
512529
}
513530
}
514531

532+
@Override
533+
void setCurrentPage(int currentPage) {
534+
super.setCurrentPage(currentPage);
535+
updateWidgetFramesImportantForAccessibility();
536+
}
537+
515538
@Override
516539
public void onAttachedToWindow() {
517540
super.onAttachedToWindow();
@@ -618,6 +641,7 @@ public void onAnimationEnd(Animator animation) {
618641
if (!show) {
619642
disablePageLayers();
620643
}
644+
updateWidgetFramesImportantForAccessibility();
621645
}
622646
});
623647
mChildrenOutlineFadeAnimation.start();

0 commit comments

Comments
 (0)