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

Commit caf2b811 authored by Winson Chung's avatar Winson Chung
Browse files

Expose call to start screen pinning on a task.

Bug: 70294936
Test: Manual
Change-Id: I7b8a079b928a9a8bf887aab7ae0bd6f93ac9d7e4
parent 66f0026f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@ interface ISystemUiProxy {
    GraphicBufferCompat screenshot(in Rect sourceCrop, int width, int height, int minLayer,
            int maxLayer, boolean useIdentityTransform, int rotation);

    /**
     * Begins screen pinning on the provided {@param taskId}.
     */
    void startScreenPinning(int taskId);

    /**
     * Called when the overview service has started the recents animation.
     */
+20 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.OverviewProxyService.OverviewProxyListener;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.GraphicBufferCompat;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.CallbackController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
@@ -67,6 +68,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private int mConnectionBackoffAttempts;

    private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {

        public GraphicBufferCompat screenshot(Rect sourceCrop, int width, int height, int minLayer,
                int maxLayer, boolean useIdentityTransform, int rotation) {
            long token = Binder.clearCallingIdentity();
@@ -78,10 +80,27 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
            }
        }

        public void startScreenPinning(int taskId) {
            long token = Binder.clearCallingIdentity();
            try {
                mHandler.post(() -> {
                    StatusBar statusBar = ((SystemUIApplication) mContext).getComponent(
                            StatusBar.class);
                    if (statusBar != null) {
                        statusBar.showScreenPinningRequest(taskId, false /* allowCancel */);
                    }
                });
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        public void onRecentsAnimationStarted() {
            long token = Binder.clearCallingIdentity();
            try {
                mHandler.post(() -> {
                    notifyRecentsAnimationStarted();
                });
            } finally {
                Binder.restoreCallingIdentity(token);
            }