Merge "Stop preloading recent tasks in SysUI when bound to overview service" into pi-dev
This commit is contained in:
@@ -26,6 +26,7 @@ import android.app.ActivityManager;
|
|||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.trust.TrustManager;
|
import android.app.trust.TrustManager;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.ComponentCallbacks2;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -45,6 +46,8 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.android.systemui.Dependency;
|
||||||
|
import com.android.systemui.OverviewProxyService;
|
||||||
import com.google.android.collect.Lists;
|
import com.google.android.collect.Lists;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
@@ -122,6 +125,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTaskStackChangedBackground() {
|
public void onTaskStackChangedBackground() {
|
||||||
|
// Skip background preloading recents in SystemUI if the overview services is bound
|
||||||
|
if (Dependency.get(OverviewProxyService.class).getProxy() != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check this is for the right user
|
// Check this is for the right user
|
||||||
if (!checkCurrentUserId(mContext, false /* debug */)) {
|
if (!checkCurrentUserId(mContext, false /* debug */)) {
|
||||||
return;
|
return;
|
||||||
@@ -257,6 +265,17 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private OverviewProxyService.OverviewProxyListener mOverviewProxyListener =
|
||||||
|
new OverviewProxyService.OverviewProxyListener() {
|
||||||
|
@Override
|
||||||
|
public void onConnectionChanged(boolean isConnected) {
|
||||||
|
if (!isConnected) {
|
||||||
|
// Clear everything when the connection to the overview service
|
||||||
|
Recents.getTaskLoader().onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public RecentsImpl(Context context) {
|
public RecentsImpl(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mHandler = new Handler();
|
mHandler = new Handler();
|
||||||
@@ -277,6 +296,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onBootCompleted() {
|
public void onBootCompleted() {
|
||||||
|
// Skip preloading tasks if we are already bound to the service
|
||||||
|
if (Dependency.get(OverviewProxyService.class).getProxy() != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// When we start, preload the data associated with the previous recent tasks.
|
// When we start, preload the data associated with the previous recent tasks.
|
||||||
// We can use a new plan since the caches will be the same.
|
// We can use a new plan since the caches will be the same.
|
||||||
RecentsTaskLoader loader = Recents.getTaskLoader();
|
RecentsTaskLoader loader = Recents.getTaskLoader();
|
||||||
|
|||||||
Reference in New Issue
Block a user