diff options
| author | Stefan Kuhne <skuhne@google.com> | 2015-06-05 07:18:06 -0700 |
|---|---|---|
| committer | Stefan Kuhne <skuhne@google.com> | 2015-06-05 16:30:29 -0700 |
| commit | 16045c24fe10cc92329ede099923f1223f49b17d (patch) | |
| tree | 1418cfb06abbef32f95c8dfa23ce9f1d704e7964 /core/java/android/app/ActivityManagerNative.java | |
| parent | e7f68c18bf1a1da5d0aa129674fe4f9ecf06ac8c (diff) | |
| download | frameworks_base-16045c24fe10cc92329ede099923f1223f49b17d.zip frameworks_base-16045c24fe10cc92329ede099923f1223f49b17d.tar.gz frameworks_base-16045c24fe10cc92329ede099923f1223f49b17d.tar.bz2 | |
Adding am send-trim-memory command
This patch adds a send-trim-memory command to the ActivityManager to allow
for better debugging&testing.
The command is
adb shell am send-trim-memory [--user <USER_ID>] <PROCESS> <LEVEL>
whereas LEVEL can be one of the following:
[HIDDEN|RUNNING_MODERATE|BACKGROUND|RUNNING_LOW|MODERATE|
RUNNING_CRITICAL|COMPLETE]
Bug: 21633189
Change-Id: I7a41ce02c3c9043ffd3e5aaa791f7b7306a9de49
Diffstat (limited to 'core/java/android/app/ActivityManagerNative.java')
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 70 |
1 files changed, 49 insertions, 21 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index e4def1e..ff52e67 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1546,21 +1546,21 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeInt(res ? 1 : 0); return true; } - + case STOP_APP_SWITCHES_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); stopAppSwitches(); reply.writeNoException(); return true; } - + case RESUME_APP_SWITCHES_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); resumeAppSwitches(); reply.writeNoException(); return true; } - + case PEEK_SERVICE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); Intent service = Intent.CREATOR.createFromParcel(data); @@ -1570,7 +1570,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeStrongBinder(binder); return true; } - + case START_BACKUP_AGENT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); @@ -1623,7 +1623,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } - + case GET_PROCESS_MEMORY_INFO_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int[] pids = data.createIntArray(); @@ -1641,7 +1641,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } - + case OVERRIDE_PENDING_TRANSITION_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); @@ -1652,7 +1652,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } - + case IS_USER_A_MONKEY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); boolean areThey = isUserAMonkey(); @@ -1660,7 +1660,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeInt(areThey ? 1 : 0); return true; } - + case SET_USER_IS_MONKEY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); final boolean monkey = (data.readInt() == 1); @@ -1736,7 +1736,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } - + case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); boolean isit = isTopActivityImmersive(); @@ -1888,7 +1888,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } - + case SWITCH_USER_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int userid = data.readInt(); @@ -2548,6 +2548,17 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeInt(res); return true; } + + case SET_PROCESS_MEMORY_TRIM_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + String process = data.readString(); + int userId = data.readInt(); + int level = data.readInt(); + boolean res = setProcessMemoryTrimLevel(process, userId, level); + reply.writeNoException(); + reply.writeInt(res ? 1 : 0); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -3619,7 +3630,7 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return res; } - + public ComponentName startService(IApplicationThread caller, Intent service, String resolvedType, int userId) throws RemoteException { @@ -3722,7 +3733,7 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return res; } - + public void publishService(IBinder token, Intent intent, IBinder service) throws RemoteException { Parcel data = Parcel.obtain(); @@ -3765,7 +3776,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + public IBinder peekService(Intent service, String resolvedType) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -4455,7 +4466,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo) throws RemoteException { @@ -4519,7 +4530,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); return res; } - + public void stopAppSwitches() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -4529,7 +4540,7 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); data.recycle(); } - + public void resumeAppSwitches() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -4564,7 +4575,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + public void closeSystemDialogs(String reason) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -4575,7 +4586,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) throws RemoteException { Parcel data = Parcel.obtain(); @@ -4601,7 +4612,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + public void overridePendingTransition(IBinder token, String packageName, int enterAnim, int exitAnim) throws RemoteException { Parcel data = Parcel.obtain(); @@ -4616,7 +4627,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + public boolean isUserAMonkey() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -4872,7 +4883,7 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); return res; } - + public int startActivities(IApplicationThread caller, String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, Bundle options, int userId) throws RemoteException { @@ -5880,5 +5891,22 @@ class ActivityManagerProxy implements IActivityManager return res; } + @Override + public boolean setProcessMemoryTrimLevel(String process, int userId, int level) + throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeString(process); + data.writeInt(userId); + data.writeInt(level); + mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0); + reply.readException(); + int res = reply.readInt(); + data.recycle(); + reply.recycle(); + return res != 0; + } + private IBinder mRemote; } |
