Merge "TaskOverlayFactoryGo: Keep persistent instance of AssistContentRequester" into sc-dev am: b7cecf8a90 am: 47229933c7 am: 9fb00f09bf
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14803962
Change-Id: Ida9ec2f681a63ec1967970d06c45963809d3e130
diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
index 754782b..65cdcf0 100644
--- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
+++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
@@ -53,14 +53,17 @@
public static final int ERROR_PERMISSIONS = 1;
private static final String TAG = "TaskOverlayFactoryGo";
- // Empty constructor required for ResourceBasedOverride
- public TaskOverlayFactoryGo(Context context) {}
+ private AssistContentRequester mContentRequester;
+
+ public TaskOverlayFactoryGo(Context context) {
+ mContentRequester = new AssistContentRequester(context);
+ }
/**
* Create a new overlay instance for the given View
*/
public TaskOverlayGo createOverlay(TaskThumbnailView thumbnailView) {
- return new TaskOverlayGo(thumbnailView);
+ return new TaskOverlayGo(thumbnailView, mContentRequester);
}
/**
@@ -72,9 +75,12 @@
private String mTaskPackageName;
private String mWebUrl;
private boolean mAssistPermissionsEnabled;
+ private AssistContentRequester mFactoryContentRequester;
- private TaskOverlayGo(TaskThumbnailView taskThumbnailView) {
+ private TaskOverlayGo(TaskThumbnailView taskThumbnailView,
+ AssistContentRequester assistContentRequester) {
super(taskThumbnailView);
+ mFactoryContentRequester = assistContentRequester;
}
/**
@@ -105,9 +111,7 @@
}
int taskId = task.key.id;
- AssistContentRequester contentRequester =
- new AssistContentRequester(mApplicationContext);
- contentRequester.requestAssistContent(taskId, this::onAssistContentReceived);
+ mFactoryContentRequester.requestAssistContent(taskId, this::onAssistContentReceived);
}
/** Provide Assist Content to the overlay. */