Ratchanan Srirattanamet 2439ff878d use BINDER_TYPE_BINDER for NULL local object
3 reasons:
- This is what encode_remote_object() does. I see no reason a NULL local
  object should be encoded differently than a NULL remote object.
- This is what Parcel.cpp does when flattening a NULL binder [1]. This
  is contrary to what is said in PR #99 [2]; I'm not sure why PR #99
  said it uses BINDER_TYPE_HANDLE.
- More importantly, BINDER_TYPE_HANDLE number 0 does NOT represent a
  NULL binder. According to the comment at [3], handle number 0 actually
  represent the context manager. So, by sending BINDER_TYPE_HANDLE
  number 0, we're sending context manager, not a NULL binder.

[1]: https://android.googlesource.com/platform/frameworks/native/+/refs/tags/android-14.0.0_r1/libs/binder/Parcel.cpp#277
[2]: https://github.com/mer-hybris/libgbinder/pull/99
[3]: https://android.googlesource.com/platform/frameworks/native/+/refs/tags/android-14.0.0_r1/libs/binder/ProcessState.cpp#336

Origin: vendor
Bug-UBports: https://gitlab.com/ubports/development/core/packaging/libgbinder/-/merge_requests/9#note_2138653925
Forwarded: https://github.com/mer-hybris/libgbinder/pull/135
2025-10-17 23:29:52 +08:00
2024-07-18 05:35:00 +03:00
2024-07-18 05:32:36 +03:00
2024-07-18 05:35:00 +03:00
2024-07-18 05:08:47 +03:00
2024-02-10 04:54:52 +02:00
2024-07-18 05:35:00 +03:00
2021-12-27 15:12:46 +02:00

GLib-style interface to binder (Android IPC mechanism)

Key features:

1. Integration with GLib event loop
2. Detection of 32 vs 64 bit kernel at runtime
3. Asynchronous transactions that don't block the event thread
4. Stable service manager and low-level transaction APIs

Android keeps changing both low-level RPC and service manager
protocols from version to version. To counter that, libgbinder
implements configirable backends for different variants of those,
and yet keeping its own API unchanged.

Configuration is loaded from [Protocol] and [ServiceManager] sections
of /etc/gbinder.conf file. The keys are binder device names or the
special Default value, the value is the identifier of the protocol
or service manager variant, respectively.

In addition to reading /etc/gbinder.conf if it exists, /etc/gbinder.d
directory is scanned for .conf files, the file list is sorted, files are
loaded one by one, overwriting the entries loaded from /etc/gbinder.conf
or from the previously processed file.

Known protocol and service manager variants are aidl, aidl2, aidl3 and
hidl. This list is expected to expand further in the future. The default
configuration is as follows:

  [Protocol]
  Default = aidl
  /dev/binder = aidl
  /dev/hwbinder = hidl

  [ServiceManager]
  Default = aidl
  /dev/binder = aidl
  /dev/hwbinder = hidl

Alternatively and preferably, one can specify the desired Android API
level:

  [General]
  ApiLevel = 29

and let libgbinder pick the appropriate preset. Full list of presets can
be found in src/gbinder_config.c
Description
No description provided
Readme 1.5 MiB
Languages
C 97.2%
Makefile 1.8%
Yacc 0.7%
Lex 0.2%
Shell 0.1%