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

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

Merge "Support for activity to opt-in/out of resizeable/multi-window support."

parents 95a8a1cf 9d3de4cf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1014,6 +1014,7 @@ package android {
    field public static final int resizeClip = 16843983; // 0x10104cf
    field public static final int resizeMode = 16843619; // 0x1010363
    field public static final int resizeable = 16843405; // 0x101028d
    field public static final int resizeableActivity = 16843995; // 0x10104db
    field public static final int resource = 16842789; // 0x1010025
    field public static final int restoreAnyVersion = 16843450; // 0x10102ba
    field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
@@ -8431,6 +8432,7 @@ package android.content.pm {
    field public java.lang.String parentActivityName;
    field public java.lang.String permission;
    field public int persistableMode;
    field public boolean resizeable;
    field public int screenOrientation;
    field public int softInputMode;
    field public java.lang.String targetActivity;
+2 −0
Original line number Diff line number Diff line
@@ -1086,6 +1086,7 @@ package android {
    field public static final int resizeClip = 16843983; // 0x10104cf
    field public static final int resizeMode = 16843619; // 0x1010363
    field public static final int resizeable = 16843405; // 0x101028d
    field public static final int resizeableActivity = 16843995; // 0x10104db
    field public static final int resource = 16842789; // 0x1010025
    field public static final int restoreAnyVersion = 16843450; // 0x10102ba
    field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
@@ -8639,6 +8640,7 @@ package android.content.pm {
    field public java.lang.String parentActivityName;
    field public java.lang.String permission;
    field public int persistableMode;
    field public boolean resizeable;
    field public int screenOrientation;
    field public int softInputMode;
    field public java.lang.String targetActivity;
+35 −6
Original line number Diff line number Diff line
@@ -134,8 +134,9 @@ public class Am extends BaseCommand {
                "       am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" +
                "       am stack list\n" +
                "       am stack info <STACK_ID>\n" +
                "       am lock-task <TASK_ID>\n" +
                "       am lock-task stop\n" +
                "       am task lock <TASK_ID>\n" +
                "       am task lock stop\n" +
                "       am task resizeable <TASK_ID> [true|false]\n" +
                "       am get-config\n" +
                "\n" +
                "am start: start an Activity.  Options are:\n" +
@@ -250,7 +251,11 @@ public class Am extends BaseCommand {
                "\n" +
                "am stack info: display the information about activity stack <STACK_ID>.\n" +
                "\n" +
                "am lock-task: bring <TASK_ID> to the front and don't allow other tasks to run\n" +
                "am task lock: bring <TASK_ID> to the front and don't allow other tasks to run\n" +
                "\n" +
                "am task lock stop: end the current task lock\n" +
                "\n" +
                "am task resizeable: change if <TASK_ID> is resizeable (true) or not (false).\n" +
                "\n" +
                "am get-config: retrieve the configuration and any recent configurations\n" +
                "  of the device\n" +
@@ -351,8 +356,8 @@ public class Am extends BaseCommand {
            runStopUser();
        } else if (op.equals("stack")) {
            runStack();
        } else if (op.equals("lock-task")) {
            runLockTask();
        } else if (op.equals("task")) {
            runTask();
        } else if (op.equals("get-config")) {
            runGetConfig();
        } else {
@@ -1778,7 +1783,19 @@ public class Am extends BaseCommand {
        }
    }

    private void runLockTask() throws Exception {
    private void runTask() throws Exception {
        String op = nextArgRequired();
        if (op.equals("lock")) {
            runTaskLock();
        } else if (op.equals("resizeable")) {
            runTaskResizeable();
        } else {
            showError("Error: unknown command '" + op + "'");
            return;
        }
    }

    private void runTaskLock() throws Exception {
        String taskIdStr = nextArgRequired();
        try {
            if (taskIdStr.equals("stop")) {
@@ -1793,6 +1810,18 @@ public class Am extends BaseCommand {
        }
    }

    private void runTaskResizeable() throws Exception {
        final String taskIdStr = nextArgRequired();
        final int taskId = Integer.valueOf(taskIdStr);
        final String resizeableStr = nextArgRequired();
        final boolean resizeable = Boolean.valueOf(resizeableStr);

        try {
            mAm.setTaskResizeable(taskId, resizeable);
        } catch (RemoteException e) {
        }
    }

    private List<Configuration> getRecentConfigurations(int days) {
        IUsageStatsManager usm = IUsageStatsManager.Stub.asInterface(ServiceManager.getService(
                    Context.USAGE_STATS_SERVICE));
+22 −0
Original line number Diff line number Diff line
@@ -2300,6 +2300,15 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case SET_TASK_RESIZEABLE_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            int taskId = data.readInt();
            boolean resizeable = (data.readInt() == 1) ? true : false;
            setTaskResizeable(taskId, resizeable);
            reply.writeNoException();
            return true;
        }

        case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            String filename = data.readString();
@@ -5401,6 +5410,19 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    @Override
    public void setTaskResizeable(int taskId, boolean resizeable) throws  RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(taskId);
        data.writeInt(resizeable ? 1 : 0);
        mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
        reply.readException();
        data.recycle();
        reply.recycle();
    }

    @Override
    public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
        Parcel data = Parcel.obtain();
+2 −0
Original line number Diff line number Diff line
@@ -460,6 +460,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 Bitmap getTaskDescriptionIcon(String filename) throws RemoteException;

    public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions opts)
@@ -802,4 +803,5 @@ public interface IActivityManager extends IInterface {
    int NOTIFY_CLEARTEXT_NETWORK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+280;
    int CREATE_STACK_ON_DISPLAY = IBinder.FIRST_CALL_TRANSACTION+281;
    int GET_FOCUSED_STACK_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+282;
    int SET_TASK_RESIZEABLE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+283;
}
Loading