Merge changes Idad77721,I9717ac4b
* changes:
Split internal interface activities from current AM interface (3/n)
Cancel Pip animation if stack is already removed
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 1d5f49a..34d6ec8 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -40,61 +40,6 @@
*/
public abstract class ActivityManagerInternal {
- /**
- * Type for {@link #notifyAppTransitionStarting}: The transition was started because we drew
- * the splash screen.
- */
- public static final int APP_TRANSITION_SPLASH_SCREEN =
- AppProtoEnums.APP_TRANSITION_SPLASH_SCREEN; // 1
-
- /**
- * Type for {@link #notifyAppTransitionStarting}: The transition was started because we all
- * app windows were drawn
- */
- public static final int APP_TRANSITION_WINDOWS_DRAWN =
- AppProtoEnums.APP_TRANSITION_WINDOWS_DRAWN; // 2
-
- /**
- * Type for {@link #notifyAppTransitionStarting}: The transition was started because of a
- * timeout.
- */
- public static final int APP_TRANSITION_TIMEOUT =
- AppProtoEnums.APP_TRANSITION_TIMEOUT; // 3
-
- /**
- * Type for {@link #notifyAppTransitionStarting}: The transition was started because of a
- * we drew a task snapshot.
- */
- public static final int APP_TRANSITION_SNAPSHOT =
- AppProtoEnums.APP_TRANSITION_SNAPSHOT; // 4
-
- /**
- * Type for {@link #notifyAppTransitionStarting}: The transition was started because it was a
- * recents animation and we only needed to wait on the wallpaper.
- */
- public static final int APP_TRANSITION_RECENTS_ANIM =
- AppProtoEnums.APP_TRANSITION_RECENTS_ANIM; // 5
-
- /**
- * The bundle key to extract the assist data.
- */
- public static final String ASSIST_KEY_DATA = "data";
-
- /**
- * The bundle key to extract the assist structure.
- */
- public static final String ASSIST_KEY_STRUCTURE = "structure";
-
- /**
- * The bundle key to extract the assist content.
- */
- public static final String ASSIST_KEY_CONTENT = "content";
-
- /**
- * The bundle key to extract the assist receiver extras.
- */
- public static final String ASSIST_KEY_RECEIVER_EXTRAS = "receiverExtras";
-
/**
* Grant Uri permissions from one app to another. This method only extends
@@ -118,34 +63,6 @@
String processName, String abiOverride, int uid, Runnable crashHandler);
/**
- * Acquires a sleep token for the specified display with the specified tag.
- *
- * @param tag A string identifying the purpose of the token (eg. "Dream").
- * @param displayId The display to apply the sleep token to.
- */
- public abstract SleepToken acquireSleepToken(@NonNull String tag, int displayId);
-
- /**
- * Sleep tokens cause the activity manager to put the top activity to sleep.
- * They are used by components such as dreams that may hide and block interaction
- * with underlying activities.
- */
- public static abstract class SleepToken {
-
- /**
- * Releases the sleep token.
- */
- public abstract void release();
- }
-
- /**
- * Returns home activity for the specified user.
- *
- * @param userId ID of the user or {@link android.os.UserHandle#USER_ALL}
- */
- public abstract ComponentName getHomeActivityForUser(int userId);
-
- /**
* Called when a user has been deleted. This can happen during normal device usage
* or just at startup, when partially removed users are purged. Any state persisted by the
* ActivityManager should be purged now.
@@ -154,44 +71,6 @@
*/
public abstract void onUserRemoved(int userId);
- public abstract void onLocalVoiceInteractionStarted(IBinder callingActivity,
- IVoiceInteractionSession mSession,
- IVoiceInteractor mInteractor);
-
- /**
- * Callback for window manager to let activity manager know that we are finally starting the
- * app transition;
- *
- * @param reasons A map from windowing mode to a reason integer why the transition was started,
- * which must be one of the APP_TRANSITION_* values.
- * @param timestamp The time at which the app transition started in
- * {@link SystemClock#uptimeMillis()} timebase.
- */
- public abstract void notifyAppTransitionStarting(SparseIntArray reasons, long timestamp);
-
- /**
- * Callback for window manager to let activity manager know that the app transition was
- * cancelled.
- */
- public abstract void notifyAppTransitionCancelled();
-
- /**
- * Callback for window manager to let activity manager know that the app transition is finished.
- */
- public abstract void notifyAppTransitionFinished();
-
- /**
- * Returns the top activity from each of the currently visible stacks. The first entry will be
- * the focused activity.
- */
- public abstract List<IBinder> getTopVisibleActivities();
-
- /**
- * Callback for window manager to let activity manager know that docked stack changes its
- * minimized state.
- */
- public abstract void notifyDockedStackMinimizedChanged(boolean minimized);
-
/**
* Kill foreground apps from the specified user.
*/
@@ -225,28 +104,6 @@
int userId);
/**
- * Start activity {@code intents} as if {@code packageName} on user {@code userId} did it.
- *
- * - DO NOT call it with the calling UID cleared.
- * - All the necessary caller permission checks must be done at callsites.
- *
- * @return error codes used by {@link IActivityManager#startActivity} and its siblings.
- */
- public abstract int startActivitiesAsPackage(String packageName,
- int userId, Intent[] intents, Bundle bOptions);
-
- /**
- * Start activity {@code intent} without calling user-id check.
- *
- * - DO NOT call it with the calling UID cleared.
- * - The caller must do the calling user ID check.
- *
- * @return error codes used by {@link IActivityManager#startActivity} and its siblings.
- */
- public abstract int startActivityAsUser(IApplicationThread caller, String callingPackage,
- Intent intent, @Nullable Bundle options, int userId);
-
- /**
* Get the procstate for the UID. The return value will be between
* {@link ActivityManager#MIN_PROCESS_STATE} and {@link ActivityManager#MAX_PROCESS_STATE}.
* Note if the UID doesn't exist, it'll return {@link ActivityManager#PROCESS_STATE_NONEXISTENT}
@@ -255,25 +112,11 @@
public abstract int getUidProcessState(int uid);
/**
- * Called when Keyguard flags might have changed.
- *
- * @param callback Callback to run after activity visibilities have been reevaluated. This can
- * be used from window manager so that when the callback is called, it's
- * guaranteed that all apps have their visibility updated accordingly.
- */
- public abstract void notifyKeyguardFlagsChanged(@Nullable Runnable callback);
-
- /**
* @return {@code true} if system is ready, {@code false} otherwise.
*/
public abstract boolean isSystemReady();
/**
- * Called when the trusted state of Keyguard has changed.
- */
- public abstract void notifyKeyguardTrustedChanged();
-
- /**
* Sets if the given pid has an overlay UI or not.
*
* @param pid The pid we are setting overlay UI for.
@@ -306,13 +149,6 @@
public abstract void notifyActiveVoiceInteractionServiceChanged(ComponentName component);
/**
- * Called after virtual display Id is updated by
- * {@link com.android.server.vr.Vr2dDisplay} with a specific
- * {@param vr2dDisplayId}.
- */
- public abstract void setVr2dDisplayId(int vr2dDisplayId);
-
- /**
* Saves the current activity manager state and includes the saved state in the next dump of
* activity manager.
*/
@@ -324,12 +160,6 @@
public abstract void clearSavedANRState();
/**
- * Set focus on an activity.
- * @param token The IApplicationToken for the activity
- */
- public abstract void setFocusedActivity(IBinder token);
-
- /**
* Set a uid that is allowed to bypass stopped app switches, launching an app
* whenever it wants.
*
@@ -346,18 +176,6 @@
public abstract boolean isRuntimeRestarted();
/**
- * Returns {@code true} if {@code uid} is running an activity from {@code packageName}.
- */
- public abstract boolean hasRunningActivity(int uid, @Nullable String packageName);
-
- public interface ScreenObserver {
- public void onAwakeStateChanged(boolean isAwake);
- public void onKeyguardStateChanged(boolean isShowing);
- }
-
- public abstract void registerScreenObserver(ScreenObserver observer);
-
- /**
* Returns if more users can be started without stopping currently running users.
*/
public abstract boolean canStartMoreUsers();
@@ -378,21 +196,6 @@
public abstract int getMaxRunningUsers();
/**
- * Returns is the caller has the same uid as the Recents component
- */
- public abstract boolean isCallerRecents(int callingUid);
-
- /**
- * Returns whether the recents component is the home activity for the given user.
- */
- public abstract boolean isRecentsComponentHomeActivity(int userId);
-
- /**
- * Cancels any currently running recents animation.
- */
- public abstract void cancelRecentsAnimation(boolean restoreHomeStackPosition);
-
- /**
* Whether an UID is active or idle.
*/
public abstract boolean isUidActive(int uid);
@@ -401,10 +204,4 @@
* Returns a list that contains the memory stats for currently running processes.
*/
public abstract List<ProcessMemoryState> getMemoryStateForProcesses();
-
- /**
- * This enforces {@code func} can only be called if either the caller is Recents activity or
- * has {@code permission}.
- */
- public abstract void enforceCallerIsRecentsOrHasPermission(String permission, String func);
}
diff --git a/core/java/android/app/ActivityTaskManagerInternal.java b/core/java/android/app/ActivityTaskManagerInternal.java
new file mode 100644
index 0000000..faafc0c
--- /dev/null
+++ b/core/java/android/app/ActivityTaskManagerInternal.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.app;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.SystemClock;
+import android.service.voice.IVoiceInteractionSession;
+import android.util.SparseIntArray;
+import android.view.RemoteAnimationAdapter;
+
+import com.android.internal.app.IVoiceInteractor;
+
+import java.util.List;
+
+/**
+ * Activity Task manager local system service interface.
+ * @hide Only for use within system server
+ */
+public abstract class ActivityTaskManagerInternal {
+
+ /**
+ * Type for {@link #notifyAppTransitionStarting}: The transition was started because we drew
+ * the splash screen.
+ */
+ public static final int APP_TRANSITION_SPLASH_SCREEN =
+ AppProtoEnums.APP_TRANSITION_SPLASH_SCREEN; // 1
+
+ /**
+ * Type for {@link #notifyAppTransitionStarting}: The transition was started because we all
+ * app windows were drawn
+ */
+ public static final int APP_TRANSITION_WINDOWS_DRAWN =
+ AppProtoEnums.APP_TRANSITION_WINDOWS_DRAWN; // 2
+
+ /**
+ * Type for {@link #notifyAppTransitionStarting}: The transition was started because of a
+ * timeout.
+ */
+ public static final int APP_TRANSITION_TIMEOUT =
+ AppProtoEnums.APP_TRANSITION_TIMEOUT; // 3
+
+ /**
+ * Type for {@link #notifyAppTransitionStarting}: The transition was started because of a
+ * we drew a task snapshot.
+ */
+ public static final int APP_TRANSITION_SNAPSHOT =
+ AppProtoEnums.APP_TRANSITION_SNAPSHOT; // 4
+
+ /**
+ * Type for {@link #notifyAppTransitionStarting}: The transition was started because it was a
+ * recents animation and we only needed to wait on the wallpaper.
+ */
+ public static final int APP_TRANSITION_RECENTS_ANIM =
+ AppProtoEnums.APP_TRANSITION_RECENTS_ANIM; // 5
+
+ /**
+ * The bundle key to extract the assist data.
+ */
+ public static final String ASSIST_KEY_DATA = "data";
+
+ /**
+ * The bundle key to extract the assist structure.
+ */
+ public static final String ASSIST_KEY_STRUCTURE = "structure";
+
+ /**
+ * The bundle key to extract the assist content.
+ */
+ public static final String ASSIST_KEY_CONTENT = "content";
+
+ /**
+ * The bundle key to extract the assist receiver extras.
+ */
+ public static final String ASSIST_KEY_RECEIVER_EXTRAS = "receiverExtras";
+
+ public interface ScreenObserver {
+ void onAwakeStateChanged(boolean isAwake);
+ void onKeyguardStateChanged(boolean isShowing);
+ }
+
+ /**
+ * Sleep tokens cause the activity manager to put the top activity to sleep.
+ * They are used by components such as dreams that may hide and block interaction
+ * with underlying activities.
+ */
+ public static abstract class SleepToken {
+
+ /** Releases the sleep token. */
+ public abstract void release();
+ }
+
+ /**
+ * Acquires a sleep token for the specified display with the specified tag.
+ *
+ * @param tag A string identifying the purpose of the token (eg. "Dream").
+ * @param displayId The display to apply the sleep token to.
+ */
+ public abstract SleepToken acquireSleepToken(@NonNull String tag, int displayId);
+
+ /**
+ * Returns home activity for the specified user.
+ *
+ * @param userId ID of the user or {@link android.os.UserHandle#USER_ALL}
+ */
+ public abstract ComponentName getHomeActivityForUser(int userId);
+
+ public abstract void onLocalVoiceInteractionStarted(IBinder callingActivity,
+ IVoiceInteractionSession mSession,
+ IVoiceInteractor mInteractor);
+
+ /**
+ * Callback for window manager to let activity manager know that we are finally starting the
+ * app transition;
+ *
+ * @param reasons A map from windowing mode to a reason integer why the transition was started,
+ * which must be one of the APP_TRANSITION_* values.
+ * @param timestamp The time at which the app transition started in
+ * {@link SystemClock#uptimeMillis()} timebase.
+ */
+ public abstract void notifyAppTransitionStarting(SparseIntArray reasons, long timestamp);
+
+ /**
+ * Callback for window manager to let activity manager know that the app transition was
+ * cancelled.
+ */
+ public abstract void notifyAppTransitionCancelled();
+
+ /**
+ * Callback for window manager to let activity manager know that the app transition is finished.
+ */
+ public abstract void notifyAppTransitionFinished();
+
+ /**
+ * Returns the top activity from each of the currently visible stacks. The first entry will be
+ * the focused activity.
+ */
+ public abstract List<IBinder> getTopVisibleActivities();
+
+ /**
+ * Callback for window manager to let activity manager know that docked stack changes its
+ * minimized state.
+ */
+ public abstract void notifyDockedStackMinimizedChanged(boolean minimized);
+
+ /**
+ * Start activity {@code intents} as if {@code packageName} on user {@code userId} did it.
+ *
+ * - DO NOT call it with the calling UID cleared.
+ * - All the necessary caller permission checks must be done at callsites.
+ *
+ * @return error codes used by {@link IActivityManager#startActivity} and its siblings.
+ */
+ public abstract int startActivitiesAsPackage(String packageName,
+ int userId, Intent[] intents, Bundle bOptions);
+
+ /**
+ * Start activity {@code intent} without calling user-id check.
+ *
+ * - DO NOT call it with the calling UID cleared.
+ * - The caller must do the calling user ID check.
+ *
+ * @return error codes used by {@link IActivityManager#startActivity} and its siblings.
+ */
+ public abstract int startActivityAsUser(IApplicationThread caller, String callingPackage,
+ Intent intent, @Nullable Bundle options, int userId);
+
+ /**
+ * Called when Keyguard flags might have changed.
+ *
+ * @param callback Callback to run after activity visibilities have been reevaluated. This can
+ * be used from window manager so that when the callback is called, it's
+ * guaranteed that all apps have their visibility updated accordingly.
+ */
+ public abstract void notifyKeyguardFlagsChanged(@Nullable Runnable callback);
+
+ /**
+ * Called when the trusted state of Keyguard has changed.
+ */
+ public abstract void notifyKeyguardTrustedChanged();
+
+ /**
+ * Called after virtual display Id is updated by
+ * {@link com.android.server.vr.Vr2dDisplay} with a specific
+ * {@param vr2dDisplayId}.
+ */
+ public abstract void setVr2dDisplayId(int vr2dDisplayId);
+
+ /**
+ * Set focus on an activity.
+ * @param token The IApplicationToken for the activity
+ */
+ public abstract void setFocusedActivity(IBinder token);
+
+ /**
+ * Returns {@code true} if {@code uid} is running an activity from {@code packageName}.
+ */
+ public abstract boolean hasRunningActivity(int uid, @Nullable String packageName);
+
+ public abstract void registerScreenObserver(ScreenObserver observer);
+
+ /**
+ * Returns is the caller has the same uid as the Recents component
+ */
+ public abstract boolean isCallerRecents(int callingUid);
+
+ /**
+ * Returns whether the recents component is the home activity for the given user.
+ */
+ public abstract boolean isRecentsComponentHomeActivity(int userId);
+
+ /**
+ * Cancels any currently running recents animation.
+ */
+ public abstract void cancelRecentsAnimation(boolean restoreHomeStackPosition);
+
+ /**
+ * This enforces {@code func} can only be called if either the caller is Recents activity or
+ * has {@code permission}.
+ */
+ public abstract void enforceCallerIsRecentsOrHasPermission(String permission, String func);
+
+}
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index b2c1bed..4365760 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -31,6 +31,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AlertDialog;
import android.app.AppOpsManager;
import android.app.PendingIntent;
@@ -2624,7 +2625,7 @@
PowerManager.USER_ACTIVITY_EVENT_ACCESSIBILITY, 0);
if (activityToken != null) {
- LocalServices.getService(ActivityManagerInternal.class)
+ LocalServices.getService(ActivityTaskManagerInternal.class)
.setFocusedActivity(activityToken);
}
connection.mConnection.performAccessibilityAction(accessibilityNodeId, action,
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 6c359fe..a2dc986 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -28,6 +28,7 @@
import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppGlobals;
import android.app.IActivityManager;
import android.app.IActivityTaskManager;
@@ -533,7 +534,7 @@
} catch (NameNotFoundException e) {
throw new SecurityException("Could not verify UID for " + componentName);
}
- if (callingUid != packageUid && !LocalServices.getService(ActivityManagerInternal.class)
+ if (callingUid != packageUid && !LocalServices.getService(ActivityTaskManagerInternal.class)
.hasRunningActivity(callingUid, packageName)) {
final String[] packages = pm.getPackagesForUid(callingUid);
final String callingPackage = packages != null ? packages[0] : "uid-" + callingUid;
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index d9dcf40..79fd29a 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -16,8 +16,8 @@
package com.android.server.autofill;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_STRUCTURE;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
import static android.service.autofill.AutofillFieldClassificationService.EXTRA_SCORES;
import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
import static android.service.autofill.FillRequest.INVALID_REQUEST_ID;
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java
index b8f395b..4e700d7 100644
--- a/services/core/java/com/android/server/DeviceIdleController.java
+++ b/services/core/java/com/android/server/DeviceIdleController.java
@@ -19,6 +19,7 @@
import android.Manifest;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AlarmManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -82,7 +83,6 @@
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.FastXmlSerializer;
-import com.android.internal.util.Preconditions;
import com.android.internal.util.XmlUtils;
import com.android.server.am.BatteryStatsService;
import com.android.server.net.NetworkPolicyManagerInternal;
@@ -118,6 +118,7 @@
private AlarmManager mAlarmManager;
private IBatteryStats mBatteryStats;
private ActivityManagerInternal mLocalActivityManager;
+ private ActivityTaskManagerInternal mLocalActivityTaskManager;
private PowerManagerInternal mLocalPowerManager;
private PowerManager mPowerManager;
private ConnectivityService mConnectivityService;
@@ -1359,8 +1360,8 @@
}
}
- private ActivityManagerInternal.ScreenObserver mScreenObserver =
- new ActivityManagerInternal.ScreenObserver() {
+ private ActivityTaskManagerInternal.ScreenObserver mScreenObserver =
+ new ActivityTaskManagerInternal.ScreenObserver() {
@Override
public void onAwakeStateChanged(boolean isAwake) { }
@@ -1461,6 +1462,7 @@
mAlarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);
mBatteryStats = BatteryStatsService.getService();
mLocalActivityManager = getLocalService(ActivityManagerInternal.class);
+ mLocalActivityTaskManager = getLocalService(ActivityTaskManagerInternal.class);
mLocalPowerManager = getLocalService(PowerManagerInternal.class);
mPowerManager = getContext().getSystemService(PowerManager.class);
mActiveIdleWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
@@ -1539,7 +1541,7 @@
mPowerSaveWhitelistAllAppIdArray, mPowerSaveWhitelistExceptIdleAppIdArray);
mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAllAppIdArray);
- mLocalActivityManager.registerScreenObserver(mScreenObserver);
+ mLocalActivityTaskManager.registerScreenObserver(mScreenObserver);
passWhiteListsToForceAppStandbyTrackerLocked();
updateInteractivityLocked();
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 2deb759..d025a87 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -39,7 +39,8 @@
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerInternal.ScreenObserver;
+import android.app.ActivityTaskManagerInternal;
+import android.app.ActivityTaskManagerInternal.ScreenObserver;
import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.app.KeyguardManager;
@@ -1511,7 +1512,7 @@
}
private void systemReady() {
- LocalServices.getService(ActivityManagerInternal.class)
+ LocalServices.getService(ActivityTaskManagerInternal.class)
.registerScreenObserver(this);
mSystemReady = true;
diff --git a/services/core/java/com/android/server/am/ActivityDisplay.java b/services/core/java/com/android/server/am/ActivityDisplay.java
index 698b6f7..b2707e7 100644
--- a/services/core/java/com/android/server/am/ActivityDisplay.java
+++ b/services/core/java/com/android/server/am/ActivityDisplay.java
@@ -39,8 +39,8 @@
import static com.android.server.am.ActivityDisplayProto.ID;
import android.annotation.Nullable;
-import android.app.ActivityManagerInternal;
import android.app.ActivityOptions;
+import android.app.ActivityTaskManagerInternal;
import android.app.WindowConfiguration;
import android.graphics.Point;
import android.util.IntArray;
@@ -90,9 +90,9 @@
private IntArray mDisplayAccessUIDs = new IntArray();
/** All tokens used to put activities on this stack to sleep (including mOffToken) */
- final ArrayList<ActivityManagerInternal.SleepToken> mAllSleepTokens = new ArrayList<>();
+ final ArrayList<ActivityTaskManagerInternal.SleepToken> mAllSleepTokens = new ArrayList<>();
/** The token acquired by ActivityStackSupervisor to put stacks on the display to sleep */
- ActivityManagerInternal.SleepToken mOffToken;
+ ActivityTaskManagerInternal.SleepToken mOffToken;
private boolean mSleeping;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 3a1a1ce..77826d4 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -16,35 +16,17 @@
package com.android.server.am;
-import static android.Manifest.permission.BIND_VOICE_INTERACTION;
import static android.Manifest.permission.CHANGE_CONFIGURATION;
import static android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST;
-import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
-import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS;
-import static android.Manifest.permission.READ_FRAME_BUFFER;
import static android.Manifest.permission.REMOVE_TASKS;
-import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.Manifest.permission.STOP_APP_SWITCHES;
-import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
-import static android.app.ActivityTaskManager.RESIZE_MODE_PRESERVE_WINDOW;
-import static android.app.ActivityTaskManager.INVALID_STACK_ID;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_CONTENT;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_DATA;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_STRUCTURE;
import static android.app.ActivityThread.PROC_START_SEQ_IDENT;
import static android.app.AppOpsManager.OP_NONE;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
@@ -120,7 +102,6 @@
import static android.provider.Settings.Global.NETWORK_ACCESS_TIMEOUT_MS;
import static android.provider.Settings.Global.WAIT_FOR_DEBUGGER;
import static android.provider.Settings.System.FONT_SCALE;
-import static android.service.voice.VoiceInteractionSession.SHOW_SOURCE_APPLICATION;
import static android.text.format.DateUtils.DAY_IN_MILLIS;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
@@ -139,7 +120,6 @@
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_BROADCAST_LIGHT;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CLEANUP;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_IMMERSIVE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LRU;
@@ -160,7 +140,6 @@
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_UID_OBSERVERS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_URI_PERMISSION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_USAGE_STATS;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_WHITELISTS;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_BACKUP;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_BROADCAST;
@@ -187,26 +166,13 @@
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_VISIBILITY;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
-import static com.android.server.am.ActivityStack.REMOVE_TASK_MODE_DESTROYING;
-import static com.android.server.am.ActivityStackSupervisor.DEFER_RESUME;
-import static com.android.server.am.ActivityStackSupervisor.MATCH_TASK_IN_STACKS_ONLY;
-import static com.android.server.am.ActivityStackSupervisor.MATCH_TASK_IN_STACKS_OR_RECENT_TASKS;
-import static com.android.server.am.ActivityStackSupervisor.ON_TOP;
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
-import static com.android.server.am.ActivityStackSupervisor.REMOVE_FROM_RECENTS;
import static com.android.server.am.MemoryStatUtil.readMemoryStatFromFilesystem;
import static com.android.server.am.MemoryStatUtil.hasMemcg;
-import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
-import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK;
-import static com.android.server.am.TaskRecord.REPARENT_KEEP_STACK_AT_FRONT;
-import static com.android.server.am.TaskRecord.REPARENT_LEAVE_STACK_IN_PLACE;
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
import static android.view.WindowManager.TRANSIT_NONE;
-import static android.view.WindowManager.TRANSIT_TASK_IN_PLACE;
import static android.view.WindowManager.TRANSIT_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
-import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_ORIGINAL_POSITION;
-import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE;
import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.START_TAG;
@@ -221,8 +187,8 @@
import android.app.ActivityManager.StackInfo;
import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerInternal.ScreenObserver;
-import android.app.ActivityManagerInternal.SleepToken;
+import android.app.ActivityTaskManagerInternal.ScreenObserver;
+import android.app.ActivityTaskManagerInternal.SleepToken;
import android.app.ActivityManagerProto;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
@@ -253,22 +219,15 @@
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
-import android.app.PictureInPictureParams;
import android.app.ProcessMemoryState;
import android.app.ProfilerInfo;
-import android.app.RemoteAction;
-import android.app.WaitResult;
import android.app.WindowConfiguration.ActivityType;
import android.app.WindowConfiguration.WindowingMode;
-import android.app.admin.DevicePolicyCache;
-import android.app.assist.AssistContent;
-import android.app.assist.AssistStructure;
import android.app.backup.IBackupManager;
import android.app.servertransaction.ConfigurationChangeItem;
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManagerInternal;
import android.appwidget.AppWidgetManager;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ComponentCallbacks2;
@@ -305,13 +264,10 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
-import android.graphics.Bitmap;
-import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.display.DisplayManagerInternal;
import android.location.LocationManager;
import android.media.audiofx.AudioEffect;
-import android.metrics.LogMaker;
import android.net.Proxy;
import android.net.ProxyInfo;
import android.net.Uri;
@@ -336,7 +292,6 @@
import android.os.Message;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
-import android.os.PersistableBundle;
import android.os.PowerManager;
import android.os.PowerManager.ServiceType;
import android.os.PowerManagerInternal;
@@ -362,8 +317,6 @@
import android.provider.Downloads;
import android.provider.Settings;
import android.service.voice.IVoiceInteractionSession;
-import android.service.voice.VoiceInteractionManagerInternal;
-import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Time;
@@ -389,8 +342,6 @@
import android.view.Gravity;
import android.view.IRecentsAnimationRunner;
import android.view.LayoutInflater;
-import android.view.RemoteAnimationAdapter;
-import android.view.RemoteAnimationDefinition;
import android.view.View;
import android.view.WindowManager;
import android.view.autofill.AutofillManagerInternal;
@@ -398,7 +349,6 @@
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.app.AssistUtils;
import com.android.internal.app.DumpHeapActivity;
import com.android.internal.app.IAppOpsCallback;
import com.android.internal.app.IAppOpsService;
@@ -406,21 +356,16 @@
import com.android.internal.app.ProcessMap;
import com.android.internal.app.SystemUserHomeActivity;
import com.android.internal.app.procstats.ProcessStats;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.BackgroundThread;
import com.android.internal.os.BatteryStatsImpl;
import com.android.internal.os.BinderInternal;
-import com.android.internal.os.logging.MetricsLoggerWrapper;
import com.android.internal.os.ByteTransferPipe;
import com.android.internal.os.IResultReceiver;
import com.android.internal.os.ProcessCpuTracker;
import com.android.internal.os.TransferPipe;
import com.android.internal.os.Zygote;
-import com.android.internal.policy.IKeyguardDismissCallback;
-import com.android.internal.policy.KeyguardDismissCallback;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.DumpUtils;
@@ -467,7 +412,6 @@
import com.android.server.pm.dex.DexManager;
import com.android.server.utils.PriorityDump;
import com.android.server.vr.VrManagerInternal;
-import com.android.server.wm.PinnedStackWindowController;
import com.android.server.wm.WindowManagerService;
import dalvik.system.VMRuntime;
@@ -3152,7 +3096,7 @@
Slog.d("AppOps", "AppOpsService published");
LocalServices.addService(ActivityManagerInternal.class, new LocalService());
// Wait for the synchronized block started in mProcessCpuThread,
- // so that any other acccess to mProcessCpuTracker from main thread
+ // so that any other access to mProcessCpuTracker from main thread
// will be blocked during mProcessCpuTracker initialization.
try {
mProcessCpuInitLatch.await();
@@ -23466,20 +23410,6 @@
}
@Override
- public SleepToken acquireSleepToken(String tag, int displayId) {
- Preconditions.checkNotNull(tag);
- return ActivityManagerService.this.acquireSleepToken(tag, displayId);
- }
-
- @Override
- public ComponentName getHomeActivityForUser(int userId) {
- synchronized (ActivityManagerService.this) {
- ActivityRecord homeActivity = mStackSupervisor.getHomeActivityForUser(userId);
- return homeActivity == null ? null : homeActivity.realActivity;
- }
- }
-
- @Override
public void onUserRemoved(int userId) {
synchronized (ActivityManagerService.this) {
ActivityManagerService.this.onUserStoppedLocked(userId);
@@ -23489,51 +23419,6 @@
}
@Override
- public void onLocalVoiceInteractionStarted(IBinder activity,
- IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor) {
- synchronized (ActivityManagerService.this) {
- ActivityManagerService.this.onLocalVoiceInteractionStartedLocked(activity,
- voiceSession, voiceInteractor);
- }
- }
-
- @Override
- public void notifyAppTransitionStarting(SparseIntArray reasons, long timestamp) {
- synchronized (ActivityManagerService.this) {
- mStackSupervisor.getActivityMetricsLogger().notifyTransitionStarting(
- reasons, timestamp);
- }
- }
-
- @Override
- public void notifyAppTransitionFinished() {
- synchronized (ActivityManagerService.this) {
- mStackSupervisor.notifyAppTransitionDone();
- }
- }
-
- @Override
- public void notifyAppTransitionCancelled() {
- synchronized (ActivityManagerService.this) {
- mStackSupervisor.notifyAppTransitionDone();
- }
- }
-
- @Override
- public List<IBinder> getTopVisibleActivities() {
- synchronized (ActivityManagerService.this) {
- return mStackSupervisor.getTopVisibleActivities();
- }
- }
-
- @Override
- public void notifyDockedStackMinimizedChanged(boolean minimized) {
- synchronized (ActivityManagerService.this) {
- mStackSupervisor.setDockedStackMinimized(minimized);
- }
- }
-
- @Override
public void killForegroundAppsForUser(int userHandle) {
synchronized (ActivityManagerService.this) {
final ArrayList<ProcessRecord> procs = new ArrayList<>();
@@ -23603,95 +23488,16 @@
}
@Override
- public int startActivitiesAsPackage(String packageName, int userId, Intent[] intents,
- Bundle bOptions) {
- Preconditions.checkNotNull(intents, "intents");
- final String[] resolvedTypes = new String[intents.length];
-
- // UID of the package on user userId.
- // "= 0" is needed because otherwise catch(RemoteException) would make it look like
- // packageUid may not be initialized.
- int packageUid = 0;
- final long ident = Binder.clearCallingIdentity();
-
- try {
- for (int i = 0; i < intents.length; i++) {
- resolvedTypes[i] =
- intents[i].resolveTypeIfNeeded(mContext.getContentResolver());
- }
-
- packageUid = AppGlobals.getPackageManager().getPackageUid(
- packageName, PackageManager.MATCH_DEBUG_TRIAGED_MISSING, userId);
- } catch (RemoteException e) {
- // Shouldn't happen.
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
-
- synchronized (ActivityManagerService.this) {
- return mActivityStartController.startActivitiesInPackage(
- packageUid, packageName,
- intents, resolvedTypes, null /* resultTo */,
- SafeActivityOptions.fromBundle(bOptions), userId,
- false /* validateIncomingUser */);
- }
- }
-
- @Override
- public int startActivityAsUser(IApplicationThread caller, String callerPacakge,
- Intent intent, Bundle options, int userId) {
- return ActivityManagerService.this.mActivityTaskManager.startActivityAsUser(
- caller, callerPacakge, intent,
- intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, userId,
- false /*validateIncomingUser*/);
- }
-
- @Override
public int getUidProcessState(int uid) {
return getUidState(uid);
}
@Override
- public void notifyKeyguardFlagsChanged(@Nullable Runnable callback) {
- synchronized (ActivityManagerService.this) {
-
- // We might change the visibilities here, so prepare an empty app transition which
- // might be overridden later if we actually change visibilities.
- final boolean wasTransitionSet =
- mWindowManager.getPendingAppTransition() != TRANSIT_NONE;
- if (!wasTransitionSet) {
- mWindowManager.prepareAppTransition(TRANSIT_NONE,
- false /* alwaysKeepCurrent */);
- }
- mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
-
- // If there was a transition set already we don't want to interfere with it as we
- // might be starting it too early.
- if (!wasTransitionSet) {
- mWindowManager.executeAppTransition();
- }
- }
- if (callback != null) {
- callback.run();
- }
- }
-
- @Override
public boolean isSystemReady() {
// no need to synchronize(this) just to read & return the value
return mSystemReady;
}
- @Override
- public void notifyKeyguardTrustedChanged() {
- synchronized (ActivityManagerService.this) {
- if (mKeyguardController.isKeyguardShowing(DEFAULT_DISPLAY)) {
- mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
- }
- }
- }
-
/**
* Sets if the given pid has an overlay UI or not.
*
@@ -23719,11 +23525,6 @@
}
}
- @Override
- public void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
- ActivityManagerService.this.setRunningRemoteAnimation(pid, runningRemoteAnimation);
- }
-
/**
* Called after the network policy rules are updated by
* {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid}
@@ -23780,22 +23581,6 @@
}
}
- /**
- * Called after virtual display Id is updated by
- * {@link com.android.server.vr.Vr2dDisplay} with a specific
- * {@param vrVr2dDisplayId}.
- */
- @Override
- public void setVr2dDisplayId(int vr2dDisplayId) {
- if (DEBUG_STACK) {
- Slog.d(TAG, "setVr2dDisplayId called for: " +
- vr2dDisplayId);
- }
- synchronized (ActivityManagerService.this) {
- mVr2dDisplayId = vr2dDisplayId;
- }
- }
-
@Override
public void saveANRState(String reason) {
synchronized (ActivityManagerService.this) {
@@ -23827,21 +23612,6 @@
}
@Override
- public void setFocusedActivity(IBinder token) {
- synchronized (ActivityManagerService.this) {
- final ActivityRecord r = ActivityRecord.forTokenLocked(token);
- if (r == null) {
- throw new IllegalArgumentException(
- "setFocusedActivity: No activity record matching token=" + token);
- }
- if (mStackSupervisor.moveFocusableActivityStackToFrontLocked(
- r, "setFocusedActivity")) {
- mStackSupervisor.resumeFocusedStackTopActivityLocked();
- }
- }
- }
-
- @Override
public void setAllowAppSwitches(@NonNull String type, int uid, int userId) {
synchronized (ActivityManagerService.this) {
if (mUserController.isUserRunning(userId, ActivityManager.FLAG_OR_STOPPED)) {
@@ -23868,31 +23638,6 @@
}
@Override
- public boolean hasRunningActivity(int uid, @Nullable String packageName) {
- if (packageName == null) return false;
-
- synchronized (ActivityManagerService.this) {
- for (int i = 0; i < mLruProcesses.size(); i++) {
- final ProcessRecord processRecord = mLruProcesses.get(i);
- if (processRecord.uid == uid) {
- for (int j = 0; j < processRecord.activities.size(); j++) {
- final ActivityRecord activityRecord = processRecord.activities.get(j);
- if (packageName.equals(activityRecord.packageName)) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public void registerScreenObserver(ScreenObserver observer) {
- mScreenObservers.add(observer);
- }
-
- @Override
public boolean canStartMoreUsers() {
return mUserController.canStartMoreUsers();
}
@@ -23913,22 +23658,6 @@
}
@Override
- public boolean isCallerRecents(int callingUid) {
- return getRecentTasks().isCallerRecents(callingUid);
- }
-
- @Override
- public boolean isRecentsComponentHomeActivity(int userId) {
- return getRecentTasks().isRecentsComponentHomeActivity(userId);
- }
-
- @Override
- public void cancelRecentsAnimation(boolean restoreHomeStackPosition) {
- ActivityManagerService.this.mActivityTaskManager.cancelRecentsAnimation(
- restoreHomeStackPosition);
- }
-
- @Override
public boolean isUidActive(int uid) {
synchronized (ActivityManagerService.this) {
return isUidActiveLocked(uid);
@@ -23936,6 +23665,11 @@
}
@Override
+ public void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
+ ActivityManagerService.this.setRunningRemoteAnimation(pid, runningRemoteAnimation);
+ }
+
+ @Override
public List<ProcessMemoryState> getMemoryStateForProcesses() {
List<ProcessMemoryState> processMemoryStates = new ArrayList<>();
synchronized (mPidsSelfLocked) {
@@ -23961,11 +23695,6 @@
}
return processMemoryStates;
}
-
- @Override
- public void enforceCallerIsRecentsOrHasPermission(String permission, String func) {
- ActivityManagerService.this.enforceCallerIsRecentsOrHasPermission(permission, func);
- }
}
/**
diff --git a/services/core/java/com/android/server/am/ActivityMetricsLogger.java b/services/core/java/com/android/server/am/ActivityMetricsLogger.java
index 47d0423..9e9f638 100644
--- a/services/core/java/com/android/server/am/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/am/ActivityMetricsLogger.java
@@ -2,7 +2,7 @@
import static android.app.ActivityManager.START_SUCCESS;
import static android.app.ActivityManager.START_TASK_TO_FRONT;
-import static android.app.ActivityManagerInternal.APP_TRANSITION_TIMEOUT;
+import static android.app.ActivityTaskManagerInternal.APP_TRANSITION_TIMEOUT;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 615edd5..39b5515 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -51,7 +51,6 @@
import static android.view.Display.INVALID_DISPLAY;
import static android.view.Display.TYPE_VIRTUAL;
-import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_PICTURE_IN_PICTURE_EXPANDED_TO_FULLSCREEN;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_IDLE;
@@ -110,7 +109,7 @@
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.StackInfo;
-import android.app.ActivityManagerInternal.SleepToken;
+import android.app.ActivityTaskManagerInternal.SleepToken;
import android.app.ActivityOptions;
import android.app.AppOpsManager;
import android.app.ProfilerInfo;
diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
index c6edfe5..ab48dd2 100644
--- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
@@ -25,10 +25,10 @@
import static android.Manifest.permission.REMOVE_TASKS;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_CONTENT;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_DATA;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_STRUCTURE;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_DATA;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
import static android.app.ActivityTaskManager.INVALID_STACK_ID;
import static android.app.ActivityTaskManager.RESIZE_MODE_PRESERVE_WINDOW;
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
@@ -46,12 +46,14 @@
import static android.service.voice.VoiceInteractionSession.SHOW_SOURCE_APPLICATION;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
+import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_TASK_IN_PLACE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_IMMERSIVE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_STACK;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_VISIBILITY;
@@ -89,6 +91,7 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppGlobals;
import android.app.IActivityTaskManager;
import android.app.IApplicationThread;
@@ -122,6 +125,7 @@
import android.os.Bundle;
import android.os.IBinder;
import android.os.PersistableBundle;
+import android.os.Process;
import android.os.RemoteException;
import android.os.TransactionTooLargeException;
import android.os.UserHandle;
@@ -132,6 +136,7 @@
import android.text.TextUtils;
import android.util.Slog;
+import android.util.SparseIntArray;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationDefinition;
@@ -143,6 +148,7 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.KeyguardDismissCallback;
+import com.android.internal.util.Preconditions;
import com.android.server.LocalServices;
import com.android.server.SystemService;
import com.android.server.Watchdog;
@@ -228,6 +234,10 @@
mStackSupervisor = mAm.mStackSupervisor;
}
+ private void start() {
+ LocalServices.addService(ActivityTaskManagerInternal.class, new LocalService());
+ }
+
public static final class Lifecycle extends SystemService {
private final ActivityTaskManagerService mService;
@@ -239,6 +249,7 @@
@Override
public void onStart() {
publishBinderService(Context.ACTIVITY_TASK_SERVICE, mService);
+ mService.start();
}
public ActivityTaskManagerService getService() {
@@ -2807,20 +2818,23 @@
}
final Runnable enterPipRunnable = () -> {
- // Only update the saved args from the args that are set
- r.pictureInPictureArgs.copyOnlySet(params);
- final float aspectRatio = r.pictureInPictureArgs.getAspectRatio();
- final List<RemoteAction> actions = r.pictureInPictureArgs.getActions();
- // Adjust the source bounds by the insets for the transition down
- final Rect sourceBounds = new Rect(r.pictureInPictureArgs.getSourceRectHint());
- mStackSupervisor.moveActivityToPinnedStackLocked(r, sourceBounds, aspectRatio,
- "enterPictureInPictureMode");
- final PinnedActivityStack stack = r.getStack();
- stack.setPictureInPictureAspectRatio(aspectRatio);
- stack.setPictureInPictureActions(actions);
- MetricsLoggerWrapper.logPictureInPictureEnter(mContext, r.appInfo.uid,
- r.shortComponentName, r.supportsEnterPipOnTaskSwitch);
- logPictureInPictureArgs(params);
+ synchronized (mGlobalLock) {
+ // Only update the saved args from the args that are set
+ r.pictureInPictureArgs.copyOnlySet(params);
+ final float aspectRatio = r.pictureInPictureArgs.getAspectRatio();
+ final List<RemoteAction> actions = r.pictureInPictureArgs.getActions();
+ // Adjust the source bounds by the insets for the transition down
+ final Rect sourceBounds = new Rect(
+ r.pictureInPictureArgs.getSourceRectHint());
+ mStackSupervisor.moveActivityToPinnedStackLocked(
+ r, sourceBounds, aspectRatio, "enterPictureInPictureMode");
+ final PinnedActivityStack stack = r.getStack();
+ stack.setPictureInPictureAspectRatio(aspectRatio);
+ stack.setPictureInPictureActions(actions);
+ MetricsLoggerWrapper.logPictureInPictureEnter(mContext, r.appInfo.uid,
+ r.shortComponentName, r.supportsEnterPipOnTaskSwitch);
+ logPictureInPictureArgs(params);
+ }
};
if (mAm.isKeyguardLocked()) {
@@ -3327,4 +3341,216 @@
}
}
}
+
+ final class LocalService extends ActivityTaskManagerInternal {
+ @Override
+ public SleepToken acquireSleepToken(String tag, int displayId) {
+ Preconditions.checkNotNull(tag);
+ return mAm.acquireSleepToken(tag, displayId);
+ }
+
+ @Override
+ public ComponentName getHomeActivityForUser(int userId) {
+ synchronized (mGlobalLock) {
+ ActivityRecord homeActivity = mStackSupervisor.getHomeActivityForUser(userId);
+ return homeActivity == null ? null : homeActivity.realActivity;
+ }
+ }
+
+ @Override
+ public void onLocalVoiceInteractionStarted(IBinder activity,
+ IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor) {
+ synchronized (mGlobalLock) {
+ mAm.onLocalVoiceInteractionStartedLocked(activity, voiceSession, voiceInteractor);
+ }
+ }
+
+ @Override
+ public void notifyAppTransitionStarting(SparseIntArray reasons, long timestamp) {
+ synchronized (mGlobalLock) {
+ mStackSupervisor.getActivityMetricsLogger().notifyTransitionStarting(
+ reasons, timestamp);
+ }
+ }
+
+ @Override
+ public void notifyAppTransitionFinished() {
+ synchronized (mGlobalLock) {
+ mStackSupervisor.notifyAppTransitionDone();
+ }
+ }
+
+ @Override
+ public void notifyAppTransitionCancelled() {
+ synchronized (mGlobalLock) {
+ mStackSupervisor.notifyAppTransitionDone();
+ }
+ }
+
+ @Override
+ public List<IBinder> getTopVisibleActivities() {
+ synchronized (mGlobalLock) {
+ return mStackSupervisor.getTopVisibleActivities();
+ }
+ }
+
+ @Override
+ public void notifyDockedStackMinimizedChanged(boolean minimized) {
+ synchronized (mGlobalLock) {
+ mStackSupervisor.setDockedStackMinimized(minimized);
+ }
+ }
+
+ @Override
+ public int startActivitiesAsPackage(String packageName, int userId, Intent[] intents,
+ Bundle bOptions) {
+ Preconditions.checkNotNull(intents, "intents");
+ final String[] resolvedTypes = new String[intents.length];
+
+ // UID of the package on user userId.
+ // "= 0" is needed because otherwise catch(RemoteException) would make it look like
+ // packageUid may not be initialized.
+ int packageUid = 0;
+ final long ident = Binder.clearCallingIdentity();
+
+ try {
+ for (int i = 0; i < intents.length; i++) {
+ resolvedTypes[i] =
+ intents[i].resolveTypeIfNeeded(mContext.getContentResolver());
+ }
+
+ packageUid = AppGlobals.getPackageManager().getPackageUid(
+ packageName, PackageManager.MATCH_DEBUG_TRIAGED_MISSING, userId);
+ } catch (RemoteException e) {
+ // Shouldn't happen.
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+
+ synchronized (mGlobalLock) {
+ return mAm.getActivityStartController().startActivitiesInPackage(
+ packageUid, packageName,
+ intents, resolvedTypes, null /* resultTo */,
+ SafeActivityOptions.fromBundle(bOptions), userId,
+ false /* validateIncomingUser */);
+ }
+ }
+
+ @Override
+ public int startActivityAsUser(IApplicationThread caller, String callerPacakge,
+ Intent intent, Bundle options, int userId) {
+ return ActivityTaskManagerService.this.startActivityAsUser(
+ caller, callerPacakge, intent,
+ intent.resolveTypeIfNeeded(mContext.getContentResolver()),
+ null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, userId,
+ false /*validateIncomingUser*/);
+ }
+
+ @Override
+ public void notifyKeyguardFlagsChanged(@Nullable Runnable callback) {
+ synchronized (mGlobalLock) {
+
+ // We might change the visibilities here, so prepare an empty app transition which
+ // might be overridden later if we actually change visibilities.
+ final boolean wasTransitionSet =
+ mAm.mWindowManager.getPendingAppTransition() != TRANSIT_NONE;
+ if (!wasTransitionSet) {
+ mAm.mWindowManager.prepareAppTransition(TRANSIT_NONE,
+ false /* alwaysKeepCurrent */);
+ }
+ mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
+
+ // If there was a transition set already we don't want to interfere with it as we
+ // might be starting it too early.
+ if (!wasTransitionSet) {
+ mAm.mWindowManager.executeAppTransition();
+ }
+ }
+ if (callback != null) {
+ callback.run();
+ }
+ }
+
+ @Override
+ public void notifyKeyguardTrustedChanged() {
+ synchronized (mGlobalLock) {
+ if (mAm.mKeyguardController.isKeyguardShowing(DEFAULT_DISPLAY)) {
+ mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
+ }
+ }
+ }
+
+ /**
+ * Called after virtual display Id is updated by
+ * {@link com.android.server.vr.Vr2dDisplay} with a specific
+ * {@param vrVr2dDisplayId}.
+ */
+ @Override
+ public void setVr2dDisplayId(int vr2dDisplayId) {
+ if (DEBUG_STACK) Slog.d(TAG, "setVr2dDisplayId called for: " + vr2dDisplayId);
+ synchronized (mGlobalLock) {
+ mAm.mVr2dDisplayId = vr2dDisplayId;
+ }
+ }
+
+ @Override
+ public void setFocusedActivity(IBinder token) {
+ synchronized (mGlobalLock) {
+ final ActivityRecord r = ActivityRecord.forTokenLocked(token);
+ if (r == null) {
+ throw new IllegalArgumentException(
+ "setFocusedActivity: No activity record matching token=" + token);
+ }
+ if (mStackSupervisor.moveFocusableActivityStackToFrontLocked(
+ r, "setFocusedActivity")) {
+ mStackSupervisor.resumeFocusedStackTopActivityLocked();
+ }
+ }
+ }
+
+ @Override
+ public boolean hasRunningActivity(int uid, @Nullable String packageName) {
+ if (packageName == null) return false;
+
+ synchronized (mGlobalLock) {
+ for (int i = 0; i < mAm.mLruProcesses.size(); i++) {
+ final ProcessRecord processRecord = mAm.mLruProcesses.get(i);
+ if (processRecord.uid == uid) {
+ for (int j = 0; j < processRecord.activities.size(); j++) {
+ final ActivityRecord activityRecord = processRecord.activities.get(j);
+ if (packageName.equals(activityRecord.packageName)) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void registerScreenObserver(ScreenObserver observer) {
+ mAm.mScreenObservers.add(observer);
+ }
+
+ @Override
+ public boolean isCallerRecents(int callingUid) {
+ return mAm.getRecentTasks().isCallerRecents(callingUid);
+ }
+
+ @Override
+ public boolean isRecentsComponentHomeActivity(int userId) {
+ return mAm.getRecentTasks().isRecentsComponentHomeActivity(userId);
+ }
+
+ @Override
+ public void cancelRecentsAnimation(boolean restoreHomeStackPosition) {
+ ActivityTaskManagerService.this.cancelRecentsAnimation(restoreHomeStackPosition);
+ }
+
+ @Override
+ public void enforceCallerIsRecentsOrHasPermission(String permission, String func) {
+ mAm.enforceCallerIsRecentsOrHasPermission(permission, func);
+ }
+ }
}
diff --git a/services/core/java/com/android/server/am/AssistDataRequester.java b/services/core/java/com/android/server/am/AssistDataRequester.java
index 14d1498..b54441a 100644
--- a/services/core/java/com/android/server/am/AssistDataRequester.java
+++ b/services/core/java/com/android/server/am/AssistDataRequester.java
@@ -17,7 +17,7 @@
package com.android.server.am;
import static android.app.ActivityManager.ASSIST_CONTEXT_FULL;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_NONE;
diff --git a/services/core/java/com/android/server/am/KeyguardController.java b/services/core/java/com/android/server/am/KeyguardController.java
index 30fa72f..fb55a47 100644
--- a/services/core/java/com/android/server/am/KeyguardController.java
+++ b/services/core/java/com/android/server/am/KeyguardController.java
@@ -35,7 +35,7 @@
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_UNSET;
-import android.app.ActivityManagerInternal.SleepToken;
+import android.app.ActivityTaskManagerInternal.SleepToken;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.Trace;
diff --git a/services/core/java/com/android/server/am/PinnedActivityStack.java b/services/core/java/com/android/server/am/PinnedActivityStack.java
index 4062f45..29898b1 100644
--- a/services/core/java/com/android/server/am/PinnedActivityStack.java
+++ b/services/core/java/com/android/server/am/PinnedActivityStack.java
@@ -100,7 +100,7 @@
// It is guaranteed that the activities requiring the update will be in the pinned stack at
// this point (either reparented before the animation into PiP, or before reparenting after
// the animation out of PiP)
- synchronized(this) {
+ synchronized (mService) {
ArrayList<TaskRecord> tasks = getAllTasks();
for (int i = 0; i < tasks.size(); i++ ) {
mStackSupervisor.updatePictureInPictureMode(tasks.get(i), targetStackBounds,
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 84cb994..571ee42 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -33,6 +33,7 @@
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.IUidObserver;
@@ -6657,7 +6658,8 @@
// when the user switches back. For managed profiles, we should kill all recording apps
ComponentName homeActivityName = null;
if (!oldUser.isManagedProfile()) {
- homeActivityName = mActivityManagerInternal.getHomeActivityForUser(oldUser.id);
+ homeActivityName = LocalServices.getService(
+ ActivityTaskManagerInternal.class).getHomeActivityForUser(oldUser.id);
}
final String[] permissions = { Manifest.permission.RECORD_AUDIO };
List<PackageInfo> packages;
diff --git a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
index 97f6aa2..079f3ea 100644
--- a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
+++ b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
@@ -21,6 +21,7 @@
import android.annotation.UserIdInt;
import android.app.ActivityManagerInternal;
import android.app.ActivityOptions;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppOpsManager;
import android.app.IApplicationThread;
import android.content.ComponentName;
@@ -112,7 +113,7 @@
launchIntent.setPackage(null);
launchIntent.setComponent(component);
- mInjector.getActivityManagerInternal().startActivityAsUser(
+ mInjector.getActivityTaskManagerInternal().startActivityAsUser(
caller, callingPackage, launchIntent,
ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(),
user.getIdentifier());
@@ -241,6 +242,11 @@
public ActivityManagerInternal getActivityManagerInternal() {
return LocalServices.getService(ActivityManagerInternal.class);
}
+
+ @Override
+ public ActivityTaskManagerInternal getActivityTaskManagerInternal() {
+ return LocalServices.getService(ActivityTaskManagerInternal.class);
+ }
}
@VisibleForTesting
@@ -264,5 +270,7 @@
AppOpsManager getAppOpsManager();
ActivityManagerInternal getActivityManagerInternal();
+
+ ActivityTaskManagerInternal getActivityTaskManagerInternal();
}
}
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index feac8e6..a52470d 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -20,6 +20,7 @@
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppGlobals;
import android.app.IApplicationThread;
import android.app.PendingIntent;
@@ -107,6 +108,7 @@
private final UserManager mUm;
private final UserManagerInternal mUserManagerInternal;
private final ActivityManagerInternal mActivityManagerInternal;
+ private final ActivityTaskManagerInternal mActivityTaskManagerInternal;
private final ShortcutServiceInternal mShortcutServiceInternal;
private final PackageCallbackList<IOnAppsChangedListener> mListeners
= new PackageCallbackList<IOnAppsChangedListener>();
@@ -122,6 +124,8 @@
LocalServices.getService(UserManagerInternal.class));
mActivityManagerInternal = Preconditions.checkNotNull(
LocalServices.getService(ActivityManagerInternal.class));
+ mActivityTaskManagerInternal = Preconditions.checkNotNull(
+ LocalServices.getService(ActivityTaskManagerInternal.class));
mShortcutServiceInternal = Preconditions.checkNotNull(
LocalServices.getService(ShortcutServiceInternal.class));
mShortcutServiceInternal.addListener(mPackageMonitor);
@@ -521,7 +525,7 @@
@NonNull String publisherPackage, Bundle startActivityOptions, int userId) {
final int code;
try {
- code = mActivityManagerInternal.startActivitiesAsPackage(publisherPackage,
+ code = mActivityTaskManagerInternal.startActivitiesAsPackage(publisherPackage,
userId, intents, startActivityOptions);
if (ActivityManager.isStartResultSuccessful(code)) {
return true; // Success
@@ -618,7 +622,7 @@
} finally {
Binder.restoreCallingIdentity(ident);
}
- mActivityManagerInternal.startActivityAsUser(caller, callingPackage,
+ mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage,
launchIntent, opts, user.getIdentifier());
}
@@ -641,7 +645,7 @@
} finally {
Binder.restoreCallingIdentity(ident);
}
- mActivityManagerInternal.startActivityAsUser(caller, callingPackage,
+ mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage,
intent, opts, user.getIdentifier());
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index e4567a8..e5e8648 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -123,6 +123,7 @@
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.app.ResourcesManager;
@@ -1018,6 +1019,7 @@
private UserManagerInternal mUserManagerInternal;
private ActivityManagerInternal mActivityManagerInternal;
+ private ActivityTaskManagerInternal mActivityTaskManagerInternal;
private DeviceIdleController.LocalService mDeviceIdleController;
@@ -4767,6 +4769,13 @@
return mActivityManagerInternal;
}
+ private ActivityTaskManagerInternal getActivityTaskManagerInternal() {
+ if (mActivityTaskManagerInternal == null) {
+ mActivityTaskManagerInternal =
+ LocalServices.getService(ActivityTaskManagerInternal.class);
+ }
+ return mActivityTaskManagerInternal;
+ }
private DeviceIdleController.LocalService getDeviceIdleController() {
if (mDeviceIdleController == null) {
@@ -4956,7 +4965,7 @@
}
private boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId) {
- if (!getActivityManagerInternal().isCallerRecents(callingUid)) {
+ if (!getActivityTaskManagerInternal().isCallerRecents(callingUid)) {
return false;
}
final long token = Binder.clearCallingIdentity();
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 32825f7..71e342e 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -155,7 +155,8 @@
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerInternal.SleepToken;
+import android.app.ActivityTaskManagerInternal;
+import android.app.ActivityTaskManagerInternal.SleepToken;
import android.app.ActivityTaskManager;
import android.app.ActivityThread;
import android.app.AppOpsManager;
@@ -454,6 +455,7 @@
WindowManagerInternal mWindowManagerInternal;
PowerManager mPowerManager;
ActivityManagerInternal mActivityManagerInternal;
+ ActivityTaskManagerInternal mActivityTaskManagerInternal;
AutofillManagerInternal mAutofillManagerInternal;
InputManagerInternal mInputManagerInternal;
InputMethodManagerInternal mInputMethodManagerInternal;
@@ -1117,7 +1119,7 @@
if (mWindowSleepToken != null) {
return;
}
- mWindowSleepToken = mActivityManagerInternal.acquireSleepToken("WindowSleepToken",
+ mWindowSleepToken = mActivityTaskManagerInternal.acquireSleepToken("WindowSleepToken",
DEFAULT_DISPLAY);
};
@@ -2001,6 +2003,7 @@
mWindowManagerFuncs = windowManagerFuncs;
mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
+ mActivityTaskManagerInternal = LocalServices.getService(ActivityTaskManagerInternal.class);
mInputManagerInternal = LocalServices.getService(InputManagerInternal.class);
mDreamManagerInternal = LocalServices.getService(DreamManagerInternal.class);
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
@@ -7792,7 +7795,7 @@
private void updateDreamingSleepToken(boolean acquire) {
if (acquire) {
if (mDreamingSleepToken == null) {
- mDreamingSleepToken = mActivityManagerInternal.acquireSleepToken(
+ mDreamingSleepToken = mActivityTaskManagerInternal.acquireSleepToken(
"Dream", DEFAULT_DISPLAY);
}
} else {
@@ -7807,7 +7810,7 @@
private void updateScreenOffSleepToken(boolean acquire) {
if (acquire) {
if (mScreenOffSleepToken == null) {
- mScreenOffSleepToken = mActivityManagerInternal.acquireSleepToken(
+ mScreenOffSleepToken = mActivityTaskManagerInternal.acquireSleepToken(
"ScreenOff", DEFAULT_DISPLAY);
}
} else {
diff --git a/services/core/java/com/android/server/vr/Vr2dDisplay.java b/services/core/java/com/android/server/vr/Vr2dDisplay.java
index 3c2d66b..9183b08 100644
--- a/services/core/java/com/android/server/vr/Vr2dDisplay.java
+++ b/services/core/java/com/android/server/vr/Vr2dDisplay.java
@@ -3,6 +3,7 @@
import static android.view.Display.INVALID_DISPLAY;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.Vr2dDisplayProperties;
import android.app.Service;
import android.content.BroadcastReceiver;
@@ -25,6 +26,7 @@
import android.util.Log;
import android.view.Surface;
+import com.android.server.LocalServices;
import com.android.server.wm.WindowManagerInternal;
/**
@@ -319,7 +321,7 @@
}
private void updateDisplayId(int displayId) {
- mActivityManagerInternal.setVr2dDisplayId(displayId);
+ LocalServices.getService(ActivityTaskManagerInternal.class).setVr2dDisplayId(displayId);
mWindowManagerInternal.setVr2dDisplayId(displayId);
}
diff --git a/services/core/java/com/android/server/vr/VrManagerService.java b/services/core/java/com/android/server/vr/VrManagerService.java
index faa197e..50bf57f 100644
--- a/services/core/java/com/android/server/vr/VrManagerService.java
+++ b/services/core/java/com/android/server/vr/VrManagerService.java
@@ -19,7 +19,8 @@
import android.Manifest;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerInternal.ScreenObserver;
+import android.app.ActivityTaskManagerInternal;
+import android.app.ActivityTaskManagerInternal.ScreenObserver;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.app.INotificationManager;
@@ -777,7 +778,7 @@
@Override
public void onBootPhase(int phase) {
if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
- LocalServices.getService(ActivityManagerInternal.class)
+ LocalServices.getService(ActivityTaskManagerInternal.class)
.registerScreenObserver(this);
mNotificationManager = INotificationManager.Stub.asInterface(
diff --git a/services/core/java/com/android/server/wm/BoundsAnimationController.java b/services/core/java/com/android/server/wm/BoundsAnimationController.java
index b2a12be..0a49c13 100644
--- a/services/core/java/com/android/server/wm/BoundsAnimationController.java
+++ b/services/core/java/com/android/server/wm/BoundsAnimationController.java
@@ -196,6 +196,12 @@
@Override
public void onAnimationStart(Animator animation) {
+ if (!mTarget.isAttached()) {
+ // No point of trying to animate something that isn't attached to the hierarchy
+ // anymore.
+ cancel();
+ }
+
if (DEBUG) Slog.d(TAG, "onAnimationStart: mTarget=" + mTarget
+ " mPrevSchedulePipModeChangedState=" + mPrevSchedulePipModeChangedState
+ " mSchedulePipModeChangedState=" + mSchedulePipModeChangedState);
diff --git a/services/core/java/com/android/server/wm/BoundsAnimationTarget.java b/services/core/java/com/android/server/wm/BoundsAnimationTarget.java
index 68be4e8..d66b42f 100644
--- a/services/core/java/com/android/server/wm/BoundsAnimationTarget.java
+++ b/services/core/java/com/android/server/wm/BoundsAnimationTarget.java
@@ -65,4 +65,9 @@
*/
void onAnimationEnd(boolean schedulePipModeChangedCallback, Rect finalStackSize,
boolean moveToFullscreen);
+
+ /** @return True if the target is attached to the window hierarchy. */
+ default boolean isAttached() {
+ return true;
+ }
}
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index cd8d677..e817d1a 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -651,7 +651,7 @@
if (wasMinimized && mMinimizedDock && containsAppInDockedStack(openingApps)
&& appTransition != TRANSIT_NONE &&
!AppTransition.isKeyguardGoingAwayTransit(appTransition)) {
- if (mService.mAmInternal.isRecentsComponentHomeActivity(mService.mCurrentUserId)) {
+ if (mService.mAtmInternal.isRecentsComponentHomeActivity(mService.mCurrentUserId)) {
// When the home activity is the recents component and we are already minimized,
// then there is nothing to do here since home is already visible
} else {
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 2723801..b610695 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -16,7 +16,7 @@
package com.android.server.wm;
-import static android.app.ActivityManagerInternal.APP_TRANSITION_RECENTS_ANIM;
+import static android.app.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index e6db6d9..76a060e 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -1703,6 +1703,11 @@
}
}
+ @Override
+ public boolean isAttached() {
+ return mDisplayContent != null;
+ }
+
/**
* Called immediately prior to resizing the tasks at the end of the pinned stack animation.
*/
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 54e9c28..2c7ab7e 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -117,6 +117,7 @@
import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityManagerInternal;
import android.app.ActivityTaskManager;
+import android.app.ActivityTaskManagerInternal;
import android.app.ActivityThread;
import android.app.AppOpsManager;
import android.app.IActivityManager;
@@ -434,6 +435,7 @@
// TODO: Probably not needed once activities are fully in WM.
final IActivityTaskManager mActivityTaskManager;
final ActivityManagerInternal mAmInternal;
+ final ActivityTaskManagerInternal mAtmInternal;
final AppOpsManager mAppOps;
final PackageManagerInternal mPmInternal;
@@ -1017,6 +1019,7 @@
mActivityManager = ActivityManager.getService();
mActivityTaskManager = ActivityTaskManager.getService();
mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
+ mAtmInternal = LocalServices.getService(ActivityTaskManagerInternal.class);
mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
AppOpsManager.OnOpChangedInternalListener opListener =
new AppOpsManager.OnOpChangedInternalListener() {
@@ -4987,16 +4990,16 @@
}
break;
case NOTIFY_APP_TRANSITION_STARTING: {
- mAmInternal.notifyAppTransitionStarting((SparseIntArray) msg.obj,
+ mAtmInternal.notifyAppTransitionStarting((SparseIntArray) msg.obj,
msg.getWhen());
}
break;
case NOTIFY_APP_TRANSITION_CANCELLED: {
- mAmInternal.notifyAppTransitionCancelled();
+ mAtmInternal.notifyAppTransitionCancelled();
}
break;
case NOTIFY_APP_TRANSITION_FINISHED: {
- mAmInternal.notifyAppTransitionFinished();
+ mAtmInternal.notifyAppTransitionFinished();
}
break;
case WINDOW_HIDE_TIMEOUT: {
@@ -5021,7 +5024,7 @@
}
break;
case NOTIFY_DOCKED_STACK_MINIMIZED_CHANGED: {
- mAmInternal.notifyDockedStackMinimizedChanged(msg.arg1 == 1);
+ mAtmInternal.notifyDockedStackMinimizedChanged(msg.arg1 == 1);
}
break;
case RESTORE_POINTER_ICON: {
@@ -5040,11 +5043,11 @@
}
break;
case NOTIFY_KEYGUARD_FLAGS_CHANGED: {
- mAmInternal.notifyKeyguardFlagsChanged((Runnable) msg.obj);
+ mAtmInternal.notifyKeyguardFlagsChanged((Runnable) msg.obj);
}
break;
case NOTIFY_KEYGUARD_TRUSTED_CHANGED: {
- mAmInternal.notifyKeyguardTrustedChanged();
+ mAtmInternal.notifyKeyguardTrustedChanged();
}
break;
case SET_HAS_OVERLAY_UI: {
@@ -5971,7 +5974,7 @@
@Override
public void setRecentsVisibility(boolean visible) {
- mAmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,
+ mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,
"setRecentsVisibility()");
synchronized (mWindowMap) {
mPolicy.setRecentsVisibilityLw(visible);
@@ -5993,7 +5996,7 @@
@Override
public void setShelfHeight(boolean visible, int shelfHeight) {
- mAmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,
+ mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,
"setShelfHeight()");
synchronized (mWindowMap) {
getDefaultDisplayContentLocked().getPinnedStackController().setAdjustedForShelf(visible,
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index d247960..1a8753d 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -16,9 +16,9 @@
package com.android.server.wm;
-import static android.app.ActivityManagerInternal.APP_TRANSITION_SNAPSHOT;
-import static android.app.ActivityManagerInternal.APP_TRANSITION_SPLASH_SCREEN;
-import static android.app.ActivityManagerInternal.APP_TRANSITION_WINDOWS_DRAWN;
+import static android.app.ActivityTaskManagerInternal.APP_TRANSITION_SNAPSHOT;
+import static android.app.ActivityTaskManagerInternal.APP_TRANSITION_SPLASH_SCREEN;
+import static android.app.ActivityTaskManagerInternal.APP_TRANSITION_WINDOWS_DRAWN;
import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE;
import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS;
@@ -44,7 +44,6 @@
import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_OPEN;
import static android.view.WindowManager.TRANSIT_WALLPAPER_OPEN;
import static com.android.server.wm.AppTransition.isKeyguardGoingAwayTransit;
-import static com.android.server.wm.AppTransition.isTaskTransit;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS;
diff --git a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
index 998ffa0..3d64f2a 100644
--- a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
@@ -41,6 +41,7 @@
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.IUidObserver;
import android.app.usage.UsageStatsManagerInternal;
import android.content.ActivityNotFoundException;
@@ -613,6 +614,7 @@
protected UserManagerInternal mMockUserManagerInternal;
protected UsageStatsManagerInternal mMockUsageStatsManagerInternal;
protected ActivityManagerInternal mMockActivityManagerInternal;
+ protected ActivityTaskManagerInternal mMockActivityTaskManagerInternal;
protected static final String CALLING_PACKAGE_1 = "com.android.test.1";
protected static final int CALLING_UID_1 = 10001;
@@ -752,6 +754,7 @@
mMockUserManagerInternal = mock(UserManagerInternal.class);
mMockUsageStatsManagerInternal = mock(UsageStatsManagerInternal.class);
mMockActivityManagerInternal = mock(ActivityManagerInternal.class);
+ mMockActivityTaskManagerInternal = mock(ActivityTaskManagerInternal.class);
LocalServices.removeServiceForTest(PackageManagerInternal.class);
LocalServices.addService(PackageManagerInternal.class, mMockPackageManagerInternal);
@@ -759,6 +762,7 @@
LocalServices.addService(UsageStatsManagerInternal.class, mMockUsageStatsManagerInternal);
LocalServices.removeServiceForTest(ActivityManagerInternal.class);
LocalServices.addService(ActivityManagerInternal.class, mMockActivityManagerInternal);
+ LocalServices.addService(ActivityTaskManagerInternal.class, mMockActivityTaskManagerInternal);
LocalServices.removeServiceForTest(UserManagerInternal.class);
LocalServices.addService(UserManagerInternal.class, mMockUserManagerInternal);
@@ -1641,11 +1645,11 @@
protected Intent[] launchShortcutAndGetIntentsInner(Runnable shortcutStarter,
@NonNull String packageName, @NonNull String shortcutId, int userId) {
- reset(mMockActivityManagerInternal);
+ reset(mMockActivityTaskManagerInternal);
shortcutStarter.run();
final ArgumentCaptor<Intent[]> intentsCaptor = ArgumentCaptor.forClass(Intent[].class);
- verify(mMockActivityManagerInternal).startActivitiesAsPackage(
+ verify(mMockActivityTaskManagerInternal).startActivitiesAsPackage(
eq(packageName),
eq(userId),
intentsCaptor.capture(),
@@ -1695,7 +1699,7 @@
protected void assertShortcutNotLaunched(@NonNull String packageName,
@NonNull String shortcutId, int userId) {
- reset(mMockActivityManagerInternal);
+ reset(mMockActivityTaskManagerInternal);
try {
mLauncherApps.startShortcut(packageName, shortcutId, null, null,
UserHandle.of(userId));
@@ -1703,7 +1707,7 @@
} catch (ActivityNotFoundException expected) {
}
// This shouldn't have been called.
- verify(mMockActivityManagerInternal, times(0)).startActivitiesAsPackage(
+ verify(mMockActivityTaskManagerInternal, times(0)).startActivitiesAsPackage(
anyString(),
anyInt(),
any(Intent[].class),
diff --git a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java
index 33acc44..3514e5a 100644
--- a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java
@@ -14,6 +14,7 @@
import static org.testng.Assert.assertThrows;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppOpsManager;
import android.app.IApplicationThread;
import android.content.ComponentName;
@@ -72,6 +73,8 @@
private AppOpsManager mAppOpsManager;
@Mock
private ActivityManagerInternal mActivityManagerInternal;
+ @Mock
+ private ActivityTaskManagerInternal mActivityTaskManagerInternal;
private TestInjector mTestInjector;
private ActivityInfo mActivityInfo;
@@ -210,7 +213,7 @@
ACTIVITY_COMPONENT,
UserHandle.of(PRIMARY_USER)));
- verify(mActivityManagerInternal, never())
+ verify(mActivityTaskManagerInternal, never())
.startActivityAsUser(
nullable(IApplicationThread.class),
anyString(),
@@ -232,7 +235,7 @@
ACTIVITY_COMPONENT,
UserHandle.of(PROFILE_OF_PRIMARY_USER)));
- verify(mActivityManagerInternal, never())
+ verify(mActivityTaskManagerInternal, never())
.startActivityAsUser(
nullable(IApplicationThread.class),
anyString(),
@@ -252,7 +255,7 @@
ACTIVITY_COMPONENT,
UserHandle.of(PROFILE_OF_PRIMARY_USER)));
- verify(mActivityManagerInternal, never())
+ verify(mActivityTaskManagerInternal, never())
.startActivityAsUser(
nullable(IApplicationThread.class),
anyString(),
@@ -274,7 +277,7 @@
ACTIVITY_COMPONENT,
UserHandle.of(PROFILE_OF_PRIMARY_USER)));
- verify(mActivityManagerInternal, never())
+ verify(mActivityTaskManagerInternal, never())
.startActivityAsUser(
nullable(IApplicationThread.class),
anyString(),
@@ -294,7 +297,7 @@
new ComponentName(PACKAGE_TWO, "test"),
UserHandle.of(PROFILE_OF_PRIMARY_USER)));
- verify(mActivityManagerInternal, never())
+ verify(mActivityTaskManagerInternal, never())
.startActivityAsUser(
nullable(IApplicationThread.class),
anyString(),
@@ -314,7 +317,7 @@
ACTIVITY_COMPONENT,
UserHandle.of(SECONDARY_USER)));
- verify(mActivityManagerInternal, never())
+ verify(mActivityTaskManagerInternal, never())
.startActivityAsUser(
nullable(IApplicationThread.class),
anyString(),
@@ -333,7 +336,7 @@
ACTIVITY_COMPONENT,
UserHandle.of(PRIMARY_USER));
- verify(mActivityManagerInternal)
+ verify(mActivityTaskManagerInternal)
.startActivityAsUser(
nullable(IApplicationThread.class),
eq(PACKAGE_ONE),
@@ -432,5 +435,10 @@
public ActivityManagerInternal getActivityManagerInternal() {
return mActivityManagerInternal;
}
+
+ @Override
+ public ActivityTaskManagerInternal getActivityTaskManagerInternal() {
+ return mActivityTaskManagerInternal;
+ }
}
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
index 7815004..6c6c9932 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
@@ -2904,7 +2904,7 @@
runWithCaller(LAUNCHER_1, USER_0, () -> {
// Not launchable.
doReturn(ActivityManager.START_CLASS_NOT_FOUND)
- .when(mMockActivityManagerInternal).startActivitiesAsPackage(
+ .when(mMockActivityTaskManagerInternal).startActivitiesAsPackage(
anyStringOrNull(), anyInt(),
anyOrNull(Intent[].class), anyOrNull(Bundle.class));
assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_0,
@@ -2912,7 +2912,7 @@
// Still not launchable.
doReturn(ActivityManager.START_CLASS_NOT_FOUND)
- .when(mMockActivityManagerInternal)
+ .when(mMockActivityTaskManagerInternal)
.startActivitiesAsPackage(
anyStringOrNull(), anyInt(),
anyOrNull(Intent[].class), anyOrNull(Bundle.class));
diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java b/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java
index d91079e..69cfaad 100644
--- a/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java
+++ b/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java
@@ -29,6 +29,7 @@
import static org.mockito.Mockito.mock;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.content.Context;
import android.hardware.display.DisplayManagerInternal;
import android.os.PowerManagerInternal;
@@ -91,15 +92,17 @@
LocalServices.addService(ActivityManagerInternal.class,
mock(ActivityManagerInternal.class));
- final ActivityManagerInternal am =
- LocalServices.getService(ActivityManagerInternal.class);
+ LocalServices.addService(ActivityTaskManagerInternal.class,
+ mock(ActivityTaskManagerInternal.class));
+ final ActivityTaskManagerInternal atm =
+ LocalServices.getService(ActivityTaskManagerInternal.class);
doAnswer((InvocationOnMock invocationOnMock) -> {
final Runnable runnable = invocationOnMock.<Runnable>getArgument(0);
if (runnable != null) {
runnable.run();
}
return null;
- }).when(am).notifyKeyguardFlagsChanged(any());
+ }).when(atm).notifyKeyguardFlagsChanged(any());
InputManagerService ims = mock(InputManagerService.class);
// InputChannel is final and can't be mocked.
@@ -125,6 +128,7 @@
LocalServices.removeServiceForTest(DisplayManagerInternal.class);
LocalServices.removeServiceForTest(PowerManagerInternal.class);
LocalServices.removeServiceForTest(ActivityManagerInternal.class);
+ LocalServices.removeServiceForTest(ActivityTaskManagerInternal.class);
LocalServices.removeServiceForTest(WindowManagerInternal.class);
LocalServices.removeServiceForTest(WindowManagerPolicy.class);
}
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index 9f8042c..a919d38 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -21,6 +21,7 @@
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -98,7 +99,7 @@
/**
* UsbDeviceManager manages USB state in device mode.
*/
-public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver {
+public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObserver {
private static final String TAG = UsbDeviceManager.class.getSimpleName();
private static final boolean DEBUG = false;
@@ -386,7 +387,7 @@
public void systemReady() {
if (DEBUG) Slog.d(TAG, "systemReady");
- LocalServices.getService(ActivityManagerInternal.class).registerScreenObserver(this);
+ LocalServices.getService(ActivityTaskManagerInternal.class).registerScreenObserver(this);
mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 44f5551..88dc325 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -19,6 +19,7 @@
import android.Manifest;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.ActivityTaskManagerInternal;
import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -88,6 +89,7 @@
final ContentResolver mResolver;
final DatabaseHelper mDbHelper;
final ActivityManagerInternal mAmInternal;
+ final ActivityTaskManagerInternal mAtmInternal;
final UserManager mUserManager;
final ArraySet<Integer> mLoadedKeyphraseIds = new ArraySet<>();
ShortcutServiceInternal mShortcutServiceInternal;
@@ -104,6 +106,8 @@
mServiceStub = new VoiceInteractionManagerServiceStub();
mAmInternal = Preconditions.checkNotNull(
LocalServices.getService(ActivityManagerInternal.class));
+ mAtmInternal = Preconditions.checkNotNull(
+ LocalServices.getService(ActivityTaskManagerInternal.class));
mUserManager = Preconditions.checkNotNull(
context.getSystemService(UserManager.class));
@@ -212,7 +216,7 @@
@Override
public void onShown() {
- mAmInternal.onLocalVoiceInteractionStarted(token,
+ mAtmInternal.onLocalVoiceInteractionStarted(token,
mImpl.mActiveSession.mSession,
mImpl.mActiveSession.mInteractor);
}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index ba94afe..54f99a6 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -26,6 +26,7 @@
import android.app.ActivityManagerInternal;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
+import android.app.ActivityTaskManagerInternal;
import android.app.IActivityManager;
import android.app.IActivityTaskManager;
import android.content.BroadcastReceiver;
@@ -171,7 +172,7 @@
activityTokens.add(activityToken);
} else {
// Let's get top activities from all visible stacks
- activityTokens = LocalServices.getService(ActivityManagerInternal.class)
+ activityTokens = LocalServices.getService(ActivityTaskManagerInternal.class)
.getTopVisibleActivities();
}
return mActiveSession.showLocked(args, flags, mDisabledShowContext, showCallback,
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 457bfcd..4eaed34 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -16,9 +16,9 @@
package com.android.server.voiceinteraction;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_CONTENT;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_DATA;
-import static android.app.ActivityManagerInternal.ASSIST_KEY_STRUCTURE;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_DATA;
+import static android.app.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
import static android.app.AppOpsManager.OP_ASSIST_SCREENSHOT;
import static android.app.AppOpsManager.OP_ASSIST_STRUCTURE;
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;