In PR #11981, a potential data race on the acknowledgedIncomingBytes field in BinderTransport was identified. However, it was noted that all incoming Binder transactions are FLAG_ONEWAY, ensuring that only one thread from the Binder thread pool invokes handleTransaction() at a time.
Despite this, the BinderTransport class is annotated with @threadsafe, which may be misleading since it implements TransactionHandler directly. To address this, BinderTransport shall delegate TransactionHandler to a private inner class not marked as @threadsafe. This change would clarify the thread safety guarantees and prevent potential misunderstandings.
Action Items:
- Refactor
BinderTransport to delegate TransactionHandler to a private inner class.
- Update documentation and annotations to accurately reflect thread safety guarantees.
- Ensure that the refactoring maintains existing functionality and passes all tests.