[AA+] Log app launches from DeviceSearchResultContainer with instance ID.
This InstanceId is used to recreate the AA+ session on the server side. Bug: 178562918 Change-Id: I1bba94417d3a142351e2470bb6153707d2cadb11
This commit is contained in:
1 parent
cbeb13d6c7
commit
f4d19f4614
4 files changed
+32
-4
No files matched your search
@@ -33,10 +33,13 @@ import androidx.slice.widget.SliceLiveData;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.widget.PendingAddWidgetInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Manages Lifecycle for Live search results
|
||||
@@ -51,6 +54,7 @@ public class LiveSearchManager {
|
||||
new HashMap<>();
|
||||
private final HashMap<Uri, LiveData<Slice>> mUriSliceMap = new HashMap<>();
|
||||
private SearchWidgetHost mSearchWidgetHost;
|
||||
private InstanceId mLogInstanceId;
|
||||
|
||||
public LiveSearchManager(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
@@ -113,6 +117,7 @@ public class LiveSearchManager {
|
||||
*/
|
||||
public void start() {
|
||||
stop();
|
||||
mLogInstanceId = new InstanceIdSequence().newInstanceId();
|
||||
mSearchWidgetHost = new SearchWidgetHost(mLauncher);
|
||||
mSearchWidgetHost.startListening();
|
||||
}
|
||||
@@ -136,6 +141,14 @@ public class LiveSearchManager {
|
||||
mUriSliceMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link InstanceId} that should be used for logging events within search session, if
|
||||
* available.
|
||||
*/
|
||||
public Optional<InstanceId> getLogInstanceId() {
|
||||
return Optional.ofNullable(mLogInstanceId);
|
||||
}
|
||||
|
||||
static class SearchWidgetHost extends AppWidgetHost {
|
||||
SearchWidgetHost(Context context) {
|
||||
super(context, SEARCH_APPWIDGET_HOST_ID);
|
||||
|
||||
Reference in new issue
Block a user