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

Test: local
Bug: 157778187
Change-Id: Ie5252d39e54ca11de389dd698bfb7751fdf8f60e
This commit is contained in:
Becky Qiu
2020-06-11 16:17:21 -07:00
parent 690b8fb3f2
commit fb40075752
3 changed files with 28 additions and 0 deletions
@@ -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);
@@ -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.
*/
@@ -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();