Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6958abb9 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge changes from topic "scaling-mode-cleanup"

* changes:
  SurfaceControl: Remove setOverrideScalingMode
  ScreenRotationAnimation: Use Surface#setScalingMode
  WindowManager: Remove windowsAreScaleable
parents 4ed5b2bb b3bb9206
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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);
+0 −22
Original line number Diff line number Diff line
@@ -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
+0 −11
Original line number Diff line number Diff line
@@ -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 },
+4 −6
Original line number Diff line number Diff line
@@ -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) {
Loading