Update usage of ActivityManagerNative.
Bug: 30977067 Test: N/A Change-Id: I46e37a09cff059d2784a819bc2651d6973fbd268
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -97,7 +96,7 @@ public class BugreportPreference extends CustomDialogPreference {
|
||||
|
||||
private void takeBugreport(int bugreportType) {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().requestBugReport(bugreportType);
|
||||
ActivityManager.getService().requestBugReport(bugreportType);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "error taking bugreport (bugreportType=" + bugreportType + ")", e);
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.IActivityManager;
|
||||
@@ -213,7 +212,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
|
||||
int taskId = getActivity().getIntent().getIntExtra(Intent.EXTRA_TASK_ID, -1);
|
||||
if (taskId != -1) {
|
||||
try {
|
||||
IActivityManager activityManager = ActivityManagerNative.getDefault();
|
||||
IActivityManager activityManager = ActivityManager.getService();
|
||||
final ActivityOptions options = ActivityOptions.makeBasic();
|
||||
options.setLaunchStackId(ActivityManager.StackId.INVALID_STACK_ID);
|
||||
activityManager.startActivityFromRecents(taskId, options.toBundle());
|
||||
|
@@ -418,7 +418,7 @@ public final class CredentialStorage extends Activity {
|
||||
|
||||
final int launchedFromUserId;
|
||||
try {
|
||||
int launchedFromUid = android.app.ActivityManagerNative.getDefault()
|
||||
int launchedFromUid = android.app.ActivityManager.getService()
|
||||
.getLaunchedFromUid(getActivityToken());
|
||||
if (launchedFromUid == -1) {
|
||||
Log.e(TAG, ACTION_INSTALL + " must be started with startActivityForResult");
|
||||
|
@@ -18,7 +18,7 @@ package com.android.settings;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AppOpsManager;
|
||||
import android.app.AppOpsManager.PackageOps;
|
||||
@@ -807,7 +807,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
try {
|
||||
String wv_package = mWebViewUpdateService.getCurrentWebViewPackageName();
|
||||
ActivityManagerNative.getDefault().killPackageDependents(
|
||||
ActivityManager.getService().killPackageDependents(
|
||||
wv_package, UserHandle.USER_ALL);
|
||||
} catch(RemoteException e) {
|
||||
}
|
||||
@@ -865,7 +865,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
private void writeDebuggerOptions() {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().setDebugApp(
|
||||
ActivityManager.getService().setDebugApp(
|
||||
mDebugApp, mWaitForDebugger.isChecked(), true);
|
||||
} catch (RemoteException ex) {
|
||||
}
|
||||
@@ -908,7 +908,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
private static void resetDebuggerOptions() {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().setDebugApp(
|
||||
ActivityManager.getService().setDebugApp(
|
||||
null, false, true);
|
||||
} catch (RemoteException ex) {
|
||||
}
|
||||
@@ -1721,7 +1721,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
private void writeImmediatelyDestroyActivitiesOptions() {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().setAlwaysFinish(
|
||||
ActivityManager.getService().setAlwaysFinish(
|
||||
mImmediatelyDestroyActivities.isChecked());
|
||||
} catch (RemoteException ex) {
|
||||
}
|
||||
@@ -1795,7 +1795,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
private void updateAppProcessLimitOptions() {
|
||||
try {
|
||||
int limit = ActivityManagerNative.getDefault().getProcessLimit();
|
||||
int limit = ActivityManager.getService().getProcessLimit();
|
||||
CharSequence[] values = mAppProcessLimit.getEntryValues();
|
||||
for (int i=0; i<values.length; i++) {
|
||||
int val = Integer.parseInt(values[i].toString());
|
||||
@@ -1817,7 +1817,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
private void writeAppProcessLimitOptions(Object newValue) {
|
||||
try {
|
||||
int limit = newValue != null ? Integer.parseInt(newValue.toString()) : -1;
|
||||
ActivityManagerNative.getDefault().setProcessLimit(limit);
|
||||
ActivityManager.getService().setProcessLimit(limit);
|
||||
updateAppProcessLimitOptions();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AppOpsManager;
|
||||
import android.app.Dialog;
|
||||
@@ -367,7 +367,7 @@ public class DeviceAdminAdd extends Activity {
|
||||
try {
|
||||
// Don't allow the admin to put a dialog up in front
|
||||
// of us while we interact with the user.
|
||||
ActivityManagerNative.getDefault().stopAppSwitches();
|
||||
ActivityManager.getService().stopAppSwitches();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mWaitingForRemoveMsg = true;
|
||||
@@ -426,7 +426,7 @@ public class DeviceAdminAdd extends Activity {
|
||||
mWaitingForRemoveMsg = false;
|
||||
if (msg == null) {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().resumeAppSwitches();
|
||||
ActivityManager.getService().resumeAppSwitches();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mDPM.removeActiveAdmin(mDeviceAdmin.getComponent());
|
||||
@@ -434,7 +434,7 @@ public class DeviceAdminAdd extends Activity {
|
||||
} else {
|
||||
try {
|
||||
// Continue preventing anything from coming in front.
|
||||
ActivityManagerNative.getDefault().stopAppSwitches();
|
||||
ActivityManager.getService().stopAppSwitches();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
Bundle args = new Bundle();
|
||||
@@ -466,7 +466,7 @@ public class DeviceAdminAdd extends Activity {
|
||||
mAppOps.setMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg, mCurSysAppOpMode);
|
||||
mAppOps.setMode(AppOpsManager.OP_TOAST_WINDOW, uid, pkg, mCurToastAppOpMode);
|
||||
try {
|
||||
ActivityManagerNative.getDefault().resumeAppSwitches();
|
||||
ActivityManager.getService().resumeAppSwitches();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ public class DeviceAdminAdd extends Activity {
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().resumeAppSwitches();
|
||||
ActivityManager.getService().resumeAppSwitches();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mDPM.removeActiveAdmin(mDeviceAdmin.getComponent());
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AppGlobals;
|
||||
import android.app.Dialog;
|
||||
@@ -648,7 +647,7 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
public static UserHandle getSecureTargetUser(IBinder activityToken,
|
||||
UserManager um, @Nullable Bundle arguments, @Nullable Bundle intentExtras) {
|
||||
UserHandle currentUser = new UserHandle(UserHandle.myUserId());
|
||||
IActivityManager am = ActivityManagerNative.getDefault();
|
||||
IActivityManager am = ActivityManager.getService();
|
||||
try {
|
||||
String launchedFromPackage = am.getLaunchedFromPackage(activityToken);
|
||||
boolean launchedFromSettingsApp = SETTINGS_PACKAGE_NAME.equals(launchedFromPackage);
|
||||
@@ -698,7 +697,7 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
public static UserHandle getInsecureTargetUser(IBinder activityToken, @Nullable Bundle arguments,
|
||||
@Nullable Bundle intentExtras) {
|
||||
UserHandle currentUser = new UserHandle(UserHandle.myUserId());
|
||||
IActivityManager am = ActivityManagerNative.getDefault();
|
||||
IActivityManager am = ActivityManager.getService();
|
||||
try {
|
||||
UserHandle launchedFromUser = new UserHandle(UserHandle.getUserId(
|
||||
am.getLaunchedFromUid(activityToken)));
|
||||
@@ -1117,7 +1116,7 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
|
||||
public static boolean unlockWorkProfileIfNecessary(Context context, int userId) {
|
||||
try {
|
||||
if (!ActivityManagerNative.getDefault().isUserRunning(userId,
|
||||
if (!ActivityManager.getService().isUserRunning(userId,
|
||||
ActivityManager.FLAG_AND_LOCKED)) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityThread;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -1320,7 +1319,7 @@ public class RunningState {
|
||||
for (int i=0; i<numProc; i++) {
|
||||
pids[i] = mAllProcessItems.get(i).mPid;
|
||||
}
|
||||
long[] pss = ActivityManagerNative.getDefault()
|
||||
long[] pss = ActivityManager.getService()
|
||||
.getProcessPss(pids);
|
||||
int bgIndex = 0;
|
||||
for (int i=0; i<pids.length; i++) {
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.AlertDialog;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.settings.inputmethod;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
@@ -63,7 +63,7 @@ class InputMethodSettingValuesWrapper {
|
||||
|
||||
private static int getDefaultCurrentUserId() {
|
||||
try {
|
||||
return ActivityManagerNative.getDefault().getCurrentUser().id;
|
||||
return ActivityManager.getService().getCurrentUser().id;
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Couldn't get current user ID; guessing it's 0", e);
|
||||
}
|
||||
|
@@ -243,7 +243,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
||||
sb.append("Intent(pkg=").append(is.getCreatorPackage());
|
||||
try {
|
||||
final boolean isActivity =
|
||||
ActivityManagerNative.getDefault().isIntentSenderAnActivity(is.getTarget());
|
||||
ActivityManager.getService().isIntentSenderAnActivity(is.getTarget());
|
||||
if (isActivity) sb.append(" (activity)");
|
||||
} catch (RemoteException ex) {}
|
||||
sb.append(")");
|
||||
|
@@ -17,7 +17,7 @@
|
||||
package com.android.settings.users;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
@@ -681,7 +681,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM);
|
||||
ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM);
|
||||
getContext().getSystemService(UserManager.class).removeUser(UserHandle.myUserId());
|
||||
} catch (RemoteException re) {
|
||||
Log.e(TAG, "Unable to remove self user");
|
||||
@@ -724,7 +724,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
|
||||
private void switchUserNow(int userId) {
|
||||
try {
|
||||
ActivityManagerNative.getDefault().switchUser(userId);
|
||||
ActivityManager.getService().switchUser(userId);
|
||||
} catch (RemoteException re) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.settings.tests;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
@@ -47,12 +47,12 @@ public class SettingsRestoreAfterCloseTest {
|
||||
.ALWAYS_FINISH_ACTIVITIES, 0)
|
||||
!= 0;
|
||||
|
||||
ActivityManagerNative.getDefault().setAlwaysFinish(true);
|
||||
ActivityManager.getService().setAlwaysFinish(true);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
ActivityManagerNative.getDefault().setAlwaysFinish(mAlwaysFinish);
|
||||
ActivityManager.getService().setAlwaysFinish(mAlwaysFinish);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user