From 204c023ae2fd775bdca8247ef16c4601821a7328 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 10 Sep 2020 15:46:52 -0700 Subject: Add focus support for SurfaceControlViewHost This change introduces a new call for clients to request focus on their embedded views. In order to accomplish this, the owner of the SurfacePackage sends an input token that can identify the input channel of the embedded window. This token is forwarded as part of the focus request. WindowManager will authenticate the calling window and the relationship between the host and the embedded window. Once authenticated, the request will be forwarded to InputDispatcher. InputDispatcher will grant the focus to the SurfaceControlViewHost if the host window is currently focused or transfer focus back to the host window if the SurfaceControlViewHost is focused. Otherwise the request is dropped. In addition, SurfaceView, the host in this scenario, now overrides the onFocused function to transfer focus to and from the embedded view. Test: atest SurfaceControlViewHostTests Bug: 151179149 Change-Id: Ia95545a60d73db4c03679bce9747d2e275806838 --- core/java/android/view/WindowlessWindowManager.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/java/android/view/WindowlessWindowManager.java') diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java index 060311ec3da8..67abb4c933cc 100644 --- a/core/java/android/view/WindowlessWindowManager.java +++ b/core/java/android/view/WindowlessWindowManager.java @@ -457,4 +457,9 @@ public class WindowlessWindowManager implements IWindowSession { return surfaceInsets != null ? attrs.height + surfaceInsets.top + surfaceInsets.bottom : attrs.height; } + + @Override + public void grantEmbeddedWindowFocus(IWindow callingWindow, IBinder targetInputToken, + boolean grantFocus) { + } } -- cgit v1.2.3