Merge "Ensure that the recent tasks are loaded for SysUI's current user." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-06-23 05:16:08 +00:00
committed by Android (Google) Code Review

View File

@@ -71,6 +71,7 @@ public class RecentsTaskLoadPlan {
Context mContext; Context mContext;
int mPreloadedUserId;
List<ActivityManager.RecentTaskInfo> mRawTasks; List<ActivityManager.RecentTaskInfo> mRawTasks;
TaskStack mStack; TaskStack mStack;
ArraySet<Integer> mCurrentQuietProfiles = new ArraySet<Integer>(); ArraySet<Integer> mCurrentQuietProfiles = new ArraySet<Integer>();
@@ -83,9 +84,6 @@ public class RecentsTaskLoadPlan {
private void updateCurrentQuietProfilesCache(int currentUserId) { private void updateCurrentQuietProfilesCache(int currentUserId) {
mCurrentQuietProfiles.clear(); mCurrentQuietProfiles.clear();
if (currentUserId == UserHandle.USER_CURRENT) {
currentUserId = SystemServicesProxy.getInstance(mContext).getCurrentUser();
}
UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
List<UserInfo> profiles = userManager.getProfiles(currentUserId); List<UserInfo> profiles = userManager.getProfiles(currentUserId);
if (profiles != null) { if (profiles != null) {
@@ -105,9 +103,10 @@ public class RecentsTaskLoadPlan {
* Note: Do not lock, callers should synchronize on the loader before making this call. * Note: Do not lock, callers should synchronize on the loader before making this call.
*/ */
void preloadRawTasks(boolean includeFrontMostExcludedTask) { void preloadRawTasks(boolean includeFrontMostExcludedTask) {
int currentUserId = UserHandle.USER_CURRENT;
updateCurrentQuietProfilesCache(currentUserId);
SystemServicesProxy ssp = Recents.getSystemServices(); SystemServicesProxy ssp = Recents.getSystemServices();
int currentUserId = ssp.getCurrentUser();
updateCurrentQuietProfilesCache(currentUserId);
mPreloadedUserId = currentUserId;
mRawTasks = ssp.getRecentTasks(ActivityManager.getMaxRecentTasksStatic(), mRawTasks = ssp.getRecentTasks(ActivityManager.getMaxRecentTasksStatic(),
currentUserId, includeFrontMostExcludedTask, mCurrentQuietProfiles); currentUserId, includeFrontMostExcludedTask, mCurrentQuietProfiles);
@@ -135,7 +134,6 @@ public class RecentsTaskLoadPlan {
preloadRawTasks(includeFrontMostExcludedTask); preloadRawTasks(includeFrontMostExcludedTask);
} }
SystemServicesProxy ssp = SystemServicesProxy.getInstance(mContext);
SparseArray<Task.TaskKey> affiliatedTasks = new SparseArray<>(); SparseArray<Task.TaskKey> affiliatedTasks = new SparseArray<>();
SparseIntArray affiliatedTaskCounts = new SparseIntArray(); SparseIntArray affiliatedTaskCounts = new SparseIntArray();
SparseBooleanArray lockedUsers = new SparseBooleanArray(); SparseBooleanArray lockedUsers = new SparseBooleanArray();
@@ -143,7 +141,7 @@ public class RecentsTaskLoadPlan {
R.string.accessibility_recents_item_will_be_dismissed); R.string.accessibility_recents_item_will_be_dismissed);
String appInfoDescFormat = mContext.getString( String appInfoDescFormat = mContext.getString(
R.string.accessibility_recents_item_open_app_info); R.string.accessibility_recents_item_open_app_info);
int currentUserId = ssp.getCurrentUser(); int currentUserId = mPreloadedUserId;
long legacyLastStackActiveTime = migrateLegacyLastStackActiveTime(currentUserId); long legacyLastStackActiveTime = migrateLegacyLastStackActiveTime(currentUserId);
long lastStackActiveTime = Settings.Secure.getLongForUser(mContext.getContentResolver(), long lastStackActiveTime = Settings.Secure.getLongForUser(mContext.getContentResolver(),
Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, legacyLastStackActiveTime, currentUserId); Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, legacyLastStackActiveTime, currentUserId);