Remove unused recents affiliated task code.
Bug: 67510855
Test: Code removal
Change-Id: Ib56cdb1153ba85dd09e815b054dc0e12d04cfd38
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 283ac0c..b94f8e5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -81,23 +81,15 @@
implements RecentsComponent, CommandQueue.Callbacks {
private final static String TAG = "Recents";
- private final static boolean DEBUG = false;
public final static int EVENT_BUS_PRIORITY = 1;
public final static int BIND_TO_SYSTEM_USER_RETRY_DELAY = 5000;
- public final static int RECENTS_GROW_TARGET_INVALID = -1;
public final static Set<String> RECENTS_ACTIVITIES = new HashSet<>();
static {
RECENTS_ACTIVITIES.add(RecentsImpl.RECENTS_ACTIVITY);
}
- // Purely for experimentation
- private final static String RECENTS_OVERRIDE_SYSPROP_KEY = "persist.recents_override_pkg";
- private final static String ACTION_SHOW_RECENTS = "com.android.systemui.recents.ACTION_SHOW";
- private final static String ACTION_HIDE_RECENTS = "com.android.systemui.recents.ACTION_HIDE";
- private final static String ACTION_TOGGLE_RECENTS = "com.android.systemui.recents.ACTION_TOGGLE";
-
private static final String COUNTER_WINDOW_SUPPORTED = "window_enter_supported";
private static final String COUNTER_WINDOW_UNSUPPORTED = "window_enter_unsupported";
private static final String COUNTER_WINDOW_INCOMPATIBLE = "window_enter_incompatible";
@@ -107,11 +99,6 @@
private static RecentsTaskLoader sTaskLoader;
private static RecentsConfiguration sConfiguration;
- // For experiments only, allows another package to handle recents if it is defined in the system
- // properties. This is limited to show/toggle/hide, and does not tie into the ActivityManager,
- // and does not reside in the home stack.
- private String mOverrideRecentsPackageName;
-
private Handler mHandler;
private RecentsImpl mImpl;
private int mDraggingInRecentsCurrentUser;
@@ -211,14 +198,6 @@
mHandler = new Handler();
mImpl = new RecentsImpl(mContext);
- // Check if there is a recents override package
- if (Build.IS_USERDEBUG || Build.IS_ENG) {
- String cnStr = SystemProperties.get(RECENTS_OVERRIDE_SYSPROP_KEY);
- if (!cnStr.isEmpty()) {
- mOverrideRecentsPackageName = cnStr;
- }
- }
-
// Register with the event bus
EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
EventBus.getDefault().register(sSystemServicesProxy, EVENT_BUS_PRIORITY);
@@ -257,16 +236,8 @@
return;
}
- if (proxyToOverridePackage(ACTION_SHOW_RECENTS)) {
- return;
- }
- try {
- ActivityManager.getService().closeSystemDialogs(SYSTEM_DIALOG_REASON_RECENT_APPS);
- } catch (RemoteException e) {
- }
-
+ sSystemServicesProxy.sendCloseSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
int recentsGrowTarget = getComponent(Divider.class).getView().growsRecents();
-
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
@@ -301,10 +272,6 @@
return;
}
- if (proxyToOverridePackage(ACTION_HIDE_RECENTS)) {
- return;
- }
-
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
@@ -336,12 +303,7 @@
return;
}
- if (proxyToOverridePackage(ACTION_TOGGLE_RECENTS)) {
- return;
- }
-
int growTarget = getComponent(Divider.class).getView().growsRecents();
-
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.toggleRecents(growTarget);
@@ -820,21 +782,6 @@
(Settings.Secure.getInt(cr, Settings.Secure.USER_SETUP_COMPLETE, 0) != 0);
}
- /**
- * Attempts to proxy the following action to the override recents package.
- * @return whether the proxying was successful
- */
- private boolean proxyToOverridePackage(String action) {
- if (mOverrideRecentsPackageName != null) {
- Intent intent = new Intent(action);
- intent.setPackage(mOverrideRecentsPackageName);
- intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
- mContext.sendBroadcast(intent);
- return true;
- }
- return false;
- }
-
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("Recents");
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
index 0262a09..75f42af 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
@@ -33,8 +33,6 @@
public static final boolean EnableTransitionThumbnailDebugMode = false;
// This disables the bitmap and icon caches
public static final boolean DisableBackgroundCache = false;
- // Enables the task affiliations
- public static final boolean EnableAffiliatedTaskGroups = false;
// Enables the button above the stack
public static final boolean EnableStackActionButton = true;
// Overrides the Tuner flags and enables the timeout
@@ -50,10 +48,6 @@
public static final int MockTasksPackageCount = 3;
// Defines the number of mock recents tasks to create
public static final int MockTaskCount = 100;
- // Enables the simulated task affiliations
- public static final boolean EnableMockTaskGroups = false;
- // Defines the number of mock task affiliations per group
- public static final int MockTaskGroupsTaskCount = 12;
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 8dd3bdc..774e993 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -77,7 +77,6 @@
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.Task.TaskKey;
-import com.android.systemui.recents.model.TaskGrouping;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.model.ThumbnailData;
import com.android.systemui.recents.views.RecentsTransitionHelper;
@@ -594,43 +593,38 @@
Task toTask = null;
ActivityOptions launchOpts = null;
int taskCount = tasks.size();
- int numAffiliatedTasks = 0;
for (int i = 0; i < taskCount; i++) {
Task task = tasks.get(i);
if (task.key.id == runningTask.id) {
- TaskGrouping group = task.group;
- Task.TaskKey toTaskKey;
if (showNextTask) {
- toTaskKey = group.getNextTaskInGroup(task);
- launchOpts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_next_affiliated_task_target,
- R.anim.recents_launch_next_affiliated_task_source);
+ if ((i + 1) < taskCount) {
+ toTask = tasks.get(i + 1);
+ launchOpts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.recents_launch_next_affiliated_task_target,
+ R.anim.recents_launch_next_affiliated_task_source);
+ }
} else {
- toTaskKey = group.getPrevTaskInGroup(task);
- launchOpts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_prev_affiliated_task_target,
- R.anim.recents_launch_prev_affiliated_task_source);
+ if ((i - 1) >= 0) {
+ toTask = tasks.get(i - 1);
+ launchOpts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.recents_launch_prev_affiliated_task_target,
+ R.anim.recents_launch_prev_affiliated_task_source);
+ }
}
- if (toTaskKey != null) {
- toTask = focusedStack.findTaskWithId(toTaskKey.id);
- }
- numAffiliatedTasks = group.getTaskCount();
break;
}
}
// Return early if there is no next task
if (toTask == null) {
- if (numAffiliatedTasks > 1) {
- if (showNextTask) {
- ssp.startInPlaceAnimationOnFrontMostApplication(
- ActivityOptions.makeCustomInPlaceAnimation(mContext,
- R.anim.recents_launch_next_affiliated_task_bounce));
- } else {
- ssp.startInPlaceAnimationOnFrontMostApplication(
- ActivityOptions.makeCustomInPlaceAnimation(mContext,
- R.anim.recents_launch_prev_affiliated_task_bounce));
- }
+ if (showNextTask) {
+ ssp.startInPlaceAnimationOnFrontMostApplication(
+ ActivityOptions.makeCustomInPlaceAnimation(mContext,
+ R.anim.recents_launch_next_affiliated_task_bounce));
+ } else {
+ ssp.startInPlaceAnimationOnFrontMostApplication(
+ ActivityOptions.makeCustomInPlaceAnimation(mContext,
+ R.anim.recents_launch_prev_affiliated_task_bounce));
}
return;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index bc3adaf..b126a56 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -140,7 +140,6 @@
UserManager mUm;
Display mDisplay;
String mRecentsPackage;
- ComponentName mAssistComponent;
private int mCurrentUserId;
boolean mIsSafeMode;
@@ -339,9 +338,6 @@
mBgProtectionPaint.setColor(0xFFffffff);
mBgProtectionCanvas = new Canvas();
- // Resolve the assist intent
- mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.myUserId());
-
// Since SystemServicesProxy can be accessed from a per-SysUI process component, create a
// per-process listener to keep track of the current user id to reduce the number of binder
// calls to fetch it.
@@ -608,7 +604,7 @@
*/
public boolean hasSoftNavigationBar() {
try {
- return WindowManagerGlobal.getWindowManagerService().hasNavigationBar();
+ return mIwm.hasNavigationBar();
} catch (RemoteException e) {
e.printStackTrace();
}
@@ -677,7 +673,7 @@
ActivityManager.TaskSnapshot snapshot = null;
try {
- snapshot = ActivityManager.getService().getTaskSnapshot(taskId, reducedResolution);
+ snapshot = mIam.getTaskSnapshot(taskId, reducedResolution);
} catch (RemoteException e) {
Log.w(TAG, "Failed to retrieve snapshot", e);
}
@@ -895,22 +891,6 @@
}
/**
- * Returns a logo used on TV for the specified Activity.
- */
- public Drawable getActivityLogo(ActivityInfo info) {
- if (mPm == null) return null;
-
- // If we are mocking, then return a mock logo
- if (RecentsDebugFlags.Static.EnableMockTasks) {
- return new ColorDrawable(0xFF666666);
- }
-
- Drawable logo = info.loadLogo(mPm);
- return logo;
- }
-
-
- /**
* Returns the given label for a user, badging if necessary.
*/
private String getBadgedLabel(String label, int userId) {
@@ -930,24 +910,6 @@
return mKgm.isDeviceLocked(userId);
}
- /** Returns the package name of the home activity. */
- public String getHomeActivityPackageName() {
- if (mPm == null) return null;
- if (RecentsDebugFlags.Static.EnableMockTasks) return null;
-
- ArrayList<ResolveInfo> homeActivities = new ArrayList<>();
- ComponentName defaultHomeActivity = mPm.getHomeActivities(homeActivities);
- if (defaultHomeActivity != null) {
- return defaultHomeActivity.getPackageName();
- } else if (homeActivities.size() == 1) {
- ResolveInfo info = homeActivities.get(0);
- if (info.activityInfo != null) {
- return info.activityInfo.packageName;
- }
- }
- return null;
- }
-
/**
* Returns whether the provided {@param userId} represents the system user.
*/
@@ -1157,7 +1119,7 @@
return;
}
try {
- WindowManagerGlobal.getWindowManagerService().endProlongedAnimations();
+ mIwm.endProlongedAnimations();
} catch (Exception e) {
e.printStackTrace();
}
@@ -1167,7 +1129,7 @@
if (mWm == null) return;
try {
- WindowManagerGlobal.getWindowManagerService().registerDockedStackListener(listener);
+ mIwm.registerDockedStackListener(listener);
} catch (Exception e) {
e.printStackTrace();
}
@@ -1194,8 +1156,7 @@
if (mWm == null) return;
try {
- WindowManagerGlobal.getWindowManagerService().getStableInsets(Display.DEFAULT_DISPLAY,
- outStableInsets);
+ mIwm.getStableInsets(Display.DEFAULT_DISPLAY, outStableInsets);
} catch (Exception e) {
e.printStackTrace();
}
@@ -1205,9 +1166,7 @@
IAppTransitionAnimationSpecsFuture future, IRemoteCallback animStartedListener,
boolean scaleUp) {
try {
- WindowManagerGlobal.getWindowManagerService()
- .overridePendingAppTransitionMultiThumbFuture(future, animStartedListener,
- scaleUp);
+ mIwm.overridePendingAppTransitionMultiThumbFuture(future, animStartedListener, scaleUp);
} catch (RemoteException e) {
Log.w(TAG, "Failed to override transition: " + e);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
index 3a357e0..1c2b94f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
@@ -112,8 +112,6 @@
preloadRawTasks();
}
- SparseArray<Task.TaskKey> affiliatedTasks = new SparseArray<>();
- SparseIntArray affiliatedTaskCounts = new SparseIntArray();
SparseBooleanArray lockedUsers = new SparseBooleanArray();
String dismissDescFormat = mContext.getString(
R.string.accessibility_recents_item_will_be_dismissed);
@@ -154,20 +152,18 @@
boolean isLocked = lockedUsers.get(t.userId);
// Add the task to the stack
- Task task = new Task(taskKey, t.affiliatedTaskId, t.affiliatedTaskColor, icon,
+ Task task = new Task(taskKey, icon,
thumbnail, title, titleDescription, dismissDescription, appInfoDescription,
activityColor, backgroundColor, isLaunchTarget, isStackTask, isSystemApp,
t.supportsSplitScreenMultiWindow, t.bounds, t.taskDescription, t.resizeMode,
t.topActivity, isLocked);
allTasks.add(task);
- affiliatedTaskCounts.put(taskKey.id, affiliatedTaskCounts.get(taskKey.id, 0) + 1);
- affiliatedTasks.put(taskKey.id, taskKey);
}
// Initialize the stacks
mStack = new TaskStack();
- mStack.setTasks(mContext, allTasks, false /* notifyStackChanges */);
+ mStack.setTasks(allTasks, false /* notifyStackChanges */);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
index b471574..e8d419d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -19,6 +19,7 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import android.app.ActivityManager;
+import android.app.ActivityManager.TaskDescription;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -123,20 +124,6 @@
public int temporarySortIndexInStack;
/**
- * The group will be computed separately from the initialization of the task
- */
- @ViewDebug.ExportedProperty(deepExport=true, prefix="group_")
- public TaskGrouping group;
- /**
- * The affiliationTaskId is the task id of the parent task or itself if it is not affiliated
- * with any task.
- */
- @ViewDebug.ExportedProperty(category="recents")
- public int affiliationTaskId;
- @ViewDebug.ExportedProperty(category="recents")
- public int affiliationColor;
-
- /**
* The icon is the task description icon (if provided), which falls back to the activity icon,
* which can then fall back to the application icon.
*/
@@ -166,7 +153,7 @@
/**
* The task description for this task, only used to reload task icons.
*/
- public ActivityManager.TaskDescription taskDescription;
+ public TaskDescription taskDescription;
/**
* The state isLaunchTarget will be set for the correct task upon launching Recents.
@@ -198,24 +185,19 @@
// Do nothing
}
- public Task(TaskKey key, int affiliationTaskId, int affiliationColor, Drawable icon,
- ThumbnailData thumbnail, String title, String titleDescription,
- String dismissDescription, String appInfoDescription, int colorPrimary,
- int colorBackground, boolean isLaunchTarget, boolean isStackTask, boolean isSystemApp,
- boolean isDockable, Rect bounds, ActivityManager.TaskDescription taskDescription,
+ public Task(TaskKey key, Drawable icon, ThumbnailData thumbnail, String title,
+ String titleDescription, String dismissDescription, String appInfoDescription,
+ int colorPrimary, int colorBackground, boolean isLaunchTarget, boolean isStackTask,
+ boolean isSystemApp, boolean isDockable, Rect bounds, TaskDescription taskDescription,
int resizeMode, ComponentName topActivity, boolean isLocked) {
- boolean isInAffiliationGroup = (affiliationTaskId != key.id);
- boolean hasAffiliationGroupColor = isInAffiliationGroup && (affiliationColor != 0);
this.key = key;
- this.affiliationTaskId = affiliationTaskId;
- this.affiliationColor = affiliationColor;
this.icon = icon;
this.thumbnail = thumbnail;
this.title = title;
this.titleDescription = titleDescription;
this.dismissDescription = dismissDescription;
this.appInfoDescription = appInfoDescription;
- this.colorPrimary = hasAffiliationGroupColor ? affiliationColor : colorPrimary;
+ this.colorPrimary = colorPrimary;
this.colorBackground = colorBackground;
this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(this.colorPrimary,
Color.WHITE) > 3f;
@@ -235,9 +217,6 @@
*/
public void copyFrom(Task o) {
this.key = o.key;
- this.group = o.group;
- this.affiliationTaskId = o.affiliationTaskId;
- this.affiliationColor = o.affiliationColor;
this.icon = o.icon;
this.thumbnail = o.thumbnail;
this.title = o.title;
@@ -274,11 +253,6 @@
mCallbacks.remove(cb);
}
- /** Set the grouping */
- public void setGroup(TaskGrouping group) {
- this.group = group;
- }
-
/** Updates the task's windowing mode. */
public void setWindowingMode(int windowingMode) {
key.setWindowingMode(windowingMode);
@@ -316,13 +290,6 @@
}
/**
- * Returns whether this task is affiliated with another task.
- */
- public boolean isAffiliatedTask() {
- return key.id != affiliationTaskId;
- }
-
- /**
* Returns the top activity component.
*/
public ComponentName getTopComponent() {
@@ -345,9 +312,6 @@
public void dump(String prefix, PrintWriter writer) {
writer.print(prefix); writer.print(key);
- if (isAffiliatedTask()) {
- writer.print(" "); writer.print("affTaskId=" + affiliationTaskId);
- }
if (!isDockable) {
writer.print(" dockable=N");
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskGrouping.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskGrouping.java
deleted file mode 100644
index 2109376..0000000
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskGrouping.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.android.systemui.recents.model;
-
-import android.util.ArrayMap;
-
-import java.util.ArrayList;
-
-/** Represents a grouping of tasks witihin a stack. */
-public class TaskGrouping {
-
- int affiliation;
- long latestActiveTimeInGroup;
-
- Task.TaskKey mFrontMostTaskKey;
- ArrayList<Task.TaskKey> mTaskKeys = new ArrayList<Task.TaskKey>();
- ArrayMap<Task.TaskKey, Integer> mTaskKeyIndices = new ArrayMap<>();
-
- /** Creates a group with a specified affiliation. */
- public TaskGrouping(int affiliation) {
- this.affiliation = affiliation;
- }
-
- /** Adds a new task to this group. */
- void addTask(Task t) {
- mTaskKeys.add(t.key);
- if (t.key.lastActiveTime > latestActiveTimeInGroup) {
- latestActiveTimeInGroup = t.key.lastActiveTime;
- }
- t.setGroup(this);
- updateTaskIndices();
- }
-
- /** Removes a task from this group. */
- void removeTask(Task t) {
- mTaskKeys.remove(t.key);
- latestActiveTimeInGroup = 0;
- int taskCount = mTaskKeys.size();
- for (int i = 0; i < taskCount; i++) {
- long lastActiveTime = mTaskKeys.get(i).lastActiveTime;
- if (lastActiveTime > latestActiveTimeInGroup) {
- latestActiveTimeInGroup = lastActiveTime;
- }
- }
- t.setGroup(null);
- updateTaskIndices();
- }
-
- /** Returns the key of the next task in the group. */
- public Task.TaskKey getNextTaskInGroup(Task t) {
- int i = indexOf(t);
- if ((i + 1) < getTaskCount()) {
- return mTaskKeys.get(i + 1);
- }
- return null;
- }
-
- /** Returns the key of the previous task in the group. */
- public Task.TaskKey getPrevTaskInGroup(Task t) {
- int i = indexOf(t);
- if ((i - 1) >= 0) {
- return mTaskKeys.get(i - 1);
- }
- return null;
- }
-
- /** Gets the front task */
- public boolean isFrontMostTask(Task t) {
- return (t.key == mFrontMostTaskKey);
- }
-
- /** Finds the index of a given task in a group. */
- public int indexOf(Task t) {
- return mTaskKeyIndices.get(t.key);
- }
-
- /** Returns whether a task is in this grouping. */
- public boolean containsTask(Task t) {
- return mTaskKeyIndices.containsKey(t.key);
- }
-
- /** Returns whether one task is above another in the group. If they are not in the same group,
- * this returns false. */
- public boolean isTaskAboveTask(Task t, Task below) {
- return mTaskKeyIndices.containsKey(t.key) && mTaskKeyIndices.containsKey(below.key) &&
- mTaskKeyIndices.get(t.key) > mTaskKeyIndices.get(below.key);
- }
-
- /** Returns the number of tasks in this group. */
- public int getTaskCount() { return mTaskKeys.size(); }
-
- /** Updates the mapping of tasks to indices. */
- private void updateTaskIndices() {
- if (mTaskKeys.isEmpty()) {
- mFrontMostTaskKey = null;
- mTaskKeyIndices.clear();
- return;
- }
-
- int taskCount = mTaskKeys.size();
- mFrontMostTaskKey = mTaskKeys.get(mTaskKeys.size() - 1);
- mTaskKeyIndices.clear();
- for (int i = 0; i < taskCount; i++) {
- Task.TaskKey k = mTaskKeys.get(i);
- mTaskKeyIndices.put(k, i);
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index 0c8316b..a0f5631 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -52,8 +52,6 @@
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
-import com.android.systemui.recents.RecentsDebugFlags;
-import com.android.systemui.recents.misc.NamedCounter;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.misc.Utilities;
import com.android.systemui.recents.views.AnimationProps;
@@ -67,7 +65,6 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.Random;
/**
@@ -75,7 +72,7 @@
*/
interface TaskFilter {
/** Returns whether the filter accepts the specified task */
- public boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index);
+ boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index);
}
/**
@@ -85,7 +82,7 @@
ArrayList<Task> mTasks = new ArrayList<>();
ArrayList<Task> mFilteredTasks = new ArrayList<>();
- ArrayMap<Task.TaskKey, Integer> mTaskIndices = new ArrayMap<>();
+ ArrayMap<Task.TaskKey, Integer> mFilteredTaskIndices = new ArrayMap<>();
TaskFilter mFilter;
/** Sets the task filter, saving the current touch state */
@@ -150,8 +147,8 @@
/** Returns the index of this task in the list of filtered tasks */
int indexOf(Task t) {
- if (t != null && mTaskIndices.containsKey(t.key)) {
- return mTaskIndices.get(t.key);
+ if (t != null && mFilteredTaskIndices.containsKey(t.key)) {
+ return mFilteredTaskIndices.get(t.key);
}
return -1;
}
@@ -163,7 +160,7 @@
/** Returns whether the filtered list contains this task */
boolean contains(Task t) {
- return mTaskIndices.containsKey(t.key);
+ return mFilteredTaskIndices.containsKey(t.key);
}
/** Updates the list of filtered tasks whenever the base task list changes */
@@ -193,18 +190,13 @@
/** Updates the mapping of tasks to indices. */
private void updateFilteredTaskIndices() {
int taskCount = mFilteredTasks.size();
- mTaskIndices.clear();
+ mFilteredTaskIndices.clear();
for (int i = 0; i < taskCount; i++) {
Task t = mFilteredTasks.get(i);
- mTaskIndices.put(t.key, i);
+ mFilteredTaskIndices.put(t.key, i);
}
}
- /** Returns whether this task list is filtered */
- boolean hasFilter() {
- return (mFilter != null);
- }
-
/** Returns the list of filtered tasks */
ArrayList<Task> getTasks() {
return mFilteredTasks;
@@ -554,32 +546,15 @@
}
};
-
- // The task offset to apply to a task id as a group affiliation
- static final int IndividualTaskIdOffset = 1 << 16;
-
ArrayList<Task> mRawTaskList = new ArrayList<>();
FilteredTaskList mStackTaskList = new FilteredTaskList();
TaskStackCallbacks mCb;
- ArrayList<TaskGrouping> mGroups = new ArrayList<>();
- ArrayMap<Integer, TaskGrouping> mAffinitiesGroups = new ArrayMap<>();
-
public TaskStack() {
- // Ensure that we only show non-docked tasks
+ // Ensure that we only show stack tasks
mStackTaskList.setFilter(new TaskFilter() {
@Override
public boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index) {
- if (RecentsDebugFlags.Static.EnableAffiliatedTaskGroups) {
- if (t.isAffiliatedTask()) {
- // If this task is affiliated with another parent in the stack, then the
- // historical state of this task depends on the state of the parent task
- Task parentTask = taskIdMap.get(t.affiliationTaskId);
- if (parentTask != null) {
- t = parentTask;
- }
- }
- }
return t.isStackTask;
}
});
@@ -611,20 +586,6 @@
}
}
- /** Does the actual work associated with removing the task. */
- void removeTaskImpl(FilteredTaskList taskList, Task t) {
- // Remove the task from the list
- taskList.remove(t);
- // Remove it from the group as well, and if it is empty, remove the group
- TaskGrouping group = t.group;
- if (group != null) {
- group.removeTask(t);
- if (group.getTaskCount() == 0) {
- removeGroup(group);
- }
- }
- }
-
/**
* Removes a task from the stack, with an additional {@param animation} hint to the callbacks on
* how they should update themselves.
@@ -640,7 +601,7 @@
public void removeTask(Task t, AnimationProps animation, boolean fromDockGesture,
boolean dismissRecentsIfAllRemoved) {
if (mStackTaskList.contains(t)) {
- removeTaskImpl(mStackTaskList, t);
+ mStackTaskList.remove(t);
Task newFrontMostTask = getStackFrontMostTask(false /* includeFreeform */);
if (mCb != null) {
// Notify that a task has been removed
@@ -658,7 +619,7 @@
ArrayList<Task> tasks = mStackTaskList.getTasks();
for (int i = tasks.size() - 1; i >= 0; i--) {
Task t = tasks.get(i);
- removeTaskImpl(mStackTaskList, t);
+ mStackTaskList.remove(t);
mRawTaskList.remove(t);
}
if (mCb != null && notifyStackChanges) {
@@ -669,10 +630,10 @@
/**
- * @see #setTasks(Context, List, boolean, boolean)
+ * @see #setTasks(List, boolean)
*/
- public void setTasks(Context context, TaskStack stack, boolean notifyStackChanges) {
- setTasks(context, stack.mRawTaskList, notifyStackChanges);
+ public void setTasks(TaskStack stack, boolean notifyStackChanges) {
+ setTasks(stack.mRawTaskList, notifyStackChanges);
}
/**
@@ -681,7 +642,7 @@
* @param tasks the new set of tasks to replace the current set.
* @param notifyStackChanges whether or not to callback on specific changes to the list of tasks.
*/
- public void setTasks(Context context, List<Task> tasks, boolean notifyStackChanges) {
+ public void setTasks(List<Task> tasks, boolean notifyStackChanges) {
// Compute a has set for each of the tasks
ArrayMap<Task.TaskKey, Task> currentTasksMap = createTaskKeyMapFromList(mRawTaskList);
ArrayMap<Task.TaskKey, Task> newTasksMap = createTaskKeyMapFromList(tasks);
@@ -703,7 +664,6 @@
removedTasks.add(task);
}
}
- task.setGroup(null);
}
// Add any new tasks
@@ -731,9 +691,6 @@
mStackTaskList.set(allTasks);
mRawTaskList = allTasks;
- // Update the affiliated groupings
- createAffiliatedGroupings(context);
-
// Only callback for the removed tasks after the stack has updated
int removedTaskCount = removedTasks.size();
Task newFrontMostTask = getStackFrontMostTask(false);
@@ -930,131 +887,7 @@
}
return null;
}
-
- /******** Grouping ********/
-
- /** Adds a group to the set */
- public void addGroup(TaskGrouping group) {
- mGroups.add(group);
- mAffinitiesGroups.put(group.affiliation, group);
- }
-
- public void removeGroup(TaskGrouping group) {
- mGroups.remove(group);
- mAffinitiesGroups.remove(group.affiliation);
- }
-
- /** Returns the group with the specified affiliation. */
- public TaskGrouping getGroupWithAffiliation(int affiliation) {
- return mAffinitiesGroups.get(affiliation);
- }
-
- /**
- * Temporary: This method will simulate affiliation groups
- */
- void createAffiliatedGroupings(Context context) {
- mGroups.clear();
- mAffinitiesGroups.clear();
-
- if (RecentsDebugFlags.Static.EnableMockTaskGroups) {
- ArrayMap<Task.TaskKey, Task> taskMap = new ArrayMap<>();
- // Sort all tasks by increasing firstActiveTime of the task
- ArrayList<Task> tasks = mStackTaskList.getTasks();
- // Create groups when sequential packages are the same
- NamedCounter counter = new NamedCounter("task-group", "");
- int taskCount = tasks.size();
- String prevPackage = "";
- int prevAffiliation = -1;
- Random r = new Random();
- int groupCountDown = RecentsDebugFlags.Static.MockTaskGroupsTaskCount;
- for (int i = 0; i < taskCount; i++) {
- Task t = tasks.get(i);
- String packageName = t.key.getComponent().getPackageName();
- packageName = "pkg";
- TaskGrouping group;
- if (packageName.equals(prevPackage) && groupCountDown > 0) {
- group = getGroupWithAffiliation(prevAffiliation);
- groupCountDown--;
- } else {
- int affiliation = IndividualTaskIdOffset + t.key.id;
- group = new TaskGrouping(affiliation);
- addGroup(group);
- prevAffiliation = affiliation;
- prevPackage = packageName;
- groupCountDown = RecentsDebugFlags.Static.MockTaskGroupsTaskCount;
- }
- group.addTask(t);
- taskMap.put(t.key, t);
- }
- // Sort groups by increasing latestActiveTime of the group
- Collections.sort(mGroups, new Comparator<TaskGrouping>() {
- @Override
- public int compare(TaskGrouping taskGrouping, TaskGrouping taskGrouping2) {
- return Long.compare(taskGrouping.latestActiveTimeInGroup,
- taskGrouping2.latestActiveTimeInGroup);
- }
- });
- // Sort group tasks by increasing firstActiveTime of the task, and also build a new list
- // of tasks
- int taskIndex = 0;
- int groupCount = mGroups.size();
- for (int i = 0; i < groupCount; i++) {
- TaskGrouping group = mGroups.get(i);
- ArrayList<Task.TaskKey> groupTasks = group.mTaskKeys;
- int groupTaskCount = groupTasks.size();
- for (int j = 0; j < groupTaskCount; j++) {
- tasks.set(taskIndex, taskMap.get(groupTasks.get(j)));
- taskIndex++;
- }
- }
- mStackTaskList.set(tasks);
- } else {
- // Create the task groups
- ArrayMap<Task.TaskKey, Task> tasksMap = new ArrayMap<>();
- ArrayList<Task> tasks = mStackTaskList.getTasks();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task t = tasks.get(i);
- TaskGrouping group;
- if (RecentsDebugFlags.Static.EnableAffiliatedTaskGroups) {
- int affiliation = t.affiliationTaskId > 0 ? t.affiliationTaskId :
- IndividualTaskIdOffset + t.key.id;
- if (mAffinitiesGroups.containsKey(affiliation)) {
- group = getGroupWithAffiliation(affiliation);
- } else {
- group = new TaskGrouping(affiliation);
- addGroup(group);
- }
- } else {
- group = new TaskGrouping(t.key.id);
- addGroup(group);
- }
- group.addTask(t);
- tasksMap.put(t.key, t);
- }
- // Update the task colors for each of the groups
- float minAlpha = context.getResources().getFloat(
- R.dimen.recents_task_affiliation_color_min_alpha_percentage);
- int taskGroupCount = mGroups.size();
- for (int i = 0; i < taskGroupCount; i++) {
- TaskGrouping group = mGroups.get(i);
- taskCount = group.getTaskCount();
- // Ignore the groups that only have one task
- if (taskCount <= 1) continue;
- // Calculate the group color distribution
- int affiliationColor = tasksMap.get(group.mTaskKeys.get(0)).affiliationColor;
- float alphaStep = (1f - minAlpha) / taskCount;
- float alpha = 1f;
- for (int j = 0; j < taskCount; j++) {
- Task t = tasksMap.get(group.mTaskKeys.get(j));
- t.colorPrimary = Utilities.getColorWithOverlay(affiliationColor, Color.WHITE,
- alpha);
- alpha -= alphaStep;
- }
- }
- }
- }
-
+
/**
* Computes the components of tasks in this stack that have been removed as a result of a change
* in the specified package.
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
index ee05d81..56b4e64 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
@@ -188,20 +188,9 @@
} else {
LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView,
screenPinningRequested);
- if (task.group != null && !task.group.isFrontMostTask(task)) {
- launchStartedEvent.addPostAnimationCallback(new Runnable() {
- @Override
- public void run() {
- startTaskActivity(stack, task, taskView, opts, transitionFuture,
- windowingMode, activityType);
- }
- });
- EventBus.getDefault().send(launchStartedEvent);
- } else {
- EventBus.getDefault().send(launchStartedEvent);
- startTaskActivity(stack, task, taskView, opts, transitionFuture,
- windowingMode, activityType);
- }
+ EventBus.getDefault().send(launchStartedEvent);
+ startTaskActivity(stack, task, taskView, opts, transitionFuture, windowingMode,
+ activityType);
}
Recents.getSystemServices().sendCloseSystemWindows(
StatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
index 81bf6af..f4862c3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
@@ -161,9 +161,6 @@
for (int i = taskViews.size() - 1; i >= 0; i--) {
TaskView tv = taskViews.get(i);
Task task = tv.getTask();
- boolean currentTaskOccludesLaunchTarget = launchTargetTask != null &&
- launchTargetTask.group != null &&
- launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
boolean hideTask = launchTargetTask != null &&
launchTargetTask.isFreeformTask() &&
task.isFreeformTask();
@@ -195,13 +192,6 @@
// com.android.server.wm.AppTransition#DEFAULT_APP_TRANSITION_DURATION}
mStackView.updateTaskViewToTransform(tv, mTmpTransform,
new AnimationProps(336, Interpolators.FAST_OUT_SLOW_IN));
- } else if (currentTaskOccludesLaunchTarget) {
- // Move the task view slightly lower so we can animate it in
- mTmpTransform.rect.offset(0, taskViewAffiliateGroupEnterOffset);
- mTmpTransform.alpha = 0f;
- mStackView.updateTaskViewToTransform(tv, mTmpTransform,
- AnimationProps.IMMEDIATE);
- tv.setClipViewInStack(false);
}
} else if (launchState.launchedFromHome) {
if (isLowRamDevice) {
@@ -266,9 +256,6 @@
int taskIndexFromBack = i;
final TaskView tv = taskViews.get(i);
Task task = tv.getTask();
- boolean currentTaskOccludesLaunchTarget = launchTargetTask != null &&
- launchTargetTask.group != null &&
- launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
// Get the current transform for the task, which will be updated to the final transform
// to animate to depending on how recents was invoked
@@ -280,21 +267,6 @@
tv.onStartLaunchTargetEnterAnimation(mTmpTransform,
taskViewEnterFromAppDuration, mStackView.mScreenPinningEnabled,
postAnimationTrigger);
- } else {
- // Animate the task up if it was occluding the launch target
- if (currentTaskOccludesLaunchTarget) {
- AnimationProps taskAnimation = new AnimationProps(
- taskViewEnterFromAffiliatedAppDuration, Interpolators.ALPHA_IN,
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- postAnimationTrigger.decrement();
- tv.setClipViewInStack(true);
- }
- });
- postAnimationTrigger.increment();
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
- }
}
} else if (launchState.launchedFromHome) {
@@ -423,9 +395,6 @@
for (int i = 0; i < taskViewCount; i++) {
TaskView tv = taskViews.get(i);
Task task = tv.getTask();
- boolean currentTaskOccludesLaunchTarget = launchingTask != null &&
- launchingTask.group != null &&
- launchingTask.group.isTaskAboveTask(task, launchingTask);
if (tv == launchingTaskView) {
tv.setClipViewInStack(false);
@@ -437,17 +406,6 @@
});
tv.onStartLaunchTargetLaunchAnimation(taskViewExitToAppDuration,
screenPinningRequested, postAnimationTrigger);
- } else if (currentTaskOccludesLaunchTarget) {
- // Animate this task out of view
- AnimationProps taskAnimation = new AnimationProps(
- taskViewExitToAppDuration, Interpolators.ALPHA_OUT,
- postAnimationTrigger.decrementOnAnimationEnd());
- postAnimationTrigger.increment();
-
- mTmpTransform.fillIn(tv);
- mTmpTransform.alpha = 0f;
- mTmpTransform.rect.offset(0, taskViewAffiliateGroupEnterOffset);
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index eaa32ee..b5e598d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -855,32 +855,25 @@
continue;
}
- boolean isFrontMostTaskInGroup = task.group == null || task.group.isFrontMostTask(task);
- if (isFrontMostTaskInGroup) {
- getStackTransform(taskProgress, taskProgress, mInitialScrollP, mFocusState,
- tmpTransform, null, false /* ignoreSingleTaskCase */,
- false /* forceUpdate */);
- float screenY = tmpTransform.rect.top;
- boolean hasVisibleThumbnail = (prevScreenY - screenY) > taskBarHeight;
- if (hasVisibleThumbnail) {
- numVisibleThumbnails++;
- numVisibleTasks++;
- prevScreenY = screenY;
- } else {
- // Once we hit the next front most task that does not have a visible thumbnail,
- // walk through remaining visible set
- for (int j = i; j >= 0; j--) {
- taskProgress = getStackScrollForTask(tasks.get(j));
- if (!currentRange.isInRange(taskProgress)) {
- break;
- }
- numVisibleTasks++;
- }
- break;
- }
- } else {
- // Affiliated task, no thumbnail
+ getStackTransform(taskProgress, taskProgress, mInitialScrollP, mFocusState,
+ tmpTransform, null, false /* ignoreSingleTaskCase */, false /* forceUpdate */);
+ float screenY = tmpTransform.rect.top;
+ boolean hasVisibleThumbnail = (prevScreenY - screenY) > taskBarHeight;
+ if (hasVisibleThumbnail) {
+ numVisibleThumbnails++;
numVisibleTasks++;
+ prevScreenY = screenY;
+ } else {
+ // Once we hit the next front most task that does not have a visible thumbnail,
+ // walk through remaining visible set
+ for (int j = i; j >= 0; j--) {
+ taskProgress = getStackScrollForTask(tasks.get(j));
+ if (!currentRange.isInRange(taskProgress)) {
+ break;
+ }
+ numVisibleTasks++;
+ }
+ break;
}
}
return new VisibilityReport(numVisibleTasks, numVisibleThumbnails);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 3160ee0..7112600 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -387,7 +387,7 @@
// Only notify if we are already initialized, otherwise, everything will pick up all the
// new and old tasks when we next layout
- mStack.setTasks(getContext(), stack, allowNotifyStackChanges && isInitialized);
+ mStack.setTasks(stack, allowNotifyStackChanges && isInitialized);
}
/** Returns the task stack. */