Merge "Port SurfaceControlViewHost to BLAST" into sc-dev
This commit is contained in:
@@ -162,7 +162,6 @@ public class SurfaceControlViewHost {
|
|||||||
@NonNull WindowlessWindowManager wwm, boolean useSfChoreographer) {
|
@NonNull WindowlessWindowManager wwm, boolean useSfChoreographer) {
|
||||||
mWm = wwm;
|
mWm = wwm;
|
||||||
mViewRoot = new ViewRootImpl(c, d, mWm, useSfChoreographer);
|
mViewRoot = new ViewRootImpl(c, d, mWm, useSfChoreographer);
|
||||||
mViewRoot.forceDisableBLAST();
|
|
||||||
mAccessibilityEmbeddedConnection = mViewRoot.getAccessibilityEmbeddedConnection();
|
mAccessibilityEmbeddedConnection = mViewRoot.getAccessibilityEmbeddedConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +187,6 @@ public class SurfaceControlViewHost {
|
|||||||
mWm = new WindowlessWindowManager(context.getResources().getConfiguration(),
|
mWm = new WindowlessWindowManager(context.getResources().getConfiguration(),
|
||||||
mSurfaceControl, hostToken);
|
mSurfaceControl, hostToken);
|
||||||
mViewRoot = new ViewRootImpl(context, display, mWm);
|
mViewRoot = new ViewRootImpl(context, display, mWm);
|
||||||
mViewRoot.forceDisableBLAST();
|
|
||||||
mAccessibilityEmbeddedConnection = mViewRoot.getAccessibilityEmbeddedConnection();
|
mAccessibilityEmbeddedConnection = mViewRoot.getAccessibilityEmbeddedConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class WindowlessWindowManager implements IWindowSession {
|
|||||||
new HashMap<IBinder, ResizeCompleteCallback>();
|
new HashMap<IBinder, ResizeCompleteCallback>();
|
||||||
|
|
||||||
private final SurfaceSession mSurfaceSession = new SurfaceSession();
|
private final SurfaceSession mSurfaceSession = new SurfaceSession();
|
||||||
private final SurfaceControl mRootSurface;
|
protected final SurfaceControl mRootSurface;
|
||||||
private final Configuration mConfiguration;
|
private final Configuration mConfiguration;
|
||||||
private final IWindowSession mRealWm;
|
private final IWindowSession mRealWm;
|
||||||
private final IBinder mHostInputToken;
|
private final IBinder mHostInputToken;
|
||||||
@@ -126,7 +126,7 @@ public class WindowlessWindowManager implements IWindowSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void attachToParentSurface(SurfaceControl.Builder b) {
|
protected void attachToParentSurface(IWindow window, SurfaceControl.Builder b) {
|
||||||
b.setParent(mRootSurface);
|
b.setParent(mRootSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,10 +140,10 @@ public class WindowlessWindowManager implements IWindowSession {
|
|||||||
InsetsSourceControl[] outActiveControls) {
|
InsetsSourceControl[] outActiveControls) {
|
||||||
final SurfaceControl.Builder b = new SurfaceControl.Builder(mSurfaceSession)
|
final SurfaceControl.Builder b = new SurfaceControl.Builder(mSurfaceSession)
|
||||||
.setFormat(attrs.format)
|
.setFormat(attrs.format)
|
||||||
.setBufferSize(getSurfaceWidth(attrs), getSurfaceHeight(attrs))
|
.setBLASTLayer()
|
||||||
.setName(attrs.getTitle().toString())
|
.setName(attrs.getTitle().toString())
|
||||||
.setCallsite("WindowlessWindowManager.addToDisplay");
|
.setCallsite("WindowlessWindowManager.addToDisplay");
|
||||||
attachToParentSurface(b);
|
attachToParentSurface(window, b);
|
||||||
final SurfaceControl sc = b.build();
|
final SurfaceControl sc = b.build();
|
||||||
|
|
||||||
if (((attrs.inputFeatures &
|
if (((attrs.inputFeatures &
|
||||||
@@ -162,7 +162,8 @@ public class WindowlessWindowManager implements IWindowSession {
|
|||||||
mStateForWindow.put(window.asBinder(), state);
|
mStateForWindow.put(window.asBinder(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int res = WindowManagerGlobal.ADD_OKAY | WindowManagerGlobal.ADD_FLAG_APP_VISIBLE;
|
final int res = WindowManagerGlobal.ADD_OKAY | WindowManagerGlobal.ADD_FLAG_APP_VISIBLE |
|
||||||
|
WindowManagerGlobal.ADD_FLAG_USE_BLAST;
|
||||||
|
|
||||||
// Include whether the window is in touch mode.
|
// Include whether the window is in touch mode.
|
||||||
return isInTouchMode() ? res | WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE : res;
|
return isInTouchMode() ? res | WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE : res;
|
||||||
@@ -222,6 +223,17 @@ public class WindowlessWindowManager implements IWindowSession {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Access to package members for SystemWindow leashing
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
protected IBinder getWindowBinder(View rootView) {
|
||||||
|
final ViewRootImpl root = rootView.getViewRootImpl();
|
||||||
|
if (root == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return root.mWindow.asBinder();
|
||||||
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@Nullable
|
@Nullable
|
||||||
protected SurfaceControl getSurfaceControl(View rootView) {
|
protected SurfaceControl getSurfaceControl(View rootView) {
|
||||||
@@ -266,8 +278,8 @@ public class WindowlessWindowManager implements IWindowSession {
|
|||||||
WindowManager.LayoutParams attrs = state.mParams;
|
WindowManager.LayoutParams attrs = state.mParams;
|
||||||
|
|
||||||
if (viewFlags == View.VISIBLE) {
|
if (viewFlags == View.VISIBLE) {
|
||||||
t.setBufferSize(sc, getSurfaceWidth(attrs), getSurfaceHeight(attrs))
|
outSurfaceSize.set(getSurfaceWidth(attrs), getSurfaceHeight(attrs));
|
||||||
.setOpaque(sc, isOpaque(attrs)).show(sc).apply();
|
t.setOpaque(sc, isOpaque(attrs)).show(sc).apply();
|
||||||
outSurfaceControl.copyFrom(sc, "WindowlessWindowManager.relayout");
|
outSurfaceControl.copyFrom(sc, "WindowlessWindowManager.relayout");
|
||||||
} else {
|
} else {
|
||||||
t.hide(sc).apply();
|
t.hide(sc).apply();
|
||||||
|
|||||||
@@ -40,9 +40,11 @@ import android.view.IWindowSessionCallback;
|
|||||||
import android.view.InsetsSourceControl;
|
import android.view.InsetsSourceControl;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
|
import android.view.SurfaceSession;
|
||||||
import android.view.SurfaceControlViewHost;
|
import android.view.SurfaceControlViewHost;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewRootImpl;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowlessWindowManager;
|
import android.view.WindowlessWindowManager;
|
||||||
import android.window.ClientWindowFrames;
|
import android.window.ClientWindowFrames;
|
||||||
@@ -251,6 +253,8 @@ public class SystemWindows {
|
|||||||
public class SysUiWindowManager extends WindowlessWindowManager {
|
public class SysUiWindowManager extends WindowlessWindowManager {
|
||||||
final int mDisplayId;
|
final int mDisplayId;
|
||||||
ContainerWindow mContainerWindow;
|
ContainerWindow mContainerWindow;
|
||||||
|
final HashMap<IBinder, SurfaceControl> mLeashForWindow =
|
||||||
|
new HashMap<IBinder, SurfaceControl>();
|
||||||
public SysUiWindowManager(int displayId, Context ctx, SurfaceControl rootSurface,
|
public SysUiWindowManager(int displayId, Context ctx, SurfaceControl rootSurface,
|
||||||
ContainerWindow container) {
|
ContainerWindow container) {
|
||||||
super(ctx.getResources().getConfiguration(), rootSurface, null /* hostInputToken */);
|
super(ctx.getResources().getConfiguration(), rootSurface, null /* hostInputToken */);
|
||||||
@@ -263,7 +267,33 @@ public class SystemWindows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SurfaceControl getSurfaceControlForWindow(View rootView) {
|
SurfaceControl getSurfaceControlForWindow(View rootView) {
|
||||||
return getSurfaceControl(rootView);
|
synchronized (this) {
|
||||||
|
return mLeashForWindow.get(getWindowBinder(rootView));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void attachToParentSurface(IWindow window, SurfaceControl.Builder b) {
|
||||||
|
SurfaceControl leash = new SurfaceControl.Builder(new SurfaceSession())
|
||||||
|
.setContainerLayer()
|
||||||
|
.setName("SystemWindowLeash")
|
||||||
|
.setHidden(false)
|
||||||
|
.setParent(mRootSurface)
|
||||||
|
.setCallsite("SysUiWIndowManager#attachToParentSurface").build();
|
||||||
|
synchronized (this) {
|
||||||
|
mLeashForWindow.put(window.asBinder(), leash);
|
||||||
|
}
|
||||||
|
b.setParent(leash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(android.view.IWindow window) throws RemoteException {
|
||||||
|
super.remove(window);
|
||||||
|
synchronized(this) {
|
||||||
|
IBinder token = window.asBinder();
|
||||||
|
new SurfaceControl.Transaction().remove(mLeashForWindow.get(token))
|
||||||
|
.apply();
|
||||||
|
mLeashForWindow.remove(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTouchableRegionForWindow(View rootView, Region region) {
|
void setTouchableRegionForWindow(View rootView, Region region) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public final class SplitWindowManager extends WindowlessWindowManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachToParentSurface(SurfaceControl.Builder b) {
|
protected void attachToParentSurface(IWindow window, SurfaceControl.Builder b) {
|
||||||
mParentContainerCallbacks.attachToParentSurface(b);
|
mParentContainerCallbacks.attachToParentSurface(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -862,14 +862,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
* assigned to it.
|
* assigned to it.
|
||||||
*/
|
*/
|
||||||
private SurfaceControl getWindowSurfaceControl() {
|
private SurfaceControl getWindowSurfaceControl() {
|
||||||
final ViewRootImpl root = getViewRootImpl();
|
|
||||||
if (root == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
SurfaceControl out = root.getSurfaceControl();
|
|
||||||
if (out != null && out.isValid()) {
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
return mWindowManager.mSystemWindows.getViewSurface(this);
|
return mWindowManager.mSystemWindows.getViewSurface(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,8 +198,7 @@ public class PhonePipMenuController implements PipMenuController {
|
|||||||
* {@code null}), it will get the leash that the WindowlessWM has assigned to it.
|
* {@code null}), it will get the leash that the WindowlessWM has assigned to it.
|
||||||
*/
|
*/
|
||||||
public SurfaceControl getSurfaceControl() {
|
public SurfaceControl getSurfaceControl() {
|
||||||
SurfaceControl sf = mPipMenuView.getWindowSurfaceControl();
|
return mSystemWindows.getViewSurface(mPipMenuView);
|
||||||
return sf != null ? sf : mSystemWindows.getViewSurface(mPipMenuView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user