Remove RecentsExtraCard plugin hook.

This plugin hook never really worked properly. The touch handling was
always a bit off and it complicates the code.

Bug: 201460301
Test: Local
Change-Id: I19401be18f859b3bdf408a2e4aacd95ca95d35cc
This commit is contained in:
Zak Cohen
2021-09-28 16:09:45 -07:00
parent c1359c448d
commit 323b1e4f43
5 changed files with 27 additions and 254 deletions
@@ -29,18 +29,14 @@ import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.Surface;
import android.widget.FrameLayout;
import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.RecentsExtraCard;
/**
* {@link RecentsView} used in Launcher activity
@@ -49,25 +45,6 @@ import com.android.systemui.plugins.RecentsExtraCard;
public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, LauncherState>
implements StateListener<LauncherState> {
private RecentsExtraCard mRecentsExtraCardPlugin;
private RecentsExtraViewContainer mRecentsExtraViewContainer;
private PluginListener<RecentsExtraCard> mRecentsExtraCardPluginListener =
new PluginListener<RecentsExtraCard>() {
@Override
public void onPluginConnected(RecentsExtraCard recentsExtraCard, Context context) {
createRecentsExtraCard();
mRecentsExtraCardPlugin = recentsExtraCard;
mRecentsExtraCardPlugin.setupView(context, mRecentsExtraViewContainer, mActivity);
}
@Override
public void onPluginDisconnected(RecentsExtraCard plugin) {
removeView(mRecentsExtraViewContainer);
mRecentsExtraCardPlugin = null;
mRecentsExtraViewContainer = null;
}
};
public LauncherRecentsView(Context context) {
this(context, null);
}
@@ -147,73 +124,6 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
return result || mActivity.getStateManager().getState().overviewUi;
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
PluginManagerWrapper.INSTANCE.get(getContext()).addPluginListener(
mRecentsExtraCardPluginListener, RecentsExtraCard.class);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(
mRecentsExtraCardPluginListener);
}
@Override
protected int computeMinScroll() {
if (canComputeScrollX() && !mIsRtl) {
return computeScrollX();
}
return super.computeMinScroll();
}
@Override
protected int computeMaxScroll() {
if (canComputeScrollX() && mIsRtl) {
return computeScrollX();
}
return super.computeMaxScroll();
}
private boolean canComputeScrollX() {
return mRecentsExtraCardPlugin != null && getTaskViewCount() > 0
&& !mDisallowScrollToClearAll;
}
private int computeScrollX() {
int scrollIndex = getTaskViewStartIndex() - 1;
while (scrollIndex >= 0 && getChildAt(scrollIndex) instanceof RecentsExtraViewContainer
&& ((RecentsExtraViewContainer) getChildAt(scrollIndex)).isScrollable()) {
scrollIndex--;
}
return getScrollForPage(scrollIndex + 1);
}
private void createRecentsExtraCard() {
mRecentsExtraViewContainer = new RecentsExtraViewContainer(getContext());
FrameLayout.LayoutParams helpCardParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
mRecentsExtraViewContainer.setLayoutParams(helpCardParams);
mRecentsExtraViewContainer.setScrollable(true);
addView(mRecentsExtraViewContainer, 0);
}
@Override
public boolean hasRecentsExtraCard() {
return mRecentsExtraViewContainer != null;
}
@Override
public void setContentAlpha(float alpha) {
super.setContentAlpha(alpha);
if (mRecentsExtraViewContainer != null) {
mRecentsExtraViewContainer.setAlpha(alpha);
}
}
@Override
protected DepthController getDepthController() {
return mActivity.getDepthController();