From 0e068b1213a9a65cbacfddfdfc9f89463d6a7e0a Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 27 Apr 2023 11:16:18 -0700 Subject: [PATCH] Pass in display when using DesktopMode APIs Pass in the display id when asking wmshell to show desktop apps or when querying the number of visible desktop tasks. Bug: 278084491 Test: open some apps on the desktop, swipe up to recents, tap the desktop tile to open desktop again Change-Id: Ia7328613244a1aa401e0e4792bc747a4b99b412d --- .../src/com/android/quickstep/RemoteTargetGluer.java | 7 ++++--- quickstep/src/com/android/quickstep/SystemUiProxy.java | 8 ++++---- .../src/com/android/quickstep/views/DesktopTaskView.java | 2 +- .../com/android/quickstep/views/LauncherRecentsView.java | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java index f30d3f14cc..d9c269a914 100644 --- a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java +++ b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java @@ -52,9 +52,10 @@ public class RemoteTargetGluer { */ public RemoteTargetGluer(Context context, BaseActivityInterface sizingStrategy) { if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { - // TODO: binder call, only for prototyping. Creating the gluer should be postponed so - // we can create it when we have the remote animation targets ready. - int desktopTasks = SystemUiProxy.INSTANCE.get(context).getVisibleDesktopTaskCount(); + // TODO(279931899): binder call, only for prototyping. Creating the gluer should be + // postponed so we can create it when we have the remote animation targets ready. + int desktopTasks = SystemUiProxy.INSTANCE.get(context).getVisibleDesktopTaskCount( + context.getDisplayId()); if (desktopTasks > 0) { init(context, sizingStrategy, desktopTasks, true /* forDesktop */); return; diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index fdb30cedf3..616ddef748 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -1060,10 +1060,10 @@ public class SystemUiProxy implements ISystemUiProxy { // /** Call shell to show all apps active on the desktop */ - public void showDesktopApps() { + public void showDesktopApps(int displayId) { if (mDesktopMode != null) { try { - mDesktopMode.showDesktopApps(); + mDesktopMode.showDesktopApps(displayId); } catch (RemoteException e) { Log.w(TAG, "Failed call showDesktopApps", e); } @@ -1071,10 +1071,10 @@ public class SystemUiProxy implements ISystemUiProxy { } /** Call shell to get number of visible freeform tasks */ - public int getVisibleDesktopTaskCount() { + public int getVisibleDesktopTaskCount(int displayId) { if (mDesktopMode != null) { try { - return mDesktopMode.getVisibleTaskCount(); + return mDesktopMode.getVisibleTaskCount(displayId); } catch (RemoteException e) { Log.w(TAG, "Failed call getVisibleDesktopTaskCount", e); } diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java index ccc2df61c9..379722b87d 100644 --- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java +++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java @@ -309,7 +309,7 @@ public class DesktopTaskView extends TaskView { @Override public RunnableList launchTasks() { - SystemUiProxy.INSTANCE.get(getContext()).showDesktopApps(); + SystemUiProxy.INSTANCE.get(getContext()).showDesktopApps(mActivity.getDisplayId()); Launcher.getLauncher(mActivity).getStateManager().goToState(NORMAL, false /* animated */); return null; } diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index 697a1c16b7..8ff0e9b0c5 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -245,7 +245,7 @@ public class LauncherRecentsView extends RecentsView