Merge changes from topic "scaling-mode-cleanup"

* changes:
  SurfaceControl: Remove setOverrideScalingMode
  ScreenRotationAnimation: Use Surface#setScalingMode
  WindowManager: Remove windowsAreScaleable
This commit is contained in:
Rob Carr
2020-10-14 06:10:46 +00:00
committed by Android (Google) Code Review
11 changed files with 9 additions and 100 deletions

View File

@@ -851,15 +851,6 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
return mWindowingMode == WINDOWING_MODE_FREEFORM || mWindowingMode == WINDOWING_MODE_PINNED;
}
/**
* Returns true if this container may be scaled without resizing, and windows within may need
* to be configured as such.
* @hide
*/
public boolean windowsAreScaleable() {
return mWindowingMode == WINDOWING_MODE_PINNED;
}
/**
* Returns true if windows in this container should be given move animations by default.
* @hide

View File

@@ -739,7 +739,7 @@ public class Surface implements Parcelable {
* Set the scaling mode to be used for this surfaces buffers
* @hide
*/
void setScalingMode(@ScalingMode int scalingMode) {
public void setScalingMode(@ScalingMode int scalingMode) {
synchronized (mLock) {
checkNotReleasedLocked();
int err = nativeSetScalingMode(mNativeObject, scalingMode);

View File

@@ -187,8 +187,6 @@ public final class SurfaceControl implements Parcelable {
private static native void nativeReparent(long transactionObj, long nativeObject,
long newParentNativeObject);
private static native void nativeSeverChildren(long transactionObj, long nativeObject);
private static native void nativeSetOverrideScalingMode(long transactionObj, long nativeObject,
int scalingMode);
private static native Display.HdrCapabilities nativeGetHdrCapabilities(IBinder displayToken);
@@ -1518,16 +1516,6 @@ public final class SurfaceControl implements Parcelable {
}
}
/**
* @hide
*/
public void setOverrideScalingMode(int scalingMode) {
checkNotReleased();
synchronized(SurfaceControl.class) {
sGlobalTransaction.setOverrideScalingMode(this, scalingMode);
}
}
/**
* @hide
*/
@@ -2988,16 +2976,6 @@ public final class SurfaceControl implements Parcelable {
return this;
}
/**
* @hide
*/
public Transaction setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode) {
checkPreconditions(sc);
nativeSetOverrideScalingMode(mNativeObject, sc.mNativeObject,
overrideScalingMode);
return this;
}
/**
* Fills the surface with the specified color.
* @param color A float array with three values to represent r, g, b in range [0..1]. An

View File

@@ -1360,15 +1360,6 @@ static void nativeSeverChildren(JNIEnv* env, jclass clazz, jlong transactionObj,
transaction->detachChildren(ctrl);
}
static void nativeSetOverrideScalingMode(JNIEnv* env, jclass clazz, jlong transactionObj,
jlong nativeObject,
jint scalingMode) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
transaction->setOverrideScalingMode(ctrl, scalingMode);
}
static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject tokenObject) {
sp<IBinder> token(ibinderForJavaObject(env, tokenObject));
if (token == NULL) return NULL;
@@ -1694,8 +1685,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeReparent },
{"nativeSeverChildren", "(JJ)V",
(void*)nativeSeverChildren } ,
{"nativeSetOverrideScalingMode", "(JJI)V",
(void*)nativeSetOverrideScalingMode },
{"nativeCaptureDisplay",
"(Landroid/view/SurfaceControl$DisplayCaptureArgs;Landroid/view/SurfaceControl$ScreenCaptureListener;)I",
(void*)nativeCaptureDisplay },

View File

@@ -203,16 +203,14 @@ class ScreenRotationAnimation {
.setCallsite("ScreenRotationAnimation")
.build();
// In case display bounds change, screenshot buffer and surface may mismatch so set a
// scaling mode.
SurfaceControl.Transaction t2 = mService.mTransactionFactory.get();
t2.setOverrideScalingMode(mScreenshotLayer, Surface.SCALING_MODE_SCALE_TO_WINDOW);
t2.apply(true /* sync */);
// Capture a screenshot into the surface we just created.
final int displayId = displayContent.getDisplayId();
final Surface surface = mService.mSurfaceFactory.get();
// In case display bounds change, screenshot buffer and surface may mismatch so set a
// scaling mode.
surface.copyFrom(mScreenshotLayer);
surface.setScalingMode(Surface.SCALING_MODE_SCALE_TO_WINDOW);
SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer =
mService.mDisplayManagerInternal.systemScreenshot(displayId);
if (screenshotBuffer != null) {

View File

@@ -1474,14 +1474,6 @@ class Task extends WindowContainer<WindowContainer> {
// Update task bounds if needed.
adjustBoundsForDisplayChangeIfNeeded(getDisplayContent());
if (getWindowConfiguration().windowsAreScaleable()) {
// We force windows out of SCALING_MODE_FREEZE so that we can continue to animate them
// while a resize is pending.
forceWindowsScaleable(true /* force */);
} else {
forceWindowsScaleable(false /* force */);
}
mRootWindowContainer.updateUIDsPresentOnDisplay();
// Resume next focusable stack after reparenting to another display if we aren't removing
@@ -3780,17 +3772,6 @@ class Task extends WindowContainer<WindowContainer> {
positionChildAt(position, child, false /* includeParents */);
}
void forceWindowsScaleable(boolean force) {
mWmService.openSurfaceTransaction();
try {
for (int i = mChildren.size() - 1; i >= 0; i--) {
mChildren.get(i).forceWindowsScaleableInTransaction(force);
}
} finally {
mWmService.closeSurfaceTransaction("forceWindowsScaleable");
}
}
void setTaskDescription(TaskDescription taskDescription) {
mTaskDescription = taskDescription;
}

View File

@@ -861,13 +861,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
}
void forceWindowsScaleableInTransaction(boolean force) {
for (int i = mChildren.size() - 1; i >= 0; --i) {
final WindowContainer wc = mChildren.get(i);
wc.forceWindowsScaleableInTransaction(force);
}
}
/**
* @return {@code true} when an application can override an app transition animation on this
* container.

View File

@@ -2172,16 +2172,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
}
@Override
void forceWindowsScaleableInTransaction(boolean force) {
if (mWinAnimator != null && mWinAnimator.hasSurface()) {
mWinAnimator.mSurfaceController.forceScaleableInTransaction(force);
}
super.forceWindowsScaleableInTransaction(force);
}
@Override
@Override
void removeImmediately() {
super.removeImmediately();

View File

@@ -971,10 +971,6 @@ class WindowStateAnimator {
* @return Returns true if the surface was successfully shown.
*/
private boolean showSurfaceRobustlyLocked() {
if (mWin.getWindowConfiguration().windowsAreScaleable()) {
mSurfaceController.forceScaleableInTransaction(true);
}
boolean shown = mSurfaceController.showRobustlyInTransaction();
if (!shown)
return false;

View File

@@ -342,11 +342,9 @@ class WindowSurfaceController {
return false;
}
void forceScaleableInTransaction(boolean force) {
// -1 means we don't override the default or client specified
// scaling mode.
int scalingMode = force ? SCALING_MODE_SCALE_TO_WINDOW : -1;
mSurfaceControl.setOverrideScalingMode(scalingMode);
void deferTransactionUntil(SurfaceControl barrier, long frame) {
// TODO: Logging
mSurfaceControl.deferTransactionUntil(barrier, frame);
}
boolean clearWindowContentFrameStats() {

View File

@@ -162,12 +162,6 @@ public class StubTransaction extends SurfaceControl.Transaction {
return this;
}
@Override
public SurfaceControl.Transaction setOverrideScalingMode(SurfaceControl sc,
int overrideScalingMode) {
return this;
}
@Override
public SurfaceControl.Transaction setColor(SurfaceControl sc, float[] color) {
return this;