Merge "Cleanup taskbar+assistant interactions" into tm-qpr-dev am: d7fb7f379a

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19450086

Change-Id: Ife34bd2a70b2b5c864873de14814ececab6c0531
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tony Wickham
2022-07-29 00:04:29 +00:00
committed by Automerger Merge Worker
2 changed files with 14 additions and 7 deletions

View File

@@ -627,7 +627,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
/** Adds the given view to WindowManager with the provided LayoutParams (creates new window). */
public void addWindowView(View view, WindowManager.LayoutParams windowLayoutParams) {
mWindowManager.addView(view, windowLayoutParams);
if (!view.isAttachedToWindow()) {
mWindowManager.addView(view, windowLayoutParams);
}
}
/** Removes the given view from WindowManager. See {@link #addWindowView}. */

View File

@@ -36,7 +36,10 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext)
override fun draw(canvas: Canvas) {
super.draw(canvas)
taskbarBackgroundRenderer.draw(canvas)
if (this@VoiceInteractionWindowController.context.isGestureNav
&& controllers.taskbarStashController.isInAppAndNotStashed) {
taskbarBackgroundRenderer.draw(canvas)
}
}
}
separateWindowForTaskbarBackground.recreateControllers()
@@ -74,18 +77,20 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext)
fadeStashedHandle.end()
}
if (context.isGestureNav && controllers.taskbarStashController.isInAppAndNotStashed) {
moveTaskbarBackgroundToLowerLayer()
}
moveTaskbarBackgroundToAppropriateLayer()
}
/**
* Either:
* Hides the TaskbarDragLayer background and creates a new window to draw just that background.
* OR
* Removes the temporary window and show the TaskbarDragLayer background again.
*/
private fun moveTaskbarBackgroundToLowerLayer() {
private fun moveTaskbarBackgroundToAppropriateLayer() {
val taskbarBackgroundOverride = controllers.taskbarDragLayerController
.overrideBackgroundAlpha
if (isVoiceInteractionWindowVisible) {
val moveToLowerLayer = isVoiceInteractionWindowVisible
if (moveToLowerLayer) {
// First add the temporary window, then hide the overlapping taskbar background.
context.addWindowView(separateWindowForTaskbarBackground, separateWindowLayoutParams)
ViewRootSync.synchronizeNextDraw(separateWindowForTaskbarBackground, context.dragLayer