Loading core/java/android/view/IWindowSession.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -342,5 +342,5 @@ interface IWindowSession { * Update the flags on an input channel associated with a particular surface. */ void updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface, int flags); int flags, in Region region); } core/java/android/view/SurfaceControlViewHost.java +8 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,14 @@ public class SurfaceControlViewHost { return mViewRoot.mWindow; } /** * @return the WindowlessWindowManager instance that this host is attached to. * @hide */ public @NonNull WindowlessWindowManager getWindowlessWM() { return mWm; } /** * @hide */ Loading core/java/android/view/WindowlessWindowManager.java +30 −2 Original line number Diff line number Diff line Loading @@ -16,16 +16,19 @@ package android.view; import android.annotation.Nullable; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Region; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.util.MergedConfiguration; import java.util.HashMap; import java.util.Objects; /** * A simplistic implementation of IWindowSession. Rather than managing Surfaces Loading @@ -42,6 +45,7 @@ public class WindowlessWindowManager implements IWindowSession { WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); int mDisplayId; IBinder mInputChannelToken; Region mInputRegion; State(SurfaceControl sc, WindowManager.LayoutParams p, int displayId, IBinder inputChannelToken) { mSurfaceControl = sc; Loading Loading @@ -95,6 +99,30 @@ public class WindowlessWindowManager implements IWindowSession { mResizeCompletionForWindow.put(window, callback); } protected void setTouchRegion(IBinder window, @Nullable Region region) { State state; synchronized (this) { // Do everything while locked so that we synchronize with relayout. This should be a // very infrequent operation. state = mStateForWindow.get(window); if (state == null) { return; } if (Objects.equals(region, state.mInputRegion)) { return; } state.mInputRegion = region != null ? new Region(region) : null; if (state.mInputChannelToken != null) { try { mRealWm.updateInputChannel(state.mInputChannelToken, state.mDisplayId, state.mSurfaceControl, state.mParams.flags, state.mInputRegion); } catch (RemoteException e) { Log.e(TAG, "Failed to update surface input channel: ", e); } } } } /** * IWindowSession implementation. */ Loading Loading @@ -234,7 +262,7 @@ public class WindowlessWindowManager implements IWindowSession { && state.mInputChannelToken != null) { try { mRealWm.updateInputChannel(state.mInputChannelToken, state.mDisplayId, sc, attrs.flags); attrs.flags, state.mInputRegion); } catch (RemoteException e) { Log.e(TAG, "Failed to update surface input channel: ", e); } Loading Loading @@ -409,7 +437,7 @@ public class WindowlessWindowManager implements IWindowSession { @Override public void updateInputChannel(IBinder channelToken, int displayId, SurfaceControl surface, int flags) { int flags, Region region) { } @Override Loading packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +16 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region.Op; import android.hardware.display.DisplayManager; import android.os.Bundle; Loading Loading @@ -338,12 +339,12 @@ public class DividerView extends FrameLayout implements OnTouchListener, @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mFirstLayout) { // Wait for first layout so that the ViewRootImpl surface has been created. initializeSurfaceState(); mFirstLayout = false; } super.onLayout(changed, left, top, right, bottom); int minimizeLeft = 0; int minimizeTop = 0; if (mDockSide == WindowManager.DOCKED_TOP) { Loading Loading @@ -783,6 +784,20 @@ public class DividerView extends FrameLayout implements OnTouchListener, setResizeDimLayer(t, false /* secondary */, 0.f /* alpha */); t.apply(); mTiles.releaseTransaction(t); // Get the actually-visible bar dimensions (relative to full window). This is a thin // bar going through the center. final Rect dividerBar = isHorizontalDivision() ? new Rect(0, mDividerInsets, mSplitLayout.mDisplayLayout.width(), mDividerInsets + mDividerSize) : new Rect(mDividerInsets, 0, mDividerInsets + mDividerSize, mSplitLayout.mDisplayLayout.height()); final Region touchRegion = new Region(dividerBar); // Add in the "draggable" portion. While not visible, this is an expanded area that the // user can interact with. touchRegion.union(new Rect(mHandle.getLeft(), mHandle.getTop(), mHandle.getRight(), mHandle.getBottom())); mWindowManager.setTouchRegion(touchRegion); } public void setMinimizedDockStack(boolean minimized, boolean isHomeStackResizable) { Loading packages/SystemUI/src/com/android/systemui/stackdivider/DividerWindowManager.java +9 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMA import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import android.graphics.PixelFormat; import android.graphics.Region; import android.os.Binder; import android.view.View; import android.view.WindowManager; Loading Loading @@ -103,4 +104,12 @@ public class DividerWindowManager { mSystemWindows.updateViewLayout(mView, mLp); } } /** Sets the touch region to `touchRegion`. Use null to unset.*/ public void setTouchRegion(Region touchRegion) { if (mView == null) { return; } mSystemWindows.setTouchableRegion(mView, touchRegion); } } Loading
core/java/android/view/IWindowSession.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -342,5 +342,5 @@ interface IWindowSession { * Update the flags on an input channel associated with a particular surface. */ void updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface, int flags); int flags, in Region region); }
core/java/android/view/SurfaceControlViewHost.java +8 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,14 @@ public class SurfaceControlViewHost { return mViewRoot.mWindow; } /** * @return the WindowlessWindowManager instance that this host is attached to. * @hide */ public @NonNull WindowlessWindowManager getWindowlessWM() { return mWm; } /** * @hide */ Loading
core/java/android/view/WindowlessWindowManager.java +30 −2 Original line number Diff line number Diff line Loading @@ -16,16 +16,19 @@ package android.view; import android.annotation.Nullable; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Region; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.util.MergedConfiguration; import java.util.HashMap; import java.util.Objects; /** * A simplistic implementation of IWindowSession. Rather than managing Surfaces Loading @@ -42,6 +45,7 @@ public class WindowlessWindowManager implements IWindowSession { WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); int mDisplayId; IBinder mInputChannelToken; Region mInputRegion; State(SurfaceControl sc, WindowManager.LayoutParams p, int displayId, IBinder inputChannelToken) { mSurfaceControl = sc; Loading Loading @@ -95,6 +99,30 @@ public class WindowlessWindowManager implements IWindowSession { mResizeCompletionForWindow.put(window, callback); } protected void setTouchRegion(IBinder window, @Nullable Region region) { State state; synchronized (this) { // Do everything while locked so that we synchronize with relayout. This should be a // very infrequent operation. state = mStateForWindow.get(window); if (state == null) { return; } if (Objects.equals(region, state.mInputRegion)) { return; } state.mInputRegion = region != null ? new Region(region) : null; if (state.mInputChannelToken != null) { try { mRealWm.updateInputChannel(state.mInputChannelToken, state.mDisplayId, state.mSurfaceControl, state.mParams.flags, state.mInputRegion); } catch (RemoteException e) { Log.e(TAG, "Failed to update surface input channel: ", e); } } } } /** * IWindowSession implementation. */ Loading Loading @@ -234,7 +262,7 @@ public class WindowlessWindowManager implements IWindowSession { && state.mInputChannelToken != null) { try { mRealWm.updateInputChannel(state.mInputChannelToken, state.mDisplayId, sc, attrs.flags); attrs.flags, state.mInputRegion); } catch (RemoteException e) { Log.e(TAG, "Failed to update surface input channel: ", e); } Loading Loading @@ -409,7 +437,7 @@ public class WindowlessWindowManager implements IWindowSession { @Override public void updateInputChannel(IBinder channelToken, int displayId, SurfaceControl surface, int flags) { int flags, Region region) { } @Override Loading
packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +16 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region.Op; import android.hardware.display.DisplayManager; import android.os.Bundle; Loading Loading @@ -338,12 +339,12 @@ public class DividerView extends FrameLayout implements OnTouchListener, @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mFirstLayout) { // Wait for first layout so that the ViewRootImpl surface has been created. initializeSurfaceState(); mFirstLayout = false; } super.onLayout(changed, left, top, right, bottom); int minimizeLeft = 0; int minimizeTop = 0; if (mDockSide == WindowManager.DOCKED_TOP) { Loading Loading @@ -783,6 +784,20 @@ public class DividerView extends FrameLayout implements OnTouchListener, setResizeDimLayer(t, false /* secondary */, 0.f /* alpha */); t.apply(); mTiles.releaseTransaction(t); // Get the actually-visible bar dimensions (relative to full window). This is a thin // bar going through the center. final Rect dividerBar = isHorizontalDivision() ? new Rect(0, mDividerInsets, mSplitLayout.mDisplayLayout.width(), mDividerInsets + mDividerSize) : new Rect(mDividerInsets, 0, mDividerInsets + mDividerSize, mSplitLayout.mDisplayLayout.height()); final Region touchRegion = new Region(dividerBar); // Add in the "draggable" portion. While not visible, this is an expanded area that the // user can interact with. touchRegion.union(new Rect(mHandle.getLeft(), mHandle.getTop(), mHandle.getRight(), mHandle.getBottom())); mWindowManager.setTouchRegion(touchRegion); } public void setMinimizedDockStack(boolean minimized, boolean isHomeStackResizable) { Loading
packages/SystemUI/src/com/android/systemui/stackdivider/DividerWindowManager.java +9 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMA import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import android.graphics.PixelFormat; import android.graphics.Region; import android.os.Binder; import android.view.View; import android.view.WindowManager; Loading Loading @@ -103,4 +104,12 @@ public class DividerWindowManager { mSystemWindows.updateViewLayout(mView, mLp); } } /** Sets the touch region to `touchRegion`. Use null to unset.*/ public void setTouchRegion(Region touchRegion) { if (mView == null) { return; } mSystemWindows.setTouchableRegion(mView, touchRegion); } }