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

Commit 75b2597e authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add long press on recents to dock top most task

- Change the gesture to unpin a locked task into long pressing
the back button.
- When long pressing recents, dock top most task.

Change-Id: I1386151e781f4034cfb97d3c8d46c709d19fe779
parent 276793a8
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -999,9 +999,7 @@
    <!-- Screen pinning dialog title. -->
    <string name="screen_pinning_title">Screen is pinned</string>
    <!-- Screen pinning dialog description. -->
    <string name="screen_pinning_description">This keeps it in view until you unpin. Touch and hold Back and Overview at the same time to unpin.</string>
    <!-- Screen pinning dialog description when in accessibility mode. -->
    <string name="screen_pinning_description_accessible">This keeps it in view until you unpin. Touch and hold Overview to unpin.</string>
    <string name="screen_pinning_description">This keeps it in view until you unpin. Touch and hold Back to unpin.</string>
    <!-- Screen pinning positive response. -->
    <string name="screen_pinning_positive">Got it</string>
    <!-- Screen pinning negative response. -->
+5 −0
Original line number Diff line number Diff line
@@ -27,4 +27,9 @@ public interface RecentsComponent {
    void cancelPreloadingRecents();
    void showNextAffiliatedTask();
    void showPrevAffiliatedTask();

    /**
     * Docks the top-most task and opens recents.
     */
    void dockTopTask();
}
+5 −0
Original line number Diff line number Diff line
@@ -283,6 +283,11 @@ public class Recents extends SystemUI
        }
    }

    @Override
    public void dockTopTask() {
        mImpl.dockTopTask();
    }

    @Override
    public void showNextAffiliatedTask() {
        mImpl.showNextAffiliatedTask();
+10 −0
Original line number Diff line number Diff line
@@ -405,6 +405,16 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub
        showRelativeAffiliatedTask(false);
    }

    public void dockTopTask() {
        SystemServicesProxy ssp = Recents.getSystemServices();
        ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
        if (topTask != null && !ssp.isInHomeStack(topTask.id)) {
            ssp.moveTaskToDockedStack(topTask.id,
                    ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT);
            showRecents(false /* triggeredFromAltTab */);
        }
    }

    /**
     * Returns the preloaded load plan and invalidates it.
     */
+1 −10
Original line number Diff line number Diff line
@@ -234,14 +234,6 @@ public class RecentsResizeTaskDialog extends DialogFragment {
        dismissAllowingStateLoss();
        mRecentsActivity.dismissRecentsToHomeWithoutTransitionAnimation();

        // In debug mode, we force all task to be resizeable regardless of the
        // current app configuration.
        for (int i = additionalTasks; i >= 0; --i) {
            if (mTasks[i] != null) {
                ssp.setTaskResizeable(mTasks[i].key.id);
            }
        }

        // Show tasks as they might not be currently visible - beginning with the oldest so that
        // the focus ends on the selected one.
        for (int i = additionalTasks; i >= 0; --i) {
@@ -277,8 +269,7 @@ public class RecentsResizeTaskDialog extends DialogFragment {
        if (mTasks[0].key.stackId != DOCKED_STACK_ID) {
            int taskId = mTasks[0].key.id;
            SystemServicesProxy ssp = Recents.getSystemServices();
            ssp.setTaskResizeable(taskId);
            ssp.dockTask(taskId, createMode);
            ssp.startTaskInDockedMode(taskId, createMode);
            mRecentsView.launchTask(mTasks[0], null, DOCKED_STACK_ID);
        } else {
            Toast.makeText(getContext(), "Already docked", Toast.LENGTH_SHORT);
Loading