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

Commit fb400757 authored by Becky Qiu's avatar Becky Qiu
Browse files

[Overview Actions] onBackPressed for the modal state will go to overview.

Test: local
Bug: 157778187
Change-Id: Ie5252d39e54ca11de389dd698bfb7751fdf8f60e
parent 690b8fb3
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Rect;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.views.RecentsView;

@@ -56,6 +57,17 @@ public class OverviewModalTaskState extends OverviewState {
        return 1.0f;
    }

    @Override
    public void onBackPressed(Launcher launcher) {
        launcher.getStateManager().goToState(LauncherState.OVERVIEW);
        RecentsView recentsView = launcher.<RecentsView>getOverviewPanel();
        if (recentsView != null) {
            recentsView.resetModalVisuals();
        } else {
            super.onBackPressed(launcher);
        }
    }

    public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
        Rect out = new Rect();
        activity.<RecentsView>getOverviewPanel().getTaskSize(out);
+6 −0
Original line number Diff line number Diff line
@@ -178,6 +178,12 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
        public void reset() {
        }

        /**
         * Called when the system wants to reset the modal visuals.
         */
        public void resetModalVisuals() {
        }

        /**
         * Gets the modal state system shortcut.
         */
+10 −0
Original line number Diff line number Diff line
@@ -1759,6 +1759,16 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        return Math.max(getWidth(), 1);
    }

    /**
     * Resets the visuals when exit modal state.
     */
    public void resetModalVisuals() {
        TaskView taskView = getCurrentPageTaskView();
        if (taskView != null) {
            taskView.getThumbnail().getTaskOverlay().resetModalVisuals();
        }
    }

    private void updateDeadZoneRects() {
        // Get the deadzone rect surrounding the clear all button to not dismiss overview to home
        mClearAllButtonDeadZoneRect.setEmpty();