diff options
| author | 2021-05-14 00:47:39 +0000 | |
|---|---|---|
| committer | 2021-05-14 01:08:19 +0000 | |
| commit | cbdfad5265989bbf155acc603fe4a91d7fee4fcd (patch) | |
| tree | 9498db18c7357840105374b89dd755ae2ef1a574 | |
| parent | c3229abcc72519b381e40fd9223df333f67d6779 (diff) | |
libbinder: more forcePersist docs
Documenting recommending use for now. Looked at adding a shared library
destructor, but this has limited use when people use _exit, when persist
HALs sometimes exit manually early, and since it only corresponds to
this one mechanism. Given perf team work targetting understanding memory
uses/process which are starting, we can focus/rely on more general
infrastructure.
Fixes: 187946888
Test: N/A
Change-Id: I67c2477bccd9ebc789e20527d5692ea3a107c675
| -rw-r--r-- | libs/binder/include/binder/LazyServiceRegistrar.h | 8 | ||||
| -rw-r--r-- | libs/binder/ndk/include_platform/android/binder_manager.h | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libs/binder/include/binder/LazyServiceRegistrar.h b/libs/binder/include/binder/LazyServiceRegistrar.h index 96597320f6..f3ba830923 100644 --- a/libs/binder/include/binder/LazyServiceRegistrar.h +++ b/libs/binder/include/binder/LazyServiceRegistrar.h @@ -50,8 +50,12 @@ class LazyServiceRegistrar { int dumpFlags = IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT); /** * Force the service to persist, even when it has 0 clients. - * If setting this flag from the server side, make sure to do so before calling registerService, - * or there may be a race with the default dynamic shutdown. + * If setting this flag from the server side, make sure to do so before calling + * registerService, or there may be a race with the default dynamic shutdown. + * + * This should only be used if it is every eventually set to false. If a + * service needs to persist but doesn't need to dynamically shut down, + * prefer to control it with another mechanism such as ctl.start. */ void forcePersist(bool persist); diff --git a/libs/binder/ndk/include_platform/android/binder_manager.h b/libs/binder/ndk/include_platform/android/binder_manager.h index a90b4aabca..db72067e33 100644 --- a/libs/binder/ndk/include_platform/android/binder_manager.h +++ b/libs/binder/ndk/include_platform/android/binder_manager.h @@ -135,6 +135,10 @@ bool AServiceManager_isUpdatableViaApex(const char* instance) __INTRODUCED_IN(31 /** * Prevent lazy services without client from shutting down their process * + * This should only be used if it is every eventually set to false. If a + * service needs to persist but doesn't need to dynamically shut down, + * prefer to control it with another mechanism. + * * \param persist 'true' if the process should not exit. */ void AServiceManager_forceLazyServicesPersist(bool persist) __INTRODUCED_IN(31); |