summaryrefslogtreecommitdiff
path: root/cmds/servicemanager/ServiceManager.h
AgeCommit message (Collapse)Author
2025-01-08[native] Restore ServiceManager#checkService() to return IBinder Alice Wang
This fixes crashes in 3p libraries. A new API ServiceManager#checkService2() has been introduced to work with the Service enum type. Bug: 387175643 Test: atest servicemanager_test Change-Id: I647f4a11469717c54111afab562a0be2d5260044
2024-12-03Remove static list in libbinder for caching Parth Sane
This adds a new flag to identify Lazy services. This flag is set when addService is called from LazyServiceRegistrar. This flag is then used by libbinder in a client. When getService is called, libbinder decides if the binder should be cached or not using this flag. Doc: go/libbinder-cache-v2 Flag: RELEASE_LIBBINDER_REMOVE_STATIC_LIST Test: atest binderCacheUnitTest Bug: 333854840 Change-Id: I5fff0140f635dddb4f5a6d618f4e9abace6feb54
2024-08-05Check permission to add accessor in servicemanager Alice Wang
When a service is served via accessor. Bug: 351790282 Test: atest vm_accessor_test Change-Id: I71ff2fab9ccd783028bd37d6e450d7842aa50e2a
2024-07-26[native] Restore ServiceManager#getService() to return IBinder Alice Wang
This fixes a crash in 3p libraries. A new API ServiceManager#getService2() has been introduced to work with the Service enum type. Bug: 354674329 Bug: 355187769 Test: atest servicemanager_test Test: atest vm_accessor_test Test: Run the demo app in b/354674329 and check it works Change-Id: If1e0e9bee6dcd3cfceea69bea58ed5fbe431e81d
2024-07-19Support IAccessor in libbinder for RPC services Alice Wang
This cl sets up preconnected RPC binder for services launched with IAccessor as a proxy. Bug: 338541373 Test: m Test: atest vm_accessor_test Change-Id: Ic54732980778bc9ba8fec3395a0e98d336fea440
2024-06-17Add perfetto traces to ServiceManager Parth Sane
Bug: 342101947 Test: run external/perfetto/tools/record_android_trace -c config.pbtx Add the following to the config.pbtx: data_sources { config { name: "track_event" track_event_config { disabled_categories:"*" enabled_categories: "servicemanager" } } } Change-Id: Ida65d96241899f9f50a48f4b2f12ec1f7a5dc978
2023-05-10servicemanager: log missing service requestor pid Steven Moreland
To aid reducing logspam when clients repeatedly request services. Bug: N/A Test: boot & check logs Change-Id: I7acce0c94f00ee954d3285b3a4b94ca56b7636ef
2023-02-04Reland "servicemanager: fix lazy service issues" Steven Moreland
This reverts commit 66417657c54cebaeda3be19e539bb17d89172ed4. This CL is relanding removing a check, that was actually hit when services die. Most of the issues here occured in a single thread, and they were due to inconsistent state in the state machine around clients, and it appears there were a lot of other things added which papered over these issues. I've marked explanations in more detail in the code itself. Bug: 264814573 Test: aidl_lazy_test in a loop at 500x speed by adjusting timings, running for an hour Change-Id: Icbd72470dbe91761800761e81893f3ebe343e430
2023-02-01Revert "servicemanager: fix lazy service issues" Steven Moreland
This reverts commit 0db2addca8284f79cc5e9a4d97a1effa5142fe1e. Reason for revert: b/267519452 Change-Id: I8c5395fa33799491b0f6e3cb4614b0ca2b68dbb4
2023-01-31servicemanager: fix lazy service issues Steven Moreland
Most of the issues here occured in a single thread, and they were due to inconsistent state in the state machine around clients, and it appears there were a lot of other things added which papered over these issues. I've marked explanations in more detail in the code itself. Bug: 264814573 Test: aidl_lazy_test in a loop at 500x speed by adjusting timings, running for an hour Change-Id: Ifa20a7214839a91543413d3c4ee2b0a24e0c3751
2023-01-26servicemanager: log why we notify lazy services Steven Moreland
This makes it more clear when races which require guaranteeClient get hit. Bug: 264814573 Test: check logs Change-Id: Id4d6984a8120d8df8e13dd748959d71a0c6b8422
2022-10-26servicemanager: getUpdatableNames() Jooyung Han
This new method is a reverse of updatableViaApex(). It returns the list of declared instances which can be updated via the passed APEX. Updatable vendor apexes are supposed to be used only to update HAL services. APEXd can use this method to see if the target APEX is actually to updating HALs. It's not exposed to NDK/Java yet because there's no clients. Bug: 254201177 Test: TBD Change-Id: I7b5aa7d00a3ddeb13855816006a9561dfa601529
2022-09-28servicemanager: log for service collision Steven Moreland
It's pretty easy to accidentally install two instances of a HAL. We've seen this in HIDL a lot, and we expect to see it some in AIDL, because we don't have a build guarantee. Bug: 247882470 Test: run binderLibTest twice and once and see PID log Change-Id: I848a767c2b3a4f089fd6742979bd94708cce2c94
2022-09-20servicemanager : Adding clear API to ServiceManager Pawan Wagh
Adding an API to clear members of ServiceManager. Using it in ServiceManagerFuzzer to avoid indirect leaks. BUG: 240481296 Test: m servicemanager_fuzzer && $ANDROID_HOST_OUT/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer Change-Id: Ifda8d81981a1143e08c80436ac80d74fcbe14318
2021-09-21Add getConnectionInfo API to service manager Devin Moore
This gets connection info from the vintf manifest for AIDL hals that report it. The hals will have new "ip" and "port" fields in their entries if they are serving the interface from a remote device at that ip address/port combo. Test: tested the IServiceManager API with an internal POC using a remote HAL Test: atest binderStabilityTest Bug: 198207801 Change-Id: I334bebe62afb40e9710b57257f95e37a9c2b8226
2021-04-21servicemanager: expose updatable-via-apex Steven Moreland
Service manager is already reading VINTF, so processes that need this information can access this information w/o needing more permissions. Bug: 185832616 Test: two added tests + manually specifying updatable-via-apex on a service and checking the result Change-Id: Id86a72d49466048a3e2173e40526981abb6f3123
2021-01-28ServiceManager: support debug dump w/ PIDs Steven Moreland
To enable binder service-name based dumps of services when the same interface might be registered from multiple different processes. The getDebugPid command can't be sent instead to specific instances, since if they are hung, the PID couldn't be retrieved. For partiy w/ HIDL, this uses the 'list' selinux permission to control reading debug dumps. Bug: 175322136 Test: using this info to dump AIDL HALs in ANR Change-Id: I4bc7c2df5faa6be1cdcc69b2a7fc882293f1d249
2020-09-24servicemanager: vintf declared API Steven Moreland
servicemanager already has to parse VINTF configurations, so exposing this functionality here (mirroring hwservicemanager). Note, this API, like isDeclared is not branded as "VINTF" for future compatibility with APEX or other interfaces. Bug: 168715768 Test: manual Change-Id: Ifbc44677605de757c46ef17f7f29fd83e66a8161
2020-01-29Revert^2 "Dynamically stop services with multiple interfaces" Jon Spivack
37f70cc1029e8e984e60f485db59d6e6889cbb1b Reason for revert: This undoes the previous reversion, which was made to fix b/148282665. Change-Id: Ie855de284969af5dc937dc95daae84c3df107d32
2020-01-25Revert "Dynamically stop services with multiple interfaces" Jon Spivack
Revert "Add aidl_lazy_test_server to Cuttlefish" Revert "Move aidl_lazy_test_server to system_ext" Revert submission 1209453-aidl-lazy-presubmit Reason for revert: b/148282665. A test has begun to fail on git_stage-aosp-master, and I need to verify whether these changes are responsible. Reverted Changes: Ib09a2460e: Add aidl_lazy_test to general-tests Ib08989356: Move aidl_lazy_test_server to system_ext I694e6ad35: Add aidl_lazy_test_server to Cuttlefish I65db12c63: Add aidl_lazy_test to presubmit I7ec80a280: Dynamically stop services with multiple interfaces... Change-Id: I6d3b589bf2861f68d2852c8def7a1f51eea7cf97
2020-01-16Dynamically stop services with multiple interfaces Jon Spivack
This fixes a couple workflow bugs with dynamic services that had multiple interfaces in use at once. Attempting to stop one could affect the reference count of the other, and re-adding it after a failed removal yielded duplicate registrations. Bug: 146903840 Test: aidl_lazy_test Change-Id: I7ec80a280dabf7c576b7b00dff404a68c24ae5f1
2019-12-23ServiceManager: Internal renames Jon Spivack
Renamed CallbackMap as ServiceCallbackMap to better distinguish it from the newly added ClientCallbackMap. Bug: N/A Test: aidl_lazy_test Change-Id: I890ddbed5734dfeb9f7265fd424098f2bac2ffca
2019-12-19Dynamically stop lazy services Jon Spivack
Services can choose to register with the new LazyServiceRegistrar. ServiceManager perpetually checks the reference counts of services registered in this way. If ServiceManager detects that a service no longer has any clients, it will notify the LazyServiceRegistrar, which will attempt to shut down the service. Bug: 143108344 Test: aidl_lazy_test Change-Id: Ic01981b767ab4402e7aecdf1cdf9ed64df1f5af4
2019-10-28ServiceManager: add isDeclared Steven Moreland
Most of the time, AIDL services exist in client/service pairs. In this context, `while(true) getService` or `waitForService` makes sense. However, for VINTF services, this client/server coupling isn't guaranteed. A device may or may not have specific hardware. So, now IServiceManager can tell a client when a server will exist so it will know if it needs to wait for this service during boot-up. The function waitForDeclaredService is provided for this. These functions are generic (not referring to VINTF specifically) because they may be expanded to include information about APEX services in the future OR the infrastructure may be made generic to work, if desired, on system services. Bug: 141828236 Test: binderStabilityTest, using waitForDeclaredService function Change-Id: Ia230625e44e1685cc3fa9230ece8f0a25c88585e
2019-09-09ServiceManager signals init to start lazy services Jon Spivack
This allows services to be disabled at boot and dynamically enabled as they are needed. When servicemanager receives a getService request, it will check whether the service is running. If it is not, servicemanager will attempt to start the service by signaling init with the ctl.interface_start control message. Bug: 138756857 Test: Manual (using mediaextractor as a test service), test_sm Change-Id: Ic2d47d21769b936381e3fae2f2cf739d3b7501a4
2019-08-29servicemanager: notifications Steven Moreland
You can now register and receive notifications for new services. Eye towards: - avoiding while(true) getService loops - need it to make AIDL dynamic HALs - need it for feature parity w/ HIDL Bug: 136027762 Test: servicemanager_test Change-Id: Iffbf984e87214aa9c9b7af8a5ae682e127ba40a5
2019-08-26servicemanager: add sanity check in destructor Steven Moreland
Documenting some invariants. Since I am adding some more APIs, I want this to be explicit. Bug: 136027762 Test: servicemanager_test Change-Id: I67da9d92c3a457926739fb1f02411a57caefa5b8
2019-07-09servicemanager: use libbinder Steven Moreland
Bug: 135768100 Test: boot Test: servicemanager_test Change-Id: I9d657b6c0d0be0f763b6d54e0e6c6bc1c1e3fc7a (cherry picked from commit 3e092daa14c63831d76d3ad6e56b2919a0523536)