package android.multiuser;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.IStopUserCallback;
import android.app.UserSwitchObserver;
final Context context = InstrumentationRegistry.getContext();
mUm = UserManager.get(context);
mAm = context.getSystemService(ActivityManager.class);
- mIam = ActivityManagerNative.getDefault();
+ mIam = ActivityManager.getService();
mState = mPerfStatusReporter.getBenchmarkState();
mUsersToRemove = new ArrayList<>();
}
private void registerUserSwitchObserver(final CountDownLatch switchLatch,
final CountDownLatch bootCompleteLatch, final int userId) throws Exception {
- ActivityManagerNative.getDefault().registerUserSwitchObserver(
+ ActivityManager.getService().registerUserSwitchObserver(
new UserSwitchObserver() {
@Override
public void onUserSwitchComplete(int newUserId) throws RemoteException {
import android.app.ActivityManager;
import android.app.ActivityManager.StackInfo;
-import android.app.ActivityManagerNative;
import android.app.IActivityContainer;
import android.app.IActivityController;
import android.app.IActivityManager;
@Override
public void onRun() throws Exception {
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
if (mAm == null) {
System.err.println(NO_SYSTEM_ERROR_CODE);
throw new AndroidException("Can't connect to activity manager; is the system running?");
package com.android.commands.content;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ContentProviderHolder;
import android.app.IActivityManager;
import android.content.ContentValues;
public final void execute() {
String providerName = mUri.getAuthority();
try {
- IActivityManager activityManager = ActivityManagerNative.getDefault();
+ IActivityManager activityManager = ActivityManager.getService();
IContentProvider provider = null;
IBinder token = new Binder();
try {
package com.android.commands.dpm;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.app.admin.DevicePolicyManager;
import android.app.admin.IDevicePolicyManager;
mUserId = parseInt(arg);
}
if (mUserId == UserHandle.USER_CURRENT) {
- IActivityManager activityManager = ActivityManagerNative.getDefault();
+ IActivityManager activityManager = ActivityManager.getService();
try {
mUserId = activityManager.getCurrentUser().id;
} catch (RemoteException e) {
import android.accounts.IAccountManager;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.PackageInstallObserver;
import android.content.ComponentName;
import android.content.Context;
ClearDataObserver obs = new ClearDataObserver();
try {
- ActivityManagerNative.getDefault().clearApplicationUserData(pkg, obs, userId);
+ ActivityManager.getService().clearApplicationUserData(pkg, obs, userId);
synchronized (obs) {
while (!obs.finished) {
try {
package com.android.uiautomator.core;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ContentProviderHolder;
import android.app.IActivityManager;
import android.app.UiAutomation;
try {
IContentProvider provider = null;
Cursor cursor = null;
- IActivityManager activityManager = ActivityManagerNative.getDefault();
+ IActivityManager activityManager = ActivityManager.getService();
String providerName = Settings.Secure.CONTENT_URI.getAuthority();
IBinder token = new Binder();
try {
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.IActivityController;
import android.app.IActivityManager;
import android.app.UiAutomation;
* @see {@link ActivityManager#isUserAMonkey()}
*/
public void setRunAsMonkey(boolean isSet) {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
if (am == null) {
throw new RuntimeException("Can't manage monkey status; is the system running?");
}
android.app.ActivityManager$TaskThumbnailInfo$1
android.app.ActivityManagerInternal
android.app.ActivityManagerInternal$SleepToken
-android.app.ActivityManagerNative
-android.app.ActivityManagerNative$1
-android.app.ActivityManagerProxy
android.app.ActivityOptions
android.app.ActivityOptions$OnAnimationFinishedListener
android.app.ActivityOptions$OnAnimationStartedListener
import com.google.android.collect.Sets;
import android.app.Activity;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
try {
IBinder activityToken = getActivityToken();
- mCallingUid = ActivityManagerNative.getDefault().getLaunchedFromUid(activityToken);
- mCallingPackage = ActivityManagerNative.getDefault().getLaunchedFromPackage(
+ mCallingUid = ActivityManager.getService().getLaunchedFromUid(activityToken);
+ mCallingPackage = ActivityManager.getService().getLaunchedFromPackage(
activityToken);
if (mCallingUid != 0 && mCallingPackage != null) {
Bundle restrictions = UserManager.get(this)
public boolean isVoiceInteractionRoot() {
try {
return mVoiceInteractor != null
- && ActivityManagerNative.getDefault().isRootVoiceInteraction(mToken);
+ && ActivityManager.getService().isRootVoiceInteraction(mToken);
} catch (RemoteException e) {
}
return false;
*/
public boolean isLocalVoiceInteractionSupported() {
try {
- return ActivityManagerNative.getDefault().supportsLocalVoiceInteraction();
+ return ActivityManager.getService().supportsLocalVoiceInteraction();
} catch (RemoteException re) {
}
return false;
*/
public void startLocalVoiceInteraction(Bundle privateOptions) {
try {
- ActivityManagerNative.getDefault().startLocalVoiceInteraction(mToken, privateOptions);
+ ActivityManager.getService().startLocalVoiceInteraction(mToken, privateOptions);
} catch (RemoteException re) {
}
}
*/
public void stopLocalVoiceInteraction() {
try {
- ActivityManagerNative.getDefault().stopLocalVoiceInteraction(mToken);
+ ActivityManager.getService().stopLocalVoiceInteraction(mToken);
} catch (RemoteException re) {
}
}
*/
public boolean showAssist(Bundle args) {
try {
- return ActivityManagerNative.getDefault().showAssistFromActivity(mToken, args);
+ return ActivityManager.getService().showAssistFromActivity(mToken, args);
} catch (RemoteException e) {
}
return false;
if (mDoReportFullyDrawn) {
mDoReportFullyDrawn = false;
try {
- ActivityManagerNative.getDefault().reportActivityFullyDrawn(mToken);
+ ActivityManager.getService().reportActivityFullyDrawn(mToken);
} catch (RemoteException e) {
}
}
*/
public boolean isInMultiWindowMode() {
try {
- return ActivityManagerNative.getDefault().isInMultiWindowMode(mToken);
+ return ActivityManager.getService().isInMultiWindowMode(mToken);
} catch (RemoteException e) {
}
return false;
*/
public boolean isInPictureInPictureMode() {
try {
- return ActivityManagerNative.getDefault().isInPictureInPictureMode(mToken);
+ return ActivityManager.getService().isInPictureInPictureMode(mToken);
} catch (RemoteException e) {
}
return false;
*/
public void enterPictureInPictureMode() {
try {
- ActivityManagerNative.getDefault().enterPictureInPictureMode(mToken);
+ ActivityManager.getService().enterPictureInPictureMode(mToken);
} catch (RemoteException e) {
}
}
*/
@Override
public void exitFreeformMode() throws RemoteException {
- ActivityManagerNative.getDefault().exitFreeformMode(mToken);
+ ActivityManager.getService().exitFreeformMode(mToken);
}
/** Returns the current stack Id for the window.
*/
@Override
public int getWindowStackId() throws RemoteException {
- return ActivityManagerNative.getDefault().getActivityStackId(mToken);
+ return ActivityManager.getService().getActivityStackId(mToken);
}
/**
fillInIntent.prepareToLeaveProcess(this);
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
}
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
fillInIntent, resolvedType, mToken, who,
requestCode, flagsMask, flagsValues, options);
}
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
- result = ActivityManagerNative.getDefault()
+ result = ActivityManager.getService()
.startActivity(mMainThread.getApplicationThread(), getBasePackageName(),
intent, intent.resolveTypeIfNeeded(getContentResolver()), mToken,
mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED,
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
*/
public void overridePendingTransition(int enterAnim, int exitAnim) {
try {
- ActivityManagerNative.getDefault().overridePendingTransition(
+ ActivityManager.getService().overridePendingTransition(
mToken, getPackageName(), enterAnim, exitAnim);
} catch (RemoteException e) {
}
@Nullable
public String getCallingPackage() {
try {
- return ActivityManagerNative.getDefault().getCallingPackage(mToken);
+ return ActivityManager.getService().getCallingPackage(mToken);
} catch (RemoteException e) {
return null;
}
@Nullable
public ComponentName getCallingActivity() {
try {
- return ActivityManagerNative.getDefault().getCallingActivity(mToken);
+ return ActivityManager.getService().getCallingActivity(mToken);
} catch (RemoteException e) {
return null;
}
throw new IllegalStateException("Must be called from main thread");
}
try {
- ActivityManagerNative.getDefault().requestActivityRelaunch(mToken);
+ ActivityManager.getService().requestActivityRelaunch(mToken);
} catch (RemoteException e) {
}
}
if (resultData != null) {
resultData.prepareToLeaveProcess(this);
}
- if (ActivityManagerNative.getDefault()
+ if (ActivityManager.getService()
.finishActivity(mToken, resultCode, resultData, finishTask)) {
mFinished = true;
}
throw new IllegalStateException("Can not be called to deliver a result");
}
try {
- if (ActivityManagerNative.getDefault().finishActivityAffinity(mToken)) {
+ if (ActivityManager.getService().finishActivityAffinity(mToken)) {
mFinished = true;
}
} catch (RemoteException e) {
public void finishActivity(int requestCode) {
if (mParent == null) {
try {
- ActivityManagerNative.getDefault()
+ ActivityManager.getService()
.finishSubActivity(mToken, mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
- ActivityManagerNative.getDefault()
+ ActivityManager.getService()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
*/
public boolean releaseInstance() {
try {
- return ActivityManagerNative.getDefault().releaseActivityInstance(mToken);
+ return ActivityManager.getService().releaseActivityInstance(mToken);
} catch (RemoteException e) {
// Empty
}
try {
data.prepareToLeaveProcess(this);
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
mParent == null ? mToken : mParent.mToken,
mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null,
public void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) {
if (mParent == null) {
try {
- ActivityManagerNative.getDefault().setRequestedOrientation(
+ ActivityManager.getService().setRequestedOrientation(
mToken, requestedOrientation);
} catch (RemoteException e) {
// Empty
public int getRequestedOrientation() {
if (mParent == null) {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getRequestedOrientation(mToken);
} catch (RemoteException e) {
// Empty
*/
public int getTaskId() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getTaskForActivity(mToken, false);
} catch (RemoteException e) {
return -1;
*/
public boolean isTaskRoot() {
try {
- return ActivityManagerNative.getDefault().getTaskForActivity(mToken, true) >= 0;
+ return ActivityManager.getService().getTaskForActivity(mToken, true) >= 0;
} catch (RemoteException e) {
return false;
}
*/
public boolean moveTaskToBack(boolean nonRoot) {
try {
- return ActivityManagerNative.getDefault().moveActivityTaskToBack(
+ return ActivityManager.getService().moveActivityTaskToBack(
mToken, nonRoot);
} catch (RemoteException e) {
// Empty
}
}
try {
- ActivityManagerNative.getDefault().setTaskDescription(mToken, mTaskDescription);
+ ActivityManager.getService().setTaskDescription(mToken, mTaskDescription);
} catch (RemoteException e) {
}
}
*/
public boolean isImmersive() {
try {
- return ActivityManagerNative.getDefault().isImmersive(mToken);
+ return ActivityManager.getService().isImmersive(mToken);
} catch (RemoteException e) {
return false;
}
return false;
}
try {
- return ActivityManagerNative.getDefault().isTopOfTask(getActivityToken());
+ return ActivityManager.getService().isTopOfTask(getActivityToken());
} catch (RemoteException e) {
return false;
}
public void convertFromTranslucent() {
try {
mTranslucentCallback = null;
- if (ActivityManagerNative.getDefault().convertFromTranslucent(mToken)) {
+ if (ActivityManager.getService().convertFromTranslucent(mToken)) {
WindowManagerGlobal.getInstance().changeCanvasOpacity(mToken, true);
}
} catch (RemoteException e) {
boolean drawComplete;
try {
mTranslucentCallback = callback;
- mChangeCanvasToTranslucent = ActivityManagerNative.getDefault().convertToTranslucent(
+ mChangeCanvasToTranslucent = ActivityManager.getService().convertToTranslucent(
mToken, options == null ? null : options.toBundle());
WindowManagerGlobal.getInstance().changeCanvasOpacity(mToken, false);
drawComplete = true;
ActivityOptions getActivityOptions() {
try {
return ActivityOptions.fromBundle(
- ActivityManagerNative.getDefault().getActivityOptions(mToken));
+ ActivityManager.getService().getActivityOptions(mToken));
} catch (RemoteException e) {
}
return null;
visible = false;
}
try {
- mVisibleBehind = ActivityManagerNative.getDefault()
+ mVisibleBehind = ActivityManager.getService()
.requestVisibleBehind(mToken, visible) && visible;
} catch (RemoteException e) {
mVisibleBehind = false;
@SystemApi
public boolean isBackgroundVisibleBehind() {
try {
- return ActivityManagerNative.getDefault().isBackgroundVisibleBehind(mToken);
+ return ActivityManager.getService().isBackgroundVisibleBehind(mToken);
} catch (RemoteException e) {
}
return false;
*/
public void setImmersive(boolean i) {
try {
- ActivityManagerNative.getDefault().setImmersive(mToken, i);
+ ActivityManager.getService().setImmersive(mToken, i);
} catch (RemoteException e) {
// pass
}
public void setVrModeEnabled(boolean enabled, @NonNull ComponentName requestedComponent)
throws PackageManager.NameNotFoundException {
try {
- if (ActivityManagerNative.getDefault().setVrMode(mToken, enabled, requestedComponent)
+ if (ActivityManager.getService().setVrMode(mToken, enabled, requestedComponent)
!= 0) {
throw new PackageManager.NameNotFoundException(
requestedComponent.flattenToString());
if (info.taskAffinity == null) {
return false;
}
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.shouldUpRecreateTask(mToken, info.taskAffinity);
} catch (RemoteException e) {
return false;
}
try {
upIntent.prepareToLeaveProcess(this);
- return ActivityManagerNative.getDefault().navigateUpTo(mToken, upIntent,
+ return ActivityManager.getService().navigateUpTo(mToken, upIntent,
resultCode, resultData);
} catch (RemoteException e) {
return false;
*/
public void startLockTask() {
try {
- ActivityManagerNative.getDefault().startLockTaskModeByToken(mToken);
+ ActivityManager.getService().startLockTaskModeByToken(mToken);
} catch (RemoteException e) {
}
}
*/
public void stopLockTask() {
try {
- ActivityManagerNative.getDefault().stopLockTaskMode();
+ ActivityManager.getService().stopLockTaskMode();
} catch (RemoteException e) {
}
}
*/
public void showLockTaskEscapeMessage() {
try {
- ActivityManagerNative.getDefault().showLockTaskEscapeMessage(mToken);
+ ActivityManager.getService().showLockTaskEscapeMessage(mToken);
} catch (RemoteException e) {
}
}
import com.android.internal.os.RoSystemProperties;
import com.android.internal.os.TransferPipe;
import com.android.internal.util.FastPrintWriter;
+import com.android.server.LocalServices;
import android.content.ComponentName;
import android.content.Context;
private final Context mContext;
private final Handler mHandler;
+ private static volatile boolean sSystemReady = false;
+
static final class UidObserver extends IUidObserver.Stub {
final OnUidImportanceListener mListener;
/** @hide */
public int getFrontActivityScreenCompatMode() {
try {
- return ActivityManagerNative.getDefault().getFrontActivityScreenCompatMode();
+ return getService().getFrontActivityScreenCompatMode();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public void setFrontActivityScreenCompatMode(int mode) {
try {
- ActivityManagerNative.getDefault().setFrontActivityScreenCompatMode(mode);
+ getService().setFrontActivityScreenCompatMode(mode);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public int getPackageScreenCompatMode(String packageName) {
try {
- return ActivityManagerNative.getDefault().getPackageScreenCompatMode(packageName);
+ return getService().getPackageScreenCompatMode(packageName);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public void setPackageScreenCompatMode(String packageName, int mode) {
try {
- ActivityManagerNative.getDefault().setPackageScreenCompatMode(packageName, mode);
+ getService().setPackageScreenCompatMode(packageName, mode);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public boolean getPackageAskScreenCompat(String packageName) {
try {
- return ActivityManagerNative.getDefault().getPackageAskScreenCompat(packageName);
+ return getService().getPackageAskScreenCompat(packageName);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public void setPackageAskScreenCompat(String packageName, boolean ask) {
try {
- ActivityManagerNative.getDefault().setPackageAskScreenCompat(packageName, ask);
+ getService().setPackageAskScreenCompat(packageName, ask);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
public static Bitmap loadTaskDescriptionIcon(String iconFilename, int userId) {
if (iconFilename != null) {
try {
- return ActivityManagerNative.getDefault().getTaskDescriptionIcon(iconFilename,
+ return getService().getTaskDescriptionIcon(iconFilename,
userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
public List<RecentTaskInfo> getRecentTasks(int maxNum, int flags)
throws SecurityException {
try {
- return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
+ return getService().getRecentTasks(maxNum,
flags, UserHandle.myUserId()).getList();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
public List<RecentTaskInfo> getRecentTasksForUser(int maxNum, int flags, int userId)
throws SecurityException {
try {
- return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
+ return getService().getRecentTasks(maxNum,
flags, userId).getList();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
ArrayList<AppTask> tasks = new ArrayList<AppTask>();
List<IBinder> appTasks;
try {
- appTasks = ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
+ appTasks = getService().getAppTasks(mContext.getPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
private void ensureAppTaskThumbnailSizeLocked() {
if (mAppTaskThumbnailSize == null) {
try {
- mAppTaskThumbnailSize = ActivityManagerNative.getDefault().getAppTaskThumbnailSize();
+ mAppTaskThumbnailSize = getService().getAppTaskThumbnailSize();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
description = new TaskDescription();
}
try {
- return ActivityManagerNative.getDefault().addAppTask(activity.getActivityToken(),
+ return getService().addAppTask(activity.getActivityToken(),
intent, description, thumbnail);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
public List<RunningTaskInfo> getRunningTasks(int maxNum)
throws SecurityException {
try {
- return ActivityManagerNative.getDefault().getTasks(maxNum, 0);
+ return getService().getTasks(maxNum, 0);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public boolean removeTask(int taskId) throws SecurityException {
try {
- return ActivityManagerNative.getDefault().removeTask(taskId);
+ return getService().removeTask(taskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public TaskThumbnail getTaskThumbnail(int id) throws SecurityException {
try {
- return ActivityManagerNative.getDefault().getTaskThumbnail(id);
+ return getService().getTaskThumbnail(id);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public boolean isInHomeStack(int taskId) {
try {
- return ActivityManagerNative.getDefault().isInHomeStack(taskId);
+ return getService().isInHomeStack(taskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public void moveTaskToFront(int taskId, int flags, Bundle options) {
try {
- ActivityManagerNative.getDefault().moveTaskToFront(taskId, flags, options);
+ getService().moveTaskToFront(taskId, flags, options);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
public List<RunningServiceInfo> getRunningServices(int maxNum)
throws SecurityException {
try {
- return ActivityManagerNative.getDefault()
+ return getService()
.getServices(maxNum, 0);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
public PendingIntent getRunningServiceControlPanel(ComponentName service)
throws SecurityException {
try {
- return ActivityManagerNative.getDefault()
+ return getService()
.getRunningServiceControlPanel(service);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public void getMemoryInfo(MemoryInfo outInfo) {
try {
- ActivityManagerNative.getDefault().getMemoryInfo(outInfo);
+ getService().getMemoryInfo(outInfo);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public boolean clearApplicationUserData(String packageName, IPackageDataObserver observer) {
try {
- return ActivityManagerNative.getDefault().clearApplicationUserData(packageName,
+ return getService().clearApplicationUserData(packageName,
observer, UserHandle.myUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName) {
try {
- return ActivityManagerNative.getDefault().getGrantedUriPermissions(packageName,
+ return getService().getGrantedUriPermissions(packageName,
UserHandle.myUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public void clearGrantedUriPermissions(String packageName) {
try {
- ActivityManagerNative.getDefault().clearGrantedUriPermissions(packageName,
+ getService().clearGrantedUriPermissions(packageName,
UserHandle.myUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public List<ProcessErrorStateInfo> getProcessesInErrorState() {
try {
- return ActivityManagerNative.getDefault().getProcessesInErrorState();
+ return getService().getProcessesInErrorState();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public List<ApplicationInfo> getRunningExternalApplications() {
try {
- return ActivityManagerNative.getDefault().getRunningExternalApplications();
+ return getService().getRunningExternalApplications();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public boolean setProcessMemoryTrimLevel(String process, int userId, int level) {
try {
- return ActivityManagerNative.getDefault().setProcessMemoryTrimLevel(process, userId,
+ return getService().setProcessMemoryTrimLevel(process, userId,
level);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public List<RunningAppProcessInfo> getRunningAppProcesses() {
try {
- return ActivityManagerNative.getDefault().getRunningAppProcesses();
+ return getService().getRunningAppProcesses();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
static public void getMyMemoryState(RunningAppProcessInfo outState) {
try {
- ActivityManagerNative.getDefault().getMyMemoryState(outState);
+ getService().getMyMemoryState(outState);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) {
try {
- return ActivityManagerNative.getDefault().getProcessMemoryInfo(pids);
+ return getService().getProcessMemoryInfo(pids);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public void killBackgroundProcesses(String packageName) {
try {
- ActivityManagerNative.getDefault().killBackgroundProcesses(packageName,
+ getService().killBackgroundProcesses(packageName,
UserHandle.myUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@RequiresPermission(Manifest.permission.KILL_UID)
public void killUid(int uid, String reason) {
try {
- ActivityManagerNative.getDefault().killUid(UserHandle.getAppId(uid),
+ getService().killUid(UserHandle.getAppId(uid),
UserHandle.getUserId(uid), reason);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public void forceStopPackageAsUser(String packageName, int userId) {
try {
- ActivityManagerNative.getDefault().forceStopPackage(packageName, userId);
+ getService().forceStopPackage(packageName, userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public ConfigurationInfo getDeviceConfigurationInfo() {
try {
- return ActivityManagerNative.getDefault().getDeviceConfigurationInfo();
+ return getService().getDeviceConfigurationInfo();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public static boolean isUserAMonkey() {
try {
- return ActivityManagerNative.getDefault().isUserAMonkey();
+ return getService().isUserAMonkey();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
return userId;
}
try {
- return ActivityManagerNative.getDefault().handleIncomingUser(callingPid,
+ return getService().handleIncomingUser(callingPid,
callingUid, userId, allowAll, requireFull, name, callerPackage);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
public static int getCurrentUser() {
UserInfo ui;
try {
- ui = ActivityManagerNative.getDefault().getCurrentUser();
+ ui = getService().getCurrentUser();
return ui != null ? ui.id : 0;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public boolean switchUser(int userid) {
try {
- return ActivityManagerNative.getDefault().switchUser(userid);
+ return getService().switchUser(userid);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
int currentUser = ActivityManager.getCurrentUser();
if (currentUser != UserHandle.USER_SYSTEM) {
try {
- ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM);
- ActivityManagerNative.getDefault().stopUser(currentUser, /* force= */ false, null);
+ getService().switchUser(UserHandle.USER_SYSTEM);
+ getService().stopUser(currentUser, /* force= */ false, null);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
*/
public boolean isUserRunning(int userId) {
try {
- return ActivityManagerNative.getDefault().isUserRunning(userId, 0);
+ return getService().isUserRunning(userId, 0);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public boolean isVrModePackageEnabled(ComponentName component) {
try {
- return ActivityManagerNative.getDefault().isVrModePackageEnabled(component);
+ return getService().isVrModePackageEnabled(component);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/**
* @hide
*/
+ public static boolean isSystemReady() {
+ if (!sSystemReady) {
+ if (ActivityThread.isSystem()) {
+ sSystemReady =
+ LocalServices.getService(ActivityManagerInternal.class).isSystemReady();
+ } else {
+ // Since this is being called from outside system server, system should be
+ // ready by now.
+ sSystemReady = true;
+ }
+ }
+ return sSystemReady;
+ }
+
+ /**
+ * @hide
+ */
public static void broadcastStickyIntent(Intent intent, int userId) {
broadcastStickyIntent(intent, AppOpsManager.OP_NONE, userId);
}
*/
public void setWatchHeapLimit(long pssSize) {
try {
- ActivityManagerNative.getDefault().setDumpHeapDebugLimit(null, 0, pssSize,
+ getService().setDumpHeapDebugLimit(null, 0, pssSize,
mContext.getPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
*/
public void clearWatchHeapLimit() {
try {
- ActivityManagerNative.getDefault().setDumpHeapDebugLimit(null, 0, 0, null);
+ getService().setDumpHeapDebugLimit(null, 0, 0, null);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public void startLockTaskMode(int taskId) {
try {
- ActivityManagerNative.getDefault().startLockTaskModeById(taskId);
+ getService().startLockTaskModeById(taskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public void stopLockTaskMode() {
try {
- ActivityManagerNative.getDefault().stopLockTaskMode();
+ getService().stopLockTaskMode();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public int getLockTaskModeState() {
try {
- return ActivityManagerNative.getDefault().getLockTaskModeState();
+ return getService().getLockTaskModeState();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public static void setVrThread(int tid) {
try {
- ActivityManagerNative.getDefault().setVrThread(tid);
+ getService().setVrThread(tid);
} catch (RemoteException e) {
// pass
}
package android.app;
import android.content.Intent;
-import android.os.Debug;
import android.os.IBinder;
-import android.util.Log;
-
-import com.android.server.LocalServices;
/**
* {@hide}
*/
@Deprecated
public abstract class ActivityManagerNative {
- private final static String TAG = "ActivityManagerNative";
-
/**
* Cast a Binder object into an activity manager interface, generating
* a proxy if needed.
* @deprecated use ActivityManagerInternal.isSystemReady instead.
*/
static public boolean isSystemReady() {
- if (!sSystemReady) {
- if (ActivityThread.isSystem()) {
- sSystemReady =
- LocalServices.getService(ActivityManagerInternal.class).isSystemReady();
- } else {
- // Since this is being called from outside system server, system should be
- // ready by now.
- sSystemReady = true;
- }
- }
- return sSystemReady;
+ return ActivityManager.isSystemReady();
}
- static volatile boolean sSystemReady = false;
-
/**
* @deprecated use ActivityManager.broadcastStickyIntent instead.
*/
}
if (a != null) {
mNewActivities = null;
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
ActivityClientRecord prev;
do {
if (localLOGV) Slog.v(
private Context createBaseContextForActivity(ActivityClientRecord r, final Activity activity) {
int displayId = Display.DEFAULT_DISPLAY;
try {
- displayId = ActivityManagerNative.getDefault().getActivityDisplayId(r.token);
+ displayId = ActivityManager.getService().getActivityDisplayId(r.token);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
} else {
// If there was an error, for any reason, tell the activity manager to stop us.
try {
- ActivityManagerNative.getDefault()
+ ActivityManager.getService()
.finishActivity(r.token, Activity.RESULT_CANCELED, null,
Activity.DONT_FINISH_TASK_WITH_ACTIVITY);
} catch (RemoteException ex) {
}
}
try {
- ActivityManagerNative.getDefault().reportSizeConfigurations(r.token,
+ ActivityManager.getService().reportSizeConfigurations(r.token,
horizontal.copyKeys(), vertical.copyKeys(), smallest.copyKeys());
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
structure = new AssistStructure();
}
mLastAssistStructures.add(new WeakReference<>(structure));
- IActivityManager mgr = ActivityManagerNative.getDefault();
+ IActivityManager mgr = ActivityManager.getService();
try {
mgr.reportAssistContextExtras(cmd.requestToken, data, structure, content, referrer);
} catch (RemoteException e) {
}
}
try {
- ActivityManagerNative.getDefault().backgroundResourcesReleased(token);
+ ActivityManager.getService().backgroundResourcesReleased(token);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
LoadedApk packageInfo = getPackageInfoNoCheck(
data.info.applicationInfo, data.compatInfo);
- IActivityManager mgr = ActivityManagerNative.getDefault();
+ IActivityManager mgr = ActivityManager.getService();
BroadcastReceiver receiver;
try {
// tell the OS that we're live now
try {
- ActivityManagerNative.getDefault().backupAgentCreated(packageName, binder);
+ ActivityManager.getService().backupAgentCreated(packageName, binder);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
Application app = packageInfo.makeApplication(false, mInstrumentation);
service.attach(context, this, data.info.name, data.token, app,
- ActivityManagerNative.getDefault());
+ ActivityManager.getService());
service.onCreate();
mServices.put(data.token, service);
try {
- ActivityManagerNative.getDefault().serviceDoneExecuting(
+ ActivityManager.getService().serviceDoneExecuting(
data.token, SERVICE_DONE_EXECUTING_ANON, 0, 0);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
try {
if (!data.rebind) {
IBinder binder = s.onBind(data.intent);
- ActivityManagerNative.getDefault().publishService(
+ ActivityManager.getService().publishService(
data.token, data.intent, binder);
} else {
s.onRebind(data.intent);
- ActivityManagerNative.getDefault().serviceDoneExecuting(
+ ActivityManager.getService().serviceDoneExecuting(
data.token, SERVICE_DONE_EXECUTING_ANON, 0, 0);
}
ensureJitEnabled();
boolean doRebind = s.onUnbind(data.intent);
try {
if (doRebind) {
- ActivityManagerNative.getDefault().unbindFinished(
+ ActivityManager.getService().unbindFinished(
data.token, data.intent, doRebind);
} else {
- ActivityManagerNative.getDefault().serviceDoneExecuting(
+ ActivityManager.getService().serviceDoneExecuting(
data.token, SERVICE_DONE_EXECUTING_ANON, 0, 0);
}
} catch (RemoteException ex) {
QueuedWork.waitToFinish();
try {
- ActivityManagerNative.getDefault().serviceDoneExecuting(
+ ActivityManager.getService().serviceDoneExecuting(
data.token, SERVICE_DONE_EXECUTING_START, data.startId, res);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
QueuedWork.waitToFinish();
try {
- ActivityManagerNative.getDefault().serviceDoneExecuting(
+ ActivityManager.getService().serviceDoneExecuting(
token, SERVICE_DONE_EXECUTING_STOP, 0, 0);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
boolean willBeVisible = !a.mStartedActivity;
if (!willBeVisible) {
try {
- willBeVisible = ActivityManagerNative.getDefault().willActivityBeVisible(
+ willBeVisible = ActivityManager.getService().willActivityBeVisible(
a.getActivityToken());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
// Tell the activity manager we have resumed.
if (reallyResume) {
try {
- ActivityManagerNative.getDefault().activityResumed(token);
+ ActivityManager.getService().activityResumed(token);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
// If an exception was thrown when trying to resume, then
// just end this activity.
try {
- ActivityManagerNative.getDefault()
+ ActivityManager.getService()
.finishActivity(token, Activity.RESULT_CANCELED, null,
Activity.DONT_FINISH_TASK_WITH_ACTIVITY);
} catch (RemoteException ex) {
// Tell the activity manager we have paused.
if (!dontReport) {
try {
- ActivityManagerNative.getDefault().activityPaused(token);
+ ActivityManager.getService().activityPaused(token);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
// Tell activity manager we have been stopped.
try {
if (DEBUG_MEMORY_TRIM) Slog.v(TAG, "Reporting activity stopped: " + activity);
- ActivityManagerNative.getDefault().activityStopped(
+ ActivityManager.getService().activityStopped(
activity.token, state, persistentState, description);
} catch (RemoteException ex) {
if (ex instanceof TransactionTooLargeException
// Tell activity manager we slept.
try {
- ActivityManagerNative.getDefault().activitySlept(r.token);
+ ActivityManager.getService().activitySlept(r.token);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
if (finishing) {
try {
- ActivityManagerNative.getDefault().activityDestroyed(token);
+ ActivityManager.getService().activityDestroyed(token);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
// For each relaunch request, activity manager expects an answer
if (!r.onlyLocalRequest && fromServer) {
try {
- ActivityManagerNative.getDefault().activityRelaunched(token);
+ ActivityManager.getService().activityRelaunched(token);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
if (r == null) {
if (!tmp.onlyLocalRequest) {
try {
- ActivityManagerNative.getDefault().activityRelaunched(tmp.token);
+ ActivityManager.getService().activityRelaunched(tmp.token);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
if (!tmp.onlyLocalRequest) {
try {
- ActivityManagerNative.getDefault().activityRelaunched(r.token);
+ ActivityManager.getService().activityRelaunched(r.token);
if (r.window != null) {
r.window.reportActivityRelaunched();
}
Debug.dumpNativeHeap(dhd.fd.getFileDescriptor());
}
try {
- ActivityManagerNative.getDefault().dumpHeapFinished(dhd.path);
+ ActivityManager.getService().dumpHeapFinished(dhd.path);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
Slog.w(TAG, "Application " + data.info.getPackageName()
+ " is waiting for the debugger on port 8100...");
- IActivityManager mgr = ActivityManagerNative.getDefault();
+ IActivityManager mgr = ActivityManager.getService();
try {
mgr.showWaitingForDebugger(mAppThread, true);
} catch (RemoteException ex) {
}
/*package*/ final void finishInstrumentation(int resultCode, Bundle results) {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
if (mProfiler.profileFile != null && mProfiler.handlingProfiling
&& mProfiler.profileFd == null) {
Debug.stopMethodTracing();
}
- //Slog.i(TAG, "am: " + ActivityManagerNative.getDefault()
+ //Slog.i(TAG, "am: " + ActivityManager.getService()
// + ", app thr: " + mAppThread);
try {
am.finishInstrumentation(mAppThread, resultCode, results);
}
try {
- ActivityManagerNative.getDefault().publishContentProviders(
+ ActivityManager.getService().publishContentProviders(
getApplicationThread(), results);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
// be re-entrant in the case where the provider is in the same process.
ContentProviderHolder holder = null;
try {
- holder = ActivityManagerNative.getDefault().getContentProvider(
+ holder = ActivityManager.getService().getContentProvider(
getApplicationThread(), auth, userId, stable);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
+ prc.holder.info.name + ": unstableDelta="
+ unstableDelta);
}
- ActivityManagerNative.getDefault().refContentProvider(
+ ActivityManager.getService().refContentProvider(
prc.holder.connection, 1, unstableDelta);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
Slog.v(TAG, "incProviderRef: Now unstable - "
+ prc.holder.info.name);
}
- ActivityManagerNative.getDefault().refContentProvider(
+ ActivityManager.getService().refContentProvider(
prc.holder.connection, 0, 1);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
Slog.v(TAG, "releaseProvider: No longer stable w/lastRef="
+ lastRef + " - " + prc.holder.info.name);
}
- ActivityManagerNative.getDefault().refContentProvider(
+ ActivityManager.getService().refContentProvider(
prc.holder.connection, -1, lastRef ? 1 : 0);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
Slog.v(TAG, "releaseProvider: No longer unstable - "
+ prc.holder.info.name);
}
- ActivityManagerNative.getDefault().refContentProvider(
+ ActivityManager.getService().refContentProvider(
prc.holder.connection, 0, -1);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
try {
if (DEBUG_PROVIDER) {
- Slog.v(TAG, "removeProvider: Invoking ActivityManagerNative."
+ Slog.v(TAG, "removeProvider: Invoking ActivityManagerService."
+ "removeContentProvider(" + prc.holder.info.name + ")");
}
- ActivityManagerNative.getDefault().removeContentProvider(
+ ActivityManager.getService().removeContentProvider(
prc.holder.connection, false);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
// it knows it is dead (so we don't race with its death
// notification).
try {
- ActivityManagerNative.getDefault().unstableProviderDied(
+ ActivityManager.getService().unstableProviderDied(
prc.holder.connection);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
ProviderRefCount prc = mProviderRefCountMap.get(provider);
if (prc != null) {
try {
- ActivityManagerNative.getDefault()
+ ActivityManager.getService()
.appNotRespondingViaProvider(prc.holder.connection);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
if (!noReleaseNeeded) {
incProviderRefLocked(prc, stable);
try {
- ActivityManagerNative.getDefault().removeContentProvider(
+ ActivityManager.getService().removeContentProvider(
holder.connection, stable);
} catch (RemoteException e) {
//do nothing content provider object is dead any way
android.ddm.DdmHandleAppName.setAppName("<pre-initialized>",
UserHandle.myUserId());
RuntimeInit.setApplicationObject(mAppThread.asBinder());
- final IActivityManager mgr = ActivityManagerNative.getDefault();
+ final IActivityManager mgr = ActivityManager.getService();
try {
mgr.attachApplication(mAppThread);
} catch (RemoteException ex) {
try {
mActivityContainer = new ActivityContainerWrapper(
- ActivityManagerNative.getDefault().createVirtualActivityContainer(
+ ActivityManager.getService().createVirtualActivityContainer(
mActivity.getActivityToken(), new ActivityContainerCallback(this)));
} catch (RemoteException e) {
throw new RuntimeException("ActivityView: Unable to create ActivityContainer. "
};
ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
try {
- ActivityManagerNative.getDefault().registerProcessObserver(mProcessObserver);
+ ActivityManager.getService().registerProcessObserver(mProcessObserver);
} catch (RemoteException e) {
}
List<ActivityManager.RunningAppProcessInfo> apps = am.getRunningAppProcesses();
@Override
public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) {
try {
- ActivityManagerNative.getDefault().startActivityAsUser(
+ ActivityManager.getService().startActivityAsUser(
mMainThread.getApplicationThread(), getBasePackageName(), intent,
intent.resolveTypeIfNeeded(getContentResolver()),
null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options,
fillInIntent.prepareToLeaveProcess(this);
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
}
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
fillInIntent, resolvedType, null, null,
0, flagsMask, flagsValues, options);
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, false,
getUserId());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE,
null, false, false, getUserId());
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE,
null, false, false, getUserId());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE,
options, false, false, getUserId());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false,
getUserId());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE,
null, true, false, getUserId());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, rd,
initialCode, initialData, initialExtras, receiverPermissions, appOp,
options, true, false, getUserId());
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(),
+ ActivityManager.getService().broadcastIntent(mMainThread.getApplicationThread(),
intent, resolvedType, null, Activity.RESULT_OK, null, null, null,
AppOpsManager.OP_NONE, null, false, false, user.getIdentifier());
} catch (RemoteException e) {
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE,
options, false, false, user.getIdentifier());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false,
user.getIdentifier());
: new String[] {receiverPermission};
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, rd,
initialCode, initialData, initialExtras, receiverPermissions,
appOp, options, true, false, user.getIdentifier());
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, true,
getUserId());
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, rd,
initialCode, initialData, initialExtras, null,
AppOpsManager.OP_NONE, null, true, true, getUserId());
}
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().unbroadcastIntent(
+ ActivityManager.getService().unbroadcastIntent(
mMainThread.getApplicationThread(), intent, getUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, true,
user.getIdentifier());
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, null,
Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, options, false, true,
user.getIdentifier());
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().broadcastIntent(
+ ActivityManager.getService().broadcastIntent(
mMainThread.getApplicationThread(), intent, resolvedType, rd,
initialCode, initialData, initialExtras, null,
AppOpsManager.OP_NONE, null, true, true, user.getIdentifier());
}
try {
intent.prepareToLeaveProcess(this);
- ActivityManagerNative.getDefault().unbroadcastIntent(
+ ActivityManager.getService().unbroadcastIntent(
mMainThread.getApplicationThread(), intent, user.getIdentifier());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
try {
- final Intent intent = ActivityManagerNative.getDefault().registerReceiver(
+ final Intent intent = ActivityManager.getService().registerReceiver(
mMainThread.getApplicationThread(), mBasePackageName,
rd, filter, broadcastPermission, userId);
if (intent != null) {
IIntentReceiver rd = mPackageInfo.forgetReceiverDispatcher(
getOuterContext(), receiver);
try {
- ActivityManagerNative.getDefault().unregisterReceiver(rd);
+ ActivityManager.getService().unregisterReceiver(rd);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
try {
validateServiceIntent(service);
service.prepareToLeaveProcess(this);
- ComponentName cn = ActivityManagerNative.getDefault().startService(
+ ComponentName cn = ActivityManager.getService().startService(
mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(
getContentResolver()), getOpPackageName(), user.getIdentifier());
if (cn != null) {
try {
validateServiceIntent(service);
service.prepareToLeaveProcess(this);
- int res = ActivityManagerNative.getDefault().stopService(
+ int res = ActivityManager.getService().stopService(
mMainThread.getApplicationThread(), service,
service.resolveTypeIfNeeded(getContentResolver()), user.getIdentifier());
if (res < 0) {
flags |= BIND_WAIVE_PRIORITY;
}
service.prepareToLeaveProcess(this);
- int res = ActivityManagerNative.getDefault().bindService(
+ int res = ActivityManager.getService().bindService(
mMainThread.getApplicationThread(), getActivityToken(), service,
service.resolveTypeIfNeeded(getContentResolver()),
sd, flags, getOpPackageName(), user.getIdentifier());
IServiceConnection sd = mPackageInfo.forgetServiceDispatcher(
getOuterContext(), conn);
try {
- ActivityManagerNative.getDefault().unbindService(sd);
+ ActivityManager.getService().unbindService(sd);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
if (arguments != null) {
arguments.setAllowFds(false);
}
- return ActivityManagerNative.getDefault().startInstrumentation(
+ return ActivityManager.getService().startInstrumentation(
className, profileFile, 0, arguments, null, null, getUserId(),
null /* ABI override */);
} catch (RemoteException e) {
}
try {
- return ActivityManagerNative.getDefault().checkPermission(
+ return ActivityManager.getService().checkPermission(
permission, pid, uid);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
try {
- return ActivityManagerNative.getDefault().checkPermissionWithToken(
+ return ActivityManager.getService().checkPermissionWithToken(
permission, pid, uid, callerToken);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@Override
public void grantUriPermission(String toPackage, Uri uri, int modeFlags) {
try {
- ActivityManagerNative.getDefault().grantUriPermission(
+ ActivityManager.getService().grantUriPermission(
mMainThread.getApplicationThread(), toPackage,
ContentProvider.getUriWithoutUserId(uri), modeFlags, resolveUserId(uri));
} catch (RemoteException e) {
@Override
public void revokeUriPermission(Uri uri, int modeFlags) {
try {
- ActivityManagerNative.getDefault().revokeUriPermission(
+ ActivityManager.getService().revokeUriPermission(
mMainThread.getApplicationThread(),
ContentProvider.getUriWithoutUserId(uri), modeFlags, resolveUserId(uri));
} catch (RemoteException e) {
@Override
public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags) {
try {
- return ActivityManagerNative.getDefault().checkUriPermission(
+ return ActivityManager.getService().checkUriPermission(
ContentProvider.getUriWithoutUserId(uri), pid, uid, modeFlags,
resolveUserId(uri), null);
} catch (RemoteException e) {
@Override
public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags, IBinder callerToken) {
try {
- return ActivityManagerNative.getDefault().checkUriPermission(
+ return ActivityManager.getService().checkUriPermission(
ContentProvider.getUriWithoutUserId(uri), pid, uid, modeFlags,
resolveUserId(uri), callerToken);
} catch (RemoteException e) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(who);
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivity(whoThread, who.getBasePackageName(), intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
token, target != null ? target.mEmbeddedID : null,
intents[i].prepareToLeaveProcess(who);
resolvedTypes[i] = intents[i].resolveTypeIfNeeded(who.getContentResolver());
}
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivities(whoThread, who.getBasePackageName(), intents, resolvedTypes,
token, options, userId);
checkStartActivityResult(result, intents[0]);
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(who);
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivity(whoThread, who.getBasePackageName(), intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
token, target, requestCode, 0, null, options);
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(who);
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivityAsUser(whoThread, who.getBasePackageName(), intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
token, target != null ? target.mEmbeddedID : null,
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(who);
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivityAsCaller(whoThread, who.getBasePackageName(), intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
token, target != null ? target.mEmbeddedID : null,
if (mRegisterPackage) {
try {
- ActivityManagerNative.getDefault().addPackageDependency(mPackageName);
+ ActivityManager.getService().addPackageDependency(mPackageName);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
StrictMode.onIntentReceiverLeaked(leak);
}
try {
- ActivityManagerNative.getDefault().unregisterReceiver(
+ ActivityManager.getService().unregisterReceiver(
rd.getIIntentReceiver());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
StrictMode.onServiceConnectionLeaked(leak);
}
try {
- ActivityManagerNative.getDefault().unbindService(
+ ActivityManager.getService().unbindService(
sd.getIServiceConnection());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
// behalf so that the system's broadcast sequence can continue.
if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG,
"Finishing broadcast to unregistered receiver");
- IActivityManager mgr = ActivityManagerNative.getDefault();
+ IActivityManager mgr = ActivityManager.getService();
try {
if (extras != null) {
extras.setAllowFds(false);
+ " mOrderedHint=" + ordered);
}
- final IActivityManager mgr = ActivityManagerNative.getDefault();
+ final IActivityManager mgr = ActivityManager.getService();
final Intent intent = mCurIntent;
if (intent == null) {
Log.wtf(TAG, "Null intent being dispatched, mDispatched=" + mDispatched);
}
if (intent == null || !mActivityThread.post(args)) {
if (mRegistered && ordered) {
- IActivityManager mgr = ActivityManagerNative.getDefault();
+ IActivityManager mgr = ActivityManager.getService();
if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG,
"Finishing sync broadcast to " + mReceiver);
args.sendFinished(mgr);
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(context);
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
null, null, requestCode, new Intent[] { intent },
resolvedType != null ? new String[] { resolvedType } : null,
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(context);
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
null, null, requestCode, new Intent[] { intent },
resolvedType != null ? new String[] { resolvedType } : null,
}
try {
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
null, null, requestCode, intents, resolvedTypes, flags, options,
UserHandle.myUserId());
}
try {
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
null, null, requestCode, intents, resolvedTypes,
flags, options, user.getIdentifier());
try {
intent.prepareToLeaveProcess(context);
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_BROADCAST, packageName,
null, null, requestCode, new Intent[] { intent },
resolvedType != null ? new String[] { resolvedType } : null,
try {
intent.prepareToLeaveProcess(context);
IIntentSender target =
- ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.getService().getIntentSender(
ActivityManager.INTENT_SENDER_SERVICE, packageName,
null, null, requestCode, new Intent[] { intent },
resolvedType != null ? new String[] { resolvedType } : null,
*/
public void cancel() {
try {
- ActivityManagerNative.getDefault().cancelIntentSender(mTarget);
+ ActivityManager.getService().cancelIntentSender(mTarget);
} catch (RemoteException e) {
}
}
String resolvedType = intent != null ?
intent.resolveTypeIfNeeded(context.getContentResolver())
: null;
- int res = ActivityManagerNative.getDefault().sendIntentSender(
+ int res = ActivityManager.getService().sendIntentSender(
mTarget, code, intent, resolvedType,
onFinished != null
? new FinishedDispatcher(this, onFinished, handler)
@Deprecated
public String getTargetPackage() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getPackageForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
@Nullable
public String getCreatorPackage() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getPackageForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public int getCreatorUid() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getUidForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
@Nullable
public UserHandle getCreatorUserHandle() {
try {
- int uid = ActivityManagerNative.getDefault()
+ int uid = ActivityManager.getService()
.getUidForIntentSender(mTarget);
return uid > 0 ? new UserHandle(UserHandle.getUserId(uid)) : null;
} catch (RemoteException e) {
*/
public boolean isTargetedToPackage() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.isIntentSenderTargetedToPackage(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public boolean isActivity() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.isIntentSenderAnActivity(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public Intent getIntent() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getIntentForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public String getTag(String prefix) {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getTagForIntentSender(mTarget, prefix);
} catch (RemoteException e) {
// Should never happen.
try {
Intent intent = new Intent(Intent.ACTION_ASSIST);
if (inclContext) {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
Bundle extras = am.getAssistContextExtras(ActivityManager.ASSIST_CONTEXT_BASIC);
if (extras != null) {
intent.replaceExtras(extras);
throwIfNotConnectedLocked();
}
try {
- ActivityManagerNative.getDefault().setUserIsMonkey(enable);
+ ActivityManager.getService().setUserIsMonkey(enable);
} catch (RemoteException re) {
Log.e(LOG_TAG, "Error while setting run as monkey!", re);
}
package android.content;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.IActivityManager;
import android.app.QueuedWork;
*/
public final void finish() {
if (mType == TYPE_COMPONENT) {
- final IActivityManager mgr = ActivityManagerNative.getDefault();
+ final IActivityManager mgr = ActivityManager.getService();
if (QueuedWork.hasPendingWork()) {
// If this is a broadcast component, we need to make sure any
// queued work is complete before telling AM we are done, so
} else if (mOrderedHint && mType != TYPE_UNREGISTERED) {
if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG,
"Finishing broadcast to " + mToken);
- final IActivityManager mgr = ActivityManagerNative.getDefault();
+ final IActivityManager mgr = ActivityManager.getService();
sendFinished(mgr);
}
}
* Context#startService(Intent)} for more information.
*/
public IBinder peekService(Context myContext, Intent service) {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
IBinder binder = null;
try {
service.prepareToLeaveProcess(myContext);
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.annotation.UserIdInt;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.content.pm.PackageManager.NameNotFoundException;
}
try {
- String type = ActivityManagerNative.getDefault().getProviderMimeType(
+ String type = ActivityManager.getService().getProviderMimeType(
ContentProvider.getUriWithoutUserId(url), resolveUserId(url));
return type;
} catch (RemoteException e) {
@Intent.AccessUriMode int modeFlags) {
Preconditions.checkNotNull(uri, "uri");
try {
- ActivityManagerNative.getDefault().takePersistableUriPermission(
+ ActivityManager.getService().takePersistableUriPermission(
ContentProvider.getUriWithoutUserId(uri), modeFlags, resolveUserId(uri));
} catch (RemoteException e) {
}
@Intent.AccessUriMode int modeFlags) {
Preconditions.checkNotNull(uri, "uri");
try {
- ActivityManagerNative.getDefault().releasePersistableUriPermission(
+ ActivityManager.getService().releasePersistableUriPermission(
ContentProvider.getUriWithoutUserId(uri), modeFlags, resolveUserId(uri));
} catch (RemoteException e) {
}
*/
public @NonNull List<UriPermission> getPersistedUriPermissions() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getPersistedUriPermissions(mPackageName, true).getList();
} catch (RemoteException e) {
throw new RuntimeException("Activity manager has died", e);
*/
public @NonNull List<UriPermission> getOutgoingPersistedUriPermissions() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getPersistedUriPermissions(mPackageName, false).getList();
} catch (RemoteException e) {
throw new RuntimeException("Activity manager has died", e);
package android.content;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.Handler;
String resolvedType = intent != null ?
intent.resolveTypeIfNeeded(context.getContentResolver())
: null;
- int res = ActivityManagerNative.getDefault().sendIntentSender(mTarget,
+ int res = ActivityManager.getService().sendIntentSender(mTarget,
code, intent, resolvedType,
onFinished != null
? new FinishedDispatcher(this, onFinished, handler)
@Deprecated
public String getTargetPackage() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getPackageForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public String getCreatorPackage() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getPackageForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public int getCreatorUid() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getUidForIntentSender(mTarget);
} catch (RemoteException e) {
// Should never happen.
*/
public UserHandle getCreatorUserHandle() {
try {
- int uid = ActivityManagerNative.getDefault()
+ int uid = ActivityManager.getService()
.getUidForIntentSender(mTarget);
return uid > 0 ? new UserHandle(UserHandle.getUserId(uid)) : null;
} catch (RemoteException e) {
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.Context;
import android.os.Binder;
import android.os.CancellationSignal;
private int getCurrentUserId() {
try {
- return ActivityManagerNative.getDefault().getCurrentUser().id;
+ return ActivityManager.getService().getCurrentUser().id;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
import android.animation.ValueAnimator;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityThread;
import android.app.ApplicationErrorReport;
import android.app.IActivityManager;
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
try {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
if (am == null) {
Log.d(TAG, "No activity manager; failed to Dropbox violation.");
} else {
// We restore the current policy below, in the finally block.
setThreadPolicyMask(0);
- ActivityManagerNative.getDefault().handleApplicationStrictModeViolation(
+ ActivityManager.getService().handleApplicationStrictModeViolation(
RuntimeInit.getApplicationObject(),
violationMaskSubset,
info);
import android.annotation.WorkerThread;
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
public boolean isUserRunning(int userId) {
// TODO Switch to using UMS internal isUserRunning
try {
- return ActivityManagerNative.getDefault().isUserRunning(userId, 0);
+ return ActivityManager.getService().isUserRunning(userId, 0);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
public boolean isUserRunningOrStopping(UserHandle user) {
try {
// TODO: reconcile stopped vs stopping?
- return ActivityManagerNative.getDefault().isUserRunning(
+ return ActivityManager.getService().isUserRunning(
user.getIdentifier(), ActivityManager.FLAG_OR_STOPPED);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
@Deprecated
public boolean isUserRunningAndLocked(UserHandle user) {
try {
- return ActivityManagerNative.getDefault().isUserRunning(
+ return ActivityManager.getService().isUserRunning(
user.getIdentifier(), ActivityManager.FLAG_AND_LOCKED);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
@Deprecated
public boolean isUserRunningAndUnlocked(UserHandle user) {
try {
- return ActivityManagerNative.getDefault().isUserRunning(
+ return ActivityManager.getService().isUserRunning(
user.getIdentifier(), ActivityManager.FLAG_AND_UNLOCKED);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
/** {@hide} */
public boolean isUserUnlocked(@UserIdInt int userId) {
try {
- return ActivityManagerNative.getDefault().isUserRunning(userId,
+ return ActivityManager.getService().isUserRunning(userId,
ActivityManager.FLAG_AND_UNLOCKED);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
import android.annotation.IntDef;
import android.annotation.NonNull;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
private static void initSched(Context context, long renderProxy) {
try {
int tid = nGetRenderThreadTid(renderProxy);
- ActivityManagerNative.getDefault().setRenderThread(tid);
+ ActivityManager.getService().setRenderThread(tid);
} catch (Throwable t) {
Log.w(LOG_TAG, "Failed to set scheduler for RenderThread", t);
}
import android.Manifest;
import android.animation.LayoutTransition;
import android.annotation.NonNull;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ResourcesManager;
import android.content.ClipData;
import android.content.ClipDescription;
private static int checkCallingPermission(String permission) {
try {
- return ActivityManagerNative.getDefault().checkPermission(
+ return ActivityManager.getService().checkPermission(
permission, Binder.getCallingPid(), Binder.getCallingUid());
} catch (RemoteException e) {
return PackageManager.PERMISSION_DENIED;
package android.webkit;
import android.annotation.SystemApi;
+import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.Application;
import android.content.Context;
// killed if the package info goes out-of-date.
Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "ActivityManager.addPackageDependency()");
try {
- ActivityManagerNative.getDefault().addPackageDependency(
+ ActivityManager.getService().addPackageDependency(
response.packageInfo.packageName);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW);
import com.android.internal.R;
import android.app.Activity;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.ApplicationInfo;
private OnClickListener mSwitchOldListener = new OnClickListener() {
public void onClick(View v) {
try {
- ActivityManagerNative.getDefault().moveTaskToFront(mCurTask, 0, null);
+ ActivityManager.getService().moveTaskToFront(mCurTask, 0, null);
} catch (RemoteException e) {
}
finish();
private OnClickListener mSwitchNewListener = new OnClickListener() {
public void onClick(View v) {
try {
- ActivityManagerNative.getDefault().finishHeavyWeightApp();
+ ActivityManager.getService().finishHeavyWeightApp();
} catch (RemoteException e) {
}
try {
import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
import android.app.Activity;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.app.admin.DevicePolicyManager;
int launchedFromUid = -1;
String launchedFromPackage = "?";
try {
- launchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(
+ launchedFromUid = ActivityManager.getService().getLaunchedFromUid(
getActivityToken());
- launchedFromPackage = ActivityManagerNative.getDefault().getLaunchedFromPackage(
+ launchedFromPackage = ActivityManager.getService().getLaunchedFromPackage(
getActivityToken());
} catch (RemoteException ignored) {
}
import com.android.internal.R;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.app.ListFragment;
import android.app.backup.BackupManager;
*/
public static void updateLocales(LocaleList locales) {
try {
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
final Configuration config = am.getConfiguration();
config.setLocales(locales);
*/
public static LocaleList getLocales() {
try {
- return ActivityManagerNative.getDefault()
+ return ActivityManager.getService()
.getConfiguration().getLocales();
} catch (RemoteException e) {
// If something went wrong
import com.android.internal.content.PackageMonitor;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.Context;
setProfileSwitchMessageId(intent.getContentUserHint());
try {
- mLaunchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(
+ mLaunchedFromUid = ActivityManager.getService().getLaunchedFromUid(
getActivityToken());
} catch (RemoteException e) {
mLaunchedFromUid = -1;
} catch (RuntimeException e) {
String launchedFromPackage;
try {
- launchedFromPackage = ActivityManagerNative.getDefault().getLaunchedFromPackage(
+ launchedFromPackage = ActivityManager.getService().getLaunchedFromPackage(
getActivityToken());
} catch (RemoteException e2) {
launchedFromPackage = "??";
package com.android.internal.os;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.ApplicationErrorReport;
import android.os.Build;
}
// Bring up crash dialog, wait for it to be dismissed
- ActivityManagerNative.getDefault().handleApplicationCrash(
+ ActivityManager.getService().handleApplicationCrash(
mApplicationObject, new ApplicationErrorReport.ParcelableCrashInfo(e));
} catch (Throwable t2) {
if (t2 instanceof DeadObjectException) {
*/
public static void wtf(String tag, Throwable t, boolean system) {
try {
- if (ActivityManagerNative.getDefault().handleApplicationWtf(
+ if (ActivityManager.getService().handleApplicationWtf(
mApplicationObject, tag, system,
new ApplicationErrorReport.ParcelableCrashInfo(t))) {
// The Activity Manager has already written us off -- now exit.
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static android.view.WindowManager.LayoutParams.*;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.SearchManager;
import android.os.UserHandle;
}
public static void sendCloseSystemWindows(Context context, String reason) {
- if (ActivityManagerNative.isSystemReady()) {
+ if (ActivityManager.isSystemReady()) {
try {
- ActivityManagerNative.getDefault().closeSystemDialogs(reason);
+ ActivityManager.getService().closeSystemDialogs(reason);
} catch (RemoteException e) {
}
}
import android.animation.RectEvaluator;
import android.animation.ValueAnimator;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.graphics.Rect;
import android.os.Handler;
public void resizeToBounds(Rect toBounds) {
mHandler.post(() -> {
if (mActivityManager == null) {
- mActivityManager = ActivityManagerNative.getDefault();
+ mActivityManager = ActivityManager.getService();
}
try {
mActivityManager.resizePinnedStack(toBounds, null /* tempPinnedTaskBounds */);
package android.app.activity;
import android.app.Activity;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public void testSetSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.getDefault().unbroadcastIntent(null, intent,
+ ActivityManager.getService().unbroadcastIntent(null, intent,
UserHandle.myUserId());
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
addIntermediate("finished-broadcast");
IntentFilter filter = new IntentFilter(LaunchpadActivity.BROADCAST_STICKY1);
public void testClearSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
- ActivityManagerNative.getDefault().unbroadcastIntent(
+ ActivityManager.getService().unbroadcastIntent(
null, new Intent(LaunchpadActivity.BROADCAST_STICKY1, null),
UserHandle.myUserId());
addIntermediate("finished-unbroadcast");
public void testReplaceSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
intent.putExtra("test", LaunchpadActivity.DATA_2);
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
addIntermediate("finished-broadcast");
IntentFilter filter = new IntentFilter(LaunchpadActivity.BROADCAST_STICKY1);
public void testReceiveSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
runLaunchpad(LaunchpadActivity.BROADCAST_STICKY1);
}
public void testReceive2Sticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
intent = new Intent(LaunchpadActivity.BROADCAST_STICKY2, null);
intent.putExtra("test", LaunchpadActivity.DATA_2);
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.myUserId());
runLaunchpad(LaunchpadActivity.BROADCAST_STICKY2);
}
package com.android.keyguard;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
// should be the equivalent to the old userActivity(EMERGENCY_CALL_TIMEOUT)
mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
try {
- ActivityManagerNative.getDefault().stopSystemLockTaskMode();
+ ActivityManager.getService().stopSystemLockTaskMode();
} catch (RemoteException e) {
Slog.w(LOG_TAG, "Failed to stop app pinning");
}
import static android.os.BatteryManager.EXTRA_STATUS;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.UserSwitchObserver;
try {
final int userId;
try {
- userId = ActivityManagerNative.getDefault().getCurrentUser().id;
+ userId = ActivityManager.getService().getCurrentUser().id;
} catch (RemoteException e) {
Log.e(TAG, "Failed to get current user id: ", e);
return;
mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionListener);
try {
- ActivityManagerNative.getDefault().registerUserSwitchObserver(
+ ActivityManager.getService().registerUserSwitchObserver(
new UserSwitchObserver() {
@Override
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
package com.android.providers.settings;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.app.backup.IBackupManager;
import android.content.ContentResolver;
if (loc == null) return; // Couldn't find the saved locale in this version of the software
try {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
Configuration config = am.getConfiguration();
config.locale = loc;
// indicate this isn't some passing default - the user wants this remembered
package com.android.providers.settings;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.IContentProvider;
import android.content.pm.PackageManager;
import android.database.Cursor;
if (mUser == UserHandle.USER_CURRENT) {
try {
- mUser = ActivityManagerNative.getDefault().getCurrentUser().id;
+ mUser = ActivityManager.getService().getCurrentUser().id;
} catch (RemoteException e) {
throw new RuntimeException("Failed in IPC", e);
}
package com.android.systemui;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
UserInfo currentUser;
try {
- currentUser = ActivityManagerNative.getDefault().getCurrentUser();
+ currentUser = ActivityManager.getService().getCurrentUser();
} catch (RemoteException e) {
return;
}
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
UserInfo currentUser;
try {
- currentUser = ActivityManagerNative.getDefault().getCurrentUser();
+ currentUser = ActivityManager.getService().getCurrentUser();
} catch (RemoteException e) {
Log.e(TAG, "Couldn't wipe session because ActivityManager is dead");
return;
try {
if (newGuest == null) {
Log.e(TAG, "Could not create new guest, switching back to system user");
- ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM);
+ ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM);
userManager.removeUser(currentUser.id);
WindowManagerGlobal.getWindowManagerService().lockNow(null /* options */);
return;
}
- ActivityManagerNative.getDefault().switchUser(newGuest.id);
+ ActivityManager.getService().switchUser(newGuest.id);
userManager.removeUser(currentUser.id);
} catch (RemoteException e) {
Log.e(TAG, "Couldn't wipe session because ActivityManager or WindowManager is dead");
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.SearchManager;
private void updateActivityLockScreenState() {
Trace.beginSection("KeyguardViewMediator#updateActivityLockScreenState");
try {
- ActivityManagerNative.getDefault().setLockScreenShown(mShowing);
+ ActivityManager.getService().setLockScreenShown(mShowing);
} catch (RemoteException e) {
}
Trace.endSection();
// Don't actually hide the Keyguard at the moment, wait for window
// manager until it tells us it's safe to do so with
// startKeyguardExitAnimation.
- ActivityManagerNative.getDefault().keyguardGoingAway(flags);
+ ActivityManager.getService().keyguardGoingAway(flags);
} catch (RemoteException e) {
Log.e(TAG, "Error while calling WindowManager", e);
}
package com.android.systemui.pip.phone;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.content.Context;
import android.view.IWindowManager;
*/
public void initialize(Context context) {
mContext = context;
- mActivityManager = ActivityManagerNative.getDefault();
+ mActivityManager = ActivityManager.getService();
mWindowManager = WindowManagerGlobal.getWindowManagerService();
mMenuController = new PipMenuActivityController(context, mActivityManager, mWindowManager);
package com.android.systemui.pip.tv;
+import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.StackInfo;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
mInitialized = true;
mContext = context;
- mActivityManager = ActivityManagerNative.getDefault();
+ mActivityManager = ActivityManager.getService();
mWindowManager = WindowManagerGlobal.getWindowManagerService();
SystemServicesProxy.getInstance(context).registerTaskStackListener(mTaskStackListener);
IntentFilter intentFilter = new IntentFilter();
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public void onClick(View v) {
if (v.getId() == R.id.screen_pinning_ok_button || mRequestWindow == v) {
try {
- ActivityManagerNative.getDefault().startSystemLockTaskMode(taskId);
+ ActivityManager.getService().startSystemLockTaskMode(taskId);
} catch (RemoteException e) {}
}
clearPrompt();
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.AppGlobals;
import android.app.IActivityManager;
/**
* Implementation of {@link android.app.ITaskStackListener} to listen task stack changes from
- * ActivityManagerNative.
+ * ActivityManagerService.
* This simply passes callbacks to listeners through {@link H}.
* */
private android.app.TaskStackListener mTaskStackListener = new android.app.TaskStackListener() {
private SystemServicesProxy(Context context) {
mAccm = AccessibilityManager.getInstance(context);
mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- mIam = ActivityManagerNative.getDefault();
+ mIam = ActivityManager.getService();
mPm = context.getPackageManager();
mIpm = AppGlobals.getPackageManager();
mAssistUtils = new AssistUtils(context);
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.content.ComponentName;
import android.content.Context;
private ShortcutKeyServiceProxy mShortcutKeyServiceProxy = new ShortcutKeyServiceProxy(this);
private IWindowManager mWindowManagerService = WindowManagerGlobal.getWindowManagerService();
- private IActivityManager mActivityManager = ActivityManagerNative.getDefault();
+ private IActivityManager mActivityManager = ActivityManager.getService();
protected final long META_MASK = ((long) KeyEvent.META_META_ON) << Integer.SIZE;
protected final long ALT_MASK = ((long) KeyEvent.META_ALT_ON) << Integer.SIZE;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.view.WindowManager.DOCKED_INVALID;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
mTmpRect5.set(mTempOtherInsetRect);
}
try {
- ActivityManagerNative.getDefault()
+ ActivityManager.getService()
.resizeDockedStack(mTmpRect1,
mTmpRect2.isEmpty() ? null : mTmpRect2,
mTmpRect3.isEmpty() ? null : mTmpRect3,
@Override
public void run() {
try {
- ActivityManagerNative.getDefault().moveTasksToFullscreenStack(
+ ActivityManager.getService().moveTasksToFullscreenStack(
DOCKED_STACK_ID, false /* onTop */);
} catch (RemoteException e) {
Log.w(TAG, "Failed to remove stack: " + e);
@Override
public void run() {
try {
- ActivityManagerNative.getDefault().resizeStack(
+ ActivityManager.getService().resizeStack(
DOCKED_STACK_ID, null, true, true, false, -1);
} catch (RemoteException e) {
Log.w(TAG, "Failed to resize stack: " + e);
@Override
public void run() {
try {
- ActivityManagerNative.getDefault().swapDockedAndFullscreenStack();
+ ActivityManager.getService().swapDockedAndFullscreenStack();
} catch (RemoteException e) {
Log.w(TAG, "Failed to resize stack: " + e);
}
import android.animation.AnimatorListenerAdapter;
import android.app.ActivityManager;
import android.app.ActivityManager.StackId;
-import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.KeyguardManager;
import android.app.Notification;
// the user switches to home. We know it is safe to do at this
// point, so make sure new activity switches are now allowed.
try {
- ActivityManagerNative.getDefault().resumeAppSwitches();
+ ActivityManager.getService().resumeAppSwitches();
} catch (RemoteException e) {
}
final boolean isActivity = pendingIntent.isActivity();
@Override
public boolean onDismiss() {
try {
- ActivityManagerNative.getDefault().resumeAppSwitches();
+ ActivityManager.getService().resumeAppSwitches();
} catch (RemoteException e) {
}
} else if (Intent.ACTION_USER_PRESENT.equals(action)) {
List<ActivityManager.RecentTaskInfo> recentTask = null;
try {
- recentTask = ActivityManagerNative.getDefault().getRecentTasks(1,
+ recentTask = ActivityManager.getService().getRecentTasks(1,
ActivityManager.RECENT_WITH_EXCLUDED
| ActivityManager.RECENT_INCLUDE_PROFILES,
mCurrentUserId).getList();
protected void sendCloseSystemWindows(String reason) {
try {
- ActivityManagerNative.getDefault().closeSystemDialogs(reason);
+ ActivityManager.getService().closeSystemDialogs(reason);
} catch (RemoteException e) {
}
}
// won't have permission to immediately start an activity after
// the user switches to home. We know it is safe to do at this
// point, so make sure new activity switches are now allowed.
- ActivityManagerNative.getDefault().resumeAppSwitches();
+ ActivityManager.getService().resumeAppSwitches();
} catch (RemoteException e) {
}
try {
// won't have permission to immediately start an activity after
// the user switches to home. We know it is safe to do at this
// point, so make sure new activity switches are now allowed.
- ActivityManagerNative.getDefault().resumeAppSwitches();
+ ActivityManager.getService().resumeAppSwitches();
} catch (RemoteException e) {
}
if (intent != null) {
&& mKeyguardManager.isDeviceLocked(userId)) {
boolean canBypass = false;
try {
- canBypass = ActivityManagerNative.getDefault()
+ canBypass = ActivityManager.getService()
.canBypassWorkChallenge(intent);
} catch (RemoteException e) {
}
Intent.EXTRA_INTENT,
callBackPendingIntent.getIntentSender());
try {
- ActivityManagerNative.getDefault().startConfirmDeviceCredentialIntent(newIntent);
+ ActivityManager.getService().startConfirmDeviceCredentialIntent(newIntent);
} catch (RemoteException ex) {
// ignore
}
package com.android.systemui.statusbar.car;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.content.BroadcastReceiver;
import android.content.Context;
private int startActivityWithOptions(Intent intent, Bundle options) {
int result = ActivityManager.START_CANCELED;
try {
- result = ActivityManagerNative.getDefault().startActivityAsUser(null /* caller */,
+ result = ActivityManager.getService().startActivityAsUser(null /* caller */,
mContext.getBasePackageName(),
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
import static android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
(DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm != null && mPhoneStatusBar != null) {
try {
- final int userId = ActivityManagerNative.getDefault().getCurrentUser().id;
+ final int userId = ActivityManager.getService().getCurrentUser().id;
final int disabledFlags = dpm.getKeyguardDisabledFeatures(null, userId);
final boolean disabledBecauseKeyguardSecure =
(disabledFlags & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0
o.setRotationAnimationHint(
WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS);
try {
- result = ActivityManagerNative.getDefault().startActivityAsUser(
+ result = ActivityManager.getService().startActivityAsUser(
null, getContext().getBasePackageName(),
intent,
intent.resolveTypeIfNeeded(getContext().getContentResolver()),
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.res.Configuration;
private boolean inLockTask() {
try {
- return ActivityManagerNative.getDefault().isInLockTaskMode();
+ return ActivityManager.getService().isInLockTaskMode();
} catch (RemoteException e) {
return false;
}
import android.animation.AnimatorListenerAdapter;
import android.annotation.NonNull;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.IActivityManager;
import android.app.Notification;
WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS);
}
try {
- result = ActivityManagerNative.getDefault().startActivityAsUser(
+ result = ActivityManager.getService().startActivityAsUser(
null, mContext.getBasePackageName(),
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
*/
private boolean handleLongPressBack() {
try {
- IActivityManager activityManager = ActivityManagerNative.getDefault();
+ IActivityManager activityManager = ActivityManager.getService();
if (activityManager.isInLockTaskMode()) {
activityManager.stopSystemLockTaskMode();
package com.android.systemui.statusbar.phone;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.AlarmManager.AlarmClockInfo;
import android.app.SynchronousUserSwitchObserver;
// listen for user / profile change.
try {
- ActivityManagerNative.getDefault().registerUserSwitchObserver(mUserSwitchListener, TAG);
+ ActivityManager.getService().registerUserSwitchObserver(mUserSwitchListener, TAG);
} catch (RemoteException e) {
// Ignore
}
UserInfo user = null;
if (userId == UserHandle.USER_CURRENT) {
try {
- user = ActivityManagerNative.getDefault().getCurrentUser();
+ user = ActivityManager.getService().getCurrentUser();
} catch (RemoteException e) {
// Ignore
}
package com.android.systemui.statusbar.phone;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
public StatusBarWindowManager(Context context) {
mContext = context;
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- mActivityManager = ActivityManagerNative.getDefault();
+ mActivityManager = ActivityManager.getService();
mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
mScreenBrightnessDoze = mContext.getResources().getInteger(
com.android.internal.R.integer.config_screenBrightnessDoze) / 255f;
package com.android.systemui.statusbar.policy;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
if (ContactsContract.Intents.ACTION_PROFILE_CHANGED.equals(action) ||
Intent.ACTION_USER_INFO_CHANGED.equals(action)) {
try {
- final int currentUser = ActivityManagerNative.getDefault().getCurrentUser().id;
+ final int currentUser = ActivityManager.getService().getCurrentUser().id;
final int changedUser =
intent.getIntExtra(Intent.EXTRA_USER_HANDLE, getSendingUserId());
if (changedUser == currentUser) {
Context currentUserContext;
UserInfo userInfo;
try {
- userInfo = ActivityManagerNative.getDefault().getCurrentUser();
+ userInfo = ActivityManager.getService().getCurrentUser();
currentUserContext = mContext.createPackageContextAsUser("android", 0,
new UserHandle(userInfo.id));
} catch (PackageManager.NameNotFoundException e) {
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
protected void switchToUserId(int id) {
try {
pauseRefreshUsers();
- ActivityManagerNative.getDefault().switchUser(id);
+ ActivityManager.getService().switchUser(id);
} catch (RemoteException e) {
Log.e(TAG, "Couldn't switch user.", e);
}
android.app.ActivityManager$StackId
android.app.ActivityManager$TaskDescription
android.app.ActivityManager$TaskDescription$1
-android.app.ActivityManagerNative
-android.app.ActivityManagerNative$1
-android.app.ActivityManagerProxy
android.app.ActivityOptions
android.app.ActivityThread
android.app.ActivityThread$1
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_BACKUP_IN_FOREGROUND;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.AppGlobals;
import android.app.ApplicationThreadConstants;
mContext = context;
mPackageManager = context.getPackageManager();
mPackageManagerBinder = AppGlobals.getPackageManager();
- mActivityManager = ActivityManagerNative.getDefault();
+ mActivityManager = ActivityManager.getService();
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.AppOpsManager;
import android.app.BroadcastOptions;
for (int i = alarms.size()-1; i >= 0; i--) {
Alarm alarm = alarms.get(i);
try {
- if (alarm.uid == uid && ActivityManagerNative.getDefault().getAppStartMode(
+ if (alarm.uid == uid && ActivityManager.getService().getAppStartMode(
uid, alarm.packageName) == ActivityManager.APP_START_MODE_DISABLED) {
alarms.remove(i);
didRemove = true;
}
try {
- ActivityManagerNative.getDefault().registerUidObserver(new UidObserver(),
+ ActivityManager.getService().registerUidObserver(new UidObserver(),
ActivityManager.UID_OBSERVER_IDLE, ActivityManager.PROCESS_STATE_UNKNOWN, null);
} catch (RemoteException e) {
// ignored; both services live in system_server
operation, directReceiver, listenerTag, workSource, flags, alarmClock,
callingUid, callingPackage);
try {
- if (ActivityManagerNative.getDefault().getAppStartMode(callingUid, callingPackage)
+ if (ActivityManager.getService().getAppStartMode(callingUid, callingPackage)
== ActivityManager.APP_START_MODE_DISABLED) {
Slog.w(TAG, "Not setting alarm from " + callingUid + ":" + a
+ " -- package not allowed to start");
if (RECORD_ALARMS_IN_HISTORY) {
if (alarm.workSource != null && alarm.workSource.size() > 0) {
for (int wi=0; wi<alarm.workSource.size(); wi++) {
- ActivityManagerNative.noteAlarmStart(
+ ActivityManager.noteAlarmStart(
alarm.operation, alarm.workSource.get(wi), alarm.statsTag);
}
} else {
- ActivityManagerNative.noteAlarmStart(
+ ActivityManager.noteAlarmStart(
alarm.operation, alarm.uid, alarm.statsTag);
}
}
final int uid = (knownUid >= 0)
? knownUid
- : ActivityManagerNative.getDefault().getUidForIntentSender(pi.getTarget());
+ : ActivityManager.getService().getUidForIntentSender(pi.getTarget());
if (uid >= 0) {
mWakeLock.setWorkSource(new WorkSource(uid));
return;
if (RECORD_ALARMS_IN_HISTORY) {
if (inflight.mWorkSource != null && inflight.mWorkSource.size() > 0) {
for (int wi=0; wi<inflight.mWorkSource.size(); wi++) {
- ActivityManagerNative.noteAlarmFinish(
+ ActivityManager.noteAlarmFinish(
inflight.mPendingIntent, inflight.mWorkSource.get(wi), inflight.mTag);
}
} else {
- ActivityManagerNative.noteAlarmFinish(
+ ActivityManager.noteAlarmFinish(
inflight.mPendingIntent, inflight.mUid, inflight.mTag);
}
}
if (alarm.workSource != null && alarm.workSource.size() > 0) {
for (int wi=0; wi<alarm.workSource.size(); wi++) {
final String wsName = alarm.workSource.getName(wi);
- ActivityManagerNative.noteWakeupAlarm(
+ ActivityManager.noteWakeupAlarm(
alarm.operation, alarm.workSource.get(wi),
(wsName != null) ? wsName : alarm.packageName,
alarm.statsTag);
}
} else {
- ActivityManagerNative.noteWakeupAlarm(
+ ActivityManager.noteWakeupAlarm(
alarm.operation, alarm.uid, alarm.packageName, alarm.statsTag);
}
}
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
mHandler.post(new Runnable() {
@Override
public void run() {
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.USER_ALL);
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL);
}
});
}
package com.android.server;
import android.Manifest;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.AlarmManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,
"No permission to change device idle whitelist");
final int callingUid = Binder.getCallingUid();
- userId = ActivityManagerNative.getDefault().handleIncomingUser(
+ userId = ActivityManager.getService().handleIncomingUser(
Binder.getCallingPid(),
callingUid,
userId,
import android.annotation.NonNull;
import android.annotation.UserIdInt;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Binder;
}
try {
- mPermissionOwnerToken = ActivityManagerNative.getDefault()
+ mPermissionOwnerToken = ActivityManager.getService()
.newUriPermissionOwner("InputContentUriTokenHandler");
} catch (RemoteException e) {
e.rethrowFromSystemServer();
long origId = Binder.clearCallingIdentity();
try {
try {
- ActivityManagerNative.getDefault().grantUriPermissionFromOwner(
+ ActivityManager.getService().grantUriPermissionFromOwner(
permissionOwner, mSourceUid, mTargetPackage, mUri,
Intent.FLAG_GRANT_READ_URI_PERMISSION, mSourceUserId, mTargetUserId);
} catch (RemoteException e) {
return;
}
try {
- ActivityManagerNative.getDefault().revokeUriPermissionFromOwner(
+ ActivityManager.getService().revokeUriPermissionFromOwner(
mPermissionOwnerToken, mUri,
Intent.FLAG_GRANT_READ_URI_PERMISSION, mSourceUserId);
} catch (RemoteException e) {
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
+import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AlertDialog;
import android.app.AppGlobals;
import android.app.AppOpsManager;
mNotificationShown = false;
int userId = 0;
try {
- userId = ActivityManagerNative.getDefault().getCurrentUser().id;
+ userId = ActivityManager.getService().getCurrentUser().id;
} catch (RemoteException e) {
Slog.w(TAG, "Couldn't get current user ID; guessing it's 0", e);
}
package com.android.server;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationManager;
};
try {
- ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
+ ActivityManager.getService().unlockUser(userId, token, secret, listener);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
import static com.android.internal.widget.LockPatternUtils.stringToPattern;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.Context;
import android.os.Binder;
import android.os.Process;
@Override
public int onCommand(String cmd) {
try {
- mCurrentUserId = ActivityManagerNative.getDefault().getCurrentUser().id;
+ mCurrentUserId = ActivityManager.getService().getCurrentUser().id;
parseArgs();
if (!checkCredential()) {
import android.Manifest;
import android.annotation.Nullable;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.content.BroadcastReceiver;
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
user.id);
if (provider != null) {
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
try {
am.killApplication(provider.applicationInfo.packageName,
UserHandle.getAppId(provider.applicationInfo.uid),
Configuration config = new Configuration();
config.setLocale(locale);
try {
- ActivityManagerNative.getDefault().updatePersistentConfiguration(config);
+ ActivityManager.getService().updatePersistentConfiguration(config);
} catch (RemoteException e) {
Slog.e(TAG, "Error setting system locale from mount service", e);
}
import java.util.Calendar;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
// is really more than just mount, some day it should be renamed to be system
// idleer).
try {
- ActivityManagerNative.getDefault().performIdleMaintenance();
+ ActivityManager.getService().performIdleMaintenance();
} catch (RemoteException e) {
}
// The mount service will run an fstrim operation asynchronously
import static com.android.server.NetworkManagementService.NetdResponseCode.TtyListResult;
import static com.android.server.NetworkManagementSocketTagger.PROP_QTAGUID_ENABLED;
import android.annotation.NonNull;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.Context;
import android.net.ConnectivityManager;
final int uid = Integer.parseInt(cooked[1]);
final byte[] firstPacket = HexDump.hexStringToByteArray(cooked[2]);
try {
- ActivityManagerNative.getDefault().notifyCleartextNetwork(uid, firstPacket);
+ ActivityManager.getService().notifyCleartextNetwork(uid, firstPacket);
} catch (RemoteException ignored) {
}
break;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.AppGlobals;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
int userId = UserHandle.USER_SYSTEM;
try {
- userId = ActivityManagerNative.getDefault().getCurrentUser().id;
+ userId = ActivityManager.getService().getCurrentUser().id;
} catch (RemoteException e) {
Slog.w(TAG, "Couldn't get current user ID; guessing it's 0", e);
}
import android.annotation.Nullable;
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.IUiModeManager;
import android.app.Notification;
import android.app.NotificationManager;
mSetUiMode = mConfiguration.uiMode;
try {
- ActivityManagerNative.getDefault().updateConfiguration(mConfiguration);
+ ActivityManager.getService().updateConfiguration(mConfiguration);
} catch (RemoteException e) {
Slog.w(TAG, "Failure communicating with activity manager", e);
}
Intent homeIntent = buildHomeIntent(category);
if (Sandman.shouldStartDockApp(getContext(), homeIntent)) {
try {
- int result = ActivityManagerNative.getDefault().startActivityWithConfig(
+ int result = ActivityManager.getService().startActivityWithConfig(
null, null, homeIntent, null, null, null, 0, 0,
mConfiguration, null, UserHandle.USER_CURRENT);
if (result >= ActivityManager.START_SUCCESS) {
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.app.AppOpsManager;
public AccountAndUser[] getRunningAccounts() {
final int[] runningUserIds;
try {
- runningUserIds = ActivityManagerNative.getDefault().getRunningUserIds();
+ runningUserIds = ActivityManager.getService().getRunningUserIds();
} catch (RemoteException e) {
// Running in system_server; should never happen
throw new RuntimeException(e);
private int handleIncomingUser(int userId) {
try {
- return ActivityManagerNative.getDefault().handleIncomingUser(
+ return ActivityManager.getService().handleIncomingUser(
Binder.getCallingPid(), Binder.getCallingUid(), userId, true, true, "", null);
} catch (RemoteException re) {
// Shouldn't happen, local.
import android.Manifest;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.NotificationManager;
private int getCurrentUserId() {
final long ident = Binder.clearCallingIdentity();
try {
- UserInfo currentUser = ActivityManagerNative.getDefault().getCurrentUser();
+ UserInfo currentUser = ActivityManager.getService().getCurrentUser();
return currentUser.id;
} catch (RemoteException e) {
// Activity manager not running, nothing we can do assume user 0.
final long ident = Binder.clearCallingIdentity();
try {
- ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.USER_ALL);
+ ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
try {
final int uid = pkg.applicationInfo.uid;
- ActivityManagerNative.getDefault().killUid(UserHandle.getAppId(uid),
+ ActivityManager.getService().killUid(UserHandle.getAppId(uid),
UserHandle.getUserId(uid),
"killBackgroundUserProcessesWithAudioRecordPermission");
} catch (RemoteException e) {
package com.android.server.clipboard;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.IActivityManager;
public ClipboardService(Context context) {
super(context);
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
mPm = getContext().getPackageManager();
mUm = (IUserManager) ServiceManager.getService(Context.USER_SERVICE);
mAppOps = (AppOpsManager) getContext().getSystemService(Context.APP_OPS_SERVICE);
import android.accounts.Account;
import android.annotation.Nullable;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.job.JobInfo;
import android.content.BroadcastReceiver;
private int checkUriPermission(Uri uri, int pid, int uid, int modeFlags, int userHandle) {
try {
- return ActivityManagerNative.getDefault().checkUriPermission(
+ return ActivityManager.getService().checkUriPermission(
uri, pid, uid, modeFlags, userHandle, null);
} catch (RemoteException e) {
return PackageManager.PERMISSION_DENIED;
import android.accounts.AccountManager;
import android.accounts.AccountManagerInternal;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.Notification;
import android.app.NotificationManager;
final int owningUid = syncAdapterInfo.uid;
final String owningPackage = syncAdapterInfo.componentName.getPackageName();
try {
- if (ActivityManagerNative.getDefault().getAppStartMode(owningUid,
+ if (ActivityManager.getService().getAppStartMode(owningUid,
owningPackage) == ActivityManager.APP_START_MODE_DISABLED) {
Slog.w(TAG, "Not scheduling job " + syncAdapterInfo.uid + ":"
+ syncAdapterInfo.componentName
import android.Manifest;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
-import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.AppOpsManager;
import android.app.PendingIntent;
private boolean isForegroundActivity(int uid, int pid) {
try {
List<RunningAppProcessInfo> procs =
- ActivityManagerNative.getDefault().getRunningAppProcesses();
+ ActivityManager.getService().getRunningAppProcesses();
int N = procs.size();
for (int i = 0; i < N; i++) {
RunningAppProcessInfo proc = procs.get(i);
private void listenForUserSwitches() {
try {
- ActivityManagerNative.getDefault().registerUserSwitchObserver(
+ ActivityManager.getService().registerUserSwitchObserver(
new SynchronousUserSwitchObserver() {
@Override
public void onUserSwitching(int newUserId) throws RemoteException {
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.IUidObserver;
import android.app.job.JobInfo;
String tag) {
JobStatus jobStatus = JobStatus.createFromJobInfo(job, uId, packageName, userId, tag);
try {
- if (ActivityManagerNative.getDefault().getAppStartMode(uId,
+ if (ActivityManager.getService().getAppStartMode(uId,
job.getService().getPackageName()) == ActivityManager.APP_START_MODE_DISABLED) {
Slog.w(TAG, "Not scheduling job " + uId + ":" + job.toString()
+ " -- package not allowed to start");
mBroadcastReceiver, UserHandle.ALL, userFilter, null, null);
mPowerManager = (PowerManager)getContext().getSystemService(Context.POWER_SERVICE);
try {
- ActivityManagerNative.getDefault().registerUidObserver(mUidObserver,
+ ActivityManager.getService().registerUidObserver(mUidObserver,
ActivityManager.UID_OBSERVER_PROCSTATE | ActivityManager.UID_OBSERVER_GONE
| ActivityManager.UID_OBSERVER_IDLE, ActivityManager.PROCESS_STATE_UNKNOWN,
null);
public void process(JobStatus job) {
if (isReadyToBeExecutedLocked(job)) {
try {
- if (ActivityManagerNative.getDefault().getAppStartMode(job.getUid(),
+ if (ActivityManager.getService().getAppStartMode(job.getUid(),
job.getJob().getService().getPackageName())
== ActivityManager.APP_START_MODE_DISABLED) {
Slog.w(TAG, "Aborting job " + job.getUid() + ":"
int memLevel;
try {
- memLevel = ActivityManagerNative.getDefault().getMemoryTrimLevel();
+ memLevel = ActivityManager.getService().getMemoryTrimLevel();
} catch (RemoteException e) {
memLevel = ProcessStats.ADJ_MEM_FACTOR_NORMAL;
}
package com.android.server.media;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.Intent;
import android.media.IMediaResourceMonitor;
private String[] getPackageNamesFromPid(int pid) {
try {
for (ActivityManager.RunningAppProcessInfo proc :
- ActivityManagerNative.getDefault().getRunningAppProcesses()) {
+ ActivityManager.getService().getRunningAppProcesses()) {
if (proc.pid == pid) {
return proc.pkgList;
}
package com.android.server.media;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.media.session.MediaController.PlaybackInfo;
import android.media.session.PlaybackState;
import android.media.session.MediaSession;
private static boolean isFromMostRecentApp(MediaSessionRecord record) {
try {
List<ActivityManager.RecentTaskInfo> tasks =
- ActivityManagerNative.getDefault().getRecentTasks(1,
+ ActivityManager.getService().getRecentTasks(1,
ActivityManager.RECENT_IGNORE_HOME_STACK_TASKS |
ActivityManager.RECENT_IGNORE_UNAVAILABLE |
ActivityManager.RECENT_INCLUDE_PROFILES |
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.AutomaticZenRule;
REASON_DELEGATE_ERROR, null);
long ident = Binder.clearCallingIdentity();
try {
- ActivityManagerNative.getDefault().crashApplication(uid, initialPid, pkg,
+ ActivityManager.getService().crashApplication(uid, initialPid, pkg,
"Bad notification posted from package " + pkg
+ ": " + message);
} catch (RemoteException e) {
Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE,
DEFAULT_MAX_NOTIFICATION_ENQUEUE_RATE);
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
mAppOps = (AppOpsManager) getContext().getSystemService(Context.APP_OPS_SERVICE);
mVibrator = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE);
mAppUsageStats = LocalServices.getService(UsageStatsManagerInternal.class);
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.ResourcesManager;
import android.app.admin.IDevicePolicyManager;
private void killUid(int appId, int userId, String reason) {
final long identity = Binder.clearCallingIdentity();
try {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
if (am != null) {
try {
am.killUid(appId, userId, reason);
}
if (!isFirstBoot() && dexOptDialogShown) {
try {
- ActivityManagerNative.getDefault().showBootMessage(
+ ActivityManager.getService().showBootMessage(
mContext.getResources().getString(
R.string.android_upgrading_fstrim), true);
} catch (RemoteException e) {
if (showDialog) {
try {
- ActivityManagerNative.getDefault().showBootMessage(
+ ActivityManager.getService().showBootMessage(
mContext.getResources().getString(R.string.android_upgrading_apk,
numberOfPackagesVisited, numberOfPackagesToDexopt), true);
} catch (RemoteException e) {
// version of the application while the new one gets installed.
final long token = Binder.clearCallingIdentity();
try {
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
if (am != null) {
try {
am.killApplication(pkgName, appId, userId, reason);
@Override
public void run() {
try {
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
if (am == null) return;
final int[] resolvedUserIds;
if (userIds == null) {
}
Intent intent = new Intent(PackageManager.ACTION_CLEAN_EXTERNAL_STORAGE);
intent.setComponent(DEFAULT_CONTAINER_COMPONENT);
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
if (am != null) {
try {
am.startService(null, intent, null, mContext.getOpPackageName(),
if (!mUserManagerInternal.isUserRunning(userId)) {
return;
}
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
try {
// Deliver LOCKED_BOOT_COMPLETED first
Intent lockedBcIntent = new Intent(Intent.ACTION_LOCKED_BOOT_COMPLETED)
private void postPreferredActivityChangedBroadcast(int userId) {
mHandler.post(() -> {
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
if (am == null) {
return;
}
}
// kill any non-foreground processes so we restart them and
// grant/revoke the GID.
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
if (am != null) {
final long token = Binder.clearCallingIdentity();
try {
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.IUidObserver;
import android.app.usage.UsageStatsManagerInternal;
@VisibleForTesting
void injectRegisterUidObserver(IUidObserver observer, int which) {
try {
- ActivityManagerNative.getDefault().registerUidObserver(observer, which,
+ ActivityManager.getService().registerUidObserver(observer, which,
ActivityManager.PROCESS_STATE_UNKNOWN, null);
} catch (RemoteException shouldntHappen) {
}
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.IActivityManager;
import android.app.IStopUserCallback;
long identity = Binder.clearCallingIdentity();
try {
if (enableQuietMode) {
- ActivityManagerNative.getDefault().stopUser(userHandle, /* force */true, null);
+ ActivityManager.getService().stopUser(userHandle, /* force */true, null);
LocalServices.getService(ActivityManagerInternal.class)
.killForegroundAppsForUser(userHandle);
} else {
- ActivityManagerNative.getDefault().startUserInBackground(userHandle);
+ ActivityManager.getService().startUserInBackground(userHandle);
}
} catch (RemoteException e) {
Slog.e(LOG_TAG, "fail to start/stop user for quiet mode", e);
// First, invalidate all cached values.
mCachedEffectiveUserRestrictions.clear();
- // We don't want to call into ActivityManagerNative while taking a lock, so we'll call
+ // We don't want to call into ActivityManagerService while taking a lock, so we'll call
// it on a handler.
final Runnable r = new Runnable() {
@Override
// Then get the list of running users.
final int[] runningUsers;
try {
- runningUsers = ActivityManagerNative.getDefault().getRunningUserIds();
+ runningUsers = ActivityManager.getService().getRunningUserIds();
} catch (RemoteException e) {
- Log.w(LOG_TAG, "Unable to access ActivityManagerNative");
+ Log.w(LOG_TAG, "Unable to access ActivityManagerService");
return;
}
// Then re-calculate the effective restrictions and apply, only for running users.
if (DBG) Slog.i(LOG_TAG, "Stopping user " + userHandle);
int res;
try {
- res = ActivityManagerNative.getDefault().stopUser(userHandle, /* force= */ true,
+ res = ActivityManager.getService().stopUser(userHandle, /* force= */ true,
new IStopUserCallback.Stub() {
@Override
public void userStopped(int userId) {
}
private int runList(PrintWriter pw) throws RemoteException {
- final IActivityManager am = ActivityManagerNative.getDefault();
+ final IActivityManager am = ActivityManager.getService();
final List<UserInfo> users = getUsers(false);
if (users == null) {
pw.println("Error: couldn't get users");
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Binder;
int currentUser = ActivityManager.getCurrentUser();
if (currentUser != userId && userId != UserHandle.USER_SYSTEM) {
try {
- ActivityManagerNative.getDefault().stopUser(userId, false, null);
+ ActivityManager.getService().stopUser(userId, false, null);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
import com.android.internal.widget.LockPatternUtils;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
// Take an "interactive" bugreport.
MetricsLogger.action(mContext,
MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_INTERACTIVE);
- ActivityManagerNative.getDefault().requestBugReport(
+ ActivityManager.getService().requestBugReport(
ActivityManager.BUGREPORT_OPTION_INTERACTIVE);
} catch (RemoteException e) {
}
try {
// Take a "full" bugreport.
MetricsLogger.action(mContext, MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_FULL);
- ActivityManagerNative.getDefault().requestBugReport(
+ ActivityManager.getService().requestBugReport(
ActivityManager.BUGREPORT_OPTION_FULL);
} catch (RemoteException e) {
}
private UserInfo getCurrentUser() {
try {
- return ActivityManagerNative.getDefault().getCurrentUser();
+ return ActivityManager.getService().getCurrentUser();
} catch (RemoteException re) {
return null;
}
+ (isCurrentUser ? " \u2714" : "")) {
public void onPress() {
try {
- ActivityManagerNative.getDefault().switchUser(user.id);
+ ActivityManager.getService().switchUser(user.id);
} catch (RemoteException re) {
Log.e(TAG, "Couldn't switch user " + re);
}
import android.app.ActivityManager.StackId;
import android.app.ActivityManagerInternal;
import android.app.ActivityManagerInternal.SleepToken;
-import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IUiModeManager;
import android.app.ProgressDialog;
public void onKeyguardExitResult(boolean success) {
if (success) {
try {
- ActivityManagerNative.getDefault().stopAppSwitches();
+ ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {
}
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
// no keyguard stuff to worry about, just launch home!
try {
- ActivityManagerNative.getDefault().stopAppSwitches();
+ ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {
}
if (mRecentsVisible) {
if (false) {
// This code always brings home to the front.
try {
- ActivityManagerNative.getDefault().stopAppSwitches();
+ ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {
}
sendCloseSystemWindows();
/// Roll back EndcallBehavior as the cupcake design to pass P1 lab entry.
Log.d(TAG, "UTS-TEST-MODE");
} else {
- ActivityManagerNative.getDefault().stopAppSwitches();
+ ActivityManager.getService().stopAppSwitches();
sendCloseSystemWindows();
Intent dock = createHomeDockIntent();
if (dock != null) {
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivityAsUser(null, null, dock,
dock.resolveTypeIfNeeded(mContext.getContentResolver()),
null, null, 0,
}
}
}
- int result = ActivityManagerNative.getDefault()
+ int result = ActivityManager.getService()
.startActivityAsUser(null, null, mHomeIntent,
mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),
null, null, 0,
package com.android.server.policy.keyguard;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
mKeyguardState.reset();
mHandler.post(() -> {
try {
- ActivityManagerNative.getDefault().setLockScreenShown(true);
+ ActivityManager.getService().setLockScreenShown(true);
} catch (RemoteException e) {
// Local call.
}
import com.android.server.EventLogTags;
import com.android.server.LocalServices;
-import android.app.ActivityManagerNative;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
package com.android.server.search;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.IActivityManager;
import android.app.ISearchManager;
try {
Intent intent = new Intent(Intent.ACTION_ASSIST);
intent.setComponent(comp);
- IActivityManager am = ActivityManagerNative.getDefault();
+ IActivityManager am = ActivityManager.getService();
return am.launchAssistIntent(intent, ActivityManager.ASSIST_CONTEXT_BASIC, hint,
userHandle, args);
} catch (RemoteException e) {
import android.Manifest;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.admin.DevicePolicyManager;
import android.app.trust.ITrustListener;
import android.app.trust.ITrustManager;
}
if (locked) {
try {
- ActivityManagerNative.getDefault().notifyLockedProfile(userId);
+ ActivityManager.getService().notifyLockedProfile(userId);
} catch (RemoteException e) {
}
}
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.IWallpaperManager;
}, shutdownFilter);
try {
- ActivityManagerNative.getDefault().registerUserSwitchObserver(
+ ActivityManager.getService().registerUserSwitchObserver(
new UserSwitchObserver() {
@Override
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
package com.android.server.webkit;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@Override
public void killPackageDependents(String packageName) {
try {
- ActivityManagerNative.getDefault().killPackageDependents(packageName,
+ ActivityManager.getService().killPackageDependents(packageName,
UserHandle.USER_ALL);
} catch (RemoteException e) {
}
package com.android.server.wm;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.content.ClipData;
import android.net.Uri;
import android.os.Binder;
mActivityToken = activityToken;
// Will throw if Activity is not found.
- IBinder permissionOwner = ActivityManagerNative.getDefault().
+ IBinder permissionOwner = ActivityManager.getService().
getUriPermissionOwnerForActivity(mActivityToken);
doTake(permissionOwner);
long origId = Binder.clearCallingIdentity();
try {
for (int i = 0; i < mUris.size(); i++) {
- ActivityManagerNative.getDefault().grantUriPermissionFromOwner(
+ ActivityManager.getService().grantUriPermissionFromOwner(
permissionOwner, mSourceUid, mTargetPackage, mUris.get(i), mMode,
mSourceUserId, mTargetUserId);
}
if (mActivityToken != null || mPermissionOwnerToken != null) {
return;
}
- mPermissionOwnerToken = ActivityManagerNative.getDefault().newUriPermissionOwner("drop");
+ mPermissionOwnerToken = ActivityManager.getService().newUriPermissionOwner("drop");
mTransientToken = transientToken;
mTransientToken.linkToDeath(this, 0);
IBinder permissionOwner = null;
if (mActivityToken != null) {
try {
- permissionOwner = ActivityManagerNative.getDefault().
+ permissionOwner = ActivityManager.getService().
getUriPermissionOwnerForActivity(mActivityToken);
} catch (Exception e) {
// Activity is destroyed, permissions already revoked.
}
for (int i = 0; i < mUris.size(); ++i) {
- ActivityManagerNative.getDefault().revokeUriPermissionFromOwner(
+ ActivityManager.getService().revokeUriPermissionFromOwner(
permissionOwner, mUris.get(i), mMode, mSourceUserId);
}
}
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITIONING;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.graphics.Rect;
import android.os.Debug;
import android.os.Looper;
try {
// Notify the activity manager about the timeout and let it decide whether
// to abort dispatching or keep waiting.
- long timeout = ActivityManagerNative.getDefault().inputDispatchingTimedOut(
+ long timeout = ActivityManager.getService().inputDispatchingTimedOut(
windowState.mSession.mPid, aboveSystem, reason);
if (timeout >= 0) {
// The activity manager declined to abort dispatching.
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.os.Handler;
if (dpm != null) {
try {
mAllowDisableKeyguard = dpm.getPasswordQuality(null,
- ActivityManagerNative.getDefault().getCurrentUser().id)
+ ActivityManager.getService().getCurrentUser().id)
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED ?
ALLOW_DISABLE_YES : ALLOW_DISABLE_NO;
} catch (RemoteException re) {
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.app.Notification;
mBoundsAnimationController =
new BoundsAnimationController(mAppTransition, UiThread.getHandler());
- mActivityManager = ActivityManagerNative.getDefault();
+ mActivityManager = ActivityManager.getService();
mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
AppOpsManager.OnOpChangedInternalListener opListener =
import android.annotation.UserIdInt;
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.AppGlobals;
import android.app.IActivityManager;
}
IActivityManager getIActivityManager() {
- return ActivityManagerNative.getDefault();
+ return ActivityManager.getService();
}
IPackageManager getIPackageManager() {
final long callingIdentity = mInjector.binderClearCallingIdentity();
try {
- ActivityManagerNative.getDefault().requestBugReport(
+ ActivityManager.getService().requestBugReport(
ActivityManager.BUGREPORT_OPTION_REMOTE);
mRemoteBugreportServiceIsActive.set(true);
import android.Manifest;
import android.annotation.NonNull;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
private int resolveCallingUserEnforcingPermissions(int userId) {
try {
- return ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),
+ return ActivityManager.getService().handleIncomingUser(Binder.getCallingPid(),
Binder.getCallingUid(), userId, true, true, "", null);
} catch (RemoteException re) {
// Shouldn't happen, local.
package com.android.server.retaildemo;
import android.Manifest;
+import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.Notification;
import android.app.NotificationManager;
void switchUser(int userId) {
if (mAms == null) {
- mAms = (ActivityManagerService) ActivityManagerNative.getDefault();
+ mAms = (ActivityManagerService) ActivityManager.getService();
}
mAms.switchUser(userId);
}
package com.android.server.am;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.os.ServiceManager;
import android.os.UserHandle;
@Override
public void setUp() throws Exception {
super.setUp();
- service = ActivityManagerNative.getDefault();
+ service = ActivityManager.getService();
}
public void testTaskIdsForRunningUsers() throws RemoteException {
}
}
}
-}
\ No newline at end of file
+}
import static org.junit.Assert.assertTrue;
import android.app.Activity;
+import android.app.ActivityManager;
import android.app.ActivityManager.TaskDescription;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.ITaskStackListener;
import android.app.Instrumentation.ActivityMonitor;
@Before
public void setUp() throws Exception {
- mService = ActivityManagerNative.getDefault();
+ mService = ActivityManager.getService();
}
@After
package com.android.server.usage;
import android.Manifest;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.admin.DevicePolicyManager;
final int[] runningUserIds;
try {
- runningUserIds = ActivityManagerNative.getDefault().getRunningUserIds();
+ runningUserIds = ActivityManager.getService().getRunningUserIds();
if (checkUserId != UserHandle.USER_ALL
&& !ArrayUtils.contains(runningUserIds, checkUserId)) {
return false;
@Override
public boolean isAppInactive(String packageName, int userId) {
try {
- userId = ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),
+ userId = ActivityManager.getService().handleIncomingUser(Binder.getCallingPid(),
Binder.getCallingUid(), userId, false, true, "isAppInactive", null);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
public void setAppInactive(String packageName, boolean idle, int userId) {
final int callingUid = Binder.getCallingUid();
try {
- userId = ActivityManagerNative.getDefault().handleIncomingUser(
+ userId = ActivityManager.getService().handleIncomingUser(
Binder.getCallingPid(), callingUid, userId, false, true,
"setAppIdle", null);
} catch (RemoteException re) {
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
mServiceStub = stub;
mUser = userHandle;
mComponent = service;
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
VoiceInteractionServiceInfo info;
try {
info = new VoiceInteractionServiceInfo(context.getPackageManager(), service, mUser);
package com.android.server.voiceinteraction;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.app.assist.AssistContent;
mCallback = callback;
mCallingUid = callingUid;
mHandler = handler;
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
mIWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
mAppOps = context.getSystemService(AppOpsManager.class);
import android.accounts.Account;
import android.accounts.AccountManager;
-import android.app.ActivityManagerNative;
import android.app.ActivityManager;
import android.app.ActivityManager.ProcessErrorStateInfo;
import android.content.Context;
InstrumentationTestRunner instrumentation =
(InstrumentationTestRunner)getInstrumentation();
Bundle args = instrumentation.getArguments();
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
String launchDirectory = args.getString(KEY_LAUNCH_DIRECTORY);
mTraceDirectoryStr = args.getString(KEY_TRACE_DIRECTORY);
mDropCache = Boolean.parseBoolean(args.getString(KEY_DROP_CACHE));
package com.android.imftest.samples;
import android.app.Activity;
-import android.app.ActivityManagerNative;
import android.os.Bundle;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.app.ActivityManager;
import android.app.ActivityManager.ProcessErrorStateInfo;
import android.app.ActivityManager.RunningAppProcessInfo;
-import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.UiAutomation;
import android.content.Context;
MemoryUsageInstrumentation instrumentation =
(MemoryUsageInstrumentation) getInstrumentation();
Bundle args = instrumentation.getBundle();
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
createMappings();
parseArgs(args);
package com.android.framework.permission.tests;
-import android.app.ActivityManagerNative;
+import android.app.ActivityManager;
import android.app.IActivityManager;
import android.content.res.Configuration;
import android.os.RemoteException;
@Override
protected void setUp() throws Exception {
super.setUp();
- mAm = ActivityManagerNative.getDefault();
+ mAm = ActivityManager.getService();
}
@SmallTest