Skip to content

Commit d092fc7

Browse files
Winson ChungAndroid (Google) Code Review
authored andcommitted
Merge "Ensure that we don't show excluded tasks when we are not in that task (Bug 17657618) - Fix regression with launching an affiliated task due to clipping changes (Bug 17755902) - Tweaking previous changes to home transition - Disable the debug mode option" into lmp-dev
2 parents bf417b4 + 9cb5c4e commit d092fc7

10 files changed

Lines changed: 43 additions & 38 deletions

File tree

packages/SystemUI/res/values/config.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,9 @@
161161
duration of the transition in to recents from home. -->
162162
<integer name="recents_animate_task_enter_from_home_delay">150</integer>
163163
<!-- The min animation duration for animating the task in when transitioning from home. -->
164-
<integer name="recents_animate_task_enter_from_home_duration">200</integer>
165-
<!-- The total animation stagger delay when entering from home. -->
166-
<integer name="recents_animate_task_enter_from_home_stagger_delay">110</integer>
167-
<!-- The total animation duration added to the last card when entering from home.
168-
This value is partialy also added to the previous tasks -->
169-
<integer name="recents_animate_task_enter_from_home_stagger_duration">72</integer>
164+
<integer name="recents_animate_task_enter_from_home_duration">250</integer>
165+
<!-- The animation stagger to apply to each task animation when transitioning from home. -->
166+
<integer name="recents_animate_task_enter_from_home_stagger_delay">12</integer>
170167
<!-- The short duration when animating in/out the lock to app button. -->
171168
<integer name="recents_animate_lock_to_app_button_short_duration">150</integer>
172169
<!-- The long duration when animating in/out the lock to app button. -->

packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public void onCancelPreloadingRecents() {
189189
void showRelativeAffiliatedTask(boolean showNextTask) {
190190
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
191191
TaskStack stack = loader.getTaskStack(mSystemServicesProxy, mContext.getResources(),
192-
-1, -1, false, null, null);
192+
-1, -1, false, true, null, null);
193193
// Return early if there are no tasks
194194
if (stack.getTaskCount() == 0) return;
195195

@@ -444,7 +444,7 @@ TaskViewTransform getThumbnailTransitionTransform(int runningTaskId, boolean isT
444444
// Get the stack of tasks that we are animating into
445445
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
446446
TaskStack stack = loader.getTaskStack(mSystemServicesProxy, mContext.getResources(),
447-
runningTaskId, -1, false, null, null);
447+
runningTaskId, -1, false, isTopTaskHome, null, null);
448448
if (stack.getTaskCount() == 0) {
449449
return null;
450450
}
@@ -485,7 +485,7 @@ void startRecentsActivity(ActivityManager.RunningTaskInfo topTask, boolean isTop
485485
// which can differ depending on the number of items in the list.
486486
SystemServicesProxy ssp = mSystemServicesProxy;
487487
List<ActivityManager.RecentTaskInfo> recentTasks =
488-
ssp.getRecentTasks(3, UserHandle.CURRENT.getIdentifier());
488+
ssp.getRecentTasks(3, UserHandle.CURRENT.getIdentifier(), isTopTaskHome);
489489
boolean useThumbnailTransition = !isTopTaskHome;
490490
boolean hasRecentTasks = !recentTasks.isEmpty();
491491

packages/SystemUI/src/com/android/systemui/recents/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public static class App {
3737
public static final boolean EnableTaskBarTouchEvents = true;
3838
// Enables app-info pane on long-pressing the icon
3939
public static final boolean EnableDevAppInfoOnLongPress = true;
40+
// Enables debug mode
41+
public static final boolean EnableDebugMode = false;
4042
// Enables the search bar layout
4143
public static final boolean EnableSearchLayout = true;
4244
// Enables the thumbnail alpha on the front-most task

packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,6 @@ public void run() {
182182

183183
/** Updates the set of recent tasks */
184184
void updateRecentsTasks(Intent launchIntent) {
185-
// Load all the tasks
186-
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
187-
SpaceNode root = loader.reload(this, Constants.Values.RecentsTaskLoader.PreloadFirstTasksCount);
188-
ArrayList<TaskStack> stacks = root.getStacks();
189-
if (!stacks.isEmpty()) {
190-
mRecentsView.setTaskStacks(root.getStacks());
191-
}
192-
193185
// Update the configuration based on the launch intent
194186
boolean fromSearchHome = launchIntent.getBooleanExtra(
195187
AlternateRecentsComponent.EXTRA_FROM_SEARCH_HOME, false);
@@ -203,6 +195,16 @@ void updateRecentsTasks(Intent launchIntent) {
203195
AlternateRecentsComponent.EXTRA_FROM_TASK_ID, -1);
204196
mConfig.launchedWithAltTab = launchIntent.getBooleanExtra(
205197
AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB, false);
198+
199+
// Load all the tasks
200+
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
201+
SpaceNode root = loader.reload(this,
202+
Constants.Values.RecentsTaskLoader.PreloadFirstTasksCount,
203+
mConfig.launchedFromHome);
204+
ArrayList<TaskStack> stacks = root.getStacks();
205+
if (!stacks.isEmpty()) {
206+
mRecentsView.setTaskStacks(root.getStacks());
207+
}
206208
mConfig.launchedWithNoRecentTasks = !root.hasTasks();
207209

208210
// Create the home intent runnable

packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,6 @@ void update(Context context) {
220220
res.getInteger(R.integer.recents_animate_task_enter_from_home_duration);
221221
taskViewEnterFromHomeStaggerDelay =
222222
res.getInteger(R.integer.recents_animate_task_enter_from_home_stagger_delay);
223-
taskViewEnterFromHomeStaggerDuration =
224-
res.getInteger(R.integer.recents_animate_task_enter_from_home_stagger_duration);
225223
taskViewExitToHomeDuration =
226224
res.getInteger(R.integer.recents_animate_task_exit_to_home_duration);
227225
taskViewRemoveAnimDuration =

packages/SystemUI/src/com/android/systemui/recents/misc/DebugTrigger.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.os.Handler;
2020
import android.os.SystemClock;
2121
import android.view.KeyEvent;
22+
import com.android.systemui.recents.Constants;
2223

2324
/**
2425
* A trigger for catching a debug chord.
@@ -48,6 +49,8 @@ void reset() {
4849
* then we just call the callback.
4950
*/
5051
public void onKeyEvent(int keyCode) {
52+
if (!Constants.DebugFlags.App.EnableDebugMode) return;
53+
5154
if (mLastKeyCode == 0) {
5255
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
5356
mLastKeyCode = keyCode;

packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ public SystemServicesProxy(Context context) {
138138
}
139139

140140
/** Returns a list of the recents tasks */
141-
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numLatestTasks, int userId) {
141+
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numLatestTasks, int userId,
142+
boolean isTopTaskHome) {
142143
if (mAm == null) return null;
143144

144145
// If we are mocking, then create some recent tasks
@@ -195,10 +196,11 @@ public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numLatestTasks, i
195196
// tasks
196197

197198
// Check the first non-recents task, include this task even if it is marked as excluded
198-
// from recents. In other words, only remove excluded tasks if it is not the first task
199+
// from recents if we are currently in the app. In other words, only remove excluded
200+
// tasks if it is not the first active task.
199201
boolean isExcluded = (t.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
200202
== Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
201-
if (isExcluded && !isFirstValidTask) {
203+
if (isExcluded && (isTopTaskHome || !isFirstValidTask)) {
202204
iter.remove();
203205
continue;
204206
}

packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,12 @@ public SystemServicesProxy getSystemServicesProxy() {
322322
}
323323

324324
/** Gets the list of recent tasks, ordered from back to front. */
325-
private static List<ActivityManager.RecentTaskInfo> getRecentTasks(SystemServicesProxy ssp) {
325+
private static List<ActivityManager.RecentTaskInfo> getRecentTasks(SystemServicesProxy ssp,
326+
boolean isTopTaskHome) {
326327
RecentsConfiguration config = RecentsConfiguration.getInstance();
327328
List<ActivityManager.RecentTaskInfo> tasks =
328-
ssp.getRecentTasks(config.maxNumTasksToLoad,
329-
UserHandle.CURRENT.getIdentifier());
329+
ssp.getRecentTasks(config.maxNumTasksToLoad, UserHandle.CURRENT.getIdentifier(),
330+
isTopTaskHome);
330331
Collections.reverse(tasks);
331332
return tasks;
332333
}
@@ -408,11 +409,11 @@ public int getActivityPrimaryColor(ActivityManager.TaskDescription td,
408409
}
409410

410411
/** Reload the set of recent tasks */
411-
public SpaceNode reload(Context context, int preloadCount) {
412+
public SpaceNode reload(Context context, int preloadCount, boolean isTopTaskHome) {
412413
ArrayList<Task.TaskKey> taskKeys = new ArrayList<Task.TaskKey>();
413414
ArrayList<Task> tasksToLoad = new ArrayList<Task>();
414415
TaskStack stack = getTaskStack(mSystemServicesProxy, context.getResources(),
415-
-1, preloadCount, true, taskKeys, tasksToLoad);
416+
-1, preloadCount, true, isTopTaskHome, taskKeys, tasksToLoad);
416417
SpaceNode root = new SpaceNode();
417418
root.setStack(stack);
418419

@@ -429,10 +430,10 @@ public SpaceNode reload(Context context, int preloadCount) {
429430
/** Creates a lightweight stack of the current recent tasks, without thumbnails and icons. */
430431
public TaskStack getTaskStack(SystemServicesProxy ssp, Resources res,
431432
int preloadTaskId, int preloadTaskCount,
432-
boolean loadTaskThumbnails, List<Task.TaskKey> taskKeysOut,
433-
List<Task> tasksToLoadOut) {
433+
boolean loadTaskThumbnails, boolean isTopTaskHome,
434+
List<Task.TaskKey> taskKeysOut, List<Task> tasksToLoadOut) {
434435
RecentsConfiguration config = RecentsConfiguration.getInstance();
435-
List<ActivityManager.RecentTaskInfo> tasks = getRecentTasks(ssp);
436+
List<ActivityManager.RecentTaskInfo> tasks = getRecentTasks(ssp, isTopTaskHome);
436437
HashMap<Task.ComponentNameKey, ActivityInfoHandle> activityInfoCache =
437438
new HashMap<Task.ComponentNameKey, ActivityInfoHandle>();
438439
ArrayList<Task> tasksToAdd = new ArrayList<Task>();

packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ public void startLaunchTaskAnimation(TaskView tv, Runnable r, boolean lockToTask
743743
for (int i = 0; i < childCount; i++) {
744744
TaskView t = (TaskView) getChildAt(i);
745745
if (t == tv) {
746+
t.setClipViewInStack(false);
746747
t.startLaunchTaskAnimation(r, true, true, lockToTask);
747748
} else {
748749
boolean occludesLaunchTarget = launchTargetTask.group.isTaskAboveTask(t.getTask(),

packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -418,22 +418,21 @@ public void run() {
418418
} else if (mConfig.launchedFromHome) {
419419
// Animate the tasks up
420420
int frontIndex = (ctx.currentStackViewCount - ctx.currentStackViewIndex - 1);
421-
float fraction = (float) frontIndex / (ctx.currentStackViewCount - 1);
422-
fraction = (float) Math.pow(fraction, 0.85f);
423-
int delay = (int) (mConfig.taskViewEnterFromHomeDelay +
424-
fraction * mConfig.taskViewEnterFromHomeStaggerDelay);
425-
long delayIncrease = (long) (fraction * mConfig.taskViewEnterFromHomeStaggerDuration);
421+
int delay = mConfig.taskViewEnterFromHomeDelay +
422+
frontIndex * mConfig.taskViewEnterFromHomeStaggerDelay;
423+
424+
setScaleX(transform.scale);
425+
setScaleY(transform.scale);
426426
if (!mConfig.fakeShadows) {
427427
animate().translationZ(transform.translationZ);
428428
}
429429
animate()
430-
.scaleX(transform.scale)
431-
.scaleY(transform.scale)
432430
.translationY(transform.translationY)
433431
.setStartDelay(delay)
434432
.setUpdateListener(ctx.updateListener)
435433
.setInterpolator(mConfig.quintOutInterpolator)
436-
.setDuration(mConfig.taskViewEnterFromHomeDuration + delayIncrease)
434+
.setDuration(mConfig.taskViewEnterFromHomeDuration +
435+
frontIndex * mConfig.taskViewEnterFromHomeStaggerDelay)
437436
.withEndAction(new Runnable() {
438437
@Override
439438
public void run() {

0 commit comments

Comments
 (0)