Adding support for blacklisting apps from Recents transition.
Bug: 30602323 Change-Id: I2a6e75a989264ce72ac552e2c7f82225ccd68adf
This commit is contained in:
@@ -790,6 +790,10 @@
|
||||
<!-- Recents: MultiStack add stack split custom radio button. [CHAR LIMIT=NONE] -->
|
||||
<string name="recents_multistack_add_stack_dialog_split_custom">Split Custom</string>
|
||||
|
||||
<!-- Fully qualified activity class names to be blacklisted in Recents, add package names into overlay as needed -->
|
||||
<string-array name="recents_blacklist_array">
|
||||
</string-array>
|
||||
|
||||
<!-- Expanded Status Bar Header: Battery Charged [CHAR LIMIT=40] -->
|
||||
<string name="expanded_header_battery_charged">Charged</string>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user