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

Commit 6fbb12d2 authored by Issei Suzuki's avatar Issei Suzuki Committed by Automerger Merge Worker
Browse files

Merge "Fix flicker when starting an activity from Recents." into sc-dev am: c6fa4e98

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13473993

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4a7faceb95345b35a8ed68c189f8041227dec91e
parents a1813197 c6fa4e98
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ package android {
    field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
    field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
    field public static final String RESET_APP_ERRORS = "android.permission.RESET_APP_ERRORS";
    field public static final String START_TASKS_FROM_RECENTS = "android.permission.START_TASKS_FROM_RECENTS";
    field public static final String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
    field public static final String TEST_BIOMETRIC = "android.permission.TEST_BIOMETRIC";
    field public static final String TEST_MANAGE_ROLLBACKS = "android.permission.TEST_MANAGE_ROLLBACKS";
@@ -119,6 +120,7 @@ package android.app {

  public class ActivityOptions {
    method @NonNull public static android.app.ActivityOptions makeCustomAnimation(@NonNull android.content.Context, int, int, @Nullable android.os.Handler, @Nullable android.app.ActivityOptions.OnAnimationStartedListener, @Nullable android.app.ActivityOptions.OnAnimationFinishedListener);
    method @NonNull @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS) public static android.app.ActivityOptions makeCustomTaskAnimation(@NonNull android.content.Context, int, int, @Nullable android.os.Handler, @Nullable android.app.ActivityOptions.OnAnimationStartedListener, @Nullable android.app.ActivityOptions.OnAnimationFinishedListener);
    method public static void setExitTransitionTimeout(long);
    method public void setLaunchActivityType(int);
    method public void setLaunchTaskId(int);
+49 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app;

import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.Display.INVALID_DISPLAY;
@@ -310,6 +311,9 @@ public class ActivityOptions {
    private static final String KEY_REMOTE_TRANSITION =
            "android:activity.remoteTransition";

    private static final String KEY_OVERRIDE_TASK_TRANSITION =
            "android:activity.overrideTaskTransition";

    /**
     * @see #setLaunchCookie
     * @hide
@@ -393,6 +397,7 @@ public class ActivityOptions {
    private RemoteAnimationAdapter mRemoteAnimationAdapter;
    private IBinder mLaunchCookie;
    private IRemoteTransition mRemoteTransition;
    private boolean mOverrideTaskTransition;

    /**
     * Create an ActivityOptions specifying a custom animation to run when
@@ -475,6 +480,40 @@ public class ActivityOptions {
        return opts;
    }

    /**
     * Create an ActivityOptions specifying a custom animation to run when the activity in the
     * different task is displayed.
     *
     * @param context Who is defining this.  This is the application that the
     * animation resources will be loaded from.
     * @param enterResId A resource ID of the animation resource to use for
     * the incoming activity.  Use 0 for no animation.
     * @param exitResId A resource ID of the animation resource to use for
     * the outgoing activity.  Use 0 for no animation.
     * @param handler If <var>listener</var> is non-null this must be a valid
     * Handler on which to dispatch the callback; otherwise it should be null.
     * @param startedListener Optional OnAnimationStartedListener to find out when the
     * requested animation has started running.  If for some reason the animation
     * is not executed, the callback will happen immediately.
     * @param finishedListener Optional OnAnimationFinishedListener when the animation
     * has finished running.
     *
     * @return Returns a new ActivityOptions object that you can use to
     * supply these options as the options Bundle when starting an activity.
     * @hide
     */
    @RequiresPermission(START_TASKS_FROM_RECENTS)
    @TestApi
    public static @NonNull ActivityOptions makeCustomTaskAnimation(@NonNull Context context,
            int enterResId, int exitResId, @Nullable Handler handler,
            @Nullable OnAnimationStartedListener startedListener,
            @Nullable OnAnimationFinishedListener finishedListener) {
        ActivityOptions opts = makeCustomAnimation(context, enterResId, exitResId, handler,
                startedListener, finishedListener);
        opts.mOverrideTaskTransition = true;
        return opts;
    }

    /**
     * Creates an ActivityOptions specifying a custom animation to run in place on an existing
     * activity.
@@ -1107,6 +1146,7 @@ public class ActivityOptions {
        mLaunchCookie = opts.getBinder(KEY_LAUNCH_COOKIE);
        mRemoteTransition = IRemoteTransition.Stub.asInterface(opts.getBinder(
                KEY_REMOTE_TRANSITION));
        mOverrideTaskTransition = opts.getBoolean(KEY_OVERRIDE_TASK_TRANSITION);
    }

    /**
@@ -1561,6 +1601,12 @@ public class ActivityOptions {
        return mLaunchCookie;
    }


    /** @hide */
    public boolean getOverrideTaskTransition() {
        return mOverrideTaskTransition;
    }

    /**
     * Update the current values in this ActivityOptions from those supplied
     * in <var>otherOptions</var>.  Any values
@@ -1789,6 +1835,9 @@ public class ActivityOptions {
        if (mRemoteTransition != null) {
            b.putBinder(KEY_REMOTE_TRANSITION, mRemoteTransition.asBinder());
        }
        if (mOverrideTaskTransition) {
            b.putBoolean(KEY_OVERRIDE_TASK_TRANSITION, mOverrideTaskTransition);
        }
        return b;
    }

+1 −1
Original line number Diff line number Diff line
@@ -2539,7 +2539,7 @@
    <permission android:name="android.permission.REAL_GET_TASKS"
        android:protectionLevel="signature|privileged" />

    <!-- Allows an application to start a task from a ActivityManager#RecentTaskInfo.
    <!-- @TestApi Allows an application to start a task from a ActivityManager#RecentTaskInfo.
         @hide -->
    <permission android:name="android.permission.START_TASKS_FROM_RECENTS"
        android:protectionLevel="signature|privileged|recents" />
+5 −1
Original line number Diff line number Diff line
@@ -72,9 +72,13 @@ public abstract class ActivityOptionsCompat {
        return ActivityOptions.makeRemoteTransition(remoteTransition.getTransition());
    }

    /**
     * Returns ActivityOptions for overriding task transition animation.
     */
    public static ActivityOptions makeCustomAnimation(Context context, int enterResId,
            int exitResId, final Runnable callback, final Handler callbackHandler) {
        return ActivityOptions.makeCustomAnimation(context, enterResId, exitResId, callbackHandler,
        return ActivityOptions.makeCustomTaskAnimation(context, enterResId, exitResId,
                callbackHandler,
                new ActivityOptions.OnAnimationStartedListener() {
                    @Override
                    public void onAnimationStarted() {
+2 −1
Original line number Diff line number Diff line
@@ -975,7 +975,8 @@ class ActivityClientController extends IActivityClientController.Stub {
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r != null && r.isState(Task.ActivityState.RESUMED, Task.ActivityState.PAUSING)) {
                r.mDisplayContent.mAppTransition.overridePendingAppTransition(
                        packageName, enterAnim, exitAnim, null, null);
                        packageName, enterAnim, exitAnim, null, null,
                        r.mOverrideTaskTransition);
            }
        }
        Binder.restoreCallingIdentity(origId);
Loading