Address a couple small followups for TaskbarInsetsController
- Added no-op onDestroy()
- Reformated some if conditions, also adding
AbstractFloatingView.hasOpenView()
Test: TaplTestsTaskbar
Bug: 215411414
Change-Id: I89b39ca5fabd03f5ac0f25d6ef69170683cf060d
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index 5d3a152..ff08e3d 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -160,6 +160,7 @@
taskbarForceVisibleImmersiveController.onDestroy();
taskbarAllAppsController.onDestroy();
navButtonController.onDestroy();
+ taskbarInsetsController.onDestroy();
mControllersToLog = null;
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 9571798..9870a2e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -18,6 +18,7 @@
import android.graphics.Insets
import android.view.WindowManager
import com.android.launcher3.AbstractFloatingView
+import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS
import com.android.launcher3.R
import com.android.launcher3.anim.AlphaUpdateListener
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
@@ -61,6 +62,8 @@
windowLayoutParams.insetsRoundedCornerFrame = true
}
+ fun onDestroy() {}
+
fun onTaskbarWindowHeightOrInsetsChanged() {
var reducingSize = getReducingInsetsForTaskbarInsetsHeight(
controllers.taskbarStashController.contentHeightToReportToApps)
@@ -106,18 +109,11 @@
} else if (controllers.taskbarDragController.isSystemDragInProgress) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
- } else if (AbstractFloatingView.getOpenView<AbstractFloatingView?>(
- context,
- AbstractFloatingView.TYPE_TASKBAR_ALL_APPS
- ) != null
- ) {
+ } else if (AbstractFloatingView.hasOpenView(context, TYPE_TASKBAR_ALL_APPS)) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
} else if (controllers.taskbarViewController.areIconsVisible()
- || AbstractFloatingView.getOpenView<AbstractFloatingView?>(
- context,
- AbstractFloatingView.TYPE_ALL
- ) != null
+ || AbstractFloatingView.hasOpenView(context, AbstractFloatingView.TYPE_ALL)
|| context.isNavBarKidsModeActive
) {
// Taskbar has some touchable elements, take over the full taskbar area
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 4386f41..90869c2 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -208,6 +208,13 @@
}
/**
+ * Returns whether there is at least one view of the given type where {@link #isOpen()} == true.
+ */
+ public static boolean hasOpenView(ActivityContext activity, @FloatingViewType int type) {
+ return getOpenView(activity, type) != null;
+ }
+
+ /**
* Returns a view matching FloatingViewType, and {@link #isOpen()} may be false (if animating
* closed).
*/