Merge "Switched TaskRecord.mService to ActivityTaskManagerService (6/n)"
This commit is contained in:
committed by
Android (Google) Code Review
commit
8bffca68ff
@@ -680,11 +680,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
*/
|
||||
String mDeviceOwnerName;
|
||||
|
||||
/**
|
||||
* The controller for all operations related to locktask.
|
||||
*/
|
||||
private final LockTaskController mLockTaskController;
|
||||
|
||||
final UserController mUserController;
|
||||
|
||||
/**
|
||||
@@ -2596,7 +2591,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mWindowManager = wm;
|
||||
mActivityTaskManager.setWindowManager(wm);
|
||||
mStackSupervisor.setWindowManager(wm);
|
||||
mLockTaskController.setWindowManager(wm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2864,7 +2858,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mSystemThread = null;
|
||||
mUiHandler = injector.getUiHandler(null);
|
||||
mUserController = null;
|
||||
mLockTaskController = null;
|
||||
mProcStartHandlerThread = null;
|
||||
mProcStartHandler = null;
|
||||
mHiddenApiBlacklist = null;
|
||||
@@ -2957,7 +2950,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mCompatModePackages = new CompatModePackages(this, systemDir, mHandler);
|
||||
mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler);
|
||||
mActivityStartController = new ActivityStartController(this);
|
||||
mLockTaskController = new LockTaskController(mContext, mStackSupervisor, mHandler);
|
||||
|
||||
mProcessCpuThread = new Thread("CpuTracker") {
|
||||
@Override
|
||||
@@ -9366,7 +9358,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
synchronized (this) {
|
||||
if (DEBUG_LOCKTASK) Slog.w(TAG_LOCKTASK, "Whitelisting " + userId + ":" +
|
||||
Arrays.toString(packages));
|
||||
mLockTaskController.updateLockTaskPackages(userId, packages);
|
||||
mActivityTaskManager.getLockTaskController().updateLockTaskPackages(userId, packages);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10142,10 +10134,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
return mActivityStartController;
|
||||
}
|
||||
|
||||
LockTaskController getLockTaskController() {
|
||||
return mLockTaskController;
|
||||
}
|
||||
|
||||
ClientLifecycleManager getLifecycleManager() {
|
||||
return mActivityTaskManager.getLifecycleManager();
|
||||
}
|
||||
@@ -10913,11 +10901,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
/** Pokes the task persister. */
|
||||
void notifyTaskPersisterLocked(TaskRecord task, boolean flush) {
|
||||
mActivityTaskManager.getRecentTasks().notifyTaskPersisterLocked(task, flush);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyCleartextNetwork(int uid, byte[] firstPacket) {
|
||||
mHandler.obtainMessage(NOTIFY_CLEARTEXT_NETWORK_MSG, uid, 0, firstPacket).sendToTarget();
|
||||
@@ -10947,7 +10930,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mBatteryStatsService.shutdown();
|
||||
synchronized (this) {
|
||||
mProcessStats.shutdownLocked();
|
||||
notifyTaskPersisterLocked(null, true);
|
||||
mActivityTaskManager.notifyTaskPersisterLocked(null, true);
|
||||
}
|
||||
|
||||
return timedout;
|
||||
|
||||
@@ -3739,7 +3739,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
|
||||
}
|
||||
|
||||
if (endTask) {
|
||||
mService.getLockTaskController().clearLockedTask(task);
|
||||
mService.mActivityTaskManager.getLockTaskController().clearLockedTask(task);
|
||||
}
|
||||
} else if (!r.isState(PAUSING)) {
|
||||
// If the activity is PAUSING, we will complete the finish once
|
||||
@@ -4656,7 +4656,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
|
||||
|
||||
// In LockTask mode, moving a locked task to the back of the stack may expose unlocked
|
||||
// ones. Therefore we need to check if this operation is allowed.
|
||||
if (!mService.getLockTaskController().canMoveTaskToBack(tr)) {
|
||||
if (!mService.mActivityTaskManager.getLockTaskController().canMoveTaskToBack(tr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5176,7 +5176,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
|
||||
boolean toTop, ActivityRecord activity, ActivityRecord source,
|
||||
ActivityOptions options) {
|
||||
final TaskRecord task = TaskRecord.create(
|
||||
mService, taskId, info, intent, voiceSession, voiceInteractor);
|
||||
mService.mActivityTaskManager, taskId, info, intent, voiceSession, voiceInteractor);
|
||||
// add the task to stack first, mTaskPositioner might need the stack association
|
||||
addTask(task, toTop, "createTaskRecord");
|
||||
final int displayId = mDisplayId != INVALID_DISPLAY ? mDisplayId : DEFAULT_DISPLAY;
|
||||
|
||||
@@ -1456,7 +1456,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
mService.updateLruProcessLocked(app, true, null);
|
||||
mService.updateOomAdjLocked();
|
||||
|
||||
final LockTaskController lockTaskController = mService.getLockTaskController();
|
||||
final LockTaskController lockTaskController = mService.mActivityTaskManager.getLockTaskController();
|
||||
if (task.mLockTaskAuth == LOCK_TASK_AUTH_LAUNCHABLE
|
||||
|| task.mLockTaskAuth == LOCK_TASK_AUTH_LAUNCHABLE_PRIV
|
||||
|| (task.mLockTaskAuth == LOCK_TASK_AUTH_WHITELISTED
|
||||
@@ -3077,9 +3077,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
if (tr != null) {
|
||||
tr.removeTaskActivitiesLocked(pauseImmediately, reason);
|
||||
cleanUpRemovedTaskLocked(tr, killProcess, removeFromRecents);
|
||||
mService.getLockTaskController().clearLockedTask(tr);
|
||||
mService.mActivityTaskManager.getLockTaskController().clearLockedTask(tr);
|
||||
if (tr.isPersistable) {
|
||||
mService.notifyTaskPersisterLocked(null, true);
|
||||
mService.mActivityTaskManager.notifyTaskPersisterLocked(null, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -4005,7 +4005,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
pw.print(mRecentTasks.isRecentsComponentHomeActivity(mCurrentUser));
|
||||
|
||||
getKeyguardController().dump(pw, prefix);
|
||||
mService.getLockTaskController().dump(pw, prefix);
|
||||
mService.mActivityTaskManager.getLockTaskController().dump(pw, prefix);
|
||||
}
|
||||
|
||||
public void writeToProto(ProtoOutputStream proto, long fieldId) {
|
||||
|
||||
@@ -1257,7 +1257,7 @@ class ActivityStarter {
|
||||
// When the flags NEW_TASK and CLEAR_TASK are set, then the task gets reused but
|
||||
// still needs to be a lock task mode violation since the task gets cleared out and
|
||||
// the device would otherwise leave the locked task.
|
||||
if (mService.getLockTaskController().isLockTaskModeViolation(reusedActivity.getTask(),
|
||||
if (mService.mActivityTaskManager.getLockTaskController().isLockTaskModeViolation(reusedActivity.getTask(),
|
||||
(mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK))
|
||||
== (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK))) {
|
||||
Slog.e(TAG, "startActivityUnchecked: Attempt to violate Lock Task Mode");
|
||||
@@ -2070,7 +2070,7 @@ class ActivityStarter {
|
||||
mStartActivity.setTaskToAffiliateWith(taskToAffiliate);
|
||||
}
|
||||
|
||||
if (mService.getLockTaskController().isLockTaskModeViolation(mStartActivity.getTask())) {
|
||||
if (mService.mActivityTaskManager.getLockTaskController().isLockTaskModeViolation(mStartActivity.getTask())) {
|
||||
Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity);
|
||||
return START_RETURN_LOCK_TASK_MODE_VIOLATION;
|
||||
}
|
||||
@@ -2093,7 +2093,7 @@ class ActivityStarter {
|
||||
}
|
||||
|
||||
private int setTaskFromSourceRecord() {
|
||||
if (mService.getLockTaskController().isLockTaskModeViolation(mSourceRecord.getTask())) {
|
||||
if (mService.mActivityTaskManager.getLockTaskController().isLockTaskModeViolation(mSourceRecord.getTask())) {
|
||||
Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity);
|
||||
return START_RETURN_LOCK_TASK_MODE_VIOLATION;
|
||||
}
|
||||
@@ -2187,7 +2187,7 @@ class ActivityStarter {
|
||||
private int setTaskFromInTask() {
|
||||
// The caller is asking that the new activity be started in an explicit
|
||||
// task it has provided to us.
|
||||
if (mService.getLockTaskController().isLockTaskModeViolation(mInTask)) {
|
||||
if (mService.mActivityTaskManager.getLockTaskController().isLockTaskModeViolation(mInTask)) {
|
||||
Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity);
|
||||
return START_RETURN_LOCK_TASK_MODE_VIOLATION;
|
||||
}
|
||||
|
||||
@@ -222,6 +222,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
KeyguardController mKeyguardController;
|
||||
private final ClientLifecycleManager mLifecycleManager;
|
||||
private TaskChangeNotificationController mTaskChangeNotificationController;
|
||||
/** The controller for all operations related to locktask. */
|
||||
private LockTaskController mLockTaskController;
|
||||
|
||||
boolean mSuppressResizeConfigChanges;
|
||||
|
||||
@@ -259,6 +261,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
mStackSupervisor = mAm.mStackSupervisor;
|
||||
mTaskChangeNotificationController =
|
||||
new TaskChangeNotificationController(mAm, mStackSupervisor, mH);
|
||||
mLockTaskController = new LockTaskController(mContext, mStackSupervisor, mH);
|
||||
mRecentTasks = createRecentTasks();
|
||||
mStackSupervisor.setRecentTasks(mRecentTasks);
|
||||
mVrController = new VrController(mAm);
|
||||
@@ -267,6 +270,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
|
||||
void setWindowManager(WindowManagerService wm) {
|
||||
mWindowManager = wm;
|
||||
mLockTaskController.setWindowManager(wm);
|
||||
}
|
||||
|
||||
protected RecentTasks createRecentTasks() {
|
||||
@@ -285,6 +289,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
return mTaskChangeNotificationController;
|
||||
}
|
||||
|
||||
LockTaskController getLockTaskController() {
|
||||
return mLockTaskController;
|
||||
}
|
||||
|
||||
private void start() {
|
||||
LocalServices.addService(ActivityTaskManagerInternal.class, new LocalService());
|
||||
}
|
||||
@@ -769,7 +777,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
}
|
||||
// Do not allow task to finish if last task in lockTask mode. Launchable priv-apps can
|
||||
// finish.
|
||||
if (mAm.getLockTaskController().activityBlockedFromFinish(r)) {
|
||||
if (getLockTaskController().activityBlockedFromFinish(r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -836,7 +844,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
// Do not allow task to finish if last task in lockTask mode. Launchable priv-apps
|
||||
// can finish.
|
||||
final TaskRecord task = r.getTask();
|
||||
if (mAm.getLockTaskController().activityBlockedFromFinish(r)) {
|
||||
if (getLockTaskController().activityBlockedFromFinish(r)) {
|
||||
return false;
|
||||
}
|
||||
return task.getStack().finishActivityAffinityLocked(r);
|
||||
@@ -1442,7 +1450,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
Slog.d(TAG, "Could not find task for id: "+ taskId);
|
||||
return;
|
||||
}
|
||||
if (mAm.getLockTaskController().isLockTaskModeViolation(task)) {
|
||||
if (getLockTaskController().isLockTaskModeViolation(task)) {
|
||||
Slog.e(TAG, "moveTaskToFront: Attempt to violate Lock Task Mode");
|
||||
return;
|
||||
}
|
||||
@@ -1812,7 +1820,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
// When a task is locked, dismiss the pinned stack if it exists
|
||||
mStackSupervisor.removeStacksInWindowingModes(WINDOWING_MODE_PINNED);
|
||||
|
||||
mAm.getLockTaskController().startLockTaskMode(task, isSystemCaller, callingUid);
|
||||
getLockTaskController().startLockTaskMode(task, isSystemCaller, callingUid);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
@@ -1823,7 +1831,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (mGlobalLock) {
|
||||
mAm.getLockTaskController().stopLockTaskMode(task, isSystemCaller, callingUid);
|
||||
getLockTaskController().stopLockTaskMode(task, isSystemCaller, callingUid);
|
||||
}
|
||||
// Launch in-call UI if a call is ongoing. This is necessary to allow stopping the lock
|
||||
// task and jumping straight into a call in the case of emergency call back.
|
||||
@@ -1844,7 +1852,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
@Override
|
||||
public int getLockTaskModeState() {
|
||||
synchronized (mGlobalLock) {
|
||||
return mAm.getLockTaskController().getLockTaskModeState();
|
||||
return getLockTaskController().getLockTaskModeState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2601,7 +2609,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
if (r == null) {
|
||||
return;
|
||||
}
|
||||
mAm.getLockTaskController().showLockTaskToast();
|
||||
getLockTaskController().showLockTaskToast();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3319,7 +3327,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
synchronized (mGlobalLock) {
|
||||
if (DEBUG_LOCKTASK) Slog.w(TAG_LOCKTASK, "Allowing features " + userId + ":0x" +
|
||||
Integer.toHexString(flags));
|
||||
mAm.getLockTaskController().updateLockTaskFeatures(userId, flags);
|
||||
getLockTaskController().updateLockTaskFeatures(userId, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ class RecentTasks {
|
||||
}
|
||||
for (int i = mTasks.size() - 1; i >= 0; --i) {
|
||||
final TaskRecord tr = mTasks.get(i);
|
||||
if (tr.userId == userId && !mService.mAm.getLockTaskController().isTaskWhitelisted(tr)) {
|
||||
if (tr.userId == userId && !mService.getLockTaskController().isTaskWhitelisted(tr)) {
|
||||
remove(tr);
|
||||
}
|
||||
}
|
||||
@@ -1162,7 +1162,7 @@ class RecentTasks {
|
||||
}
|
||||
|
||||
// If we're in lock task mode, ignore the root task
|
||||
if (task == mService.mAm.getLockTaskController().getRootTask()) {
|
||||
if (task == mService.getLockTaskController().getRootTask()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ class SafeActivityOptions {
|
||||
// Check if someone tries to launch an unwhitelisted activity into LockTask mode.
|
||||
final boolean lockTaskMode = options.getLockTaskMode();
|
||||
if (aInfo != null && lockTaskMode
|
||||
&& !supervisor.mService.getLockTaskController().isPackageWhitelisted(
|
||||
&& !supervisor.mService.mActivityTaskManager.getLockTaskController().isPackageWhitelisted(
|
||||
UserHandle.getUserId(callingUid), aInfo.packageName)) {
|
||||
final String msg = "Permission Denial: starting " + getIntentString(intent)
|
||||
+ " from " + callerApp + " (pid=" + callingPid
|
||||
|
||||
@@ -295,7 +295,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
int mCallingUid;
|
||||
String mCallingPackage;
|
||||
|
||||
final ActivityManagerService mService;
|
||||
final ActivityTaskManagerService mService;
|
||||
|
||||
private final Rect mTmpStableBounds = new Rect();
|
||||
private final Rect mTmpNonDecorBounds = new Rect();
|
||||
@@ -320,10 +320,10 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
private TaskWindowContainerController mWindowContainerController;
|
||||
|
||||
/**
|
||||
* Don't use constructor directly. Use {@link #create(ActivityManagerService, int, ActivityInfo,
|
||||
* Intent, TaskDescription)} instead.
|
||||
* Don't use constructor directly. Use {@link #create(ActivityTaskManagerService, int,
|
||||
* ActivityInfo, Intent, TaskDescription)} instead.
|
||||
*/
|
||||
TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
|
||||
TaskRecord(ActivityTaskManagerService service, int _taskId, ActivityInfo info, Intent _intent,
|
||||
IVoiceInteractionSession _voiceSession, IVoiceInteractor _voiceInteractor) {
|
||||
mService = service;
|
||||
userId = UserHandle.getUserId(info.applicationInfo.uid);
|
||||
@@ -339,14 +339,15 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
setIntent(_intent, info);
|
||||
setMinDimensions(info);
|
||||
touchActiveTime();
|
||||
mService.mActivityTaskManager.getTaskChangeNotificationController().notifyTaskCreated(_taskId, realActivity);
|
||||
mService.getTaskChangeNotificationController().notifyTaskCreated(_taskId, realActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't use constructor directly. Use {@link #create(ActivityManagerService, int, ActivityInfo,
|
||||
* Don't use constructor directly.
|
||||
* Use {@link #create(ActivityTaskManagerService, int, ActivityInfo,
|
||||
* Intent, IVoiceInteractionSession, IVoiceInteractor)} instead.
|
||||
*/
|
||||
TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
|
||||
TaskRecord(ActivityTaskManagerService service, int _taskId, ActivityInfo info, Intent _intent,
|
||||
TaskDescription _taskDescription) {
|
||||
mService = service;
|
||||
userId = UserHandle.getUserId(info.applicationInfo.uid);
|
||||
@@ -369,13 +370,13 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
|
||||
lastTaskDescription = _taskDescription;
|
||||
touchActiveTime();
|
||||
mService.mActivityTaskManager.getTaskChangeNotificationController().notifyTaskCreated(_taskId, realActivity);
|
||||
mService.getTaskChangeNotificationController().notifyTaskCreated(_taskId, realActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't use constructor directly. This is only used by XML parser.
|
||||
*/
|
||||
TaskRecord(ActivityManagerService service, int _taskId, Intent _intent,
|
||||
TaskRecord(ActivityTaskManagerService service, int _taskId, Intent _intent,
|
||||
Intent _affinityIntent, String _affinity, String _rootAffinity,
|
||||
ComponentName _realActivity, ComponentName _origActivity, boolean _rootWasReset,
|
||||
boolean _autoRemoveRecents, boolean _askedCompatMode, int _userId,
|
||||
@@ -419,7 +420,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
mSupportsPictureInPicture = supportsPictureInPicture;
|
||||
mMinWidth = minWidth;
|
||||
mMinHeight = minHeight;
|
||||
mService.mActivityTaskManager.getTaskChangeNotificationController().notifyTaskCreated(_taskId, realActivity);
|
||||
mService.getTaskChangeNotificationController().notifyTaskCreated(_taskId, realActivity);
|
||||
}
|
||||
|
||||
TaskWindowContainerController getWindowContainerController() {
|
||||
@@ -460,13 +461,13 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
// default configuration the next time it launches.
|
||||
updateOverrideConfiguration(null);
|
||||
}
|
||||
mService.mActivityTaskManager.getTaskChangeNotificationController().notifyTaskRemoved(taskId);
|
||||
mService.getTaskChangeNotificationController().notifyTaskRemoved(taskId);
|
||||
mWindowContainerController = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSnapshotChanged(TaskSnapshot snapshot) {
|
||||
mService.mActivityTaskManager.getTaskChangeNotificationController().notifyTaskSnapshotChanged(taskId, snapshot);
|
||||
mService.getTaskChangeNotificationController().notifyTaskSnapshotChanged(taskId, snapshot);
|
||||
}
|
||||
|
||||
void setResizeMode(int resizeMode) {
|
||||
@@ -486,7 +487,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
// TODO: Consolidate this with the resize() method below.
|
||||
@Override
|
||||
public void requestResize(Rect bounds, int resizeMode) {
|
||||
mService.mActivityTaskManager.resizeTask(taskId, bounds, resizeMode);
|
||||
mService.resizeTask(taskId, bounds, resizeMode);
|
||||
}
|
||||
|
||||
boolean resize(Rect bounds, int resizeMode, boolean preserveWindow, boolean deferResume) {
|
||||
@@ -1302,7 +1303,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
// We normally notify listeners of task stack changes on pause, however pinned stack
|
||||
// activities are normally in the paused state so no notification will be sent there
|
||||
// before the activity is removed. We send it here so instead.
|
||||
mService.mActivityTaskManager.getTaskChangeNotificationController().notifyTaskStackChanged();
|
||||
mService.getTaskChangeNotificationController().notifyTaskStackChanged();
|
||||
}
|
||||
|
||||
if (mActivities.isEmpty()) {
|
||||
@@ -1493,7 +1494,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
}
|
||||
|
||||
private boolean isResizeable(boolean checkSupportsPip) {
|
||||
return (mService.mForceResizableActivities || ActivityInfo.isResizeableMode(mResizeMode)
|
||||
return (mService.mAm.mForceResizableActivities || ActivityInfo.isResizeableMode(mResizeMode)
|
||||
|| (checkSupportsPip && mSupportsPictureInPicture));
|
||||
}
|
||||
|
||||
@@ -1506,8 +1507,8 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
// A task can not be docked even if it is considered resizeable because it only supports
|
||||
// picture-in-picture mode but has a non-resizeable resizeMode
|
||||
return super.supportsSplitScreenWindowingMode()
|
||||
&& mService.mSupportsSplitScreenMultiWindow
|
||||
&& (mService.mForceResizableActivities
|
||||
&& mService.mAm.mSupportsSplitScreenMultiWindow
|
||||
&& (mService.mAm.mForceResizableActivities
|
||||
|| (isResizeable(false /* checkSupportsPip */)
|
||||
&& !ActivityInfo.isPreserveOrientationMode(mResizeMode)));
|
||||
}
|
||||
@@ -2205,14 +2206,14 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
sTaskRecordFactory = factory;
|
||||
}
|
||||
|
||||
static TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info,
|
||||
static TaskRecord create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||
Intent intent, IVoiceInteractionSession voiceSession,
|
||||
IVoiceInteractor voiceInteractor) {
|
||||
return getTaskRecordFactory().create(
|
||||
service, taskId, info, intent, voiceSession, voiceInteractor);
|
||||
}
|
||||
|
||||
static TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info,
|
||||
static TaskRecord create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||
Intent intent, TaskDescription taskDescription) {
|
||||
return getTaskRecordFactory().create(service, taskId, info, intent, taskDescription);
|
||||
}
|
||||
@@ -2229,14 +2230,14 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
*/
|
||||
static class TaskRecordFactory {
|
||||
|
||||
TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info,
|
||||
TaskRecord create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||
Intent intent, IVoiceInteractionSession voiceSession,
|
||||
IVoiceInteractor voiceInteractor) {
|
||||
return new TaskRecord(
|
||||
service, taskId, info, intent, voiceSession, voiceInteractor);
|
||||
}
|
||||
|
||||
TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info,
|
||||
TaskRecord create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||
Intent intent, TaskDescription taskDescription) {
|
||||
return new TaskRecord(service, taskId, info, intent, taskDescription);
|
||||
}
|
||||
@@ -2244,7 +2245,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
/**
|
||||
* Should only be used when we're restoring {@link TaskRecord} from storage.
|
||||
*/
|
||||
TaskRecord create(ActivityManagerService service, int taskId, Intent intent,
|
||||
TaskRecord create(ActivityTaskManagerService service, int taskId, Intent intent,
|
||||
Intent affinityIntent, String affinity, String rootAffinity,
|
||||
ComponentName realActivity, ComponentName origActivity, boolean rootWasReset,
|
||||
boolean autoRemoveRecents, boolean askedCompatMode, int userId,
|
||||
@@ -2468,7 +2469,8 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
|
||||
}
|
||||
}
|
||||
|
||||
final TaskRecord task = create(stackSupervisor.mService, taskId, intent, affinityIntent,
|
||||
final TaskRecord task = create(stackSupervisor.mService.mActivityTaskManager,
|
||||
taskId, intent, affinityIntent,
|
||||
affinity, rootAffinity, realActivity, origActivity, rootHasReset,
|
||||
autoRemoveRecents, askedCompatMode, userId, effectiveUid, lastDescription,
|
||||
activities, lastTimeOnTop, neverRelinquishIdentity, taskDescription,
|
||||
|
||||
@@ -2248,7 +2248,7 @@ class UserController implements Handler.Callback {
|
||||
|
||||
protected void clearAllLockedTasks(String reason) {
|
||||
synchronized (mService) {
|
||||
mService.getLockTaskController().clearLockedTasks(reason);
|
||||
mService.mActivityTaskManager.getLockTaskController().clearLockedTasks(reason);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ public class ActivityStarterTests extends ActivityTestsBase {
|
||||
|
||||
final ActivityStarter starter = prepareStarter(0);
|
||||
|
||||
final LockTaskController lockTaskController = mService.getLockTaskController();
|
||||
final LockTaskController lockTaskController = mService.mActivityTaskManager.getLockTaskController();
|
||||
doReturn(true).when(lockTaskController).isLockTaskModeViolation(any());
|
||||
|
||||
final int result = starter.setReason("testTaskModeViolation").execute();
|
||||
|
||||
@@ -311,7 +311,7 @@ public class ActivityTestsBase {
|
||||
intent.setComponent(mComponent);
|
||||
intent.setFlags(mFlags);
|
||||
|
||||
final TestTaskRecord task = new TestTaskRecord(mSupervisor.mService, mTaskId, aInfo,
|
||||
final TestTaskRecord task = new TestTaskRecord(mSupervisor.mService.mActivityTaskManager, mTaskId, aInfo,
|
||||
intent /*intent*/, mVoiceSession, null /*_voiceInteractor*/);
|
||||
task.userId = mUserId;
|
||||
|
||||
@@ -328,7 +328,7 @@ public class ActivityTestsBase {
|
||||
}
|
||||
|
||||
private static class TestTaskRecord extends TaskRecord {
|
||||
TestTaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info,
|
||||
TestTaskRecord(ActivityTaskManagerService service, int _taskId, ActivityInfo info,
|
||||
Intent _intent, IVoiceInteractionSession _voiceSession,
|
||||
IVoiceInteractor _voiceInteractor) {
|
||||
super(service, _taskId, info, _intent, _voiceSession, _voiceInteractor);
|
||||
@@ -346,9 +346,20 @@ public class ActivityTestsBase {
|
||||
}
|
||||
|
||||
protected static class TestActivityTaskManagerService extends ActivityTaskManagerService {
|
||||
private LockTaskController mLockTaskController;
|
||||
|
||||
TestActivityTaskManagerService(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockTaskController getLockTaskController() {
|
||||
if (mLockTaskController == null) {
|
||||
mLockTaskController = spy(super.getLockTaskController());
|
||||
}
|
||||
|
||||
return mLockTaskController;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -356,8 +367,6 @@ public class ActivityTestsBase {
|
||||
* {@link ActivityStackSupervisor}.
|
||||
*/
|
||||
protected static class TestActivityManagerService extends ActivityManagerService {
|
||||
private ClientLifecycleManager mLifecycleManager;
|
||||
private LockTaskController mLockTaskController;
|
||||
|
||||
TestActivityManagerService(Context context) {
|
||||
super(context);
|
||||
@@ -369,22 +378,6 @@ public class ActivityTestsBase {
|
||||
mWindowManager = WindowTestUtils.getMockWindowManagerService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientLifecycleManager getLifecycleManager() {
|
||||
if (mLifecycleManager == null) {
|
||||
return super.getLifecycleManager();
|
||||
}
|
||||
return mLifecycleManager;
|
||||
}
|
||||
|
||||
public LockTaskController getLockTaskController() {
|
||||
if (mLockTaskController == null) {
|
||||
mLockTaskController = spy(super.getLockTaskController());
|
||||
}
|
||||
|
||||
return mLockTaskController;
|
||||
}
|
||||
|
||||
@Override
|
||||
final protected ActivityStackSupervisor createStackSupervisor() {
|
||||
final ActivityStackSupervisor supervisor = spy(createTestSupervisor());
|
||||
|
||||
@@ -155,7 +155,8 @@ public class TaskRecordTests extends ActivityTestsBase {
|
||||
}
|
||||
|
||||
private TaskRecord createTaskRecord(int taskId) {
|
||||
return new TaskRecord(mService, taskId, new Intent(), null, null, null, null, null, false,
|
||||
return new TaskRecord(mService.mActivityTaskManager, taskId, new Intent(), null, null, null,
|
||||
null, null, false,
|
||||
false, false, 0, 10050, null, new ArrayList<>(), 0, false, null, 0, 0, 0, 0, 0,
|
||||
null, 0, false, false, false, 0, 0);
|
||||
}
|
||||
@@ -164,7 +165,7 @@ public class TaskRecordTests extends ActivityTestsBase {
|
||||
private boolean mCreated = false;
|
||||
|
||||
@Override
|
||||
TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info,
|
||||
TaskRecord create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||
Intent intent,
|
||||
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor) {
|
||||
mCreated = true;
|
||||
@@ -172,7 +173,7 @@ public class TaskRecordTests extends ActivityTestsBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info,
|
||||
TaskRecord create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||
Intent intent,
|
||||
ActivityManager.TaskDescription taskDescription) {
|
||||
mCreated = true;
|
||||
@@ -180,7 +181,7 @@ public class TaskRecordTests extends ActivityTestsBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
TaskRecord create(ActivityManagerService service, int taskId, Intent intent,
|
||||
TaskRecord create(ActivityTaskManagerService service, int taskId, Intent intent,
|
||||
Intent affinityIntent, String affinity, String rootAffinity,
|
||||
ComponentName realActivity,
|
||||
ComponentName origActivity, boolean rootWasReset, boolean autoRemoveRecents,
|
||||
|
||||
Reference in New Issue
Block a user