Cleaning up task loading code.
- Moving all references of SystemServicesProxy and RecentsTaskLoader to
a single static instance in Recents. This ensures that we only refer
to an instance that is created with the application context.
- Moving ActivityInfo cache into RecentsTaskLoader with the other caches
which allows us to invalidate it less frequently. This requires the
loader to handle package changes to invalidate the cached infos
accordingly.
- Cleaned up old code to handle case where the Recents component for
secondary users might not be initialized (fixed in ag/773159)
- Moving the package monitor to the background thread.
- Cleaning user interaction and visibility changes to events.
- Fixed issue with sending events from binder thread.
Change-Id: Ie785347055736f6dd7802f32454f77073e20b83e
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index c2400df..6bdd7de 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -42,6 +42,7 @@
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
import com.android.systemui.recents.Constants;
+import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsActivity;
import com.android.systemui.recents.RecentsAppWidgetHostView;
import com.android.systemui.recents.RecentsConfiguration;
@@ -53,7 +54,6 @@
import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
@@ -404,14 +404,6 @@
return super.verifyDrawable(who);
}
- /** Notifies each task view of the user interaction. */
- public void onUserInteraction() {
- // Get the first stack view
- if (mTaskStackView != null) {
- mTaskStackView.onUserInteraction();
- }
- }
-
/** Focuses the next task in the first stack view */
public void focusNextTask(boolean forward) {
// Get the first stack view
@@ -637,8 +629,7 @@
}
// Compute the thumbnail to scale up from
- final SystemServicesProxy ssp =
- RecentsTaskLoader.getInstance().getSystemServicesProxy();
+ final SystemServicesProxy ssp = Recents.getSystemServices();
ActivityOptions opts = null;
ActivityOptions.OnAnimationStartedListener animStartedListener = null;
if (task.thumbnail != null && task.thumbnail.getWidth() > 0 &&
@@ -652,8 +643,6 @@
postDelayed(new Runnable() {
@Override
public void run() {
- RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
- SystemServicesProxy ssp = loader.getSystemServicesProxy();
EventBus.getDefault().send(new ScreenPinningRequestEvent(
getContext(), ssp));
}
@@ -687,8 +676,6 @@
if (ssp.startActivityFromRecents(getContext(), task.key.id,
task.activityLabel, launchOpts)) {
if (screenPinningRequested) {
- RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
- SystemServicesProxy ssp = loader.getSystemServicesProxy();
EventBus.getDefault().send(new ScreenPinningRequestEvent(
getContext(), ssp));
}
@@ -748,14 +735,6 @@
MetricsLogger.count(getContext(), "overview_task_all_dismissed", 1);
}
- /** Final callback after Recents is finally hidden. */
- public void onRecentsHidden() {
- // Notify each task stack view
- if (mTaskStackView != null) {
- mTaskStackView.onRecentsHidden();
- }
- }
-
@Override
public void onTaskStackFilterTriggered() {
// Hide the search bar
@@ -820,7 +799,7 @@
// Dock the new task if we are hovering over a valid dock state
if (event.dockState != TaskStack.DockState.NONE) {
- SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy();
+ SystemServicesProxy ssp = Recents.getSystemServices();
ssp.setTaskResizeable(event.task.key.id);
ssp.dockTask(event.task.key.id, event.dockState.createMode);
launchTask(event.task, null, INVALID_STACK_ID);