Switched TaskRecord.mService to ActivityTaskManagerService (6/n)
Objects that contain or represent activities like TaskRecord can
no longer rely on ActivityManagerService as it is going to be in a
different package.
Test: Existing tests pass
Test: go/wm-smoke-auto
Bug: 80414790
Change-Id: Ia17591f7d709839c18762d1eb2474b2e2f649dfc
diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
index 37ee3f7..a49e20d 100644
--- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
@@ -222,6 +222,8 @@
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 @@
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 @@
void setWindowManager(WindowManagerService wm) {
mWindowManager = wm;
+ mLockTaskController.setWindowManager(wm);
}
protected RecentTasks createRecentTasks() {
@@ -285,6 +289,10 @@
return mTaskChangeNotificationController;
}
+ LockTaskController getLockTaskController() {
+ return mLockTaskController;
+ }
+
private void start() {
LocalServices.addService(ActivityTaskManagerInternal.class, new LocalService());
}
@@ -769,7 +777,7 @@
}
// 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 @@
// 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 @@
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 @@
// 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 @@
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 @@
@Override
public int getLockTaskModeState() {
synchronized (mGlobalLock) {
- return mAm.getLockTaskController().getLockTaskModeState();
+ return getLockTaskController().getLockTaskModeState();
}
}
@@ -2601,7 +2609,7 @@
if (r == null) {
return;
}
- mAm.getLockTaskController().showLockTaskToast();
+ getLockTaskController().showLockTaskToast();
}
}
@@ -3319,7 +3327,7 @@
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);
}
}