Merge "Ensure we change SurfaceView size from UI thread." into nyc-dev

This commit is contained in:
Rob Carr
2016-03-29 23:50:45 +00:00
committed by Android (Google) Code Review
5 changed files with 1 additions and 23 deletions

View File

@@ -116,14 +116,11 @@ interface IWindowSession {
* @param top The new top position
* @param right The new right position
* @param bottom The new bottom position
* @param requestedWidth The new requested width
* @param requestedHeight The new requested height
* @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,
int requestedWidth, int requestedHeight,
long deferTransactionUntilFrame, out Rect outFrame);
/*

View File

@@ -490,7 +490,7 @@ public class SurfaceView extends View {
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
;
if (!creating && !force && !mUpdateWindowNeeded) {
if (!creating && !force && !mUpdateWindowNeeded && !sizeChanged) {
mLayout.privateFlags |=
WindowManager.LayoutParams.PRIVATE_FLAG_PRESERVE_GEOMETRY;
} else {
@@ -584,18 +584,6 @@ public class SurfaceView extends View {
mSurface.transferFrom(mNewSurface);
if (visible && mSurface.isValid()) {
// We set SCALING_MODE_NO_SCALE_CROP to allow the WindowManager
// to update our Surface crop without requiring a new buffer from
// us. In the default mode of SCALING_MODE_FREEZE, surface geometry
// state (which includes crop) is only applied when a buffer
// with appropriate geometry is available. During drag resize
// it is quite frequent that a matching buffer will not be available
// (because we are constantly being resized and have fallen behind).
// However in such situations the WindowManager still needs to be able
// to update our crop to ensure we stay within the bounds of the containing
// window.
mSurface.setScalingMode(Surface.SCALING_MODE_NO_SCALE_CROP);
if (!mSurfaceCreated && (surfaceChanged || visibleChanged)) {
mSurfaceCreated = true;
mIsCreating = true;
@@ -666,7 +654,6 @@ public class SurfaceView extends View {
mLocation[0], mLocation[1]));
mSession.repositionChild(mWindow, mWindowSpaceLeft, mWindowSpaceTop,
mLocation[0], mLocation[1],
mWindowSpaceWidth, mWindowSpaceHeight,
-1, mWinFrame);
} catch (RemoteException ex) {
Log.e(TAG, "Exception from relayout", ex);
@@ -703,7 +690,6 @@ public class SurfaceView extends View {
}
// Just using mRTLastReportedPosition as a dummy rect here
session.repositionChild(window, left, top, right, bottom,
mWindowSpaceWidth, mWindowSpaceHeight,
frameNumber,
mRTLastReportedPosition);
// Now overwrite mRTLastReportedPosition with our values

View File

@@ -195,10 +195,8 @@ final class Session extends IWindowSession.Stub
@Override
public void repositionChild(IWindow window, int left, int top, int right, int bottom,
int requestedWidth, int requestedHeight,
long deferTransactionUntilFrame, Rect outFrame) {
mService.repositionChild(this, window, left, top, right, bottom,
requestedWidth, requestedHeight,
deferTransactionUntilFrame, outFrame);
}

View File

@@ -2531,7 +2531,6 @@ public class WindowManagerService extends IWindowManager.Stub
void repositionChild(Session session, IWindow client,
int left, int top, int right, int bottom,
int requestedWidth, int requestedHeight,
long deferTransactionUntilFrame, Rect outFrame) {
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "repositionChild");
long origId = Binder.clearCallingIdentity();
@@ -2547,7 +2546,6 @@ public class WindowManagerService extends IWindowManager.Stub
"repositionChild called but window is not"
+ "attached to a parent win=" + win);
}
win.setRequestedSize(requestedWidth, requestedHeight);
win.mAttrs.x = left;
win.mAttrs.y = top;

View File

@@ -97,7 +97,6 @@ public final class BridgeWindowSession implements IWindowSession {
@Override
public void repositionChild(IWindow window, int left, int top, int right, int bottom,
int requestedWidth, int requestedHeight,
long deferTransactionUntilFrame, Rect outFrame) {
// pass for now.
return;