Commit 592dc9e4 authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

[a11y] Enable GTS for accessibility (2/2)

This CL enables the new Tab Switcher in list version when TalkBack is on
for LowEnd phone.

Change-Id: If8d1f0dd54624be8ec66eeb953fffbc9a30c34a2
Bug: 992134
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2045072
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747646}
parent 69c86691
......@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.device;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
import org.chromium.base.SysUtils;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches;
......@@ -44,9 +45,7 @@ public class DeviceClassManager {
// Device based configurations.
if (SysUtils.isLowEndDevice()) {
mEnableLayerDecorationCache = true;
mEnableAccessibilityLayout =
!ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID)
|| !ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUPS_ANDROID);
mEnableAccessibilityLayout = true;
mEnableAnimations = false;
mEnablePrerendering = false;
mEnableToolbarSwipe = false;
......@@ -87,9 +86,15 @@ public class DeviceClassManager {
* @return Whether or not should use the accessibility tab switcher.
*/
public static boolean enableAccessibilityLayout() {
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID)) {
if (isPhone()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID)
&& (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUPS_ANDROID)
|| (!SysUtils.isLowEndDevice()
&& ChromeFeatureList.isEnabled(
ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID)))) {
return false;
}
if (getInstance().mEnableAccessibilityLayout) return true;
if (!AccessibilityUtil.isAccessibilityEnabled()) return false;
return SharedPreferencesManager.getInstance().readBoolean(
......@@ -126,4 +131,9 @@ public class DeviceClassManager {
public static boolean enableToolbarSwipe() {
return getInstance().mEnableToolbarSwipe;
}
private static boolean isPhone() {
return !DeviceFormFactor.isNonMultiDisplayContextOnTablet(
ContextUtils.getApplicationContext());
}
}
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