Commit 49c37b20 authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Fix accessibility crash on < L devices

This patch adds an API util method that simply does not run the
setAccessibilityTraversalBefore method on devices that are running
Android versions < L.

Bug: 881400
Change-Id: Ie29a7f8f96e87661d0543fe99ca9e5f1a18f468f
Reviewed-on: https://chromium-review.googlesource.com/1211103Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589288}
parent f2a15473
......@@ -702,4 +702,13 @@ public class ApiCompatibilityUtils {
options.setLaunchDisplayId(displayId);
return options.toBundle();
}
/**
* @see View#setAccessibilityTraversalBefore(int)
*/
public static void setAccessibilityTraversalBefore(View view, int viewFocusedAfter) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
view.setAccessibilityTraversalBefore(viewFocusedAfter);
}
}
}
......@@ -23,6 +23,7 @@ import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.View.OnClickListener;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Callback;
import org.chromium.base.ThreadUtils;
import org.chromium.base.VisibleForTesting;
......@@ -892,8 +893,8 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
maybeShowDuetHelpBubble(currentTab);
// Allow the bottom toolbar to be focused in accessibility after the top toolbar.
mLocationBar.getContainerView().setAccessibilityTraversalBefore(
R.id.bottom_toolbar);
ApiCompatibilityUtils.setAccessibilityTraversalBefore(
mLocationBar.getContainerView(), R.id.bottom_toolbar);
}
onNativeLibraryReady();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment