Unbind service only if it was bound

Removed unused SplitPlaceholderView

Fixes: 200004580
Change-Id: I54ee819260ad6e4e6da2d3efafd38bad0336486e
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index b8ce818..a68322d 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -85,7 +85,6 @@
 import com.android.quickstep.util.SplitSelectStateController;
 import com.android.quickstep.views.OverviewActionsView;
 import com.android.quickstep.views.RecentsView;
-import com.android.quickstep.views.SplitPlaceholderView;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.ActivityOptionsCompat;
 import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -131,7 +130,7 @@
                 // Seems like there can be a race condition when user unlocks, which kills the TIS
                 // process and re-starts it. I guess in the meantime service can be connected to
                 // a killed TIS? Either way, unbind and try to re-connect in that case.
-                unbindService(mTisBinderConnection);
+                internalUnbindToTIS();
                 mHandler.postDelayed(mConnectionRunnable, BACKOFF_MILLIS);
                 return;
             }
@@ -159,10 +158,10 @@
     private short mConnectionAttempts;
     private final TaskbarStateHandler mTaskbarStateHandler = new TaskbarStateHandler(this);
     private final Handler mHandler = new Handler();
+    private boolean mTisServiceBound;
 
     // Will be updated when dragging from taskbar.
     private @Nullable DragOptions mNextWorkspaceDragOptions = null;
-    private SplitPlaceholderView mSplitPlaceholderView;
 
     private @Nullable UnfoldTransitionProgressProvider mUnfoldTransitionProgressProvider;
     private @Nullable LauncherUnfoldAnimationController mLauncherUnfoldAnimationController;
@@ -202,7 +201,7 @@
 
         SysUINavigationMode.INSTANCE.get(this).removeModeChangeListener(this);
 
-        unbindService(mTisBinderConnection);
+        internalUnbindToTIS();
         if (mTaskbarManager != null) {
             mTaskbarManager.clearLauncher(this);
         }
@@ -363,12 +362,13 @@
 
     /**
      * Binds {@link #mTisBinderConnection} to {@link TouchInteractionService}. If the binding fails,
-     * attempts to retry via {@link #mConnectionRunnable}
+     * attempts to retry via {@link #mConnectionRunnable}.
+     * Unbind via {@link #internalUnbindToTIS()}
      */
     private void internalBindToTIS() {
-        boolean bound = bindService(new Intent(this, TouchInteractionService.class),
+        mTisServiceBound = bindService(new Intent(this, TouchInteractionService.class),
                         mTisBinderConnection, 0);
-        if (bound) {
+        if (mTisServiceBound) {
             resetServiceBindRetryState();
             return;
         }
@@ -380,6 +380,14 @@
         mConnectionAttempts++;
     }
 
+    /** See {@link #internalBindToTIS()} */
+    private void internalUnbindToTIS() {
+        if (mTisServiceBound) {
+            unbindService(mTisBinderConnection);
+            mTisServiceBound = false;
+        }
+    }
+
     private void resetServiceBindRetryState() {
         if (mHandler.hasCallbacks(mConnectionRunnable)) {
             mHandler.removeCallbacks(mConnectionRunnable);
@@ -417,10 +425,6 @@
         return (T) mActionsView;
     }
 
-    public SplitPlaceholderView getSplitPlaceholderView() {
-        return mSplitPlaceholderView;
-    }
-
     @Override
     protected void closeOpenViews(boolean animate) {
         super.closeOpenViews(animate);