[CD Taskbar] Cache displayId & Consolidate DisplayController methods

TaskbarActivityContext should store displayId and return a cached value to avoid unnessary binder calls.

Flag: com.android.window.flags.enable_taskbar_connected_displays
Bug: 406019031
Test: m
Change-Id: I808352e7098ee731abc7362b2f8f1b7a675457f9
This commit is contained in:
Sukesh Ram
2025-03-27 14:54:06 -07:00
parent 21c065ae3d
commit 5da5e1c9e1
9 changed files with 132 additions and 108 deletions
@@ -44,7 +44,6 @@ import com.android.launcher3.R;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.taskbar.BarsLocationAnimatorHelper;
import com.android.launcher3.taskbar.bubbles.animation.BubbleAnimator;
import com.android.launcher3.util.DisplayController;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import java.io.PrintWriter;
@@ -656,7 +655,7 @@ public class BubbleBarView extends FrameLayout {
* Get bubble bar top coordinate on screen when bar is resting
*/
public int getRestingTopPositionOnScreen() {
int displayHeight = DisplayController.INSTANCE.get(getContext()).getInfo().currentSize.y;
int displayHeight = mController.getScreenHeight();
int bubbleBarHeight = getBubbleBarBounds().height();
return displayHeight - bubbleBarHeight + (int) mController.getBubbleBarTranslationY();
}
@@ -1646,6 +1645,9 @@ public class BubbleBarView extends FrameLayout {
/** Interface for BubbleBarView to communicate with its controller. */
interface Controller {
/** Returns the screen height. */
int getScreenHeight();
/** Returns the translation Y that the bubble bar should have. */
float getBubbleBarTranslationY();