Adding support for blacklisting apps from Recents transition.
am: fc73eec235
Change-Id: Ie2b253c2dd9bd6660b6a18e21b7e4afd43f99b6e
This commit is contained in:
@@ -790,6 +790,10 @@
|
|||||||
<!-- Recents: MultiStack add stack split custom radio button. [CHAR LIMIT=NONE] -->
|
<!-- Recents: MultiStack add stack split custom radio button. [CHAR LIMIT=NONE] -->
|
||||||
<string name="recents_multistack_add_stack_dialog_split_custom">Split Custom</string>
|
<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] -->
|
<!-- Expanded Status Bar Header: Battery Charged [CHAR LIMIT=40] -->
|
||||||
<string name="expanded_header_battery_charged">Charged</string>
|
<string name="expanded_header_battery_charged">Charged</string>
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class RecentsActivityLaunchState {
|
|||||||
|
|
||||||
public boolean launchedWithAltTab;
|
public boolean launchedWithAltTab;
|
||||||
public boolean launchedFromApp;
|
public boolean launchedFromApp;
|
||||||
|
public boolean launchedFromBlacklistedApp;
|
||||||
public boolean launchedFromHome;
|
public boolean launchedFromHome;
|
||||||
public boolean launchedViaDragGesture;
|
public boolean launchedViaDragGesture;
|
||||||
public boolean launchedViaDockGesture;
|
public boolean launchedViaDockGesture;
|
||||||
@@ -39,6 +40,7 @@ public class RecentsActivityLaunchState {
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
launchedFromHome = false;
|
launchedFromHome = false;
|
||||||
launchedFromApp = false;
|
launchedFromApp = false;
|
||||||
|
launchedFromBlacklistedApp = false;
|
||||||
launchedToTaskId = -1;
|
launchedToTaskId = -1;
|
||||||
launchedWithAltTab = false;
|
launchedWithAltTab = false;
|
||||||
launchedViaDragGesture = false;
|
launchedViaDragGesture = false;
|
||||||
@@ -53,8 +55,14 @@ public class RecentsActivityLaunchState {
|
|||||||
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
|
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
|
||||||
if (launchedFromApp) {
|
if (launchedFromApp) {
|
||||||
if (!launchState.launchedWithAltTab && debugFlags.isFastToggleRecentsEnabled()) {
|
if (!launchState.launchedWithAltTab && debugFlags.isFastToggleRecentsEnabled()) {
|
||||||
// If fast toggling, focus the front most task so that the next tap will focus the
|
// If fast toggling, focus the front most task so that the next tap will launch the
|
||||||
// N-1 task
|
// 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;
|
return numTasks - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +75,7 @@ public class RecentsActivityLaunchState {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If coming from home, focus the first task
|
// If coming from home, focus the front most task
|
||||||
return numTasks - 1;
|
return numTasks - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -807,15 +807,19 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
|||||||
boolean isHomeStackVisible, boolean animate, int growTarget) {
|
boolean isHomeStackVisible, boolean animate, int growTarget) {
|
||||||
RecentsTaskLoader loader = Recents.getTaskLoader();
|
RecentsTaskLoader loader = Recents.getTaskLoader();
|
||||||
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
|
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
|
? runningTask.id
|
||||||
: -1;
|
: -1;
|
||||||
|
|
||||||
// In the case where alt-tab is triggered, we never get a preloadRecents() call, so we
|
// 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
|
// should always preload the tasks now. If we are dragging in recents, reload them as
|
||||||
// the stacks might have changed.
|
// 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
|
// Create a new load plan if preloadRecents() was never triggered
|
||||||
sInstanceLoadPlan = loader.createLoadPlan(mContext);
|
sInstanceLoadPlan = loader.createLoadPlan(mContext);
|
||||||
}
|
}
|
||||||
@@ -825,11 +829,13 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
|||||||
|
|
||||||
TaskStack stack = sInstanceLoadPlan.getTaskStack();
|
TaskStack stack = sInstanceLoadPlan.getTaskStack();
|
||||||
boolean hasRecentTasks = stack.getTaskCount() > 0;
|
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()
|
// Update the launch state that we need in updateHeaderBarLayout()
|
||||||
launchState.launchedFromHome = !useThumbnailTransition && !mLaunchedWhileDocking;
|
launchState.launchedFromHome = !useThumbnailTransition && !mLaunchedWhileDocking;
|
||||||
launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking;
|
launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking;
|
||||||
|
launchState.launchedFromBlacklistedApp = launchState.launchedFromApp && isBlacklisted;
|
||||||
launchState.launchedViaDockGesture = mLaunchedWhileDocking;
|
launchState.launchedViaDockGesture = mLaunchedWhileDocking;
|
||||||
launchState.launchedViaDragGesture = mDraggingInRecents;
|
launchState.launchedViaDragGesture = mDraggingInRecents;
|
||||||
launchState.launchedToTaskId = runningTaskId;
|
launchState.launchedToTaskId = runningTaskId;
|
||||||
@@ -857,7 +863,9 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
ActivityOptions opts;
|
ActivityOptions opts;
|
||||||
if (useThumbnailTransition) {
|
if (isBlacklisted) {
|
||||||
|
opts = getUnknownTransitionActivityOptions();
|
||||||
|
} else if (useThumbnailTransition) {
|
||||||
// Try starting with a thumbnail transition
|
// Try starting with a thumbnail transition
|
||||||
opts = getThumbnailTransitionActivityOptions(runningTask, mDummyStackView,
|
opts = getThumbnailTransitionActivityOptions(runningTask, mDummyStackView,
|
||||||
windowOverrideRect);
|
windowOverrideRect);
|
||||||
|
|||||||
@@ -243,6 +243,9 @@ public class SystemServicesProxy {
|
|||||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
||||||
Collections.addAll(sRecentsBlacklist,
|
Collections.addAll(sRecentsBlacklist,
|
||||||
res.getStringArray(R.array.recents_tv_blacklist_array));
|
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 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.
|
* Returns a list of the recents tasks.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -556,7 +556,9 @@ public class TaskStackLayoutAlgorithm {
|
|||||||
Math.max(0, mUnfocusedRange.getAbsoluteX(maxBottomNormX)));
|
Math.max(0, mUnfocusedRange.getAbsoluteX(maxBottomNormX)));
|
||||||
boolean scrollToFront = launchState.launchedFromHome ||
|
boolean scrollToFront = launchState.launchedFromHome ||
|
||||||
launchState.launchedViaDockGesture;
|
launchState.launchedViaDockGesture;
|
||||||
if (launchState.launchedWithAltTab) {
|
if (launchState.launchedFromBlacklistedApp) {
|
||||||
|
mInitialScrollP = mMaxScrollP;
|
||||||
|
} else if (launchState.launchedWithAltTab) {
|
||||||
mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
|
mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
|
||||||
} else if (scrollToFront) {
|
} else if (scrollToFront) {
|
||||||
mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
|
mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
|
||||||
@@ -579,6 +581,7 @@ public class TaskStackLayoutAlgorithm {
|
|||||||
mTaskIndexOverrideMap.clear();
|
mTaskIndexOverrideMap.clear();
|
||||||
|
|
||||||
boolean scrollToFront = launchState.launchedFromHome ||
|
boolean scrollToFront = launchState.launchedFromHome ||
|
||||||
|
launchState.launchedFromBlacklistedApp ||
|
||||||
launchState.launchedViaDockGesture;
|
launchState.launchedViaDockGesture;
|
||||||
if (getInitialFocusState() == STATE_UNFOCUSED && mNumStackTasks > 1) {
|
if (getInitialFocusState() == STATE_UNFOCUSED && mNumStackTasks > 1) {
|
||||||
if (ignoreScrollToFront || (!launchState.launchedWithAltTab && !scrollToFront)) {
|
if (ignoreScrollToFront || (!launchState.launchedWithAltTab && !scrollToFront)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user