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

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

Merge "Incremental repairs to side by side stacks."

parents 53078b25 4cd0c13f
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -100,7 +100,7 @@ public class Am extends BaseCommand {
                "       am to-intent-uri [INTENT]\n" +
                "       am to-intent-uri [INTENT]\n" +
                "       am switch-user <USER_ID>\n" +
                "       am switch-user <USER_ID>\n" +
                "       am stop-user <USER_ID>\n" +
                "       am stop-user <USER_ID>\n" +
                "       am stack create <RELATIVE_STACK_ID> <POSITION> <WEIGHT>\n" +
                "       am stack create <TASK_ID> <RELATIVE_STACK_ID> <POSITION> <WEIGHT>\n" +
                "       am stack movetask <STACK_ID> <TASK_ID> [true|false]\n" +
                "       am stack movetask <STACK_ID> <TASK_ID> [true|false]\n" +
                "       am stack dump\n" +
                "       am stack dump\n" +
                "\n" +
                "\n" +
@@ -186,6 +186,7 @@ public class Am extends BaseCommand {
                "  code until a later explicit switch to it.\n" +
                "  code until a later explicit switch to it.\n" +
                "\n" +
                "\n" +
                "am stack create: create a new stack relative to an existing one.\n" +
                "am stack create: create a new stack relative to an existing one.\n" +
                "   <TASK_ID>: the task to populate the new stack with. Must exist.\n" +
                "   <RELATIVE_STACK_ID>: existing stack's id.\n" +
                "   <RELATIVE_STACK_ID>: existing stack's id.\n" +
                "   <POSITION>: 0: to left of, 1: to right of, 2: above, 3: below\n" +
                "   <POSITION>: 0: to left of, 1: to right of, 2: above, 3: below\n" +
                "   <WEIGHT>: float between 0.2 and 0.8 inclusive.\n" +
                "   <WEIGHT>: float between 0.2 and 0.8 inclusive.\n" +
@@ -1454,6 +1455,8 @@ public class Am extends BaseCommand {
    }
    }


    private void runStackCreate() throws Exception {
    private void runStackCreate() throws Exception {
        String taskIdStr = nextArgRequired();
        int taskId = Integer.valueOf(taskIdStr);
        String relativeToStr = nextArgRequired();
        String relativeToStr = nextArgRequired();
        int relativeTo = Integer.valueOf(relativeToStr);
        int relativeTo = Integer.valueOf(relativeToStr);
        String positionStr = nextArgRequired();
        String positionStr = nextArgRequired();
@@ -1462,8 +1465,8 @@ public class Am extends BaseCommand {
        float weight = Float.valueOf(weightStr);
        float weight = Float.valueOf(weightStr);


        try {
        try {
            int stackId = mAm.createStack(relativeTo, position, weight);
            int stackId = mAm.createStack(taskId, relativeTo, position, weight);
            System.out.println("createStack returned " + stackId + "\n\n");
            System.out.println("createStack returned new stackId=" + stackId + "\n\n");
        } catch (RemoteException e) {
        } catch (RemoteException e) {
        }
        }
    }
    }
+24 −22
Original line number Original line Diff line number Diff line
@@ -108,6 +108,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        attachInterface(this, descriptor);
        attachInterface(this, descriptor);
    }
    }


    @Override
    public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
    public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
            throws RemoteException {
            throws RemoteException {
        switch (code) {
        switch (code) {
@@ -478,14 +479,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            IThumbnailReceiver receiver = receiverBinder != null
            IThumbnailReceiver receiver = receiverBinder != null
                ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
                ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
                : null;
                : null;
            List list = getTasks(maxNum, fl, receiver);
            List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
            reply.writeNoException();
            reply.writeNoException();
            int N = list != null ? list.size() : -1;
            int N = list != null ? list.size() : -1;
            reply.writeInt(N);
            reply.writeInt(N);
            int i;
            int i;
            for (i=0; i<N; i++) {
            for (i=0; i<N; i++) {
                ActivityManager.RunningTaskInfo info =
                ActivityManager.RunningTaskInfo info = list.get(i);
                        (ActivityManager.RunningTaskInfo)list.get(i);
                info.writeToParcel(reply, 0);
                info.writeToParcel(reply, 0);
            }
            }
            return true;
            return true;
@@ -535,14 +535,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            data.enforceInterface(IActivityManager.descriptor);
            data.enforceInterface(IActivityManager.descriptor);
            int maxNum = data.readInt();
            int maxNum = data.readInt();
            int fl = data.readInt();
            int fl = data.readInt();
            List list = getServices(maxNum, fl);
            List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
            reply.writeNoException();
            reply.writeNoException();
            int N = list != null ? list.size() : -1;
            int N = list != null ? list.size() : -1;
            reply.writeInt(N);
            reply.writeInt(N);
            int i;
            int i;
            for (i=0; i<N; i++) {
            for (i=0; i<N; i++) {
                ActivityManager.RunningServiceInfo info =
                ActivityManager.RunningServiceInfo info = list.get(i);
                        (ActivityManager.RunningServiceInfo)list.get(i);
                info.writeToParcel(reply, 0);
                info.writeToParcel(reply, 0);
            }
            }
            return true;
            return true;
@@ -611,10 +610,11 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM


        case CREATE_STACK_TRANSACTION: {
        case CREATE_STACK_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            data.enforceInterface(IActivityManager.descriptor);
            int position = data.readInt();
            int taskId = data.readInt();
            int relativeStackId = data.readInt();
            int relativeStackId = data.readInt();
            int position = data.readInt();
            float weight = data.readFloat();
            float weight = data.readFloat();
            int res = createStack(position, relativeStackId, weight);
            int res = createStack(taskId, relativeStackId, position, weight);
            reply.writeNoException();
            reply.writeNoException();
            reply.writeInt(res);
            reply.writeInt(res);
            return true;
            return true;
@@ -2595,13 +2595,15 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
        reply.recycle();
    }
    }
    @Override
    @Override
    public int createStack(int position, int relativeStackId, float weight) throws RemoteException
    public int createStack(int taskId, int relativeStackId, int position, float weight)
            throws RemoteException
    {
    {
        Parcel data = Parcel.obtain();
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(position);
        data.writeInt(taskId);
        data.writeInt(relativeStackId);
        data.writeInt(relativeStackId);
        data.writeInt(position);
        data.writeFloat(weight);
        data.writeFloat(weight);
        mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
        mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
        reply.readException();
        reply.readException();
+2 −1
Original line number Original line Diff line number Diff line
@@ -115,7 +115,8 @@ public interface IActivityManager extends IInterface {
    public void moveTaskToBack(int task) throws RemoteException;
    public void moveTaskToBack(int task) throws RemoteException;
    public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
    public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
    public void moveTaskBackwards(int task) throws RemoteException;
    public void moveTaskBackwards(int task) throws RemoteException;
    public int createStack(int relativeStackId, int position, float weight) throws RemoteException;
    public int createStack(int taskId, int relativeStackId, int position, float weight)
            throws RemoteException;
    public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
    public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
    public void resizeStack(int stackId, float weight) throws RemoteException;
    public void resizeStack(int stackId, float weight) throws RemoteException;
    public List<StackInfo> getStacks() throws RemoteException;
    public List<StackInfo> getStacks() throws RemoteException;
+4 −1
Original line number Original line Diff line number Diff line
@@ -6265,13 +6265,16 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    }
    @Override
    @Override
    public int createStack(int relativeStackId, int position, float weight) {
    public int createStack(int taskId, int relativeStackId, int position, float weight) {
        synchronized (this) {
        synchronized (this) {
            if (mStackSupervisor.getStack(relativeStackId) == null) {
            if (mStackSupervisor.getStack(relativeStackId) == null) {
                return -1;
                return -1;
            }
            }
            int stackId = mStackSupervisor.createStack();
            int stackId = mStackSupervisor.createStack();
            mWindowManager.createStack(stackId, relativeStackId, position, weight);
            mWindowManager.createStack(stackId, relativeStackId, position, weight);
            if (taskId > 0) {
                moveTaskToStack(taskId, stackId, true);
            }
            return stackId;
            return stackId;
        }
        }
    }
    }
+6 −9
Original line number Original line Diff line number Diff line
@@ -236,13 +236,10 @@ public class ActivityStackSupervisor {
        final ActivityStack stack = task.stack;
        final ActivityStack stack = task.stack;
        if (stack.removeTask(task) && !stack.isHomeStack()) {
        if (stack.removeTask(task) && !stack.isHomeStack()) {
            mStacks.remove(stack);
            mStacks.remove(stack);
            final int oldStackId = stack.mStackId;
            final int stackId = stack.mStackId;
            final int newMainStackId = mService.mWindowManager.removeStack(oldStackId);
            final int nextStackId = mService.mWindowManager.removeStack(stackId);
            if (newMainStackId == HOME_STACK_ID) {
            if (mMainStack.mStackId == stackId) {
                return;
                mMainStack = nextStackId == HOME_STACK_ID ? null : getStack(nextStackId);
            }
            if (mMainStack.mStackId == oldStackId) {
                mMainStack = getStack(newMainStackId);
            }
            }
        }
        }
    }
    }
@@ -1044,8 +1041,8 @@ public class ActivityStackSupervisor {
        if (!r.isHomeActivity) {
        if (!r.isHomeActivity) {
            if (mStacks.size() == 1) {
            if (mStacks.size() == 1) {
                // Time to create the first app stack.
                // Time to create the first app stack.
                int stackId =
                int stackId = mService.createStack(-1, HOME_STACK_ID,
                        mService.createStack(HOME_STACK_ID, StackBox.TASK_STACK_GOES_OVER, 1.0f);
                        StackBox.TASK_STACK_GOES_OVER, 1.0f);
                mMainStack = getStack(stackId);
                mMainStack = getStack(stackId);
            }
            }
            return mMainStack;
            return mMainStack;
Loading