Fixing issue where accessibility was reporting items behind an open folder. (Bug 8331717)

Change-Id: Ibaec4144ee911c6d784737cf56a4fc8a1dad2886
This commit is contained in:
Winson Chung
2013-04-12 15:10:52 -07:00
parent b68e03a83c
commit 83ca480941
2 changed files with 35 additions and 0 deletions
+26
View File
@@ -34,6 +34,7 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
@@ -221,6 +222,31 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
}
}
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
Folder currentFolder = mLauncher.getWorkspace().getOpenFolder();
if (currentFolder != null) {
if (child == currentFolder) {
return super.onRequestSendAccessibilityEvent(child, event);
}
// Skip propagating onRequestSendAccessibilityEvent all for other children
// when a folder is open
return false;
}
return super.onRequestSendAccessibilityEvent(child, event);
}
@Override
public void addChildrenForAccessibility(ArrayList<View> childrenForAccessibility) {
Folder currentFolder = mLauncher.getWorkspace().getOpenFolder();
if (currentFolder != null) {
// Only add the folder as a child for accessibility when it is open
childrenForAccessibility.add(currentFolder);
} else {
super.addChildrenForAccessibility(childrenForAccessibility);
}
}
@Override
public boolean onHoverEvent(MotionEvent ev) {
// If we've received this, we've already done the necessary handling
+9
View File
@@ -2287,6 +2287,11 @@ public final class Launcher extends Activity
}
folder.animateOpen();
growAndFadeOutFolderIcon(folderIcon);
// Notify the accessibility manager that this folder "window" has appeared and occluded
// the workspace items
folder.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
getDragLayer().sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
public void closeFolder() {
@@ -2311,6 +2316,10 @@ public final class Launcher extends Activity
shrinkAndFadeInFolderIcon(fi);
}
folder.animateClosed();
// Notify the accessibility manager that this folder "window" has disappeard and no
// longer occludeds the workspace items
getDragLayer().sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
}
public boolean onLongClick(View v) {