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
This commit is contained in:
@@ -167,6 +167,22 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWidgetFramesImportantForAccessibility() {
|
||||
final int pageCount = getPageCount();
|
||||
for (int i = 0; i < pageCount; i++) {
|
||||
KeyguardWidgetFrame frame = getWidgetPageAt(i);
|
||||
updateWidgetFrameImportantForAccessibility(frame);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWidgetFrameImportantForAccessibility(KeyguardWidgetFrame frame) {
|
||||
if (frame.getContentAlpha() <= 0) {
|
||||
frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
} else {
|
||||
frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
}
|
||||
}
|
||||
|
||||
private void userActivity() {
|
||||
if (mCallbacks != null) {
|
||||
mCallbacks.onUserActivityTimeoutChanged();
|
||||
@@ -276,6 +292,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
|
||||
content.getContentDescription());
|
||||
frame.setContentDescription(contentDescription);
|
||||
}
|
||||
updateWidgetFrameImportantForAccessibility(frame);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,6 +529,12 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setCurrentPage(int currentPage) {
|
||||
super.setCurrentPage(currentPage);
|
||||
updateWidgetFramesImportantForAccessibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
@@ -618,6 +641,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
|
||||
if (!show) {
|
||||
disablePageLayers();
|
||||
}
|
||||
updateWidgetFramesImportantForAccessibility();
|
||||
}
|
||||
});
|
||||
mChildrenOutlineFadeAnimation.start();
|
||||
|
||||
Reference in New Issue
Block a user