Route PredictedAppIcon clicks through launcher

* This allows us to intercept launching predicted apps for
split-screen if user is in split selection flow
* Defaults to existing behavior of ItemClickHandler.INSTANCE
if we do not need to intercept the click

Bug: 276361926
Flag: ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE
Test: Launches as expected when not in split, launches in
split when selected as second app to initiate split with

Change-Id: Ieb45137ae89da340d314e995f4f6eb1f8b49a42f
This commit is contained in:
Vinit Nayak
2023-04-18 18:20:01 -07:00
parent a6a0867b65
commit 1bb594c72b
4 changed files with 6 additions and 5 deletions
@@ -402,8 +402,9 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
PredictedAppIcon icon = (PredictedAppIcon) LayoutInflater.from(parent.getContext())
.inflate(R.layout.predicted_app_icon, parent, false);
icon.applyFromWorkspaceItem(info);
icon.setOnClickListener(ItemClickHandler.INSTANCE);
icon.setOnFocusChangeListener(Launcher.getLauncher(parent.getContext()).getFocusHandler());
Launcher launcher = Launcher.getLauncher(parent.getContext());
icon.setOnClickListener(launcher.getItemOnClickListener());
icon.setOnFocusChangeListener(launcher.getFocusHandler());
return icon;
}
@@ -205,7 +205,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx;
icon.setTag(folderInfo);
icon.setOnClickListener(ItemClickHandler.INSTANCE);
icon.setOnClickListener(activity.getItemOnClickListener());
icon.mInfo = folderInfo;
icon.mActivity = activity;
icon.mDotRenderer = grid.mDotRendererWorkSpace;
@@ -216,7 +216,7 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
final BubbleTextView textView = mViewCache.getView(
R.layout.folder_application, getContext(), null);
textView.applyFromWorkspaceItem(item);
textView.setOnClickListener(ItemClickHandler.INSTANCE);
textView.setOnClickListener(mFolder.mActivityContext.getItemOnClickListener());
textView.setOnLongClickListener(mFolder);
textView.setOnFocusChangeListener(mFocusIndicatorHelper);
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) textView.getLayoutParams();
@@ -86,7 +86,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView
setWillNotDraw(false);
super.updateAppWidget(null);
setOnClickListener(ItemClickHandler.INSTANCE);
setOnClickListener(mLauncher.getItemOnClickListener());
if (info.pendingItemInfo == null) {
info.pendingItemInfo = new PackageItemInfo(info.providerName.getPackageName(),