[automerger] Only preload tasks in background when service is connected am: b882b171e0
Change-Id: Ibe7acefd4575a73072270d04f21ec47cfa354bc8
This commit is contained in:
@@ -87,7 +87,8 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||
private int mTaskChangeId;
|
||||
private ISystemUiProxy mSystemUiProxy;
|
||||
private boolean mClearAssistCacheOnStackChange = true;
|
||||
private final boolean mPreloadTasksInBackground;
|
||||
private final boolean mIsLowRamDevice;
|
||||
private boolean mPreloadTasksInBackground;
|
||||
private final AccessibilityManager mAccessibilityManager;
|
||||
|
||||
private RecentsModel(Context context) {
|
||||
@@ -95,7 +96,7 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||
|
||||
ActivityManager activityManager =
|
||||
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
mPreloadTasksInBackground = !activityManager.isLowRamDevice();
|
||||
mIsLowRamDevice = activityManager.isLowRamDevice();
|
||||
mMainThreadExecutor = new MainThreadExecutor();
|
||||
|
||||
Resources res = context.getResources();
|
||||
@@ -160,6 +161,10 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setPreloadTasksInBackground(boolean preloadTasksInBackground) {
|
||||
mPreloadTasksInBackground = preloadTasksInBackground && !mIsLowRamDevice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPinned(String packageName, int userId, int taskId, int stackId) {
|
||||
mTaskChangeId++;
|
||||
|
||||
@@ -173,6 +173,7 @@ public class TouchInteractionService extends Service {
|
||||
super.onCreate();
|
||||
mAM = ActivityManagerWrapper.getInstance();
|
||||
mRecentsModel = RecentsModel.getInstance(this);
|
||||
mRecentsModel.setPreloadTasksInBackground(true);
|
||||
mMainThreadExecutor = new MainThreadExecutor();
|
||||
mOverviewCommandHelper = new OverviewCommandHelper(this);
|
||||
mMainThreadChoreographer = Choreographer.getInstance();
|
||||
|
||||
Reference in New Issue
Block a user