drm_hwcomposer: hwc3: Fix build with Android-13
Account for differences in the Composer3 API between v1 and v2.
Change-Id: Ia8cbef19b5554467af15932afd842601d9d7f7a8
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/hwc3/service.cpp b/hwc3/service.cpp
index d91ce9e..b545a67 100644
--- a/hwc3/service.cpp
+++ b/hwc3/service.cpp
@@ -46,9 +46,14 @@
const std::string instance = std::string() + Composer::descriptor +
"/default";
ALOGI("HWC3 service name %s", instance.c_str());
+#if __ANDROID_API__ >= 34
auto status = AServiceManager_addServiceWithFlags(
composer->asBinder().get(), instance.c_str(),
AServiceManager_AddServiceFlag::ADD_SERVICE_ALLOW_ISOLATED);
+#else
+ auto status = AServiceManager_addService(composer->asBinder().get(),
+ instance.c_str());
+#endif
if (status != STATUS_OK) {
ALOGE("Failed to register service. Error %d", (int)status);
return -EINVAL;