commit | 03f538bd9621064363f65cc5950065e72ca7b3c1 | [log] [tgz] |
---|---|---|
author | Zim <zezeozue@google.com> | Thu Sep 01 01:31:05 2022 +0100 |
committer | Zimuzo Ezeozue <zezeozue@google.com> | Thu Sep 08 01:14:15 2022 +0000 |
tree | 829c430e2a8ecbcb6316c55575a3c63a50048da4 | |
parent | ff29fc321a792e0de03a00bf0e73b5f4f42f06a5 [diff] |
Modify aidl tracing code gen for Java Enabling aidl#generate_traces in aosp/2190022 increases framework.jar size by ~3%. This is primarily due to the increase in transaction name strings in the dex. The real issue here is that the dex size increases proportional to the number of methods vs the number of interfaces To fix this, we take advantage of the already generated txn name strings in the framework.jar aidl as part of the enabled aidl#'generate_get_transaction_name'. This tag creates a method getDefaultTransactionName(txnCode) with a switch statement to convert txnCode -> txnName. We can then emit traceBegin code once per Stub interface that looks like: boolean onTransact(int code...) { try { ... traceBegin(getDefaultTransactionName(code)) ... } finally { traceEnd(...) } } instead of emitting a traceBegin per txn case statement. Unfortunately, this approach does not extend to the Proxy interface because each txn exposes an individual method and there's no single entry point to emit a traceBegin like the Stub#onTransact. Hence we skip tracing the Proxy side. This means we don't get any 'client' aidl tracing for Java aidl interfaces but this was arguably unnecessary anyways and might be worth considering dropping that for the Cpp backend Test: Manual Bug: 161393989 Change-Id: Ib78d82ceea41d13e047337907a1f49f9f1615a86
Documentation for this project is currently maintained here:
https://source.android.com/devices/architecture/aidl/overview