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

Commit aa5a7a4a authored by Patrick Williams's avatar Patrick Williams
Browse files

Add a test api for setting launch cookies

This will be used in a future CTS test along with a new MediaProjection
test api to test screen sharing tasks.

Bug: 304574518
Test: presubmits
Change-Id: I77f815a217d54a2c2843436f194f018ce57b8e8e
parent 73f5cd20
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ package android.app {
    method public void setEligibleForLegacyPermissionPrompt(boolean);
    method public static void setExitTransitionTimeout(long);
    method public void setLaunchActivityType(int);
    method public void setLaunchCookie(@NonNull android.app.ActivityOptions.LaunchCookie);
    method public void setLaunchTaskDisplayAreaFeatureId(int);
    method public void setLaunchWindowingMode(int);
    method public void setLaunchedFromBubble(boolean);
@@ -193,6 +194,10 @@ package android.app {
    method public void setTaskOverlay(boolean, boolean);
  }

  public static final class ActivityOptions.LaunchCookie {
    ctor public ActivityOptions.LaunchCookie();
  }

  public static interface ActivityOptions.OnAnimationFinishedListener {
    method public void onAnimationFinished(long);
  }
+34 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.ExitTransitionCoordinator.ActivityExitTransitionCallbacks;
@@ -41,6 +42,7 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Rect;
import android.hardware.HardwareBuffer;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -1920,6 +1922,38 @@ public class ActivityOptions extends ComponentOptions {
        return mApplyNoUserActionFlagForShortcut;
    }

    /**
     * An opaque token to use with {@link #setLaunchCookie(LaunchCookie)}.
     *
     * @hide
     */
    @SuppressLint("UnflaggedApi")
    @TestApi
    public static final class LaunchCookie {
        /** @hide */
        public final IBinder binder = new Binder();

        /** @hide */
        @SuppressLint("UnflaggedApi")
        @TestApi
        public LaunchCookie() {}
    }

    /**
     * Sets a launch cookie that can be used to track the {@link Activity} and task that are
     * launched as a result of this option. If the launched activity is a trampoline that starts
     * another activity immediately, the cookie will be transferred to the next activity.
     *
     * @param launchCookie a developer specified identifier for a specific task.
     *
     * @hide
     */
    @SuppressLint("UnflaggedApi")
    @TestApi
    public void setLaunchCookie(@NonNull LaunchCookie launchCookie) {
        setLaunchCookie(launchCookie.binder);
    }

    /**
     * Sets a launch cookie that can be used to track the activity and task that are launch as a
     * result of this option. If the launched activity is a trampoline that starts another activity