commit | 296c736696ac75de3399538b4c83642044f20fc1 | [log] [tgz] |
---|---|---|
author | Pawan Wagh <waghpawan@google.com> | Thu Sep 22 02:01:20 2022 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Sep 22 02:01:20 2022 +0000 |
tree | 1b9baeb7afabe20f781a9ec0ee8d1f0e86714e97 | |
parent | 85f8a3557ec9398d96885871d92a9f60ebc6194c [diff] | |
parent | 6eef6394860146e17cbfb0c17f137ff908757b7e [diff] |
Merge "servicemanager : Adding clear API to ServiceManager" am: 00a54e416a am: 77527d1c6b am: 1c1f4122c4 am: 6eef639486 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2222273 Change-Id: Id22322c17de1c937e5478181c423cc83bb8d8dac Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp index 3cfe529..0727383 100644 --- a/cmds/servicemanager/ServiceManager.cpp +++ b/cmds/servicemanager/ServiceManager.cpp
@@ -762,4 +762,10 @@ return Status::ok(); } +void ServiceManager::clear() { + mNameToService.clear(); + mNameToRegistrationCallback.clear(); + mNameToClientCallback.clear(); +} + } // namespace android
diff --git a/cmds/servicemanager/ServiceManager.h b/cmds/servicemanager/ServiceManager.h index 5e40319..c6db697 100644 --- a/cmds/servicemanager/ServiceManager.h +++ b/cmds/servicemanager/ServiceManager.h
@@ -58,6 +58,12 @@ void binderDied(const wp<IBinder>& who) override; void handleClientCallbacks(); + /** + * This API is added for debug purposes. It clears members which hold service and callback + * information. + */ + void clear(); + protected: virtual void tryStartService(const std::string& name);
diff --git a/cmds/servicemanager/ServiceManagerFuzzer.cpp b/cmds/servicemanager/ServiceManagerFuzzer.cpp index 39f8522..b76a6bd 100644 --- a/cmds/servicemanager/ServiceManagerFuzzer.cpp +++ b/cmds/servicemanager/ServiceManagerFuzzer.cpp
@@ -29,6 +29,7 @@ auto accessPtr = std::make_unique<Access>(); auto serviceManager = sp<ServiceManager>::make(std::move(accessPtr)); fuzzService(serviceManager, FuzzedDataProvider(data, size)); + serviceManager->clear(); return 0; }