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

Commit b5c1f3b4 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Only allow activities to move to full screen stack."

parents 1097fa88 411c06fb
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.Rect;
import android.media.AudioManager;
import android.media.session.MediaController;
import android.net.Uri;
@@ -2807,17 +2806,15 @@ public class Activity extends ContextThemeWrapper


    /**
     * Called to move the window and its activity/task to a different stack container.
     * For example, a window can move between
     * {@link android.app.ActivityManager.StackId#FULLSCREEN_WORKSPACE_STACK_ID} stack and
     * {@link android.app.ActivityManager.StackId#FREEFORM_WORKSPACE_STACK_ID} stack.
     * Moves the activity from
     * {@link android.app.ActivityManager.StackId#FREEFORM_WORKSPACE_STACK_ID} to
     * {@link android.app.ActivityManager.StackId#FULLSCREEN_WORKSPACE_STACK_ID} stack.
     *
     * @param stackId stack Id to change to.
     * @hide
     */
    @Override
    public void changeWindowStack(int stackId) throws RemoteException {
        ActivityManagerNative.getDefault().moveActivityToStack(mToken, stackId);
    public void exitFreeformMode() throws RemoteException {
        ActivityManagerNative.getDefault().exitFreeformMode(mToken);
    }

    /** Returns the current stack Id for the window.
+4 −6
Original line number Diff line number Diff line
@@ -2752,11 +2752,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            reply.writeInt(stackId);
            return true;
        }
        case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
        case EXIT_FREEFORM_MODE_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            IBinder token = data.readStrongBinder();
            int stackId = data.readInt();
            moveActivityToStack(token, stackId);
            exitFreeformMode(token);
            reply.writeNoException();
            return true;
        }
@@ -6457,13 +6456,12 @@ class ActivityManagerProxy implements IActivityManager
    }

    @Override
    public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
    public void exitFreeformMode(IBinder token) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeStrongBinder(token);
        data.writeInt(stackId);
        mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
        mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
        reply.recycle();
+2 −2
Original line number Diff line number Diff line
@@ -564,7 +564,7 @@ public interface IActivityManager extends IInterface {
    public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException;

    public int getActivityStackId(IBinder token) throws RemoteException;
    public void moveActivityToStack(IBinder token, int stackId) throws RemoteException;
    public void exitFreeformMode(IBinder token) throws RemoteException;

    public void suppressResizeConfigChanges(boolean suppress) throws RemoteException;

@@ -933,7 +933,7 @@ public interface IActivityManager extends IInterface {
    int STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 341;
    int POSITION_TASK_IN_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 342;
    int GET_ACTIVITY_STACK_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 343;
    int MOVE_ACTIVITY_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 344;
    int EXIT_FREEFORM_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 344;
    int REPORT_SIZE_CONFIGURATIONS = IBinder.FIRST_CALL_TRANSACTION + 345;
    int MOVE_TASK_TO_DOCKED_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 346;
    int SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 347;
+4 −7
Original line number Diff line number Diff line
@@ -571,14 +571,11 @@ public abstract class Window {
    /** @hide */
    public interface WindowControllerCallback {
        /**
         * Called to move the window and its activity/task to a different stack container.
         * For example, a window can move between
         * {@link android.app.ActivityManager.StackId#FULLSCREEN_WORKSPACE_STACK_ID} stack and
         * {@link android.app.ActivityManager.StackId#FREEFORM_WORKSPACE_STACK_ID} stack.
         *
         * @param stackId stack Id to change to.
         * Moves the activity from
         * {@link android.app.ActivityManager.StackId#FREEFORM_WORKSPACE_STACK_ID} to
         * {@link android.app.ActivityManager.StackId#FULLSCREEN_WORKSPACE_STACK_ID} stack.
         */
        void changeWindowStack(int stackId) throws RemoteException;
        void exitFreeformMode() throws RemoteException;

        /** Returns the current stack Id for the window. */
        int getWindowStackId() throws RemoteException;
+1 −3
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.internal.widget;

import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
@@ -351,7 +349,7 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
        Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback();
        if (callback != null) {
            try {
                callback.changeWindowStack(FULLSCREEN_WORKSPACE_STACK_ID);
                callback.exitFreeformMode();
            } catch (RemoteException ex) {
                Log.e(TAG, "Cannot change task workspace.");
            }
Loading