Merge "[CD Taskbar] Bypass binder calls for TaskbarManager#getDefaultDisplayId()" into main

This commit is contained in:
Treehugger Robot
2025-03-20 16:25:34 -07:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 7 deletions
@@ -140,6 +140,7 @@ public class TaskbarManager implements DisplayDecorationListener {
Settings.Secure.NAV_BAR_KIDS_MODE);
private final Context mBaseContext;
private final int mPrimaryDisplayId;
private final TaskbarNavButtonCallbacks mNavCallbacks;
// TODO: Remove this during the connected displays lifecycle refactor.
private final Context mPrimaryWindowContext;
@@ -436,21 +437,21 @@ public class TaskbarManager implements DisplayDecorationListener {
TaskbarNavButtonCallbacks navCallbacks,
RecentsDisplayModel recentsDisplayModel) {
mBaseContext = context;
mPrimaryDisplayId = mBaseContext.getDisplayId();
mAllAppsActionManager = allAppsActionManager;
mNavCallbacks = navCallbacks;
mRecentsDisplayModel = recentsDisplayModel;
// Set up primary display.
int primaryDisplayId = getDefaultDisplayId();
debugPrimaryTaskbar("TaskbarManager constructor");
mPrimaryWindowContext = createWindowContext(primaryDisplayId);
mPrimaryWindowContext = createWindowContext(getDefaultDisplayId());
mPrimaryWindowManager = mPrimaryWindowContext.getSystemService(WindowManager.class);
DesktopVisibilityController.INSTANCE.get(
mPrimaryWindowContext).registerTaskbarDesktopModeListener(
mTaskbarDesktopModeListener);
createTaskbarRootLayout(primaryDisplayId);
createNavButtonController(primaryDisplayId);
createAndRegisterComponentCallbacks(primaryDisplayId);
createTaskbarRootLayout(getDefaultDisplayId());
createNavButtonController(getDefaultDisplayId());
createAndRegisterComponentCallbacks(getDefaultDisplayId());
SettingsCache.INSTANCE.get(mPrimaryWindowContext)
.register(USER_SETUP_COMPLETE_URI, mOnSettingsChangeListener);
@@ -1678,7 +1679,7 @@ public class TaskbarManager implements DisplayDecorationListener {
}
private int getDefaultDisplayId() {
return mBaseContext.getDisplayId();
return mPrimaryDisplayId;
}
/**
@@ -1048,7 +1048,8 @@ public class TouchInteractionService extends Service {
private boolean isHoverActionWithoutConsumer(MotionEvent event) {
// Only process these events when taskbar is present.
TaskbarActivityContext tac = mTaskbarManager.getCurrentActivityContext();
int displayId = event.getDisplayId();
TaskbarActivityContext tac = mTaskbarManager.getTaskbarForDisplay(displayId);
boolean isTaskbarPresent = tac != null && tac.getDeviceProfile().isTaskbarPresent
&& !tac.isPhoneMode();
return event.isHoverEvent() && (mUncheckedConsumer.getType() & TYPE_CURSOR_HOVER) == 0