perf(binder): skip interception for system transaction codes
AIDL methods use codes 1..0x00ffffff. System transactions like PING_TRANSACTION (0x5f4e4750) fall above that range. Intercepting pings forces a full JNI round-trip to Java and back, adding enough latency for timing detectors to flag the ratio (3.85x vs 3.0x threshold). Early-return for codes above LAST_CALL_TRANSACTION eliminates this overhead while preserving all AIDL interception.
This commit is contained in:
@@ -358,6 +358,12 @@ void inspectAndRewriteTransaction(binder_transaction_data *txn_data) {
|
||||
if (txn_data->data_size > kMaxInterceptableDataSize)
|
||||
return;
|
||||
|
||||
// AIDL methods use codes in [FIRST_CALL_TRANSACTION, LAST_CALL_TRANSACTION] (1..0x00ffffff).
|
||||
// System transactions (PING, INTERFACE, DUMP, SHELL_COMMAND) use codes above that range.
|
||||
// Skip those — intercepting a ping adds measurable latency that timing detectors flag.
|
||||
if (txn_data->code > 0x00ffffffu && txn_data->code != intercept::kBackdoorCode)
|
||||
return;
|
||||
|
||||
bool hijack = false;
|
||||
ThreadTransactionInfo info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user