Moved some activities implementation to ActivityTaskManagerService (2/n)
Second step in unifying the window hierarchy that is currently split
within AM and WM packages. We move some of the API implementation for
activities from ActivityManagerService.java to
ActivityTaskManagerService.java.
Test: Existing tests pass
Test: go/wm-smoke-auto
Bug: 80414790
Change-Id: I23dcd924493d8ad1e0b6e3a55386fd72b0146605
diff --git a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java
index 9435589..5605b7a 100644
--- a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java
@@ -18,6 +18,7 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.ActivityTaskManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
@@ -171,7 +172,7 @@
// should be the equivalent to the old userActivity(EMERGENCY_CALL_TIMEOUT)
mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
try {
- ActivityManager.getService().stopSystemLockTaskMode();
+ ActivityTaskManager.getService().stopSystemLockTaskMode();
} catch (RemoteException e) {
Slog.w(LOG_TAG, "Failed to stop app pinning");
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 62cd13b..d9a1b11 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -32,6 +32,7 @@
import android.annotation.AnyThread;
import android.annotation.MainThread;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.app.AlarmManager;
import android.app.Instrumentation;
import android.app.PendingIntent;
@@ -1843,7 +1844,7 @@
@Override
public void onTaskStackChangedBackground() {
try {
- ActivityManager.StackInfo info = ActivityManager.getService().getStackInfo(
+ ActivityManager.StackInfo info = ActivityTaskManager.getService().getStackInfo(
WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
if (info == null) {
return;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 5e94dd7..cf6f16a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -26,6 +26,7 @@
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_TIMEOUT;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.StatusBarManager;
@@ -1750,7 +1751,7 @@
int secondaryDisplayShowing) {
mUiOffloadThread.submit(() -> {
try {
- ActivityManager.getService().setLockScreenShown(showing, aodShowing,
+ ActivityTaskManager.getService().setLockScreenShown(showing, aodShowing,
secondaryDisplayShowing);
} catch (RemoteException e) {
}
@@ -1813,7 +1814,7 @@
// Don't actually hide the Keyguard at the moment, wait for window
// manager until it tells us it's safe to do so with
// startKeyguardExitAnimation.
- ActivityManager.getService().keyguardGoingAway(flags);
+ ActivityTaskManager.getService().keyguardGoingAway(flags);
} catch (RemoteException e) {
Log.e(TAG, "Error while calling WindowManager", e);
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java
index b9e9e0a..0cedf98 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java
@@ -18,7 +18,9 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.ActivityTaskManager;
import android.app.IActivityManager;
+import android.app.IActivityTaskManager;
import android.app.KeyguardManager;
import android.content.ComponentName;
import android.content.Context;
@@ -37,16 +39,17 @@
private static final String TAG = WorkLockActivityController.class.getSimpleName();
private final Context mContext;
- private final IActivityManager mIam;
+ private final IActivityTaskManager mIatm;
public WorkLockActivityController(Context context) {
- this(context, ActivityManagerWrapper.getInstance(), ActivityManager.getService());
+ this(context, ActivityManagerWrapper.getInstance(), ActivityTaskManager.getService());
}
@VisibleForTesting
- WorkLockActivityController(Context context, ActivityManagerWrapper am, IActivityManager iAm) {
+ WorkLockActivityController(
+ Context context, ActivityManagerWrapper am, IActivityTaskManager iAtm) {
mContext = context;
- mIam = iAm;
+ mIatm = iAtm;
am.registerTaskStackListener(mLockListener);
}
@@ -54,7 +57,7 @@
private void startWorkChallengeInTask(int taskId, int userId) {
ActivityManager.TaskDescription taskDescription = null;
try {
- taskDescription = mIam.getTaskDescription(taskId);
+ taskDescription = mIatm.getTaskDescription(taskId);
} catch (RemoteException e) {
Log.w(TAG, "Failed to get description for task=" + taskId);
}
@@ -76,7 +79,7 @@
// Starting the activity inside the task failed. We can't be sure why, so to be
// safe just remove the whole task if it still exists.
try {
- mIam.removeTask(taskId);
+ mIatm.removeTask(taskId);
} catch (RemoteException e) {
Log.w(TAG, "Failed to get description for task=" + taskId);
}
@@ -89,7 +92,7 @@
*/
private int startActivityAsUser(Intent intent, Bundle options, int userId) {
try {
- return mIam.startActivityAsUser(
+ return mIatm.startActivityAsUser(
mContext.getIApplicationThread() /*caller*/,
mContext.getBasePackageName() /*callingPackage*/,
intent /*intent*/,
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
index 26fced3..360fe73 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
@@ -19,6 +19,7 @@
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
+import android.app.ActivityTaskManager;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityOptions;
import android.app.IActivityManager;
@@ -384,7 +385,7 @@
private void startMenuActivity(int menuState, Rect stackBounds, Rect movementBounds,
boolean allowMenuTimeout, boolean willResizeMenu) {
try {
- StackInfo pinnedStackInfo = mActivityManager.getStackInfo(
+ StackInfo pinnedStackInfo = ActivityTaskManager.getService().getStackInfo(
WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
if (pinnedStackInfo != null && pinnedStackInfo.taskIds != null &&
pinnedStackInfo.taskIds.length > 0) {
@@ -423,7 +424,7 @@
// Fetch the pinned stack bounds
Rect stackBounds = null;
try {
- StackInfo pinnedStackInfo = mActivityManager.getStackInfo(
+ StackInfo pinnedStackInfo = ActivityTaskManager.getService().getStackInfo(
WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
if (pinnedStackInfo != null) {
stackBounds = pinnedStackInfo.bounds;
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
index 2ec5662..f0ab046 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
@@ -30,6 +30,7 @@
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.ActivityManager.StackInfo;
+import android.app.ActivityTaskManager;
import android.app.IActivityManager;
import android.app.IActivityTaskManager;
import android.content.Context;
@@ -124,8 +125,8 @@
void synchronizePinnedStackBounds() {
cancelAnimations();
try {
- StackInfo stackInfo =
- mActivityManager.getStackInfo(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
+ StackInfo stackInfo = mActivityTaskManager.getStackInfo(
+ WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
if (stackInfo != null) {
mBounds.set(stackInfo.bounds);
}
@@ -162,7 +163,7 @@
mMenuController.hideMenuWithoutResize();
mHandler.post(() -> {
try {
- mActivityManager.dismissPip(!skipAnimation, EXPAND_STACK_TO_FULLSCREEN_DURATION);
+ mActivityTaskManager.dismissPip(!skipAnimation, EXPAND_STACK_TO_FULLSCREEN_DURATION);
} catch (RemoteException e) {
Log.e(TAG, "Error expanding PiP activity", e);
}
@@ -516,7 +517,8 @@
SomeArgs args = (SomeArgs) msg.obj;
Rect toBounds = (Rect) args.arg1;
try {
- mActivityManager.resizePinnedStack(toBounds, null /* tempPinnedTaskBounds */);
+ mActivityTaskManager.resizePinnedStack(
+ toBounds, null /* tempPinnedTaskBounds */);
mBounds.set(toBounds);
} catch (RemoteException e) {
Log.e(TAG, "Could not resize pinned stack to bounds: " + toBounds, e);
@@ -529,7 +531,7 @@
Rect toBounds = (Rect) args.arg1;
int duration = args.argi1;
try {
- StackInfo stackInfo = mActivityManager.getStackInfo(
+ StackInfo stackInfo = mActivityTaskManager.getStackInfo(
WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
if (stackInfo == null) {
// In the case where we've already re-expanded or dismissed the PiP, then
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipUtils.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipUtils.java
index 2f53de9..1ed1904 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipUtils.java
@@ -20,6 +20,7 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import android.app.ActivityManager.StackInfo;
+import android.app.ActivityTaskManager;
import android.app.IActivityManager;
import android.content.ComponentName;
import android.content.Context;
@@ -39,8 +40,8 @@
IActivityManager activityManager) {
try {
final String sysUiPackageName = context.getPackageName();
- final StackInfo pinnedStackInfo =
- activityManager.getStackInfo(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
+ final StackInfo pinnedStackInfo = ActivityTaskManager.getService().getStackInfo(
+ WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
if (pinnedStackInfo != null && pinnedStackInfo.taskIds != null &&
pinnedStackInfo.taskIds.length > 0) {
for (int i = pinnedStackInfo.taskNames.length - 1; i >= 0; i--) {
diff --git a/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java
index 1dcdc5f..d9f923f 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java
@@ -347,7 +347,7 @@
mMediaSessionManager.removeOnActiveSessionsChangedListener(mActiveMediaSessionListener);
if (removePipStack) {
try {
- mActivityManager.removeStack(mPinnedStackId);
+ mActivityTaskManager.removeStack(mPinnedStackId);
} catch (RemoteException e) {
Log.e(TAG, "removeStack failed", e);
} finally {
@@ -515,7 +515,7 @@
private StackInfo getPinnedStackInfo() {
StackInfo stackInfo = null;
try {
- stackInfo = mActivityManager.getStackInfo(
+ stackInfo = ActivityTaskManager.getService().getStackInfo(
WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
} catch (RemoteException e) {
Log.e(TAG, "getStackInfo failed", e);
@@ -608,7 +608,7 @@
private boolean isSettingsShown() {
List<RunningTaskInfo> runningTasks;
try {
- runningTasks = mActivityManager.getTasks(1);
+ runningTasks = mActivityTaskManager.getTasks(1);
if (runningTasks.isEmpty()) {
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java
index 481d54f..91512dd 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java
@@ -19,6 +19,7 @@
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -124,7 +125,7 @@
public void onClick(View v) {
if (v.getId() == R.id.screen_pinning_ok_button || mRequestWindow == v) {
try {
- ActivityManager.getService().startSystemLockTaskMode(taskId);
+ ActivityTaskManager.getService().startSystemLockTaskMode(taskId);
} catch (RemoteException e) {}
}
clearPrompt();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index 7321507..350fe78 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -207,7 +207,7 @@
if (mIam == null) return false;
try {
- List<StackInfo> stackInfos = mIam.getAllStackInfos();
+ List<StackInfo> stackInfos = mIatm.getAllStackInfos();
ActivityManager.StackInfo homeStackInfo = null;
ActivityManager.StackInfo fullscreenStackInfo = null;
ActivityManager.StackInfo recentsStackInfo = null;
@@ -280,7 +280,7 @@
public ActivityManager.StackInfo getSplitScreenPrimaryStack() {
try {
- return mIam.getStackInfo(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_UNDEFINED);
+ return mIatm.getStackInfo(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_UNDEFINED);
} catch (RemoteException e) {
return null;
}
@@ -376,7 +376,7 @@
if (mIam == null) return false;
try {
- return mIam.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_PINNED;
+ return mIatm.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_PINNED;
} catch (RemoteException e) {
return false;
}
@@ -417,9 +417,9 @@
try {
// Use the recents stack bounds, fallback to fullscreen stack if it is null
ActivityManager.StackInfo stackInfo =
- mIam.getStackInfo(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS);
+ mIatm.getStackInfo(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS);
if (stackInfo == null) {
- stackInfo = mIam.getStackInfo(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
+ stackInfo = mIatm.getStackInfo(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
}
if (stackInfo != null) {
windowRect.set(stackInfo.bounds);
@@ -441,7 +441,7 @@
if (mIam == null) return;
try {
- mIam.startInPlaceAnimationOnFrontMostApplication(
+ mIatm.startInPlaceAnimationOnFrontMostApplication(
opts == null ? null : opts.toBundle());
} catch (Exception e) {
e.printStackTrace();
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
index 1e5b37c..600964e 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
@@ -19,6 +19,7 @@
import static android.view.WindowManager.DOCKED_INVALID;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
@@ -71,7 +72,7 @@
mTmpRect5.set(mTempOtherInsetRect);
}
try {
- ActivityManager.getService()
+ ActivityTaskManager.getService()
.resizeDockedStack(mTmpRect1,
mTmpRect2.isEmpty() ? null : mTmpRect2,
mTmpRect3.isEmpty() ? null : mTmpRect3,
@@ -87,7 +88,7 @@
@Override
public void run() {
try {
- ActivityManager.getService().dismissSplitScreenMode(false /* onTop */);
+ ActivityTaskManager.getService().dismissSplitScreenMode(false /* onTop */);
} catch (RemoteException e) {
Log.w(TAG, "Failed to remove stack: " + e);
}
@@ -98,7 +99,7 @@
@Override
public void run() {
try {
- ActivityManager.getService().dismissSplitScreenMode(true /* onTop */);
+ ActivityTaskManager.getService().dismissSplitScreenMode(true /* onTop */);
} catch (RemoteException e) {
Log.w(TAG, "Failed to resize stack: " + e);
}
@@ -180,7 +181,7 @@
@Override
public void run() {
try {
- ActivityManager.getService().setSplitScreenResizing(resizing);
+ ActivityTaskManager.getService().setSplitScreenResizing(resizing);
} catch (RemoteException e) {
Log.w(TAG, "Error calling setDockedStackResizing: " + e);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
index 1287ced..7e397e8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.app.Notification;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
@@ -111,7 +112,7 @@
} else if (Intent.ACTION_USER_PRESENT.equals(action)) {
try {
final int lastResumedActivityUserId =
- ActivityManager.getService().getLastResumedActivityUserId();
+ ActivityTaskManager.getService().getLastResumedActivityUserId();
if (mUserManager.isManagedProfile(lastResumedActivityUserId)) {
showForegroundManagedProfileActivityToast();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 83021ca..288b473 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.car;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.os.SystemProperties;
@@ -452,7 +453,7 @@
public void onTaskStackChanged() {
try {
mCarFacetButtonController.taskChanged(
- ActivityManager.getService().getAllStackInfos());
+ ActivityTaskManager.getService().getAllStackInfos());
} catch (Exception e) {
Log.e(TAG, "Getting StackInfo from activity manager failed", e);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 0716b37..3b12051 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -26,6 +26,7 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.ActivityTaskManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -523,7 +524,7 @@
o.setRotationAnimationHint(
WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS);
try {
- result = ActivityManager.getService().startActivityAsUser(
+ result = ActivityTaskManager.getService().startActivityAsUser(
null, getContext().getBasePackageName(),
intent,
intent.resolveTypeIfNeeded(getContext().getContentResolver()),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index faf9d52..1003833 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -38,6 +38,7 @@
import android.app.ActivityTaskManager;
import android.app.Fragment;
import android.app.IActivityManager;
+import android.app.IActivityTaskManager;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -880,7 +881,7 @@
private boolean onLongPressNavigationButtons(View v, @IdRes int btnId1, @IdRes int btnId2) {
try {
boolean sendBackLongPress = false;
- IActivityManager activityManager = ActivityManagerNative.getDefault();
+ IActivityTaskManager activityManager = ActivityTaskManager.getService();
boolean touchExplorationEnabled = mAccessibilityManager.isTouchExplorationEnabled();
boolean inLockTaskMode = activityManager.isInLockTaskMode();
if (inLockTaskMode && !touchExplorationEnabled) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index e0c7342..57e01e7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -23,6 +23,7 @@
import android.app.ActivityManager;
import android.app.ActivityManager.StackInfo;
+import android.app.ActivityTaskManager;
import android.app.AlarmManager;
import android.app.AlarmManager.AlarmClockInfo;
import android.app.AppGlobals;
@@ -505,7 +506,7 @@
mUiOffloadThread.submit(() -> {
final int userId;
try {
- userId = ActivityManager.getService().getLastResumedActivityUserId();
+ userId = ActivityTaskManager.getService().getLastResumedActivityUserId();
boolean isManagedProfile = mUserManager.isManagedProfile(userId);
mHandler.post(() -> {
final boolean showIcon;
@@ -536,7 +537,8 @@
mCurrentNotifs.clear();
mUiOffloadThread.submit(() -> {
try {
- final StackInfo focusedStack = ActivityManager.getService().getFocusedStackInfo();
+ final StackInfo focusedStack =
+ ActivityTaskManager.getService().getFocusedStackInfo();
if (focusedStack != null) {
final int windowingMode =
focusedStack.configuration.windowConfiguration.getWindowingMode();
@@ -562,7 +564,7 @@
ArraySet<Pair<String, Integer>> notifs, NotificationManager noMan, IPackageManager pm) {
try {
final StackInfo info =
- ActivityManager.getService().getStackInfo(windowingMode, activityType);
+ ActivityTaskManager.getService().getStackInfo(windowingMode, activityType);
checkStack(info, notifs, noMan, pm);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
@@ -651,7 +653,7 @@
private Intent getTaskIntent(int taskId, int userId) {
try {
final List<ActivityManager.RecentTaskInfo> tasks =
- ActivityManager.getService().getRecentTasks(
+ ActivityTaskManager.getService().getRecentTasks(
NUM_TASKS_FOR_INSTANT_APP_INFO, 0, userId).getList();
for (int i = 0; i < tasks.size(); i++) {
if (tasks.get(i).id == taskId) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 252f776..5d366a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -46,6 +46,7 @@
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.ActivityTaskManager;
import android.app.AlarmManager;
import android.app.IWallpaperManager;
import android.app.KeyguardManager;
@@ -2959,7 +2960,7 @@
WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS);
}
try {
- result = ActivityManager.getService().startActivityAsUser(
+ result = ActivityTaskManager.getService().startActivityAsUser(
null, mContext.getBasePackageName(),
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
@@ -5152,7 +5153,7 @@
row, wasOccluded);
try {
if (adapter != null) {
- ActivityManager.getService()
+ ActivityTaskManager.getService()
.registerRemoteAnimationForNextActivityStart(
intent.getCreatorPackage(), adapter);
}