Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Compatibility with different versions of 'Stability' in Android Binder Protocol #17

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

tsailin-bit
Copy link
Contributor

@tsailin-bit tsailin-bit commented Mar 11, 2024

panic on Android 12

OnePlus8T:/data/local/tmp # ./hello_service
[2024-03-11T13:37:55Z WARN  rsbinder::process_state] Binder ioctl to enable oneway spam detection failed: EINVAL: Invalid argument
[2024-03-11T13:37:55Z WARN  rsbinder::thread_state] binder::BR_REPLY (BadType)
Error: TransactionFailed / BadType:

Android 12 version uses "Category" as the stability format for passed on the wire lines, whereas other versions do not. Therefore, we can use the android_properties crate to determine the Android version and perform different handling accordingly.
http://aospxref.com/android-11.0.0_r21/xref/frameworks/native/libs/binder/include/binder/Stability.h
http://aospxref.com/android-12.0.0_r3/xref/frameworks/native/include/binder/Stability.h
http://aospxref.com/android-13.0.0_r3/xref/frameworks/native/libs/binder/include/binder/Stability.h
http://aospxref.com/android-14.0.0_r2/xref/frameworks/native/libs/binder/include/binder/Stability.h

…Binder Protocol

Android 12 version uses "Category" as the stability format for passed on the wire lines,
whereas other versions do not. Therefore, we can use the android_properties crate
to determine the Android version and perform different handling accordingly.
Copy link
Owner

@hiking90 hiking90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tested it, changing only the stability value as you suggested didn't cause any problems on Android 12 and 13. If it's stated that it only supports Android 12 and above, this should be sufficient. Can you rewrite the patch with the following content? I ask because I want to keep a record of your contribution.

Vendor => 0x0c000003,
System => 0x0c00000c,
Vintf => 0x0c00003f,

@hiking90 hiking90 merged commit 44263dc into hiking90:master Mar 16, 2024
@hiking90
Copy link
Owner

I merged your PR.
Then I added another commit that removes the dependency on android-properties and changes it so that developers can specify the Android version through the set_android_version() function. This was because android-properties was not built in the NDK environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants