diff options
| author | Rahul Chaturvedi <rkc@google.com> | 2015-06-22 23:55:07 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-22 23:55:09 +0000 |
| commit | 8ee0c2cf24cc4de0abe7114c189051277568f7f1 (patch) | |
| tree | 4a0e018005f276a2645cc69fd22395a8a8f64205 /core/java/android/app/ApplicationThreadNative.java | |
| parent | 02724743791c05331b1d5d339812cee3395cb0f0 (diff) | |
| parent | 52613f9084f40100021fbf21173bda329a2d5cc3 (diff) | |
Merge "Add binder transaction tracking."
Diffstat (limited to 'core/java/android/app/ApplicationThreadNative.java')
| -rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index e17808744408..5b120cd5a941 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -291,6 +291,7 @@ public abstract class ApplicationThreadNative extends Binder IUiAutomationConnection uiAutomationConnection = IUiAutomationConnection.Stub.asInterface(binder); int testMode = data.readInt(); + boolean enableBinderTracking = data.readInt() != 0; boolean openGlTrace = data.readInt() != 0; boolean restrictedBackupMode = (data.readInt() != 0); boolean persistent = (data.readInt() != 0); @@ -299,8 +300,8 @@ public abstract class ApplicationThreadNative extends Binder HashMap<String, IBinder> services = data.readHashMap(null); Bundle coreSettings = data.readBundle(); bindApplication(packageName, info, providers, testName, profilerInfo, testArgs, - testWatcher, uiAutomationConnection, testMode, openGlTrace, - restrictedBackupMode, persistent, config, compatInfo, services, coreSettings); + testWatcher, uiAutomationConnection, testMode, enableBinderTracking, + openGlTrace, restrictedBackupMode, persistent, config, compatInfo, services, coreSettings); return true; } @@ -693,6 +694,28 @@ public abstract class ApplicationThreadNative extends Binder reply.writeNoException(); return true; } + + case START_BINDER_TRACKING_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + startBinderTracking(); + return true; + } + + case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + ParcelFileDescriptor fd = data.readFileDescriptor(); + if (fd != null) { + stopBinderTrackingAndDump(fd.getFileDescriptor()); + try { + fd.close(); + } catch (IOException e) { + } + } + return true; + } + } return super.onTransact(code, data, reply, flags); @@ -988,12 +1011,12 @@ class ApplicationThreadProxy implements IApplicationThread { } public final void bindApplication(String packageName, ApplicationInfo info, - List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo, - Bundle testArgs, IInstrumentationWatcher testWatcher, - IUiAutomationConnection uiAutomationConnection, int debugMode, - boolean openGlTrace, boolean restrictedBackupMode, boolean persistent, - Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, - Bundle coreSettings) throws RemoteException { + List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo, + Bundle testArgs, IInstrumentationWatcher testWatcher, + IUiAutomationConnection uiAutomationConnection, int debugMode, + boolean enableBinderTracking, boolean openGlTrace, boolean restrictedBackupMode, boolean persistent, + Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, + Bundle coreSettings) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeString(packageName); @@ -1015,6 +1038,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeStrongInterface(testWatcher); data.writeStrongInterface(uiAutomationConnection); data.writeInt(debugMode); + data.writeInt(enableBinderTracking ? 1 : 0); data.writeInt(openGlTrace ? 1 : 0); data.writeInt(restrictedBackupMode ? 1 : 0); data.writeInt(persistent ? 1 : 0); @@ -1404,4 +1428,23 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } + + @Override + public void startBinderTracking() throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } + + @Override + public void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeFileDescriptor(fd); + mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } } |
