Change taskbar corner roundness when entering overview

- Roundness will be 0 in Launcher, and 1 in an app

Bug: 250645563
Test: With and without taskbar in overview, switch between home/overview/app and observe the round corners above taskbar
Test: Ensure corner above taskbar is correct in overview and in app when chat bubble is active
Change-Id: I1f4911626c8e79fce8d81a76a9bd0d0670d111da
This commit is contained in:
Alex Chau
2022-10-31 18:17:03 +00:00
parent eeaba0903a
commit 68e7fe6b7d
8 changed files with 119 additions and 7 deletions

View File

@@ -23,6 +23,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsController;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.quickstep.AnimatedFloat;
import com.android.systemui.shared.rotation.RotationButtonController;
import java.io.PrintWriter;
@@ -58,6 +59,7 @@ public class TaskbarControllers {
public final TaskbarOverlayController taskbarOverlayController;
@Nullable private LoggableTaskbarController[] mControllersToLog = null;
@Nullable private BackgroundRendererController[] mBackgroundRendererControllers = null;
/** Do not store this controller, as it may change at runtime. */
@NonNull public TaskbarUIController uiController = TaskbarUIController.DEFAULT;
@@ -67,6 +69,9 @@ public class TaskbarControllers {
@Nullable private TaskbarSharedState mSharedState = null;
// Roundness property for round corner above taskbar .
private final AnimatedFloat mCornerRoundness = new AnimatedFloat(this::updateCornerRoundness);
public TaskbarControllers(TaskbarActivityContext taskbarActivityContext,
TaskbarDragController taskbarDragController,
TaskbarNavButtonController navButtonController,
@@ -148,6 +153,11 @@ public class TaskbarControllers {
taskbarAutohideSuspendController, taskbarPopupController, taskbarInsetsController,
voiceInteractionWindowController
};
mBackgroundRendererControllers = new BackgroundRendererController[] {
taskbarDragLayerController, taskbarScrimViewController,
voiceInteractionWindowController
};
mCornerRoundness.updateValue(TaskbarBackgroundRenderer.DEFAULT_ROUNDNESS);
mAreAllControllersInitialized = true;
for (Runnable postInitCallback : mPostInitCallbacks) {
@@ -191,6 +201,7 @@ public class TaskbarControllers {
taskbarRecentAppsController.onDestroy();
mControllersToLog = null;
mBackgroundRendererControllers = null;
}
/**
@@ -224,6 +235,23 @@ public class TaskbarControllers {
rotationButtonController.dumpLogs(prefix + "\t", pw);
}
/**
* Returns a float property that animates roundness of the round corner above Taskbar.
*/
public AnimatedFloat getTaskbarCornerRoundness() {
return mCornerRoundness;
}
private void updateCornerRoundness() {
if (mBackgroundRendererControllers == null) {
return;
}
for (BackgroundRendererController controller : mBackgroundRendererControllers) {
controller.setCornerRoundness(mCornerRoundness.value);
}
}
@VisibleForTesting
TaskbarActivityContext getTaskbarActivityContext() {
// Used to mock
@@ -233,4 +261,12 @@ public class TaskbarControllers {
protected interface LoggableTaskbarController {
void dumpLogs(String prefix, PrintWriter pw);
}
protected interface BackgroundRendererController {
/**
* Sets the roundness of the round corner above Taskbar.
* @param cornerRoundness 0 has no round corner, 1 has complete round corner.
*/
void setCornerRoundness(float cornerRoundness);
}
}