* they are in.
* @param homeTask True if this is the task.
* @param targetSdkVersion The application's target SDK version
+ * @param isOnTopLauncher True if this task is an on-top launcher.
*/
void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
in Rect taskBounds, in Configuration configuration, int taskResizeMode,
- boolean alwaysFocusable, boolean homeTask, int targetSdkVersion, int rotationAnimationHint);
+ boolean alwaysFocusable, boolean homeTask, int targetSdkVersion,
+ int rotationAnimationHint, boolean isOnTopLauncher);
/**
*
* @param token The token we are adding to the input task Id.
* @param config Configuration that is being used with this task.
* @param taskResizeMode The resize mode of the task.
* @param homeTask True if this is the task.
+ * @param isOnTopLauncher True if this task is an on-top launcher.
*/
void setAppTask(IBinder token, int taskId, int stackId, in Rect taskBounds,
- in Configuration config, int taskResizeMode, boolean homeTask);
+ in Configuration config, int taskResizeMode, boolean homeTask, boolean isOnTopLauncher);
void setAppOrientation(IApplicationToken token, int requestedOrientation);
int getAppOrientation(IApplicationToken token);
void setFocusedApp(IBinder token, boolean moveFocusNow);
(r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId, r.info.configChanges,
task.voiceSession != null, r.mLaunchTaskBehind, bounds, task.mOverrideConfig,
task.mResizeMode, r.isAlwaysFocusable(), task.isHomeTask(),
- r.appInfo.targetSdkVersion, r.mRotationAnimationHint);
+ r.appInfo.targetSdkVersion, r.mRotationAnimationHint, task.isOnTopLauncher());
r.taskConfigOverride = task.mOverrideConfig;
}
private void setAppTask(ActivityRecord r, TaskRecord task) {
final Rect bounds = task.updateOverrideConfigurationFromLaunchBounds();
mWindowManager.setAppTask(r.appToken, task.taskId, mStackId, bounds, task.mOverrideConfig,
- task.mResizeMode, task.isHomeTask());
+ task.mResizeMode, task.isHomeTask(), task.isOnTopLauncher());
r.taskConfigOverride = task.mOverrideConfig;
}
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
+import static android.content.pm.ActivityInfo.FLAG_ON_TOP_LAUNCHER;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_DEFAULT;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED;
// ActivityManager.LOCK_TASK_LAUNCH_MODE_*
private boolean mPrivileged; // The root activity application of this task holds
// privileged permissions.
+ private boolean mIsOnTopLauncher; // Whether this task is an on-top launcher. See
+ // android.R.attr#onTopLauncher.
/** Can't be put in lockTask mode. */
final static int LOCK_TASK_AUTH_DONT_LOCK = 0;
autoRemoveRecents = false;
}
mResizeMode = info.resizeMode;
+ mIsOnTopLauncher = (info.flags & FLAG_ON_TOP_LAUNCHER) != 0;
mLockTaskMode = info.lockTaskLaunchMode;
mPrivileged = (info.applicationInfo.privateFlags & PRIVATE_FLAG_PRIVILEGED) != 0;
setLockTaskAuth();
|| ActivityInfo.isResizeableMode(mResizeMode)) && !mTemporarilyUnresizable;
}
+ boolean isOnTopLauncher() {
+ return isHomeTask() && mIsOnTopLauncher;
+ }
+
boolean inCropWindowsResizeMode() {
return !isResizeable() && mResizeMode == RESIZE_MODE_CROP_WINDOWS;
}
private boolean mHomeTask;
+ // Whether this task is an on-top launcher task, which is determined by the root activity.
+ private boolean mIsOnTopLauncher;
+
Task(int taskId, TaskStack stack, int userId, WindowManagerService service, Rect bounds,
- Configuration config) {
+ Configuration config, boolean isOnTopLauncher) {
mTaskId = taskId;
mStack = stack;
mUserId = userId;
mService = service;
+ mIsOnTopLauncher = isOnTopLauncher;
setBounds(bounds, config);
}
&& (ActivityInfo.isResizeableMode(mResizeMode) || mService.mForceResizableTasks);
}
+ boolean isOnTopLauncher() {
+ return mIsOnTopLauncher;
+ }
+
boolean cropWindowsToStackBounds() {
return !mHomeTask && (isResizeable() || mResizeMode == RESIZE_MODE_CROP_WINDOWS);
}
}
private Task createTaskLocked(int taskId, int stackId, int userId, AppWindowToken atoken,
- Rect bounds, Configuration config) {
+ Rect bounds, Configuration config, boolean isOnTopLauncher) {
if (DEBUG_STACK) Slog.i(TAG_WM, "createTaskLocked: taskId=" + taskId + " stackId=" + stackId
+ " atoken=" + atoken + " bounds=" + bounds);
final TaskStack stack = mStackIdToStack.get(stackId);
throw new IllegalArgumentException("addAppToken: invalid stackId=" + stackId);
}
EventLog.writeEvent(EventLogTags.WM_TASK_CREATED, taskId, stackId);
- Task task = new Task(taskId, stack, userId, this, bounds, config);
+ Task task = new Task(taskId, stack, userId, this, bounds, config, isOnTopLauncher);
mTaskIdToTask.put(taskId, task);
stack.addTask(task, !atoken.mLaunchTaskBehind /* toTop */, atoken.showForAllUsers);
return task;
int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int userId,
int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
Rect taskBounds, Configuration config, int taskResizeMode, boolean alwaysFocusable,
- boolean homeTask, int targetSdkVersion, int rotationAnimationHint) {
+ boolean homeTask, int targetSdkVersion, int rotationAnimationHint,
+ boolean isOnTopLauncher) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"addAppToken()")) {
throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
Task task = mTaskIdToTask.get(taskId);
if (task == null) {
- task = createTaskLocked(taskId, stackId, userId, atoken, taskBounds, config);
+ task = createTaskLocked(taskId, stackId, userId, atoken, taskBounds, config,
+ isOnTopLauncher);
}
task.addAppToken(addPos, atoken, taskResizeMode, homeTask);
@Override
public void setAppTask(IBinder token, int taskId, int stackId, Rect taskBounds,
- Configuration config, int taskResizeMode, boolean homeTask) {
+ Configuration config, int taskResizeMode, boolean homeTask, boolean isOnTopLauncher) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"setAppTask()")) {
throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
Task newTask = mTaskIdToTask.get(taskId);
if (newTask == null) {
newTask = createTaskLocked(
- taskId, stackId, oldTask.mUserId, atoken, taskBounds, config);
+ taskId, stackId, oldTask.mUserId, atoken, taskBounds, config,
+ isOnTopLauncher);
}
newTask.addAppToken(Integer.MAX_VALUE /* at top */, atoken, taskResizeMode, homeTask);
}
try {
mWm.addAppToken(0, null, 0, 0, 0, false, false, 0, 0, false, false, null,
- Configuration.EMPTY, 0, false, false, 0, -1);
+ Configuration.EMPTY, 0, false, false, 0, -1, false);
fail("IWindowManager.addAppToken did not throw SecurityException as"
+ " expected");
} catch (SecurityException e) {
}
try {
- mWm.setAppTask(null, 0, INVALID_STACK_ID, null, null, 0, false);
+ mWm.setAppTask(null, 0, INVALID_STACK_ID, null, null, 0, false, false);
fail("IWindowManager.setAppGroupId did not throw SecurityException as"
+ " expected");
} catch (SecurityException e) {