Delete some SurfaceView support code.
repositionChild, performDeferredDestroy, and SurfaceControl with background were all only used by SurfaceView and are now no longer required in the wm. Test: Only red. Change-Id: Icb773572e6d6202f78a6d23b2431fbfacbe272c6
This commit is contained in:
@@ -98,31 +98,6 @@ interface IWindowSession {
|
||||
out Rect outOutsets, out Rect outBackdropFrame, out Configuration outConfig,
|
||||
out Surface outSurface);
|
||||
|
||||
/**
|
||||
* Position a window relative to it's parent (attached) window without triggering
|
||||
* a full relayout. This action may be deferred until a given frame number
|
||||
* for the parent window appears. This allows for synchronizing movement of a child
|
||||
* to repainting the contents of the parent.
|
||||
*
|
||||
* "width" and "height" correspond to the width and height members of
|
||||
* WindowManager.LayoutParams in the {@link #relayout relayout()} case.
|
||||
* This may differ from the surface buffer size in the
|
||||
* case of {@link LayoutParams#FLAG_SCALED} and {@link #relayout relayout()}
|
||||
* must be used with requestedWidth/height if this must be changed.
|
||||
*
|
||||
* @param window The window being modified. Must be attached to a parent window
|
||||
* or this call will fail.
|
||||
* @param left The new left position
|
||||
* @param top The new top position
|
||||
* @param right The new right position
|
||||
* @param bottom The new bottom position
|
||||
* @param deferTransactionUntilFrame Frame number from our parent (attached) to
|
||||
* defer this action until.
|
||||
* @param outFrame Rect in which is placed the new position/size on screen.
|
||||
*/
|
||||
void repositionChild(IWindow childWindow, int left, int top, int right, int bottom,
|
||||
long deferTransactionUntilFrame, out Rect outFrame);
|
||||
|
||||
/*
|
||||
* Notify the window manager that an application is relaunching and
|
||||
* windows should be prepared for replacement.
|
||||
@@ -133,12 +108,6 @@ interface IWindowSession {
|
||||
*/
|
||||
void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
|
||||
|
||||
/**
|
||||
* If a call to relayout() asked to have the surface destroy deferred,
|
||||
* it must call this once it is okay to destroy that surface.
|
||||
*/
|
||||
void performDeferredDestroy(IWindow window);
|
||||
|
||||
/**
|
||||
* Called by a client to report that it ran out of graphics memory.
|
||||
*/
|
||||
|
||||
@@ -163,9 +163,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
||||
private boolean mLastContainsShowWhenLockedWindow;
|
||||
private boolean mLastContainsDismissKeyguardWindow;
|
||||
|
||||
private ArrayList<WindowSurfaceController.SurfaceControlWithBackground> mSurfaceViewBackgrounds =
|
||||
new ArrayList<>();
|
||||
|
||||
ArrayDeque<Rect> mFrozenBounds = new ArrayDeque<>();
|
||||
ArrayDeque<Configuration> mFrozenMergedConfig = new ArrayDeque<>();
|
||||
|
||||
@@ -970,36 +967,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
||||
mService.mWindowPlacerLocked.performSurfacePlacement();
|
||||
}
|
||||
|
||||
void addSurfaceViewBackground(WindowSurfaceController.SurfaceControlWithBackground background) {
|
||||
mSurfaceViewBackgrounds.add(background);
|
||||
}
|
||||
|
||||
void removeSurfaceViewBackground(WindowSurfaceController.SurfaceControlWithBackground background) {
|
||||
mSurfaceViewBackgrounds.remove(background);
|
||||
updateSurfaceViewBackgroundVisibilities();
|
||||
}
|
||||
|
||||
// We use DimLayers behind SurfaceViews to prevent holes while resizing and creating.
|
||||
// However, we need to ensure one SurfaceView doesn't cover another when they are both placed
|
||||
// below the main app window (as traditionally a SurfaceView which is never drawn
|
||||
// to is totally translucent). So we look at all our SurfaceView backgrounds and only enable
|
||||
// the background for the SurfaceView with lowest Z order
|
||||
void updateSurfaceViewBackgroundVisibilities() {
|
||||
WindowSurfaceController.SurfaceControlWithBackground bottom = null;
|
||||
int bottomLayer = Integer.MAX_VALUE;
|
||||
for (int i = 0; i < mSurfaceViewBackgrounds.size(); i++) {
|
||||
WindowSurfaceController.SurfaceControlWithBackground sc = mSurfaceViewBackgrounds.get(i);
|
||||
if (sc.mVisible && sc.mLayer < bottomLayer) {
|
||||
bottomLayer = sc.mLayer;
|
||||
bottom = sc;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mSurfaceViewBackgrounds.size(); i++) {
|
||||
WindowSurfaceController.SurfaceControlWithBackground sc = mSurfaceViewBackgrounds.get(i);
|
||||
sc.updateBackgroundVisibility(sc != bottom);
|
||||
}
|
||||
}
|
||||
|
||||
void resetJustMovedInStack() {
|
||||
for (int i = mChildren.size() - 1; i >= 0; i--) {
|
||||
(mChildren.get(i)).resetJustMovedInStack();
|
||||
|
||||
@@ -207,13 +207,6 @@ public class Session extends IWindowSession.Stub
|
||||
mService.removeWindow(this, window);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void repositionChild(IWindow window, int left, int top, int right, int bottom,
|
||||
long deferTransactionUntilFrame, Rect outFrame) {
|
||||
mService.repositionChild(this, window, left, top, right, bottom,
|
||||
deferTransactionUntilFrame, outFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly) {
|
||||
mService.setWillReplaceWindows(appToken, childrenOnly);
|
||||
@@ -235,10 +228,6 @@ public class Session extends IWindowSession.Stub
|
||||
return res;
|
||||
}
|
||||
|
||||
public void performDeferredDestroy(IWindow window) {
|
||||
mService.performDeferredDestroyWindow(this, window);
|
||||
}
|
||||
|
||||
public boolean outOfMemory(IWindow window) {
|
||||
return mService.outOfMemoryWindow(this, window);
|
||||
}
|
||||
|
||||
@@ -1817,64 +1817,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
void repositionChild(Session session, IWindow client,
|
||||
int left, int top, int right, int bottom,
|
||||
long frameNumber, Rect outFrame) {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "repositionChild");
|
||||
long origId = Binder.clearCallingIdentity();
|
||||
|
||||
try {
|
||||
synchronized(mWindowMap) {
|
||||
WindowState win = windowForClientLocked(session, client, false);
|
||||
if (win == null) {
|
||||
return;
|
||||
}
|
||||
if (!win.isChildWindow()) {
|
||||
throw new IllegalArgumentException(
|
||||
"repositionChild called but window is not"
|
||||
+ "attached to a parent win=" + win);
|
||||
}
|
||||
|
||||
win.mAttrs.x = left;
|
||||
win.mAttrs.y = top;
|
||||
win.mAttrs.width = right - left;
|
||||
win.mAttrs.height = bottom - top;
|
||||
win.setWindowScale(win.mRequestedWidth, win.mRequestedHeight);
|
||||
|
||||
if (win.mHasSurface) {
|
||||
if (SHOW_TRANSACTIONS) {
|
||||
Slog.i(TAG_WM, ">>> OPEN TRANSACTION repositionChild");
|
||||
}
|
||||
|
||||
openSurfaceTransaction();
|
||||
|
||||
try {
|
||||
|
||||
win.applyGravityAndUpdateFrame(win.mContainingFrame, win.mDisplayFrame);
|
||||
win.mWinAnimator.computeShownFrameLocked();
|
||||
|
||||
win.mWinAnimator.setSurfaceBoundariesLocked(false);
|
||||
|
||||
if (frameNumber > 0) {
|
||||
win.mWinAnimator.deferTransactionUntilParentFrame(frameNumber);
|
||||
}
|
||||
|
||||
} finally {
|
||||
closeSurfaceTransaction();
|
||||
if (SHOW_TRANSACTIONS) {
|
||||
Slog.i(TAG_WM, "<<< CLOSE TRANSACTION repositionChild");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outFrame = win.mCompatFrame;
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
|
||||
}
|
||||
}
|
||||
|
||||
public int relayoutWindow(Session session, IWindow client, int seq,
|
||||
WindowManager.LayoutParams attrs, int requestedWidth,
|
||||
int requestedHeight, int viewVisibility, int flags,
|
||||
@@ -2219,23 +2161,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return result;
|
||||
}
|
||||
|
||||
public void performDeferredDestroyWindow(Session session, IWindow client) {
|
||||
long origId = Binder.clearCallingIdentity();
|
||||
|
||||
try {
|
||||
synchronized (mWindowMap) {
|
||||
WindowState win = windowForClientLocked(session, client, false);
|
||||
if (win == null || win.mWillReplaceWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
win.mWinAnimator.destroyDeferredSurfaceLocked();
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean outOfMemoryWindow(Session session, IWindow client) {
|
||||
final long origId = Binder.clearCallingIdentity();
|
||||
|
||||
|
||||
@@ -97,13 +97,7 @@ class WindowSurfaceController {
|
||||
mWindowType = windowType;
|
||||
mWindowSession = win.mSession;
|
||||
|
||||
// For opaque child windows placed under parent windows, we use a special SurfaceControl
|
||||
// which mirrors commands to a black-out layer placed one Z-layer below the surface.
|
||||
// This prevents holes to whatever app/wallpaper is underneath.
|
||||
if (win.isChildWindow() && win.mSubLayer < 0 && win.mAppToken != null) {
|
||||
mSurfaceControl = new SurfaceControlWithBackground(
|
||||
s, name, w, h, format, flags, win.mAppToken, windowType, ownerUid);
|
||||
} else if (DEBUG_SURFACE_TRACE) {
|
||||
if (DEBUG_SURFACE_TRACE) {
|
||||
mSurfaceControl = new SurfaceTrace(
|
||||
s, name, w, h, format, flags, windowType, ownerUid);
|
||||
} else {
|
||||
@@ -834,141 +828,4 @@ class WindowSurfaceController {
|
||||
+ " (" + mDsdx + "," + mDtdx + "," + mDsdy + "," + mDtdy + ")";
|
||||
}
|
||||
}
|
||||
|
||||
class SurfaceControlWithBackground extends SurfaceControl {
|
||||
private SurfaceControl mBackgroundControl;
|
||||
private boolean mOpaque = true;
|
||||
private boolean mAppForcedInvisible = false;
|
||||
private AppWindowToken mAppToken;
|
||||
public boolean mVisible = false;
|
||||
public int mLayer = -1;
|
||||
|
||||
public SurfaceControlWithBackground(SurfaceSession s, String name, int w, int h, int format,
|
||||
int flags, AppWindowToken token, int windowType, int ownerUid)
|
||||
throws OutOfResourcesException {
|
||||
super(s, name, w, h, format, flags, windowType, ownerUid);
|
||||
mBackgroundControl = new SurfaceControl(s, name, w, h,
|
||||
PixelFormat.OPAQUE, flags | SurfaceControl.FX_SURFACE_DIM);
|
||||
mOpaque = (flags & SurfaceControl.OPAQUE) != 0;
|
||||
mAppToken = token;
|
||||
|
||||
mAppToken.addSurfaceViewBackground(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
super.setAlpha(alpha);
|
||||
mBackgroundControl.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLayer(int zorder) {
|
||||
super.setLayer(zorder);
|
||||
mBackgroundControl.setLayer(zorder - 1);
|
||||
if (mLayer != zorder) {
|
||||
mLayer = zorder;
|
||||
mAppToken.updateSurfaceViewBackgroundVisibilities();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(float x, float y) {
|
||||
super.setPosition(x, y);
|
||||
mBackgroundControl.setPosition(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(int w, int h) {
|
||||
super.setSize(w, h);
|
||||
mBackgroundControl.setSize(w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowCrop(Rect crop) {
|
||||
super.setWindowCrop(crop);
|
||||
mBackgroundControl.setWindowCrop(crop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFinalCrop(Rect crop) {
|
||||
super.setFinalCrop(crop);
|
||||
mBackgroundControl.setFinalCrop(crop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLayerStack(int layerStack) {
|
||||
super.setLayerStack(layerStack);
|
||||
mBackgroundControl.setLayerStack(layerStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOpaque(boolean isOpaque) {
|
||||
super.setOpaque(isOpaque);
|
||||
mOpaque = isOpaque;
|
||||
updateBackgroundVisibility(mAppForcedInvisible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecure(boolean isSecure) {
|
||||
super.setSecure(isSecure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) {
|
||||
super.setMatrix(dsdx, dtdx, dsdy, dtdy);
|
||||
mBackgroundControl.setMatrix(dsdx, dtdx, dsdy, dtdy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
if (mVisible) {
|
||||
mVisible = false;
|
||||
mAppToken.updateSurfaceViewBackgroundVisibilities();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
if (!mVisible) {
|
||||
mVisible = true;
|
||||
mAppToken.updateSurfaceViewBackgroundVisibilities();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
mBackgroundControl.destroy();
|
||||
mAppToken.removeSurfaceViewBackground(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
super.release();
|
||||
mBackgroundControl.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransparentRegionHint(Region region) {
|
||||
super.setTransparentRegionHint(region);
|
||||
mBackgroundControl.setTransparentRegionHint(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deferTransactionUntil(IBinder handle, long frame) {
|
||||
super.deferTransactionUntil(handle, frame);
|
||||
mBackgroundControl.deferTransactionUntil(handle, frame);
|
||||
}
|
||||
|
||||
void updateBackgroundVisibility(boolean forcedInvisible) {
|
||||
mAppForcedInvisible = forcedInvisible;
|
||||
if (mOpaque && mVisible && !mAppForcedInvisible) {
|
||||
mBackgroundControl.show();
|
||||
} else {
|
||||
mBackgroundControl.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,18 +95,6 @@ public final class BridgeWindowSession implements IWindowSession {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void repositionChild(IWindow window, int left, int top, int right, int bottom,
|
||||
long deferTransactionUntilFrame, Rect outFrame) {
|
||||
// pass for now.
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performDeferredDestroy(IWindow window) {
|
||||
// pass for now.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outOfMemory(IWindow window) throws RemoteException {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user