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

Commit 1ca6a33f authored by Robert Carr's avatar Robert Carr
Browse files

Force windows to be scalable during pinned animation.

We resize windows at the beginning of the pinned stack
animation when animating to a larger size, and so for some
duration a resize will be pending. We need to force the window
out of SCALING_MODE_FREEZE so we can animate during this period.

Bug: 27891386
Change-Id: I5cff599ed67f2c179e938662b6f0d99bd790aaba
parent 1ed0c12a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -102,13 +102,13 @@ public class Surface implements Parcelable {
    public @interface ScalingMode {}
    // From system/window.h
    /** @hide */
    static final int SCALING_MODE_FREEZE = 0;
    public static final int SCALING_MODE_FREEZE = 0;
    /** @hide */
    static final int SCALING_MODE_SCALE_TO_WINDOW = 1;
    public static final int SCALING_MODE_SCALE_TO_WINDOW = 1;
    /** @hide */
    static final int SCALING_MODE_SCALE_CROP = 2;
    public static final int SCALING_MODE_SCALE_CROP = 2;
    /** @hide */
    static final int SCALING_MODE_NO_SCALE_CROP = 3;
    public static final int SCALING_MODE_NO_SCALE_CROP = 3;

    /** @hide */
    @IntDef({ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270})
+7 −0
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ public class SurfaceControl {
            IBinder displayToken, int mode);
    private static native void nativeDeferTransactionUntil(long nativeObject,
            IBinder handle, long frame);
    private static native void nativeSetOverrideScalingMode(long nativeObject,
            int scalingMode);
    private static native IBinder nativeGetHandle(long nativeObject);


@@ -376,6 +378,11 @@ public class SurfaceControl {
        nativeDeferTransactionUntil(mNativeObject, handle, frame);
    }

    public void setOverrideScalingMode(int scalingMode) {
        checkNotReleased();
        nativeSetOverrideScalingMode(mNativeObject, scalingMode);
    }

    public IBinder getHandle() {
        return nativeGetHandle(mNativeObject);
    }
+9 −0
Original line number Diff line number Diff line
@@ -597,6 +597,13 @@ static void nativeDeferTransactionUntil(JNIEnv* env, jclass clazz, jlong nativeO
    ctrl->deferTransactionUntil(handle, frameNumber);
}

static void nativeSetOverrideScalingMode(JNIEnv* env, jclass clazz, jlong nativeObject,
        jint scalingMode) {
    auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);

    ctrl->setOverrideScalingMode(scalingMode);
}

static jobject nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) {
    auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);

@@ -676,6 +683,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeSetDisplayPowerMode },
    {"nativeDeferTransactionUntil", "(JLandroid/os/IBinder;J)V",
            (void*)nativeDeferTransactionUntil },
    {"nativeSetOverrideScalingMode", "(JI)V",
            (void*)nativeSetOverrideScalingMode },
    {"nativeGetHandle", "(J)Landroid/os/IBinder;",
            (void*)nativeGetHandle }
};
+7 −4
Original line number Diff line number Diff line
@@ -129,13 +129,16 @@ public class BoundsAnimationController {
        public void onAnimationStart(Animator animation) {
            if (DEBUG) Slog.d(TAG, "onAnimationStart: mTarget=" + mTarget
                    + " mReplacement=" + mReplacement);
            if (animatingToLargerSize()) {
                mTarget.setPinnedStackSize(mFrom, mTo);
            }

            if (!mReplacement) {
                mTarget.onAnimationStart();
            }

            // Ensure that we have prepared the target for animation before
            // we trigger any size changes, so it can swap surfaces
            // in to appropriate modes, or do as it wishes otherwise.
            if (animatingToLargerSize()) {
                mTarget.setPinnedStackSize(mFrom, mTo);
            }
        }

        @Override
+2 −1
Original line number Diff line number Diff line
@@ -600,7 +600,8 @@ class Task implements DimLayer.DimLayerUser {
                    //
                    // Anyway we don't need to synchronize position and content updates for these
                    // windows since they aren't at the base layer and could be moved around anyway.
                    if (!win.computeDragResizing() && win.mAttrs.type == TYPE_BASE_APPLICATION) {
                    if (!win.computeDragResizing() && win.mAttrs.type == TYPE_BASE_APPLICATION &&
                            !mStack.getBoundsAnimating()) {
                        win.mResizedWhileNotDragResizing = true;
                    }
                }
Loading