From a90a18db9147709411bc911cf6337b61b9d75412 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Tue, 6 Nov 2012 15:22:11 -0800 Subject: [PATCH] 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 --- .../impl/keyguard/KeyguardWidgetPager.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java index f04c4df0636eb..04abeb10abdc6 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java @@ -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();