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

Commit 87b21722 authored by Chong Zhang's avatar Chong Zhang
Browse files

Change resizeTask's parameter resizedByUser to constants

to indicate who initiated the resize, or if the resize should be forced.

Change-Id: Ic7021f76bec677027cbf27deeb63f92ea911a75c
parent 9e6b0912
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
package com.android.commands.am;

import static android.app.ActivityManager.DOCKED_STACK_ID;
import static android.app.ActivityManager.RESIZE_MODE_SYSTEM;
import static android.app.ActivityManager.RESIZE_MODE_USER;

import android.app.ActivityManager;
import android.app.ActivityManager.StackInfo;
@@ -2271,7 +2273,8 @@ public class Am extends BaseCommand {

    private void taskResize(int taskId, Rect bounds, int delay_ms, boolean pretendUserResize) {
        try {
            mAm.resizeTask(taskId, bounds, pretendUserResize);
            final int resizeMode = pretendUserResize ? RESIZE_MODE_USER : RESIZE_MODE_SYSTEM;
            mAm.resizeTask(taskId, bounds, resizeMode);
            Thread.sleep(delay_ms);
        } catch (RemoteException e) {
            System.err.println("Error changing task bounds: " + e);
+23 −0
Original line number Diff line number Diff line
@@ -468,6 +468,29 @@ public class ActivityManager {
     */
    public static final int DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT = 1;


    /**
     * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates
     * that the resize is from the window manager (instead of the user).
     * @hide
     */
    public static final int RESIZE_MODE_SYSTEM = 0;

    /**
     * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates
     * that the resize is initiated by the user (most likely via a drag action on the
     * window's edge or corner).
     * @hide
     */
    public static final int RESIZE_MODE_USER   = 1;

    /**
     * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates
     * that the resize should be performed even if the bounds appears unchanged.
     * @hide
     */
    public static final int RESIZE_MODE_FORCED = 2;

    /** @hide */
    public int getFrontActivityScreenCompatMode() {
        try {
+4 −4
Original line number Diff line number Diff line
@@ -2452,9 +2452,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        case RESIZE_TASK_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            int taskId = data.readInt();
            final boolean resizedByUser = data.readInt() == 1;
            int resizeMode = data.readInt();
            Rect r = Rect.CREATOR.createFromParcel(data);
            resizeTask(taskId, r, resizedByUser);
            resizeTask(taskId, r, resizeMode);
            reply.writeNoException();
            return true;
        }
@@ -5900,13 +5900,13 @@ class ActivityManagerProxy implements IActivityManager
    }

    @Override
    public void resizeTask(int taskId, Rect r, boolean resizedByUser) throws RemoteException
    public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(taskId);
        data.writeInt(resizedByUser ? 1 : 0);
        data.writeInt(resizeMode);
        r.writeToParcel(data, 0);
        mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
        reply.readException();
+1 −1
Original line number Diff line number Diff line
@@ -491,7 +491,7 @@ public interface IActivityManager extends IInterface {
    public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
            throws RemoteException;
    public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException;
    public void resizeTask(int taskId, Rect bounds, boolean resizedByUser) throws RemoteException;
    public void resizeTask(int taskId, Rect bounds, int resizeMode) throws RemoteException;

    public Rect getTaskBounds(int taskId) throws RemoteException;
    public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException;
+2 −2
Original line number Diff line number Diff line
@@ -8671,7 +8671,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    @Override
    public void resizeTask(int taskId, Rect bounds, boolean resizedByUser) {
    public void resizeTask(int taskId, Rect bounds, int resizeMode) {
        enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,
                "resizeTask()");
        long ident = Binder.clearCallingIdentity();
@@ -8682,7 +8682,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                    Slog.w(TAG, "resizeTask: taskId=" + taskId + " not found");
                    return;
                }
                mStackSupervisor.resizeTaskLocked(task, bounds, resizedByUser);
                mStackSupervisor.resizeTaskLocked(task, bounds, resizeMode);
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
Loading