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

[gbinder] correct stability field wire format on Android 12 #133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Oct 12, 2024

  1. [gbinder] correct stability field wire format on Android 12

    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 13 [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 32 and use 'aidl3' from API
    level 33 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]: LineageOS/android_frameworks_native@89ddfc5
    [2]: LineageOS/android_frameworks_native@16a4106
    [3]: LineageOS/android_frameworks_native@14e4cfa
    peat-psuwit committed Oct 12, 2024
    Configuration menu
    Copy the full SHA
    62dac7e View commit details
    Browse the repository at this point in the history
  2. [gbinder] uses aidl3 servicemanager on API level 31 & 32

    Nikita (@NotKit) noticed that the change in commit f227ae4
    ("[gbinder] All binder objects need stability field in Android 11.
    JB#58951") has made the aidl4 servicemanager variant redundant. In fact,
    using aidl4 variant will cause an extra stability field to be sent on
    the wire (luckily it has not caused any problem).
    
    I've tried using aidl3 variant on Volla Phone X23 which runs Halium 12
    (API level 32), and service registration still work, which seems to
    validate this theory. Thus, stop using aidl4 servicemanager variant on
    any of the API level-based config, as it no longer correspond to any of
    Android versions.
    
    Note that this commit doesn't outright remove aidl4 variant, as doing so
    would break configurations which explicitly request its use. This commit
    doesn't doesn't alias the aidl4 variant to aidl3 variant either.
    Manually requesting a certain variant could mean some unusual setup;
    aliasing aidl4 to aidl3 could break such setup.
    peat-psuwit committed Oct 12, 2024
    Configuration menu
    Copy the full SHA
    374526b View commit details
    Browse the repository at this point in the history