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

Commit 3c614ac2 authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Add flag to allow OEMs to disable PIP enter/exit animation." into rvc-dev

parents dfde8e6a ede9a606
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -468,6 +468,9 @@
    <!-- On debuggable builds, alert the user if SystemUI PSS goes over this number (in kb) -->
    <integer name="watch_heap_limit">256000</integer>

    <!-- Animation duration for resizing of PIP when entering/exiting. -->
    <integer name="config_pipResizeAnimationDuration">425</integer>

    <!-- Allow dragging the PIP to a location to close it -->
    <bool name="config_pipEnableDismissDragToEdge">true</bool>

+0 −1
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ public class PipAnimationController {
    private static final float FRACTION_START = 0f;
    private static final float FRACTION_END = 1f;

    public static final int DURATION_DEFAULT_MS = 425;
    public static final int ANIM_TYPE_BOUNDS = 0;
    public static final int ANIM_TYPE_ALPHA = 1;

+7 −5
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.pip;

import static com.android.systemui.pip.PipAnimationController.ANIM_TYPE_ALPHA;
import static com.android.systemui.pip.PipAnimationController.ANIM_TYPE_BOUNDS;
import static com.android.systemui.pip.PipAnimationController.DURATION_DEFAULT_MS;
import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_NONE;
import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_SAME;
import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_FULLSCREEN;
@@ -81,6 +80,7 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
    private final Rect mLastReportedBounds = new Rect();
    private final int mCornerRadius;
    private final Map<IBinder, Rect> mBoundsToRestore = new HashMap<>();
    private final int mEnterExitAnimationDuration;

    // These callbacks are called on the update thread
    private final PipAnimationController.PipAnimationCallback mPipAnimationCallback =
@@ -180,6 +180,8 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
        mPipBoundsHandler = boundsHandler;
        mPipAnimationController = new PipAnimationController(context);
        mCornerRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_corner_radius);
        mEnterExitAnimationDuration = context.getResources()
                .getInteger(R.integer.config_pipResizeAnimationDuration);
    }

    public Handler getUpdateHandler() {
@@ -235,14 +237,14 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
        mBoundsToRestore.put(mToken.asBinder(), currentBounds);
        if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
            scheduleAnimateResizePip(currentBounds, destinationBounds,
                    TRANSITION_DIRECTION_TO_PIP, DURATION_DEFAULT_MS, null);
                    TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, null);
        } else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) {
            mUpdateHandler.post(() -> mPipAnimationController
                    .getAnimator(mLeash, destinationBounds, 0f, 1f)
                    .setTransitionDirection(TRANSITION_DIRECTION_TO_PIP)
                    .setCornerRadius(mCornerRadius)
                    .setPipAnimationCallback(mPipAnimationCallback)
                    .setDuration(DURATION_DEFAULT_MS)
                    .setDuration(mEnterExitAnimationDuration)
                    .start());
            mOneShotAnimationType = ANIM_TYPE_BOUNDS;
        } else {
@@ -260,7 +262,7 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
        }
        final Rect boundsToRestore = mBoundsToRestore.remove(mToken.asBinder());
        scheduleAnimateResizePip(mLastReportedBounds, boundsToRestore,
                TRANSITION_DIRECTION_TO_FULLSCREEN, DURATION_DEFAULT_MS, null);
                TRANSITION_DIRECTION_TO_FULLSCREEN, mEnterExitAnimationDuration, null);
        mInPip = false;
    }

@@ -278,7 +280,7 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
        final Rect destinationBounds = mPipBoundsHandler.getDestinationBounds(
                getAspectRatioOrDefault(newParams), null /* bounds */);
        Objects.requireNonNull(destinationBounds, "Missing destination bounds");
        scheduleAnimateResizePip(destinationBounds, DURATION_DEFAULT_MS, null);
        scheduleAnimateResizePip(destinationBounds, mEnterExitAnimationDuration, null);
    }

    /**
+5 −3
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import static android.app.ActivityTaskManager.INVALID_STACK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;

import static com.android.systemui.pip.PipAnimationController.DURATION_DEFAULT_MS;

import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityTaskManager;
@@ -136,6 +134,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    private String[] mLastPackagesResourceGranted;
    private PipNotification mPipNotification;
    private ParceledListSlice mCustomActions;
    private int mResizeAnimationDuration;

    // Used to calculate the movement bounds
    private final DisplayInfo mTmpDisplayInfo = new DisplayInfo();
@@ -238,6 +237,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
        mInitialized = true;
        mContext = context;
        mPipBoundsHandler = pipBoundsHandler;
        mResizeAnimationDuration = context.getResources()
                .getInteger(R.integer.config_pipResizeAnimationDuration);
        mPipTaskOrganizer = new PipTaskOrganizer(mContext, mPipBoundsHandler);
        mPipTaskOrganizer.registerPipTransitionCallback(this);
        mActivityTaskManager = ActivityTaskManager.getService();
@@ -436,7 +437,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
                mCurrentPipBounds = mPipBounds;
                break;
        }
        mPipTaskOrganizer.scheduleAnimateResizePip(mCurrentPipBounds, DURATION_DEFAULT_MS, null);
        mPipTaskOrganizer.scheduleAnimateResizePip(mCurrentPipBounds, mResizeAnimationDuration,
                null);
    }

    /**