libgbinder
libgbinder copied to clipboard
[gbinder] correct stability field wire format on Android 12 & 13
On Android 12, the wire format of stability field is changed to also include so-called "Binder wire format version", which starts at 1 [1]. A 32-bit-sized struct is re-interpreted into a 32-bit integer, with a layout which makes it incompatible with the old version. Interestingly, they reverted this idea in Android 14 [2], which makes the wire format of the stability field the same as Android 11 again (as far as I know).
Add a new RPC protocol variant 'aidl4' to account for this difference. Use this protocol on API level 31 through 33 and use 'aidl3' from API level 34 onwards. The only difference from 'aidl3' is finish_flatten_ binder()
function.
Interestingly, there is also a 16-bit-sized struct variant of the field too [3]. However, to the best of my knowledge, this version is not used in any of the released Android versions.
[1]: https://github.com/LineageOS/android_frameworks_native/commit/89ddfc5f8c1c9f5bacc6d6d5133bb910d63663a3 [2]: https://github.com/LineageOS/android_frameworks_native/commit/16a4106cb7bc18d473a428d9f19c7561a21e3f06 [3]: https://github.com/LineageOS/android_frameworks_native/commit/14e4cfae36aa878c6a9838299bc7b9aa42a16dfa