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

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

Merge "Add support for singleTaskInstance displays"

parents 957d5392 9e737db3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ package android.app {
    method public void resizeStack(int, android.graphics.Rect) throws java.lang.SecurityException;
    method public void resizeStack(int, android.graphics.Rect, boolean);
    method public void resizeTask(int, android.graphics.Rect);
    method public void setDisplayToSingleTaskInstance(int);
    method public void setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
    method public void setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
    method public void startSystemLockTaskMode(int);
+13 −0
Original line number Diff line number Diff line
@@ -430,4 +430,17 @@ public class ActivityTaskManager {
            e.rethrowFromSystemServer();
        }
    }

    /**
     * Makes the display with the given id a single task instance display. I.e the display can only
     * contain one task.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void setDisplayToSingleTaskInstance(int displayId) {
        try {
            getService().setDisplayToSingleTaskInstance(displayId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@ public class ActivityView extends ViewGroup {
    private final SurfaceControl.Transaction mTmpTransaction = new SurfaceControl.Transaction();
    private Surface mTmpSurface = new Surface();

    /** The ActivityView is only allowed to contain one task. */
    private final boolean mSingleTaskInstance;

    @UnsupportedAppUsage
    public ActivityView(Context context) {
        this(context, null /* attrs */);
@@ -93,7 +96,13 @@ public class ActivityView extends ViewGroup {
    }

    public ActivityView(Context context, AttributeSet attrs, int defStyle) {
        this(context, attrs, defStyle, false /*singleTaskInstance*/);
    }

    public ActivityView(
            Context context, AttributeSet attrs, int defStyle, boolean singleTaskInstance) {
        super(context, attrs, defStyle);
        mSingleTaskInstance = singleTaskInstance;

        mActivityTaskManager = ActivityTaskManager.getService();
        mSurfaceView = new SurfaceView(context);
@@ -379,6 +388,9 @@ public class ActivityView extends ViewGroup {
        try {
            wm.reparentDisplayContent(displayId, mRootSurfaceControl.getHandle());
            wm.dontOverrideDisplayInfo(displayId);
            if (mSingleTaskInstance) {
                mActivityTaskManager.setDisplayToSingleTaskInstance(displayId);
            }
        } catch (RemoteException e) {
            e.rethrowAsRuntimeException();
        }
+6 −0
Original line number Diff line number Diff line
@@ -452,4 +452,10 @@ interface IActivityTaskManager {
     * Clears launch params for given packages.
     */
    void clearLaunchParamsForPackages(in List<String> packageNames);

    /**
     * Makes the display with the given id a single task instance display. I.e the display can only
     * contain one task.
     */
    void setDisplayToSingleTaskInstance(int displayId);
}
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ message ActivityDisplayProto {
    repeated ActivityStackProto stacks = 3;
    optional int32 focused_stack_id = 4;
    optional .com.android.server.wm.IdentifierProto resumed_activity = 5;
    optional bool single_task_instance = 6;
}

message ActivityStackProto {
Loading