From 29794c56a4ffbae6b1f1b420a619877d1da0c4bb Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 21 Jun 2019 12:50:30 -0700 Subject: [PATCH] Workaround issue with latest version of RecyclerView which is overriding our custom accessibility delegate -> Not the prettiest fix, but we only ever use the LauncherAccessibilityDelegate for BubbleTextViews,so anything else getting set here is incorrect. Stop-gap until we root cause the RV issue and decide whether there's a fix there, or a better way to ensure Launcher behaves correctly. issue 129745295 Change-Id: I27cf79fda9edc2bebeda4728b776ab292caa141d --- src/com/android/launcher3/BubbleTextView.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 7085c60521..1619e3645f 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -43,6 +43,7 @@ import android.view.ViewDebug; import android.widget.TextView; import com.android.launcher3.Launcher.OnResumeCallback; +import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.dot.DotInfo; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.DrawableFactory; @@ -227,6 +228,18 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, applyFromWorkspaceItem(info, false); } + @Override + public void setAccessibilityDelegate(AccessibilityDelegate delegate) { + if (delegate instanceof LauncherAccessibilityDelegate) { + super.setAccessibilityDelegate(delegate); + } else { + // NO-OP + // Workaround for b/129745295 where RecyclerView is setting our Accessibility + // delegate incorrectly. There are no cases when we shouldn't be using the + // LauncherAccessibilityDelegate for BubbleTextView. + } + } + public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) { applyIconAndLabel(info); setTag(info);