Loading core/java/android/view/IWindowSession.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -353,4 +353,6 @@ interface IWindowSession { * Returns whether this window needs to cancel draw and retry later. */ boolean cancelDraw(IWindow window); boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow); } core/java/android/view/SurfaceControlViewHost.java +23 −2 Original line number Diff line number Diff line Loading @@ -460,5 +460,26 @@ public class SurfaceControlViewHost { (WindowManagerImpl) mViewRoot.mContext.getSystemService(Context.WINDOW_SERVICE); attrs.token = wm.getDefaultToken(); } /** * Transfer the currently in progress touch gesture to the parent * (if any) of this SurfaceControlViewHost. This requires that the * SurfaceControlViewHost was created with an associated hostInputToken. * * @return Whether the touch stream was transferred. * @hide */ public boolean transferTouchGestureToHost() { if (mViewRoot == null) { return false; } final IWindowSession realWm = WindowManagerGlobal.getWindowSession(); try { return realWm.transferEmbeddedTouchFocusToHost(mViewRoot.mWindow); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } return false; } } core/java/android/view/WindowlessWindowManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -561,4 +561,11 @@ public class WindowlessWindowManager implements IWindowSession { public boolean cancelDraw(IWindow window) { return false; } @Override public boolean transferEmbeddedTouchFocusToHost(IWindow window) { Log.e(TAG, "Received request to transferEmbeddedTouch focus on WindowlessWindowManager" + " we shouldn't get here!"); return false; } } services/core/java/com/android/server/wm/Session.java +16 −0 Original line number Diff line number Diff line Loading @@ -909,6 +909,22 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { } } @Override public boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow) { if (embeddedWindow == null) { return false; } final long identity = Binder.clearCallingIdentity(); boolean didTransfer = false; try { didTransfer = mService.transferEmbeddedTouchFocusToHost(embeddedWindow); } finally { Binder.restoreCallingIdentity(identity); } return didTransfer; } @Override public void generateDisplayHash(IWindow window, Rect boundsInWindow, String hashAlgorithm, RemoteCallback callback) { Loading services/core/java/com/android/server/wm/WindowManagerService.java +32 −0 Original line number Diff line number Diff line Loading @@ -8682,6 +8682,38 @@ public class WindowManagerService extends IWindowManager.Stub clientChannel.copyTo(outInputChannel); } boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow) { final IBinder windowBinder = embeddedWindow.asBinder(); final IBinder hostInputChannel, embeddedInputChannel; synchronized (mGlobalLock) { final EmbeddedWindowController.EmbeddedWindow ew = mEmbeddedWindowController.getByWindowToken(windowBinder); if (ew == null) { Slog.w(TAG, "Attempt to transfer touch focus from non-existent embedded window"); return false; } final WindowState hostWindowState = ew.getWindowState(); if (hostWindowState == null) { Slog.w(TAG, "Attempt to transfer touch focus from embedded window with no" + " associated host"); return false; } embeddedInputChannel = ew.getInputChannelToken(); if (embeddedInputChannel == null) { Slog.w(TAG, "Attempt to transfer touch focus from embedded window with no input" + " channel"); return false; } hostInputChannel = hostWindowState.mInputChannelToken; if (hostInputChannel == null) { Slog.w(TAG, "Attempt to transfer touch focus to a host window with no" + " input channel"); return false; } return mInputManager.transferTouchFocus(embeddedInputChannel, hostInputChannel); } } private void updateInputChannel(IBinder channelToken, int callingUid, int callingPid, int displayId, SurfaceControl surface, String name, InputApplicationHandle applicationHandle, int flags, Loading Loading
core/java/android/view/IWindowSession.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -353,4 +353,6 @@ interface IWindowSession { * Returns whether this window needs to cancel draw and retry later. */ boolean cancelDraw(IWindow window); boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow); }
core/java/android/view/SurfaceControlViewHost.java +23 −2 Original line number Diff line number Diff line Loading @@ -460,5 +460,26 @@ public class SurfaceControlViewHost { (WindowManagerImpl) mViewRoot.mContext.getSystemService(Context.WINDOW_SERVICE); attrs.token = wm.getDefaultToken(); } /** * Transfer the currently in progress touch gesture to the parent * (if any) of this SurfaceControlViewHost. This requires that the * SurfaceControlViewHost was created with an associated hostInputToken. * * @return Whether the touch stream was transferred. * @hide */ public boolean transferTouchGestureToHost() { if (mViewRoot == null) { return false; } final IWindowSession realWm = WindowManagerGlobal.getWindowSession(); try { return realWm.transferEmbeddedTouchFocusToHost(mViewRoot.mWindow); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } return false; } }
core/java/android/view/WindowlessWindowManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -561,4 +561,11 @@ public class WindowlessWindowManager implements IWindowSession { public boolean cancelDraw(IWindow window) { return false; } @Override public boolean transferEmbeddedTouchFocusToHost(IWindow window) { Log.e(TAG, "Received request to transferEmbeddedTouch focus on WindowlessWindowManager" + " we shouldn't get here!"); return false; } }
services/core/java/com/android/server/wm/Session.java +16 −0 Original line number Diff line number Diff line Loading @@ -909,6 +909,22 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { } } @Override public boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow) { if (embeddedWindow == null) { return false; } final long identity = Binder.clearCallingIdentity(); boolean didTransfer = false; try { didTransfer = mService.transferEmbeddedTouchFocusToHost(embeddedWindow); } finally { Binder.restoreCallingIdentity(identity); } return didTransfer; } @Override public void generateDisplayHash(IWindow window, Rect boundsInWindow, String hashAlgorithm, RemoteCallback callback) { Loading
services/core/java/com/android/server/wm/WindowManagerService.java +32 −0 Original line number Diff line number Diff line Loading @@ -8682,6 +8682,38 @@ public class WindowManagerService extends IWindowManager.Stub clientChannel.copyTo(outInputChannel); } boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow) { final IBinder windowBinder = embeddedWindow.asBinder(); final IBinder hostInputChannel, embeddedInputChannel; synchronized (mGlobalLock) { final EmbeddedWindowController.EmbeddedWindow ew = mEmbeddedWindowController.getByWindowToken(windowBinder); if (ew == null) { Slog.w(TAG, "Attempt to transfer touch focus from non-existent embedded window"); return false; } final WindowState hostWindowState = ew.getWindowState(); if (hostWindowState == null) { Slog.w(TAG, "Attempt to transfer touch focus from embedded window with no" + " associated host"); return false; } embeddedInputChannel = ew.getInputChannelToken(); if (embeddedInputChannel == null) { Slog.w(TAG, "Attempt to transfer touch focus from embedded window with no input" + " channel"); return false; } hostInputChannel = hostWindowState.mInputChannelToken; if (hostInputChannel == null) { Slog.w(TAG, "Attempt to transfer touch focus to a host window with no" + " input channel"); return false; } return mInputManager.transferTouchFocus(embeddedInputChannel, hostInputChannel); } } private void updateInputChannel(IBinder channelToken, int callingUid, int callingPid, int displayId, SurfaceControl surface, String name, InputApplicationHandle applicationHandle, int flags, Loading