Use DeviceProfile.widthPx to initialize Taskbar touchableRegion
- TaskbarDraglayer.width isn't initialize when Taskbar is recreated before layout, so use DeviceProfile.widthPx instead
- Also listen for DeviceProfile change in TaskbarInsetsController to update Taskbar touchableRegion
Fix: 233316713
Test: Switch to 3 button, nav button works. Swtich to gesture nav, taskbar icon can be tapped
Test: Rotate deice, whole Taskbar should still be touchable
Change-Id: I29ff86fd8616a620f98d9b5438cc586bd69fac33
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 21d7af9..6a6a693 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -21,6 +21,7 @@
import android.view.WindowManager
import com.android.launcher3.AbstractFloatingView
import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS
+import com.android.launcher3.DeviceProfile
import com.android.launcher3.anim.AlphaUpdateListener
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.quickstep.KtR
@@ -38,6 +39,9 @@
val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize(
KtR.dimen.taskbar_ime_size)
private val contentRegion: Region = Region()
+ private val deviceProfileChangeListener = { _: DeviceProfile ->
+ onTaskbarWindowHeightOrInsetsChanged()
+ }
// Initialized in init.
private lateinit var controllers: TaskbarControllers
@@ -63,16 +67,19 @@
onTaskbarWindowHeightOrInsetsChanged()
windowLayoutParams.insetsRoundedCornerFrame = true
+ context.addOnDeviceProfileChangeListener(deviceProfileChangeListener)
}
- fun onDestroy() {}
+ fun onDestroy() {
+ context.removeOnDeviceProfileChangeListener(deviceProfileChangeListener)
+ }
fun onTaskbarWindowHeightOrInsetsChanged() {
var reducingSize = getReducingInsetsForTaskbarInsetsHeight(
controllers.taskbarStashController.contentHeightToReportToApps)
contentRegion.set(0, reducingSize.top,
- context.dragLayer.width, windowLayoutParams.height)
+ context.deviceProfile.widthPx, windowLayoutParams.height)
windowLayoutParams.providedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize
windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize
reducingSize = getReducingInsetsForTaskbarInsetsHeight(