Merge changes I8fca0e6f,I7fb46a09 into main

* changes:
  [CS] Remove CentralSurfaces screen pinning methods.
  Update NavBarController's CommandQueue callbacks to be separate.
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
index 580facd..5a42028 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
@@ -19,7 +19,6 @@
 import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
 import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
 import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
-
 import static com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler.DEBUG_MISSING_GESTURE_TAG;
 import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
 
@@ -58,7 +57,6 @@
 import com.android.systemui.shared.system.QuickStepContract;
 import com.android.systemui.shared.system.TaskStackChangeListeners;
 import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.CommandQueue.Callbacks;
 import com.android.systemui.statusbar.phone.AutoHideController;
 import com.android.systemui.statusbar.phone.BarTransitions.TransitionMode;
 import com.android.systemui.statusbar.phone.LightBarController;
@@ -75,7 +73,6 @@
 /** A controller to handle navigation bars. */
 @SysUISingleton
 public class NavigationBarController implements
-        Callbacks,
         ConfigurationController.ConfigurationListener,
         NavigationModeController.ModeChangedListener,
         Dumpable {
@@ -130,7 +127,7 @@
         mSecureSettings = secureSettings;
         mDisplayTracker = displayTracker;
         mDisplayManager = mContext.getSystemService(DisplayManager.class);
-        commandQueue.addCallback(this);
+        commandQueue.addCallback(mCommandQueueCallbacks);
         configurationController.addCallback(this);
         mConfigChanges.applyNewConfig(mContext.getResources());
         mNavMode = navigationModeController.addListener(this);
@@ -270,25 +267,51 @@
         return taskbarEnabled;
     }
 
-    @Override
-    public void onDisplayRemoved(int displayId) {
-        removeNavigationBar(displayId);
-    }
-
-    @Override
-    public void onDisplayReady(int displayId) {
-        Display display = mDisplayManager.getDisplay(displayId);
-        mIsLargeScreen = isLargeScreen(mContext);
-        createNavigationBar(display, null /* savedState */, null /* result */);
-    }
-
-    @Override
-    public void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable) {
-        final NavigationBar navigationBar = getNavigationBar(displayId);
-        if (navigationBar != null) {
-            navigationBar.setNavigationBarLumaSamplingEnabled(enable);
+    private final CommandQueue.Callbacks mCommandQueueCallbacks = new CommandQueue.Callbacks() {
+        @Override
+        public void onDisplayRemoved(int displayId) {
+            removeNavigationBar(displayId);
         }
-    }
+
+        @Override
+        public void onDisplayReady(int displayId) {
+            Display display = mDisplayManager.getDisplay(displayId);
+            mIsLargeScreen = isLargeScreen(mContext);
+            createNavigationBar(display, null /* savedState */, null /* result */);
+        }
+
+        @Override
+        public void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable) {
+            final NavigationBar navigationBar = getNavigationBar(displayId);
+            if (navigationBar != null) {
+                navigationBar.setNavigationBarLumaSamplingEnabled(enable);
+            }
+        }
+
+        @Override
+        public void showPinningEnterExitToast(boolean entering) {
+            int displayId = mContext.getDisplayId();
+            final NavigationBarView navBarView = getNavigationBarView(displayId);
+            if (navBarView != null) {
+                navBarView.showPinningEnterExitToast(entering);
+            } else if (displayId == mDisplayTracker.getDefaultDisplayId()
+                    && mTaskbarDelegate.isInitialized()) {
+                mTaskbarDelegate.showPinningEnterExitToast(entering);
+            }
+        }
+
+        @Override
+        public void showPinningEscapeToast() {
+            int displayId = mContext.getDisplayId();
+            final NavigationBarView navBarView = getNavigationBarView(displayId);
+            if (navBarView != null) {
+                navBarView.showPinningEscapeToast();
+            } else if (displayId == mDisplayTracker.getDefaultDisplayId()
+                    && mTaskbarDelegate.isInitialized()) {
+                mTaskbarDelegate.showPinningEscapeToast();
+            }
+        }
+    };
 
     /**
      * Recreates the navigation bar for the given display.
@@ -446,26 +469,6 @@
         return mNavigationBars.get(displayId);
     }
 
-    public void showPinningEnterExitToast(int displayId, boolean entering) {
-        final NavigationBarView navBarView = getNavigationBarView(displayId);
-        if (navBarView != null) {
-            navBarView.showPinningEnterExitToast(entering);
-        } else if (displayId == mDisplayTracker.getDefaultDisplayId()
-                && mTaskbarDelegate.isInitialized()) {
-            mTaskbarDelegate.showPinningEnterExitToast(entering);
-        }
-    }
-
-    public void showPinningEscapeToast(int displayId) {
-        final NavigationBarView navBarView = getNavigationBarView(displayId);
-        if (navBarView != null) {
-            navBarView.showPinningEscapeToast();
-        } else if (displayId == mDisplayTracker.getDefaultDisplayId()
-                && mTaskbarDelegate.isInitialized()) {
-            mTaskbarDelegate.showPinningEscapeToast();
-        }
-    }
-
     public boolean isOverviewEnabled(int displayId) {
         final NavigationBarView navBarView = getNavigationBarView(displayId);
         if (navBarView != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index e914de8..cfa481e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -265,10 +265,6 @@
 
     boolean isOverviewEnabled();
 
-    void showPinningEnterExitToast(boolean entering);
-
-    void showPinningEscapeToast();
-
     void setBouncerShowing(boolean bouncerShowing);
 
     boolean isScreenFullyOff();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
index 0a57046..28bb581 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
@@ -510,16 +510,6 @@
     }
 
     @Override
-    public void showPinningEnterExitToast(boolean entering) {
-        mCentralSurfaces.showPinningEnterExitToast(entering);
-    }
-
-    @Override
-    public void showPinningEscapeToast() {
-        mCentralSurfaces.showPinningEscapeToast();
-    }
-
-    @Override
     public void showScreenPinningRequest(int taskId) {
         if (mKeyguardStateController.isShowing()) {
             // Don't allow apps to trigger this from keyguard.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt
index 15176d6..ff380db 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt
@@ -69,8 +69,6 @@
     ) {}
     override fun getNavigationBarView(): NavigationBarView? = null
     override fun isOverviewEnabled() = false
-    override fun showPinningEnterExitToast(entering: Boolean) {}
-    override fun showPinningEscapeToast() {}
     override fun setBouncerShowing(bouncerShowing: Boolean) {}
     override fun isScreenFullyOff() = false
     override fun showScreenPinningRequest(taskId: Int, allowCancel: Boolean) {}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index d3a4034..490c469 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -2546,16 +2546,6 @@
         return mNavigationBarController.isOverviewEnabled(mDisplayId);
     }
 
-    @Override
-    public void showPinningEnterExitToast(boolean entering) {
-        mNavigationBarController.showPinningEnterExitToast(mDisplayId, entering);
-    }
-
-    @Override
-    public void showPinningEscapeToast() {
-        mNavigationBarController.showPinningEscapeToast(mDisplayId);
-    }
-
     /**
      * Propagation of the bouncer state, indicating that it's fully visible.
      */