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

Commit e395d157 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Introduce and update interfaces for return animations and takeovers.

WindowAnimationState will be used to transfer the state of a task's
window from Launcher to the Animation lib (through Shell) when a Home
gesture handover happens.

Bug: 323863002
Flag: NA
Test: NA, new methods and interfaces are unused (still builds)
Change-Id: I507246206a86029601c2a4c08f8c7e601b039167
parent 2fe6f173
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.window;
import android.view.SurfaceControl;
import android.window.IRemoteTransitionFinishedCallback;
import android.window.TransitionInfo;
import android.window.WindowAnimationState;

/**
 * Interface allowing remote processes to play transition animations.
@@ -60,6 +61,19 @@ oneway interface IRemoteTransition {
            in SurfaceControl.Transaction t, in IBinder mergeTarget,
            in IRemoteTransitionFinishedCallback finishCallback);

    /**
     * Takes over the animation of the windows from an existing transition. Once complete, the
     * implementation should call `finishCallback`.
     *
     * @param transition An identifier for the transition to be taken over.
     * @param states The animation states of the windows involved in the transition. These must be
     *               sorted in the same way as the Changes inside `info`, and each state may be
     *               null.
     */
    void takeOverAnimation(in IBinder transition, in TransitionInfo info,
            in SurfaceControl.Transaction t, in IRemoteTransitionFinishedCallback finishCallback,
            in WindowAnimationState[] states);

    /**
     * Called when a different handler has consumed the transition
     *
+10 −0
Original line number Diff line number Diff line
@@ -31,6 +31,16 @@ public abstract class RemoteTransitionStub extends IRemoteTransition.Stub {
            SurfaceControl.Transaction t, IBinder mergeTarget,
            IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {}


    @Override
    public void takeOverAnimation(IBinder transition, TransitionInfo info,
            SurfaceControl.Transaction startTransaction,
            IRemoteTransitionFinishedCallback finishCallback,
            WindowAnimationState[] states) throws RemoteException {
        throw new RemoteException("Takeovers are not supported by this IRemoteTransition");
    }


    @Override
    public void onTransitionConsumed(IBinder transition, boolean aborted)
            throws RemoteException {}
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.window;

import android.graphics.PointF;
import android.graphics.RectF;

/**
 * Properties of a window animation at a given point in time.
 *
 * {@hide}
 */
parcelable WindowAnimationState {
    long timestamp;
    RectF bounds;
    float scale;
    float topLeftRadius;
    float topRightRadius;
    float bottomRightRadius;
    float bottomLeftRadius;
    PointF velocityPxPerMs;
}
+2 −10
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ import android.os.RemoteException
import android.util.Log
import android.view.SurfaceControl
import android.view.animation.DecelerateInterpolator
import android.window.IRemoteTransition
import android.window.IRemoteTransitionFinishedCallback
import android.window.RemoteTransitionStub
import android.window.TransitionInfo
import android.window.WindowContainerToken
import com.android.app.viewcapture.ViewCapture
@@ -41,7 +41,7 @@ class RemoteRecentSplitTaskTransitionRunner(
    private val viewPosition: IntArray,
    private val screenBounds: Rect,
    private val handleResult: () -> Unit,
) : IRemoteTransition.Stub() {
) : RemoteTransitionStub() {
    override fun startAnimation(
        transition: IBinder?,
        info: TransitionInfo?,
@@ -114,14 +114,6 @@ class RemoteRecentSplitTaskTransitionRunner(
        }
    }

    override fun mergeAnimation(
        transition: IBinder?,
        info: TransitionInfo?,
        t: SurfaceControl.Transaction?,
        mergeTarget: IBinder?,
        finishedCallback: IRemoteTransitionFinishedCallback?
    ) {}

    @Throws(RemoteException::class)
    override fun onTransitionConsumed(transition: IBinder, aborted: Boolean) {
        Log.w(TAG, "unexpected consumption of app selector transition: aborted=$aborted")