Check before the user is unlocked before handling proxied events

Bug: 130272454
Test: None, just checking for null state
Change-Id: I6b5a5c0dc7a0dbd8d2d75decd4e7d7ddf6cc3e3d
(cherry picked from commit fd378d79e5623e72e57e8ed459a908116baddbab)
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 87ae091..bcce937 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -136,6 +136,12 @@
 
         @Override
         public void onAssistantVisibilityChanged(float visibility) {
+            if (mOverviewComponentObserver == null) {
+                // Save the visibility to be applied when the user is unlocked
+                mPendingAssistantVisibility = visibility;
+                return;
+            }
+
             MAIN_THREAD_EXECUTOR.execute(() -> {
                 mOverviewComponentObserver.getActivityControlHelper()
                         .onAssistantVisibilityChanged(visibility);
@@ -144,6 +150,10 @@
 
         public void onBackAction(boolean completed, int downX, int downY, boolean isButton,
                 boolean gestureSwipeLeft) {
+            if (mOverviewComponentObserver == null) {
+                return;
+            }
+
             final ActivityControlHelper activityControl =
                     mOverviewComponentObserver.getActivityControlHelper();
             UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
@@ -186,6 +196,7 @@
     private InputConsumerController mInputConsumer;
     private SwipeSharedState mSwipeSharedState;
     private boolean mAssistantAvailable;
+    private float mPendingAssistantVisibility = 0;
 
     private boolean mIsUserUnlocked;
     private List<Runnable> mOnUserUnlockedCallbacks;
@@ -338,6 +349,8 @@
         mAM = ActivityManagerWrapper.getInstance();
         mRecentsModel = RecentsModel.INSTANCE.get(this);
         mOverviewComponentObserver = new OverviewComponentObserver(this);
+        mOverviewComponentObserver.getActivityControlHelper().onAssistantVisibilityChanged(
+                mPendingAssistantVisibility);
 
         mOverviewCommandHelper = new OverviewCommandHelper(this, mOverviewComponentObserver);
         mOverviewInteractionState = OverviewInteractionState.INSTANCE.get(this);