Skip to content

Commit 5fff5f0

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Make partially visible widget pages not important for accessibility." into jb-mr1-dev
2 parents 872965b + a90a18d commit 5fff5f0

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
@@ -180,6 +180,22 @@ public void sendAccessibilityEvent(int eventType) {
180180
}
181181
}
182182

183+
private void updateWidgetFramesImportantForAccessibility() {
184+
final int pageCount = getPageCount();
185+
for (int i = 0; i < pageCount; i++) {
186+
KeyguardWidgetFrame frame = getWidgetPageAt(i);
187+
updateWidgetFrameImportantForAccessibility(frame);
188+
}
189+
}
190+
191+
private void updateWidgetFrameImportantForAccessibility(KeyguardWidgetFrame frame) {
192+
if (frame.getContentAlpha() <= 0) {
193+
frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
194+
} else {
195+
frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
196+
}
197+
}
198+
183199
private void userActivity() {
184200
if (mCallbacks != null) {
185201
mCallbacks.onUserActivityTimeoutChanged();
@@ -312,6 +328,7 @@ public void addWidget(View widget, int pageIndex) {
312328
content.getContentDescription());
313329
frame.setContentDescription(contentDescription);
314330
}
331+
updateWidgetFrameImportantForAccessibility(frame);
315332
}
316333

317334
/**
@@ -558,6 +575,12 @@ public void showSidePageHints() {
558575
animateOutlinesAndSidePages(true, -1);
559576
}
560577

578+
@Override
579+
void setCurrentPage(int currentPage) {
580+
super.setCurrentPage(currentPage);
581+
updateWidgetFramesImportantForAccessibility();
582+
}
583+
561584
@Override
562585
public void onAttachedToWindow() {
563586
super.onAttachedToWindow();
@@ -669,6 +692,7 @@ public void onAnimationEnd(Animator animation) {
669692
}
670693
mWidgetToResetAfterFadeOut = -1;
671694
}
695+
updateWidgetFramesImportantForAccessibility();
672696
}
673697
});
674698
mChildrenOutlineFadeAnimation.start();

0 commit comments

Comments
 (0)