Merge "Fixing case where we were not preloading tasks correctly." into mnc-dev
This commit is contained in:
@@ -35,6 +35,7 @@ import android.graphics.Rect;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.util.MutableBoolean;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -57,7 +58,6 @@ import com.android.systemui.recents.views.TaskViewTransform;
|
|||||||
import com.android.systemui.statusbar.phone.PhoneStatusBar;
|
import com.android.systemui.statusbar.phone.PhoneStatusBar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation for a method that is only called from the primary user's SystemUI process and will be
|
* Annotation for a method that is only called from the primary user's SystemUI process and will be
|
||||||
@@ -362,7 +362,12 @@ public class Recents extends SystemUI
|
|||||||
// RecentsActivity)
|
// RecentsActivity)
|
||||||
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
|
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
|
||||||
sInstanceLoadPlan = loader.createLoadPlan(mContext);
|
sInstanceLoadPlan = loader.createLoadPlan(mContext);
|
||||||
sInstanceLoadPlan.preloadRawTasks(true);
|
|
||||||
|
ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask();
|
||||||
|
MutableBoolean isTopTaskHome = new MutableBoolean(true);
|
||||||
|
if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) {
|
||||||
|
sInstanceLoadPlan.preloadRawTasks(isTopTaskHome.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -546,7 +551,7 @@ public class Recents extends SystemUI
|
|||||||
// If Recents is the front most activity, then we should just communicate with it directly
|
// If Recents is the front most activity, then we should just communicate with it directly
|
||||||
// to launch the first task or dismiss itself
|
// to launch the first task or dismiss itself
|
||||||
ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask();
|
ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask();
|
||||||
AtomicBoolean isTopTaskHome = new AtomicBoolean(true);
|
MutableBoolean isTopTaskHome = new MutableBoolean(true);
|
||||||
if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) {
|
if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) {
|
||||||
// Notify recents to toggle itself
|
// Notify recents to toggle itself
|
||||||
Intent intent = createLocalBroadcastIntent(mContext, ACTION_TOGGLE_RECENTS_ACTIVITY);
|
Intent intent = createLocalBroadcastIntent(mContext, ACTION_TOGGLE_RECENTS_ACTIVITY);
|
||||||
@@ -555,7 +560,7 @@ public class Recents extends SystemUI
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, start the recents activity
|
// Otherwise, start the recents activity
|
||||||
startRecentsActivity(topTask, isTopTaskHome.get());
|
startRecentsActivity(topTask, isTopTaskHome.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,9 +568,9 @@ public class Recents extends SystemUI
|
|||||||
void startRecentsActivity() {
|
void startRecentsActivity() {
|
||||||
// Check if the top task is in the home stack, and start the recents activity
|
// Check if the top task is in the home stack, and start the recents activity
|
||||||
ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask();
|
ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask();
|
||||||
AtomicBoolean isTopTaskHome = new AtomicBoolean(true);
|
MutableBoolean isTopTaskHome = new MutableBoolean(true);
|
||||||
if (topTask == null || !mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) {
|
if (topTask == null || !mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) {
|
||||||
startRecentsActivity(topTask, isTopTaskHome.get());
|
startRecentsActivity(topTask, isTopTaskHome.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,6 +659,7 @@ public class Recents extends SystemUI
|
|||||||
if (task == null) {
|
if (task == null) {
|
||||||
// If no task is specified or we can not find the task just use the front most one
|
// If no task is specified or we can not find the task just use the front most one
|
||||||
task = tasks.get(tasks.size() - 1);
|
task = tasks.get(tasks.size() - 1);
|
||||||
|
runningTaskOut.copyFrom(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the transform for the running task
|
// Get the transform for the running task
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import android.os.SystemProperties;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.MutableBoolean;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
@@ -67,12 +68,9 @@ import com.android.systemui.recents.Recents;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts as a shim around the real system services that we need to access data from, and provides
|
* Acts as a shim around the real system services that we need to access data from, and provides
|
||||||
@@ -192,7 +190,7 @@ public class SystemServicesProxy {
|
|||||||
|
|
||||||
// Break early if we can't get a valid set of tasks
|
// Break early if we can't get a valid set of tasks
|
||||||
if (tasks == null) {
|
if (tasks == null) {
|
||||||
return new ArrayList<ActivityManager.RecentTaskInfo>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isFirstValidTask = true;
|
boolean isFirstValidTask = true;
|
||||||
@@ -235,7 +233,7 @@ public class SystemServicesProxy {
|
|||||||
|
|
||||||
/** Returns whether the recents is currently running */
|
/** Returns whether the recents is currently running */
|
||||||
public boolean isRecentsTopMost(ActivityManager.RunningTaskInfo topTask,
|
public boolean isRecentsTopMost(ActivityManager.RunningTaskInfo topTask,
|
||||||
AtomicBoolean isHomeTopMost) {
|
MutableBoolean isHomeTopMost) {
|
||||||
if (topTask != null) {
|
if (topTask != null) {
|
||||||
ComponentName topActivity = topTask.topActivity;
|
ComponentName topActivity = topTask.topActivity;
|
||||||
|
|
||||||
@@ -243,13 +241,13 @@ public class SystemServicesProxy {
|
|||||||
if (topActivity.getPackageName().equals(Recents.sRecentsPackage) &&
|
if (topActivity.getPackageName().equals(Recents.sRecentsPackage) &&
|
||||||
topActivity.getClassName().equals(Recents.sRecentsActivity)) {
|
topActivity.getClassName().equals(Recents.sRecentsActivity)) {
|
||||||
if (isHomeTopMost != null) {
|
if (isHomeTopMost != null) {
|
||||||
isHomeTopMost.set(false);
|
isHomeTopMost.value = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHomeTopMost != null) {
|
if (isHomeTopMost != null) {
|
||||||
isHomeTopMost.set(isInHomeStack(topTask.id));
|
isHomeTopMost.value = isInHomeStack(topTask.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -104,13 +104,9 @@ public class RecentsTaskLoadPlan {
|
|||||||
if (mRawTasks == null) {
|
if (mRawTasks == null) {
|
||||||
preloadRawTasks(isTopTaskHome);
|
preloadRawTasks(isTopTaskHome);
|
||||||
}
|
}
|
||||||
int firstStackId = -1;
|
|
||||||
int taskCount = mRawTasks.size();
|
int taskCount = mRawTasks.size();
|
||||||
for (int i = 0; i < taskCount; i++) {
|
for (int i = 0; i < taskCount; i++) {
|
||||||
ActivityManager.RecentTaskInfo t = mRawTasks.get(i);
|
ActivityManager.RecentTaskInfo t = mRawTasks.get(i);
|
||||||
if (firstStackId < 0) {
|
|
||||||
firstStackId = t.stackId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compose the task key
|
// Compose the task key
|
||||||
Task.TaskKey taskKey = new Task.TaskKey(t.persistentId, t.stackId, t.baseIntent,
|
Task.TaskKey taskKey = new Task.TaskKey(t.persistentId, t.stackId, t.baseIntent,
|
||||||
@@ -158,17 +154,17 @@ public class RecentsTaskLoadPlan {
|
|||||||
|
|
||||||
if (!mConfig.multiStackEnabled ||
|
if (!mConfig.multiStackEnabled ||
|
||||||
Constants.DebugFlags.App.EnableMultiStackToSingleStack) {
|
Constants.DebugFlags.App.EnableMultiStackToSingleStack) {
|
||||||
firstStackId = 0;
|
int firstStackId = 0;
|
||||||
ArrayList<Task> stackTasks = stacksTasks.get(firstStackId);
|
ArrayList<Task> stackTasks = stacksTasks.get(firstStackId);
|
||||||
if (stackTasks == null) {
|
if (stackTasks == null) {
|
||||||
stackTasks = new ArrayList<Task>();
|
stackTasks = new ArrayList<>();
|
||||||
stacksTasks.put(firstStackId, stackTasks);
|
stacksTasks.put(firstStackId, stackTasks);
|
||||||
}
|
}
|
||||||
stackTasks.add(task);
|
stackTasks.add(task);
|
||||||
} else {
|
} else {
|
||||||
ArrayList<Task> stackTasks = stacksTasks.get(t.stackId);
|
ArrayList<Task> stackTasks = stacksTasks.get(t.stackId);
|
||||||
if (stackTasks == null) {
|
if (stackTasks == null) {
|
||||||
stackTasks = new ArrayList<Task>();
|
stackTasks = new ArrayList<>();
|
||||||
stacksTasks.put(t.stackId, stackTasks);
|
stacksTasks.put(t.stackId, stackTasks);
|
||||||
}
|
}
|
||||||
stackTasks.add(task);
|
stackTasks.add(task);
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
|||||||
if (tv == null) {
|
if (tv == null) {
|
||||||
launchRunnable.run();
|
launchRunnable.run();
|
||||||
} else {
|
} else {
|
||||||
if (!task.group.isFrontMostTask(task)) {
|
if (task.group != null && !task.group.isFrontMostTask(task)) {
|
||||||
// For affiliated tasks that are behind other tasks, we must animate the front cards
|
// For affiliated tasks that are behind other tasks, we must animate the front cards
|
||||||
// out of view before starting the task transition
|
// out of view before starting the task transition
|
||||||
stackView.startLaunchTaskAnimation(tv, launchRunnable, lockToTask);
|
stackView.startLaunchTaskAnimation(tv, launchRunnable, lockToTask);
|
||||||
|
|||||||
Reference in New Issue
Block a user