Fixed a bug where the AssistComponent was outdated

It also wasn’t updated when switching users.

Bug: 22005038
Change-Id: I45e58de5f48e3769f114ff830d62c287d2b04d4f
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 674356b..7838119 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -311,4 +311,12 @@
     public void showDisclosure() {
         mAssistDisclosure.postShow();
     }
+
+    public void onUserSwitched(int newUserId) {
+        updateAssistInfo();
+    }
+
+    public void prepareBeforeInvocation() {
+        updateAssistInfo();
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 16df64c..cde743a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1028,6 +1028,7 @@
     private int mShowSearchHoldoff = 0;
     private Runnable mInvokeAssist = new Runnable() {
         public void run() {
+            mAssistManager.prepareBeforeInvocation();
             invokeAssistGesture(true /* vibrate */);
             awakenDreams();
             if (mNavigationBarView != null) {
@@ -2917,6 +2918,7 @@
         updateNotifications();
         resetUserSetupObserver();
         setControllerUsers();
+        mAssistManager.onUserSwitched(newUserId);
     }
 
     private void setControllerUsers() {