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

Commit 3a39664b authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Added hidden API for specifying launch stack in ActivityOptions"

parents 8190e5dc 854809c0
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -332,10 +332,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        {
            data.enforceInterface(IActivityManager.descriptor);
            final int taskId = data.readInt();
            final int launchStackId = data.readInt();
            final Bundle options =
                    data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
            final int result = startActivityFromRecents(taskId, launchStackId, options);
            final int result = startActivityFromRecents(taskId, options);
            reply.writeNoException();
            reply.writeInt(result);
            return true;
@@ -3088,13 +3087,12 @@ class ActivityManagerProxy implements IActivityManager
        data.recycle();
        return result != 0;
    }
    public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
    public int startActivityFromRecents(int taskId, Bundle options)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(taskId);
        data.writeInt(launchStackId);
        if (options == null) {
            data.writeInt(0);
        } else {
+25 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app;

import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;

import android.content.Context;
import android.content.Intent;
@@ -67,7 +68,8 @@ public class ActivityOptions {
     * The bounds (window size) that the activity should be launched in. Set to null explicitly for
     * full screen. If the key is not found, previous bounds will be preserved.
     * NOTE: This value is ignored on devices that don't have
     * {@link android.content.pm.PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT} enabled.
     * {@link android.content.pm.PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT} or
     * {@link android.content.pm.PackageManager#FEATURE_PICTURE_IN_PICTURE} enabled.
     * @hide
     */
    public static final String KEY_LAUNCH_BOUNDS = "android:activity.launchBounds";
@@ -144,6 +146,12 @@ public class ActivityOptions {
     */
    private static final String KEY_ANIM_SPECS = "android:activity.animSpecs";

    /**
     * The stack id the activity should be launched into.
     * @hide
     */
    private static final String KEY_LAUNCH_STACK_ID = "android.activity.launchStackId";

    /**
     * Where the docked stack should be positioned.
     * @hide
@@ -215,6 +223,7 @@ public class ActivityOptions {
    private int mResultCode;
    private int mExitCoordinatorIndex;
    private PendingIntent mUsageTimeReport;
    private int mLaunchStackId = INVALID_STACK_ID;
    private int mDockCreateMode = DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
    private AppTransitionAnimationSpec mAnimSpecs[];

@@ -754,6 +763,7 @@ public class ActivityOptions {
                mExitCoordinatorIndex = opts.getInt(KEY_EXIT_COORDINATOR_INDEX);
                break;
        }
        mLaunchStackId = opts.getInt(KEY_LAUNCH_STACK_ID, INVALID_STACK_ID);
        mDockCreateMode = opts.getInt(KEY_DOCK_CREATE_MODE, DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT);
        if (opts.containsKey(KEY_ANIM_SPECS)) {
            Parcelable[] specs = opts.getParcelableArray(KEY_ANIM_SPECS);
@@ -901,7 +911,19 @@ public class ActivityOptions {
    }

    /** @hide */
    public int getDockCreateMode() { return mDockCreateMode; }
    public int getLaunchStackId() {
        return mLaunchStackId;
    }

    /** @hide */
    public void setLaunchStackId(int launchStackId) {
        mLaunchStackId = launchStackId;
    }

    /** @hide */
    public int getDockCreateMode() {
        return mDockCreateMode;
    }

    /** @hide */
    public void setDockCreateMode(int dockCreateMode) {
@@ -1049,6 +1071,7 @@ public class ActivityOptions {
                b.putInt(KEY_EXIT_COORDINATOR_INDEX, mExitCoordinatorIndex);
                break;
        }
        b.putInt(KEY_LAUNCH_STACK_ID, mLaunchStackId);
        b.putInt(KEY_DOCK_CREATE_MODE, mDockCreateMode);
        if (mAnimSpecs != null) {
            b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public interface IActivityManager extends IInterface {
            int userId) throws RemoteException;
    public boolean startNextMatchingActivity(IBinder callingActivity,
            Intent intent, Bundle options) throws RemoteException;
    public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
    public int startActivityFromRecents(int taskId, Bundle options)
            throws RemoteException;
    public boolean finishActivity(IBinder token, int code, Intent data, int finishTask)
            throws RemoteException;
+3 −3
Original line number Diff line number Diff line
@@ -310,7 +310,8 @@ public class SystemServicesProxy {
        try {
            final ActivityOptions options = ActivityOptions.makeBasic();
            options.setDockCreateMode(createMode);
            mIam.startActivityFromRecents(taskId, DOCKED_STACK_ID, options.toBundle());
            options.setLaunchStackId(DOCKED_STACK_ID);
            mIam.startActivityFromRecents(taskId, options.toBundle());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
@@ -836,8 +837,7 @@ public class SystemServicesProxy {
            ActivityOptions options) {
        if (mIam != null) {
            try {
                mIam.startActivityFromRecents(
                        taskId, INVALID_STACK_ID, options == null ? null : options.toBundle());
                mIam.startActivityFromRecents(taskId, options == null ? null : options.toBundle());
                return true;
            } catch (Exception e) {
                Log.e(TAG, context.getString(R.string.recents_launch_error_message, taskName), e);
+1 −1
Original line number Diff line number Diff line
@@ -746,7 +746,7 @@ class NavigationBarApps extends LinearLayout
        // Launch or bring the activity to front.
        final IActivityManager iAm = ActivityManagerNative.getDefault();
        try {
            iAm.startActivityFromRecents(taskPersistentId, INVALID_STACK_ID, null /* options */);
            iAm.startActivityFromRecents(taskPersistentId, null /* options */);
        } catch (RemoteException e) {
            Slog.e(TAG, "Exception when activating a recent task", e);
        } catch (IllegalArgumentException e) {
Loading