Setup logging pipeline for search results

Bug: 168121204
Test: Manual
Change-Id: I4abb6c75aa0f22416616a713733bef2802b703d1
This commit is contained in:
Samuel Fufa committed 2020-09-10 17:28:42 -07:00
1 parent 4dfd31024e
commit f4eb70c96e
10 files changed
+264 -61

No files matched your search

@@ -31,6 +31,9 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsGridAdapter;
import com.android.launcher3.allapps.search.AllAppsSearchBarController;
import com.android.systemui.plugins.AllAppsSearchPlugin;
import com.android.systemui.plugins.shared.SearchTarget;
import com.android.systemui.plugins.shared.SearchTargetEvent;
import java.util.ArrayList;
@@ -44,6 +47,7 @@ public class SearchSettingsRowView extends LinearLayout implements
private TextView mDescriptionView;
private TextView mBreadcrumbsView;
private Intent mIntent;
private AllAppsSearchPlugin mPlugin;
public SearchSettingsRowView(@NonNull Context context) {
super(context);
@@ -72,6 +76,7 @@ public class SearchSettingsRowView extends LinearLayout implements
public void applyAdapterInfo(
AllAppsGridAdapter.AdapterItemWithPayload<Bundle> adapterItemWithPayload) {
Bundle bundle = adapterItemWithPayload.getPayload();
mPlugin = adapterItemWithPayload.getPlugin();
mIntent = bundle.getParcelable("intent");
showIfAvailable(mTitleView, bundle.getString("title"));
showIfAvailable(mDescriptionView, bundle.getString("description"));
@@ -79,7 +84,7 @@ public class SearchSettingsRowView extends LinearLayout implements
//TODO: implement RTL friendly breadcrumbs view
showIfAvailable(mBreadcrumbsView, breadcrumbs != null
? String.join(" > ", breadcrumbs) : null);
adapterItemWithPayload.setSelectionHandler(() -> onClick(this));
adapterItemWithPayload.setSelectionHandler(this::handleSelection);
}
private void showIfAvailable(TextView view, @Nullable String string) {
@@ -93,10 +98,22 @@ public class SearchSettingsRowView extends LinearLayout implements
@Override
public void onClick(View view) {
handleSelection(SearchTargetEvent.SELECT);
}
private void handleSelection(int eventType) {
if (mIntent == null) return;
// TODO: create ItemInfo object and then use it to call startActivityForResult for proper
// WW logging
Launcher launcher = Launcher.getLauncher(view.getContext());
Launcher launcher = Launcher.getLauncher(getContext());
launcher.startActivityForResult(mIntent, 0);
SearchTargetEvent searchTargetEvent = new SearchTargetEvent(
SearchTarget.ItemType.SETTINGS_ROW, eventType);
searchTargetEvent.bundle = new Bundle();
searchTargetEvent.bundle.putParcelable("intent", mIntent);
if (mPlugin != null) {
mPlugin.notifySearchTargetEvent(searchTargetEvent);
}
}
}