Commit 1d732d21 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Disable focus highlight overlay for non-touch mode on ContentView.

On O+, Android draws a translucent grey overlay over focused views when
the device is not in touch mode (as in, the user is using keyboard to
navigate rather than touch/mouse). Drawing this overlay over the entire
ContentView doesn't make sense, so we should just disable it.
We also have to disable it for the CompositorViewHolder, or when we
go between NativePages (like NTP) and WebContents, we animate into and
out of the grey overlay, because the CompositorViewHolder briefly
gains focus.

Bug: 912724, 908917
Change-Id: I97b7f688f06581e872898028a48e6e7b4546d710
Reviewed-on: https://chromium-review.googlesource.com/c/1367926Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614783}
parent 777e77ef
......@@ -9,6 +9,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Build;
import android.view.Display;
import android.view.View;
import org.chromium.base.annotations.DoNotInline;
......@@ -36,4 +37,9 @@ public final class ApiHelperForO {
public static boolean isInstantApp(PackageManager packageManager) {
return packageManager.isInstantApp();
}
/** See {@link View#setDefaultFocusHighlightEnabled(boolean) }. */
public static void setDefaultFocusHighlightEnabled(View view, boolean enabled) {
view.setDefaultFocusHighlightEnabled(enabled);
}
}
......@@ -32,6 +32,7 @@ import android.widget.FrameLayout;
import org.chromium.base.SysUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.compat.ApiHelperForO;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.InsetObserverView;
import org.chromium.chrome.browser.autofill.keyboard_accessory.KeyboardExtensionSizeManager;
......@@ -269,6 +270,10 @@ public class CompositorViewHolder extends FrameLayout
}
});
handleSystemUiVisibilityChange();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ApiHelperForO.setDefaultFocusHighlightEnabled(this, false);
}
}
private Point getViewportSize() {
......
......@@ -21,6 +21,7 @@ import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
import org.chromium.base.TraceEvent;
import org.chromium.base.compat.ApiHelperForO;
import org.chromium.content_public.browser.ImeAdapter;
import org.chromium.content_public.browser.RenderCoordinates;
import org.chromium.content_public.browser.SmartClipProvider;
......@@ -84,6 +85,10 @@ public class ContentView
setFocusable(true);
setFocusableInTouchMode(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ApiHelperForO.setDefaultFocusHighlightEnabled(this, false);
}
}
protected WebContentsAccessibility getWebContentsAccessibility() {
......
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