[Search] Tie quick-launch and focus highlight

Highlight and quick-launch item should be determined by Search service pipeline based on quick_launch flag on SearchTarget

Bug: 183083807
Bug: 183083682
Test: Manual
Change-Id: I0191474653deca7e1ecd01fa92c90efcdbb9a8dc
This commit is contained in:
Samuel Fufa
2021-03-19 09:52:37 -05:00
parent bab908bfca
commit 147527229b
6 changed files with 41 additions and 80 deletions

View File

@@ -15,7 +15,6 @@
*/
package com.android.launcher3.allapps;
import static com.android.launcher3.allapps.AllAppsGridAdapter.AdapterItem;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION;
@@ -63,7 +62,6 @@ import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.MultiValueAlpha;
@@ -564,37 +562,9 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
/**
* Handles selection on focused view and returns success
*/
public boolean selectFocusedView(View v) {
ItemInfo headerItem = getHighlightedItemFromHeader();
if (headerItem != null) {
return mLauncher.startActivitySafely(v, headerItem.getIntent(), headerItem);
}
AdapterItem focusedItem = getActiveRecyclerView().getApps().getFocusedChild();
if (focusedItem != null) {
View focusedView = getActiveRecyclerView().getLayoutManager()
.findViewByPosition(focusedItem.position);
if (focusedView != null && mSearchAdapterProvider.onAdapterItemSelected(focusedItem,
focusedView)) {
return true;
}
}
if (focusedItem != null && focusedItem.appInfo != null) {
ItemInfo itemInfo = focusedItem.appInfo;
return mLauncher.startActivitySafely(v, itemInfo.getIntent(), itemInfo);
}
return false;
}
/**
* Returns the ItemInfo of a focused view inside {@link FloatingHeaderView}
*/
public ItemInfo getHighlightedItemFromHeader() {
View view = getFloatingHeaderView().getFocusedChild();
if (view != null && view.getTag() instanceof ItemInfo) {
return ((ItemInfo) view.getTag());
}
return null;
public boolean launchHighlightedItem() {
if (mSearchAdapterProvider == null) return false;
return mSearchAdapterProvider.launchHighlightedItem();
}
public SearchAdapterProvider getSearchAdapterProvider() {