diff options
| author | 2024-06-06 02:25:45 +0000 | |
|---|---|---|
| committer | 2024-06-06 02:25:45 +0000 | |
| commit | ac35d9ec1aa00d58b0a561a992271b3583ea0dba (patch) | |
| tree | e7a700a71d66a96d1ce87d3658579f9c54c20bfa | |
| parent | fdd8dab646641f13d5ae925cfbf7e94ab0539340 (diff) | |
| parent | ebd1094818ece2699f880c290bf44bf4ff3c91b1 (diff) | |
Merge "Add addService to pass in dump priority flags." into main am: e2555ea7a3 am: ebd1094818
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3112921
Change-Id: I157c0727cf11f60f430c76c1e193b00346464aa7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/binder/ndk/include_platform/android/binder_manager.h | 6 | ||||
| -rw-r--r-- | libs/binder/ndk/service_manager.cpp | 20 |
2 files changed, 24 insertions, 2 deletions
diff --git a/libs/binder/ndk/include_platform/android/binder_manager.h b/libs/binder/ndk/include_platform/android/binder_manager.h index 52edae4a38..41b30a0a0f 100644 --- a/libs/binder/ndk/include_platform/android/binder_manager.h +++ b/libs/binder/ndk/include_platform/android/binder_manager.h @@ -30,7 +30,11 @@ enum AServiceManager_AddServiceFlag : uint32_t { * Services with methods that perform file IO, web socket creation or ways to egress data must * not be added with this flag for privacy concerns. */ - ADD_SERVICE_ALLOW_ISOLATED = 1, + ADD_SERVICE_ALLOW_ISOLATED = 1 << 0, + ADD_SERVICE_DUMP_FLAG_PRIORITY_CRITICAL = 1 << 1, + ADD_SERVICE_DUMP_FLAG_PRIORITY_HIGH = 1 << 2, + ADD_SERVICE_DUMP_FLAG_PRIORITY_NORMAL = 1 << 3, + ADD_SERVICE_DUMP_FLAG_PRIORITY_DEFAULT = 1 << 4, }; /** diff --git a/libs/binder/ndk/service_manager.cpp b/libs/binder/ndk/service_manager.cpp index 5529455cc6..4436dbeed7 100644 --- a/libs/binder/ndk/service_manager.cpp +++ b/libs/binder/ndk/service_manager.cpp @@ -49,7 +49,25 @@ binder_exception_t AServiceManager_addServiceWithFlags(AIBinder* binder, const c sp<IServiceManager> sm = defaultServiceManager(); bool allowIsolated = flags & AServiceManager_AddServiceFlag::ADD_SERVICE_ALLOW_ISOLATED; - status_t exception = sm->addService(String16(instance), binder->getBinder(), allowIsolated); + int dumpFlags = 0; + if (flags & AServiceManager_AddServiceFlag::ADD_SERVICE_DUMP_FLAG_PRIORITY_CRITICAL) { + dumpFlags |= IServiceManager::DUMP_FLAG_PRIORITY_CRITICAL; + } + if (flags & AServiceManager_AddServiceFlag::ADD_SERVICE_DUMP_FLAG_PRIORITY_HIGH) { + dumpFlags |= IServiceManager::DUMP_FLAG_PRIORITY_HIGH; + } + if (flags & AServiceManager_AddServiceFlag::ADD_SERVICE_DUMP_FLAG_PRIORITY_NORMAL) { + dumpFlags |= IServiceManager::DUMP_FLAG_PRIORITY_NORMAL; + } + if (flags & AServiceManager_AddServiceFlag::ADD_SERVICE_DUMP_FLAG_PRIORITY_DEFAULT) { + dumpFlags |= IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT; + } + if (dumpFlags == 0) { + dumpFlags = IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT; + } + status_t exception = + sm->addService(String16(instance), binder->getBinder(), allowIsolated, dumpFlags); + return PruneException(exception); } |