From cde805e99517873d7d7a6a25cdea099055573078 Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Mon, 24 Apr 2023 15:23:32 +0100 Subject: [PATCH] [Unfold animation] Move unfold animation background under wallpaper We add a color layer during unfold animation so when the wallpaper is not visible (e.g. when an app is opened) we will show our colored background instead of black pixels. But when the wallpaper is visible the background is shown on top of the wallpaper which is undesirable. Removed the parent of the background layer so it is attached to the root of the surface flinger hiearchy and below the wallpaper layer. Bug: 272703608 Test: manually test unfolding, folding when on launcher, a fullscreen app and split screen tasks are visible => checked that we show the background when wallpaper is not visible and do not show it when wallpaper is visible Test: attached winscope traces Change-Id: Ic7f7ad855055b5de87db912a7dbaf3112bcf289c --- .../src/com/android/wm/shell/dagger/WMShellModule.java | 10 ++-------- .../wm/shell/unfold/UnfoldBackgroundController.java | 10 +--------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java index d8e2f5c4a817e..2f0f56cfdfb08 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java @@ -634,14 +634,8 @@ public abstract class WMShellModule { @WMSingleton @Provides - static UnfoldBackgroundController provideUnfoldBackgroundController( - RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer, - Context context - ) { - return new UnfoldBackgroundController( - context, - rootTaskDisplayAreaOrganizer - ); + static UnfoldBackgroundController provideUnfoldBackgroundController(Context context) { + return new UnfoldBackgroundController(context); } // diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldBackgroundController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldBackgroundController.java index fe0a3fb7b9dc3..96657af22e37f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldBackgroundController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldBackgroundController.java @@ -19,14 +19,12 @@ package com.android.wm.shell.unfold; import static android.graphics.Color.blue; import static android.graphics.Color.green; import static android.graphics.Color.red; -import static android.view.Display.DEFAULT_DISPLAY; import android.annotation.NonNull; import android.content.Context; import android.view.SurfaceControl; import com.android.wm.shell.R; -import com.android.wm.shell.RootTaskDisplayAreaOrganizer; /** * Controls background color layer for the unfold animations @@ -34,15 +32,10 @@ import com.android.wm.shell.RootTaskDisplayAreaOrganizer; public class UnfoldBackgroundController { private static final int BACKGROUND_LAYER_Z_INDEX = -1; - - private final RootTaskDisplayAreaOrganizer mRootTaskDisplayAreaOrganizer; private final float[] mBackgroundColor; private SurfaceControl mBackgroundLayer; - public UnfoldBackgroundController( - @NonNull Context context, - @NonNull RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer) { - mRootTaskDisplayAreaOrganizer = rootTaskDisplayAreaOrganizer; + public UnfoldBackgroundController(@NonNull Context context) { mBackgroundColor = getBackgroundColor(context); } @@ -57,7 +50,6 @@ public class UnfoldBackgroundController { .setName("app-unfold-background") .setCallsite("AppUnfoldTransitionController") .setColorLayer(); - mRootTaskDisplayAreaOrganizer.attachToDisplayArea(DEFAULT_DISPLAY, colorLayerBuilder); mBackgroundLayer = colorLayerBuilder.build(); transaction