Merge "Set minsdk for AIDL libs to 31" into main
diff --git a/media/codec2/hal/aidl/Android.bp b/media/codec2/hal/aidl/Android.bp
index b968c39..a6a6b77 100644
--- a/media/codec2/hal/aidl/Android.bp
+++ b/media/codec2/hal/aidl/Android.bp
@@ -6,6 +6,7 @@
// use libcodec2-aidl-client-defaults instead
cc_library {
name: "libcodec2_aidl_client",
+ min_sdk_version: "31",
srcs: [
"BufferTypes.cpp",
@@ -53,8 +54,8 @@
// use libcodec2-aidl-defaults instead
cc_library {
name: "libcodec2_aidl",
+ min_sdk_version: "31",
vendor_available: true,
- min_sdk_version: "34",
apex_available: [
"//apex_available:platform",
"com.android.media.swcodec",
@@ -131,11 +132,12 @@
// public dependency for Codec 2.0 HAL service implementations
cc_defaults {
name: "libcodec2-aidl-defaults",
- min_sdk_version: "34",
+ min_sdk_version: "31",
defaults: ["libcodec2-impl-defaults"],
shared_libs: [
"android.hardware.media.c2-V1-ndk",
+ "libbinder_ndk",
"libcodec2_aidl",
],
}
@@ -143,7 +145,7 @@
// public dependency for Codec 2.0 HAL client
cc_defaults {
name: "libcodec2-aidl-client-defaults",
- min_sdk_version: "34",
+ min_sdk_version: "31",
defaults: ["libcodec2-impl-defaults"],
shared_libs: [
diff --git a/media/codec2/hal/aidl/Component.cpp b/media/codec2/hal/aidl/Component.cpp
index fa18c3e..9c21a5b 100644
--- a/media/codec2/hal/aidl/Component.cpp
+++ b/media/codec2/hal/aidl/Component.cpp
@@ -301,7 +301,7 @@
switch (allocator.getTag()) {
case ALLOCATOR_ID:
#ifdef __ANDROID_APEX__
- status = CreateCodec2BlockPool(
+ status = ::android::CreateCodec2BlockPool(
static_cast<::android::C2PlatformAllocatorStore::id_t>(
allocator.get<ALLOCATOR_ID>()),
mComponent,
@@ -405,18 +405,22 @@
}
void Component::initListener(const std::shared_ptr<Component>& self) {
- std::shared_ptr<C2Component::Listener> c2listener =
- std::make_shared<Listener>(self);
- c2_status_t res = mComponent->setListener_vb(c2listener, C2_DONT_BLOCK);
- if (res != C2_OK) {
- mInit = res;
- }
+ if (__builtin_available(android __ANDROID_API_T__, *)) {
+ std::shared_ptr<C2Component::Listener> c2listener =
+ std::make_shared<Listener>(self);
+ c2_status_t res = mComponent->setListener_vb(c2listener, C2_DONT_BLOCK);
+ if (res != C2_OK) {
+ mInit = res;
+ }
- mDeathRecipient = ::ndk::ScopedAIBinder_DeathRecipient(
- AIBinder_DeathRecipient_new(OnBinderDied));
- mDeathContext = new DeathContext{weak_from_this()};
- AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), OnBinderUnlinked);
- AIBinder_linkToDeath(mListener->asBinder().get(), mDeathRecipient.get(), mDeathContext);
+ mDeathRecipient = ::ndk::ScopedAIBinder_DeathRecipient(
+ AIBinder_DeathRecipient_new(OnBinderDied));
+ mDeathContext = new DeathContext{weak_from_this()};
+ AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), OnBinderUnlinked);
+ AIBinder_linkToDeath(mListener->asBinder().get(), mDeathRecipient.get(), mDeathContext);
+ } else {
+ mInit = C2_NO_INIT;
+ }
}
// static
diff --git a/media/codec2/hal/aidl/ComponentStore.cpp b/media/codec2/hal/aidl/ComponentStore.cpp
index 19734c0..2489683 100644
--- a/media/codec2/hal/aidl/ComponentStore.cpp
+++ b/media/codec2/hal/aidl/ComponentStore.cpp
@@ -51,8 +51,11 @@
namespace c2 {
namespace utils {
+#ifndef __ANDROID_APEX__
using ::android::DefaultFilterPlugin;
using ::android::FilterWrapper;
+#endif
+
using ::ndk::ScopedAStatus;
namespace /* unnamed */ {