From 538c9a0b525826a706ed45e10ee03a0ace580472 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 28 Mar 2022 14:48:20 -0700 Subject: [PATCH] Fix problems with taskbar floating views on rotation - Close all views except TYPE_REBIND_SAFE - Make All Apps TYPE_REBIND_SAFE again - Reapply fullscreen to ensure any remaining floating views such as taskbr edu are laid out correctly upon rotation Test: Rotating with folder and/or popup closes them; rotating with all apps stays open; rotating with all apps + popup closes popup but not all apps; rotating taskbar edu lays out correctly; opening shortcut or notification from all apps popup still closes all apps Fixes: 220074790 Fixes: 219981733 Change-Id: I1dfea4ed0a636ab84bcc4e33304c80a689da01cd --- .../android/launcher3/taskbar/TaskbarActivityContext.java | 6 ++++++ .../launcher3/taskbar/allapps/TaskbarAllAppsContext.java | 4 ++++ src/com/android/launcher3/AbstractFloatingView.java | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 0f3a6eee47..5479664cf9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_M import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; +import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.ResourceUtils.getBoolByName; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; @@ -227,6 +228,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { public void updateDeviceProfile(DeviceProfile dp) { mDeviceProfile = dp; updateIconSize(getResources()); + + AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); + // Reapply fullscreen to take potential new screen size into account. + setTaskbarWindowFullscreen(mIsFullscreen); + dispatchDeviceProfileChanged(); } diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java index 50dfff0854..1cdbdb228b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java @@ -19,6 +19,7 @@ import static android.view.KeyEvent.ACTION_UP; import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; +import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION; import android.content.Context; @@ -143,6 +144,9 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { @Override public void updateDeviceProfile(DeviceProfile dp) { mDeviceProfile = dp; + + AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); + dispatchDeviceProfileChanged(); } diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index e75348cc55..ceb38d0e77 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -103,7 +103,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET | TYPE_WIDGETS_BOTTOM_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE | TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_WIDGETS_EDUCATION_DIALOG - | TYPE_TASKBAR_EDUCATION_DIALOG; + | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS; // Usually we show the back button when a floating view is open. Instead, hide for these types. public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE