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/ComposerClient.cpp b/hwc3/ComposerClient.cpp
index 47ffc7e..0d3f9c0 100644
--- a/hwc3/ComposerClient.cpp
+++ b/hwc3/ComposerClient.cpp
@@ -154,7 +154,9 @@
// DisplayCommand and return.
case Composition::DISPLAY_DECORATION:
case Composition::SIDEBAND:
+#if __ANDROID_API__ >= 34
case Composition::REFRESH_RATE_INDICATOR:
+#endif
return false;
}
}
@@ -188,7 +190,9 @@
// Unsupported composition types.
case Composition::DISPLAY_DECORATION:
case Composition::SIDEBAND:
+#if __ANDROID_API__ >= 34
case Composition::REFRESH_RATE_INDICATOR:
+#endif
ALOGE("Unsupported composition type: %s",
toString(composition->composition).c_str());
return std::nullopt;
@@ -1242,6 +1246,8 @@
return ToBinderStatus(hwc3::Error::kUnsupported);
}
+#if __ANDROID_API__ >= 34
+
ndk::ScopedAStatus ComposerClient::getOverlaySupport(
OverlayProperties* /*out_overlay_properties*/) {
return ToBinderStatus(hwc3::Error::kUnsupported);
@@ -1263,6 +1269,8 @@
return ToBinderStatus(hwc3::Error::kUnsupported);
}
+#endif
+
#if __ANDROID_API__ >= 35
ndk::ScopedAStatus ComposerClient::getDisplayConfigurations(
diff --git a/hwc3/ComposerClient.h b/hwc3/ComposerClient.h
index 91a0be0..20d15b4 100644
--- a/hwc3/ComposerClient.h
+++ b/hwc3/ComposerClient.h
@@ -131,6 +131,9 @@
ndk::ScopedAStatus setVsyncEnabled(int64_t display, bool enabled) override;
ndk::ScopedAStatus setIdleTimerEnabled(int64_t display,
int32_t timeout) override;
+
+#if __ANDROID_API__ >= 34
+
ndk::ScopedAStatus getOverlaySupport(
OverlayProperties* out_overlay_properties) override;
ndk::ScopedAStatus getHdrConversionCapabilities(
@@ -141,6 +144,8 @@
ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(
int64_t display, bool enabled) override;
+#endif
+
#if __ANDROID_API__ >= 35
ndk::ScopedAStatus getDisplayConfigurations(
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;