Unbind service only if it was bound

Removed unused SplitPlaceholderView

Fixes: 200004580
Change-Id: I54ee819260ad6e4e6da2d3efafd38bad0336486e
This commit is contained in:
Vinit Nayak
2021-09-27 13:23:13 -07:00
parent d58e7b6fc4
commit a26e4f8e43

View File

@@ -85,7 +85,6 @@ import com.android.quickstep.util.RemoteFadeOutAnimationListener;
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 @@ public abstract class BaseQuickstepLauncher extends Launcher
// 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 @@ public abstract class BaseQuickstepLauncher extends Launcher
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 @@ public abstract class BaseQuickstepLauncher extends Launcher
SysUINavigationMode.INSTANCE.get(this).removeModeChangeListener(this);
unbindService(mTisBinderConnection);
internalUnbindToTIS();
if (mTaskbarManager != null) {
mTaskbarManager.clearLauncher(this);
}
@@ -363,12 +362,13 @@ public abstract class BaseQuickstepLauncher extends Launcher
/**
* 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 @@ public abstract class BaseQuickstepLauncher extends Launcher
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 @@ public abstract class BaseQuickstepLauncher extends Launcher
return (T) mActionsView;
}
public SplitPlaceholderView getSplitPlaceholderView() {
return mSplitPlaceholderView;
}
@Override
protected void closeOpenViews(boolean animate) {
super.closeOpenViews(animate);