diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index a0cb61ab301e3..935894c56649d 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -790,6 +790,10 @@ Split Custom + + + + Charged diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java index 71610534f1e6d..914035bc525cb 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java @@ -29,6 +29,7 @@ public class RecentsActivityLaunchState { public boolean launchedWithAltTab; public boolean launchedFromApp; + public boolean launchedFromBlacklistedApp; public boolean launchedFromHome; public boolean launchedViaDragGesture; public boolean launchedViaDockGesture; @@ -39,6 +40,7 @@ public class RecentsActivityLaunchState { public void reset() { launchedFromHome = false; launchedFromApp = false; + launchedFromBlacklistedApp = false; launchedToTaskId = -1; launchedWithAltTab = false; launchedViaDragGesture = false; @@ -53,8 +55,14 @@ public class RecentsActivityLaunchState { RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState(); if (launchedFromApp) { if (!launchState.launchedWithAltTab && debugFlags.isFastToggleRecentsEnabled()) { - // If fast toggling, focus the front most task so that the next tap will focus the - // N-1 task + // If fast toggling, focus the front most task so that the next tap will launch the + // task + return numTasks - 1; + } + + if (launchState.launchedFromBlacklistedApp) { + // If we are launching from a blacklisted app, focus the front most task so that the + // next tap will launch the task return numTasks - 1; } @@ -67,7 +75,7 @@ public class RecentsActivityLaunchState { return -1; } - // If coming from home, focus the first task + // If coming from home, focus the front most task return numTasks - 1; } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java index f9e59e7ccf995..2757fc4f5cc78 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java @@ -807,15 +807,19 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener boolean isHomeStackVisible, boolean animate, int growTarget) { RecentsTaskLoader loader = Recents.getTaskLoader(); RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState(); + SystemServicesProxy ssp = Recents.getSystemServices(); + boolean isBlacklisted = (runningTask != null) + ? ssp.isBlackListedActivity(runningTask.baseActivity.getClassName()) + : false; - int runningTaskId = !mLaunchedWhileDocking && (runningTask != null) + int runningTaskId = !mLaunchedWhileDocking && !isBlacklisted && (runningTask != null) ? runningTask.id : -1; // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // should always preload the tasks now. If we are dragging in recents, reload them as // the stacks might have changed. - if (mLaunchedWhileDocking || mTriggeredFromAltTab ||sInstanceLoadPlan == null) { + if (mLaunchedWhileDocking || mTriggeredFromAltTab || sInstanceLoadPlan == null) { // Create a new load plan if preloadRecents() was never triggered sInstanceLoadPlan = loader.createLoadPlan(mContext); } @@ -825,11 +829,13 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener TaskStack stack = sInstanceLoadPlan.getTaskStack(); boolean hasRecentTasks = stack.getTaskCount() > 0; - boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible && hasRecentTasks; + boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible && + hasRecentTasks; // Update the launch state that we need in updateHeaderBarLayout() launchState.launchedFromHome = !useThumbnailTransition && !mLaunchedWhileDocking; launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking; + launchState.launchedFromBlacklistedApp = launchState.launchedFromApp && isBlacklisted; launchState.launchedViaDockGesture = mLaunchedWhileDocking; launchState.launchedViaDragGesture = mDraggingInRecents; launchState.launchedToTaskId = runningTaskId; @@ -857,7 +863,9 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener } ActivityOptions opts; - if (useThumbnailTransition) { + if (isBlacklisted) { + opts = getUnknownTransitionActivityOptions(); + } else if (useThumbnailTransition) { // Try starting with a thumbnail transition opts = getThumbnailTransitionActivityOptions(runningTask, mDummyStackView, windowOverrideRect); 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 37a4948ae8b0e..b896f8a4d815c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -243,6 +243,9 @@ public class SystemServicesProxy { if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { Collections.addAll(sRecentsBlacklist, res.getStringArray(R.array.recents_tv_blacklist_array)); + } else { + Collections.addAll(sRecentsBlacklist, + res.getStringArray(R.array.recents_blacklist_array)); } } @@ -260,6 +263,13 @@ public class SystemServicesProxy { return sSystemServicesProxy; } + /** + * @return whether the provided {@param className} is blacklisted + */ + public boolean isBlackListedActivity(String className) { + return sRecentsBlacklist.contains(className); + } + /** * Returns a list of the recents tasks. * 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 89789bce6cf4e..702b076d5aec0 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java @@ -556,7 +556,9 @@ public class TaskStackLayoutAlgorithm { Math.max(0, mUnfocusedRange.getAbsoluteX(maxBottomNormX))); boolean scrollToFront = launchState.launchedFromHome || launchState.launchedViaDockGesture; - if (launchState.launchedWithAltTab) { + if (launchState.launchedFromBlacklistedApp) { + mInitialScrollP = mMaxScrollP; + } else if (launchState.launchedWithAltTab) { mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP); } else if (scrollToFront) { mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP); @@ -579,6 +581,7 @@ public class TaskStackLayoutAlgorithm { mTaskIndexOverrideMap.clear(); boolean scrollToFront = launchState.launchedFromHome || + launchState.launchedFromBlacklistedApp || launchState.launchedViaDockGesture; if (getInitialFocusState() == STATE_UNFOCUSED && mNumStackTasks > 1) { if (ignoreScrollToFront || (!launchState.launchedWithAltTab && !scrollToFront)) {