diff options
Diffstat (limited to 'core/java/android/app/ApplicationThreadNative.java')
| -rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 16181e0e8742..942f245bebf8 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -485,6 +485,48 @@ public abstract class ApplicationThreadNative extends Binder scheduleTrimMemory(level); return true; } + + case DUMP_MEM_INFO_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + ParcelFileDescriptor fd = data.readFileDescriptor(); + String[] args = data.readStringArray(); + Debug.MemoryInfo mi = null; + if (fd != null) { + try { + mi = dumpMemInfo(fd.getFileDescriptor(), args); + } finally { + try { + fd.close(); + } catch (IOException e) { + // swallowed, not propagated back to the caller + } + } + } + reply.writeNoException(); + mi.writeToParcel(reply, 0); + return true; + } + + case DUMP_GFX_INFO_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + ParcelFileDescriptor fd = data.readFileDescriptor(); + String[] args = data.readStringArray(); + if (fd != null) { + try { + dumpGfxInfo(fd.getFileDescriptor(), args); + } finally { + try { + fd.close(); + } catch (IOException e) { + // swallowed, not propagated back to the caller + } + } + } + reply.writeNoException(); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -1004,4 +1046,28 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); } + + public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, String[] args) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeFileDescriptor(fd); + data.writeStringArray(args); + mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0); + reply.readException(); + Debug.MemoryInfo info = new Debug.MemoryInfo(); + info.readFromParcel(reply); + data.recycle(); + reply.recycle(); + return info; + } + + public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeFileDescriptor(fd); + data.writeStringArray(args); + mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); + data.recycle(); + } } |
