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

Commit d52e491d authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Implement default exit animation for splash screen.(9/N)

Implement default exit animation on the view of splash screen, there
will be a two layers switch happen when playing exit animation. For
the detail please reference
go/improved_app_launch_animations and go/app-startup

Note: For this version we skip shift-up animation, need to fix the
flicker test so we can enable it.
Note2: Fix the possible missing splash screen view issue, but could
make the first window draw slower, keep tracking.

Bug: 73289295
Test: build/flash
Test: check splash screen starting window.
Test: atest StartingSurfaceDrawerTests ShellTaskOrganizerTests
WindowOrganizerTests SplashscreenTests

Change-Id: I796811d010ac70f256169dd03d5e05ef0ed79d28
parent 2f3e1415
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2907,7 +2907,7 @@ package android.window {
    method @BinderThread public void onTaskInfoChanged(@NonNull android.app.ActivityManager.RunningTaskInfo);
    method @BinderThread public void onTaskVanished(@NonNull android.app.ActivityManager.RunningTaskInfo);
    method @CallSuper @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.window.TaskAppearedInfo> registerOrganizer();
    method @BinderThread public void removeStartingWindow(int);
    method @BinderThread public void removeStartingWindow(int, @Nullable android.view.SurfaceControl, @Nullable android.graphics.Rect, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void setInterceptBackPressedOnTaskRoot(@NonNull android.window.WindowContainerToken, boolean);
    method @CallSuper @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void unregisterOrganizer();
  }
+6 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.window;

import android.view.SurfaceControl;
import android.app.ActivityManager;
import android.graphics.Rect;
import android.window.StartingWindowInfo;
import android.window.WindowContainerToken;

@@ -38,8 +39,12 @@ oneway interface ITaskOrganizer {

    /**
     * Called when the Task want to remove the starting window.
     * @param leash A persistent leash for the top window in this task.
     * @param frame Window frame of the top window.
     * @param playRevealAnimation Play vanish animation.
     */
    void removeStartingWindow(int taskId);
    void removeStartingWindow(int taskId, in SurfaceControl leash, in Rect frame,
            in boolean playRevealAnimation);

    /**
     * Called when the Task want to copy the splash screen.
+6 −3
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ import android.widget.FrameLayout;
import com.android.internal.R;
import com.android.internal.policy.DecorView;

import java.util.function.Consumer;

/**
 * <p>The view which allows an activity to customize its splash screen exit animation.</p>
 *
@@ -77,7 +79,8 @@ public final class SplashScreenView extends FrameLayout {

    private Animatable mAnimatableIcon;
    private ValueAnimator mAnimator;

    private Runnable mAnimationFinishListener;
    private Consumer<Canvas> mOnDrawCallback;
    // cache original window and status
    private Window mWindow;
    private boolean mDrawBarBackground;
@@ -85,7 +88,7 @@ public final class SplashScreenView extends FrameLayout {
    private int mNavigationBarColor;

    /**
     * Internal builder to create a SplashScreenWindowView object.
     * Internal builder to create a SplashScreenView object.
     * @hide
     */
    public static class Builder {
@@ -391,7 +394,7 @@ public final class SplashScreenView extends FrameLayout {
     * Get the initial background color of this view.
     * @hide
     */
    @ColorInt int getInitBackgroundColor() {
    public @ColorInt int getInitBackgroundColor() {
        return mInitBackgroundColor;
    }

+11 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.RemoteException;
import android.view.SurfaceControl;
@@ -100,9 +101,14 @@ public class TaskOrganizer extends WindowOrganizer {

    /**
     * Called when the Task want to remove the starting window.
     * @param leash A persistent leash for the top window in this task. Release it once exit
     *              animation has finished.
     * @param frame Window frame of the top window.
     * @param playRevealAnimation Play vanish animation.
     */
    @BinderThread
    public void removeStartingWindow(int taskId) {}
    public void removeStartingWindow(int taskId, @Nullable SurfaceControl leash,
            @Nullable Rect frame, boolean playRevealAnimation) {}

    /**
     * Called when the Task want to copy the splash screen.
@@ -217,15 +223,16 @@ public class TaskOrganizer extends WindowOrganizer {

    private final ITaskOrganizer mInterface = new ITaskOrganizer.Stub() {
        @Override

        public void addStartingWindow(StartingWindowInfo windowInfo,
                IBinder appToken) {
            mExecutor.execute(() -> TaskOrganizer.this.addStartingWindow(windowInfo, appToken));
        }

        @Override
        public void removeStartingWindow(int taskId) {
            mExecutor.execute(() -> TaskOrganizer.this.removeStartingWindow(taskId));
        public void removeStartingWindow(int taskId, SurfaceControl leash, Rect frame,
                boolean playRevealAnimation) {
            mExecutor.execute(() -> TaskOrganizer.this.removeStartingWindow(taskId, leash, frame,
                    playRevealAnimation));
        }

        @Override
+6 −0
Original line number Diff line number Diff line
@@ -51,4 +51,10 @@

    <!-- maximum animation duration for the icon when entering the starting window -->
    <integer name="max_starting_window_intro_icon_anim_duration">1000</integer>

    <!-- Animation duration when exit starting window: icon going away -->
    <integer name="starting_window_icon_exit_anim_duration">166</integer>

    <!-- Animation duration when exit starting window: reveal app -->
    <integer name="starting_window_app_reveal_anim_duration">333</integer>
</resources>
Loading