resourcemanager: refactor death notification
media.resource.manager Binder death notification is refactored
as it:
- uses static/no_destroy map and locks.
- doesn't connect with the resource.manager upon death.
So, the following changes are made with this CL:
- Reconnect with the resource.manager upon death
- Re-register all the resources, so that resource.manager
will have all the resource information to help with
codec reclaim.
- Avoid the usage of static/no_destroy map and locks by using
a context with a weak_ptr (as cookie) to validate
the object before dereferencing it.
- Replacing the deprecated API AServiceManager_getService
with AServiceManager_waitForService.
Bug: 284031542
Test: atest android.media.misc.cts.ResourceManagerTest
atest android.resourcemanager.cts.ResourceManagerHostJUnit4Test
atest android.mediav2.cts.CodecDecoderSurfaceTest
atest android.mediav2.cts.CodecDecoderTest
atest android.mediav2.cts.CodecEncoderSurfaceTest
atest android.mediav2.cts.CodecEncoderTest
Merged-In: I4332945086640876fc730992986181e883faddc0
Change-Id: I4332945086640876fc730992986181e883faddc0
diff --git a/services/mediaresourcemanager/ResourceManagerService.cpp b/services/mediaresourcemanager/ResourceManagerService.cpp
index 7446e0e..28a17b8 100644
--- a/services/mediaresourcemanager/ResourceManagerService.cpp
+++ b/services/mediaresourcemanager/ResourceManagerService.cpp
@@ -133,7 +133,7 @@
}
static bool hasResourceType(MediaResource::Type type, MediaResource::SubType subType,
- MediaResourceParcel resource) {
+ const MediaResourceParcel& resource) {
if (type != resource.type) {
return false;
}