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

Commit 18f85304 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Convert API refs to StackBox from ActivityStack."

parents 6b23af09 5a449154
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1485,7 +1485,7 @@ public class Am extends BaseCommand {
        } else if (op.equals("movetask")) {
            runStackMoveTask();
        } else if (op.equals("resize")) {
            runStackResize();
            runStackBoxResize();
        } else if (op.equals("boxes")) {
            runStackBoxes();
        } else {
@@ -1533,14 +1533,14 @@ public class Am extends BaseCommand {
        }
    }

    private void runStackResize() throws Exception {
        String stackIdStr = nextArgRequired();
        int stackId = Integer.valueOf(stackIdStr);
    private void runStackBoxResize() throws Exception {
        String stackBoxIdStr = nextArgRequired();
        int stackBoxId = Integer.valueOf(stackBoxIdStr);
        String weightStr = nextArgRequired();
        float weight = Float.valueOf(weightStr);

        try {
            mAm.resizeStack(stackId, weight);
            mAm.resizeStackBox(stackBoxId, weight);
        } catch (RemoteException e) {
        }
    }
+6 −28
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.app;

import android.app.ActivityManager.StackBoxInfo;
import android.app.ActivityManager.StackInfo;
import android.content.ComponentName;
import android.content.IIntentReceiver;
import android.content.IIntentSender;
@@ -634,21 +633,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM

        case RESIZE_STACK_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            int stackId = data.readInt();
            int stackBoxId = data.readInt();
            float weight = data.readFloat();
            resizeStack(stackId, weight);
            resizeStackBox(stackBoxId, weight);
            reply.writeNoException();
            return true;
        }

        case GET_STACKS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            List<ActivityManager.StackInfo> list = getStacks();
            reply.writeNoException();
            reply.writeTypedList(list);
            return true;
        }

        case GET_STACK_BOXES_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            List<StackBoxInfo> list = getStackBoxes();
@@ -2622,14 +2613,14 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }
    @Override
    public int createStack(int taskId, int relativeStackId, int position, float weight)
    public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
            throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(taskId);
        data.writeInt(relativeStackId);
        data.writeInt(relativeStackBoxId);
        data.writeInt(position);
        data.writeFloat(weight);
        mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
@@ -2654,12 +2645,12 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }
    @Override
    public void resizeStack(int stackId, float weight) throws RemoteException
    public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(stackId);
        data.writeInt(stackBoxId);
        data.writeFloat(weight);
        mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
        reply.readException();
@@ -2667,19 +2658,6 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }
    @Override
    public List<StackInfo> getStacks() throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(GET_STACKS_TRANSACTION, data, reply, 0);
        reply.readException();
        ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
        data.recycle();
        reply.recycle();
        return list;
    }
    @Override
    public List<StackBoxInfo> getStackBoxes() throws RemoteException
    {
        Parcel data = Parcel.obtain();
+3 −6
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.app;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.ActivityManager.StackBoxInfo;
import android.app.ActivityManager.StackInfo;
import android.content.ComponentName;
import android.content.ContentProviderNative;
import android.content.IContentProvider;
@@ -116,12 +115,11 @@ public interface IActivityManager extends IInterface {
    public void moveTaskToBack(int task) throws RemoteException;
    public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
    public void moveTaskBackwards(int task) throws RemoteException;
    public int createStack(int taskId, int relativeStackId, int position, float weight)
    public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
            throws RemoteException;
    public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
    public void resizeStack(int stackId, float weight) throws RemoteException;
    public void resizeStackBox(int stackBoxId, float weight) throws RemoteException;
    public List<StackBoxInfo> getStackBoxes() throws RemoteException;
    public List<StackInfo> getStacks() throws RemoteException;
    public void setFocusedStack(int stackId) throws RemoteException;
    public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException;
    /* oneway */
@@ -663,7 +661,6 @@ public interface IActivityManager extends IInterface {
    int CREATE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+167;
    int MOVE_TASK_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+168;
    int RESIZE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+169;
    int GET_STACKS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170;
    int GET_STACK_BOXES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170;
    int SET_FOCUSED_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+171;
    int GET_STACK_BOXES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+172;
}
+14 −17
Original line number Diff line number Diff line
@@ -5687,6 +5687,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    @Override
    public void revokeUriPermission(IApplicationThread caller, Uri uri,
            int modeFlags) {
        enforceNotIsolatedCaller("revokeUriPermission");
@@ -5919,6 +5920,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    @Override
    public void showWaitingForDebugger(IApplicationThread who, boolean waiting) {
        synchronized (this) {
            ProcessRecord app =
@@ -5933,6 +5935,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    @Override
    public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) {
        final long homeAppMem = mProcessList.getMemLevel(ProcessList.HOME_APP_ADJ);
        final long hiddenAppMem = mProcessList.getMemLevel(ProcessList.HIDDEN_APP_MIN_ADJ);
@@ -6319,17 +6322,12 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    @Override
    public int createStack(int taskId, int relativeStackId, int position, float weight) {
        if (DEBUG_STACK) Slog.d(TAG, "createStack: taskId=" + taskId + " relStackId=" +
                relativeStackId + " position=" + position + " weight=" + weight);
    public int createStack(int taskId, int relativeStackBoxId, int position, float weight) {
        if (DEBUG_STACK) Slog.d(TAG, "createStack: taskId=" + taskId + " relStackBoxId=" +
                relativeStackBoxId + " position=" + position + " weight=" + weight);
        synchronized (this) {
            if (mStackSupervisor.getStack(relativeStackId) == null) {
                if (DEBUG_STACK) Slog.d(TAG, "createStack: invalide relativeStackId=" +
                        relativeStackId);
                return -1;
            }
            int stackId = mStackSupervisor.createStack();
            mWindowManager.createStack(stackId, relativeStackId, position, weight);
            mWindowManager.createStack(stackId, relativeStackBoxId, position, weight);
            if (taskId > 0) {
                moveTaskToStack(taskId, stackId, true);
            }
@@ -6349,12 +6347,11 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    @Override
    public void resizeStack(int stackId, float weight) {
        mWindowManager.resizeStack(stackId, weight);
    public void resizeStackBox(int stackBoxId, float weight) {
        mWindowManager.resizeStackBox(stackBoxId, weight);
    }
    @Override
    public List<StackInfo> getStacks() {
    private ArrayList<StackInfo> getStacks() {
        synchronized (this) {
            ArrayList<ActivityManager.StackInfo> list = new ArrayList<ActivityManager.StackInfo>();
            ArrayList<ActivityStack> stacks = mStackSupervisor.getStacks();
+10 −9
Original line number Diff line number Diff line
@@ -203,11 +203,11 @@ class DisplayContent {
    }

    /** Refer to {@link WindowManagerService#createStack(int, int, int, float)} */
    TaskStack createStack(WindowManagerService service, int stackId, int relativeStackId,
    TaskStack createStack(WindowManagerService service, int stackId, int relativeStackBoxId,
            int position, float weight) {
        TaskStack newStack = null;
        if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackId="
                + relativeStackId + " position=" + position + " weight=" + weight);
        if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackBoxId="
                + relativeStackBoxId + " position=" + position + " weight=" + weight);
        if (mStackBoxes.isEmpty()) {
            if (stackId != HOME_STACK_ID) {
                throw new IllegalArgumentException("createStack: First stackId not "
@@ -226,7 +226,7 @@ class DisplayContent {
                if (position == StackBox.TASK_STACK_GOES_OVER
                        || position == StackBox.TASK_STACK_GOES_UNDER) {
                    // Position indicates a new box is added at top level only.
                    if (box.contains(relativeStackId)) {
                    if (box.contains(relativeStackBoxId)) {
                        StackBox newBox = new StackBox(service, this, null);
                        newStack = new TaskStack(service, stackId, this);
                        newStack.mStackBox = newBox;
@@ -239,14 +239,14 @@ class DisplayContent {
                    }
                } else {
                    // Remaining position values indicate a box must be split.
                    newStack = box.split(stackId, relativeStackId, position, weight);
                    newStack = box.split(stackId, relativeStackBoxId, position, weight);
                    if (newStack != null) {
                        break;
                    }
                }
            }
            if (stackBoxNdx < 0) {
                throw new IllegalArgumentException("createStack: stackId " + relativeStackId
                throw new IllegalArgumentException("createStack: stackBoxId " + relativeStackBoxId
                        + " not found.");
            }
        }
@@ -256,11 +256,12 @@ class DisplayContent {
        return newStack;
    }

    /** Refer to {@link WindowManagerService#resizeStack(int, float)} */
    boolean resizeStack(int stackId, float weight) {
    /** Refer to {@link WindowManagerService#resizeStackBox(int, float)} */
    boolean resizeStack(int stackBoxId, float weight) {
        for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
            final StackBox box = mStackBoxes.get(stackBoxNdx);
            if (box.resize(stackId, weight)) {
            if (box.resize(stackBoxId, weight)) {
                layoutNeeded = true;
                return true;
            }
        }
Loading