Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efb192bf authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add an aconfig flag for media.c2 AIDL impl" into main am: 5cb473bc

parents b26090f7 5cb473bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -12,5 +12,11 @@ java_aconfig_library {

cc_aconfig_library {
    name: "aconfig_mediacodec_flags_c_lib",
    min_sdk_version: "30",
    vendor_available: true,
    apex_available: [
        "//apex_available:platform",
        "com.android.media.swcodec",
    ],
    aconfig_declarations: "aconfig_mediacodec_flags",
}
+7 −0
Original line number Diff line number Diff line
@@ -13,3 +13,10 @@ flag {
  description: "Feature flags for media codec importance"
  bug: "297929011"
}

flag {
  name: "aidl_hal"
  namespace: "codec_fwk"
  description: "Feature flags for enabling AIDL HAL handling"
  bug: "251850069"
}
+8 −1
Original line number Diff line number Diff line
@@ -7,6 +7,10 @@ package {
cc_library {
    name: "libcodec2_aidl_client",

    defaults: [
        "libcodec2_hal_selection",
    ],

    srcs: [
        "BufferTypes.cpp",
        "ParamTypes.cpp",
@@ -58,7 +62,10 @@ cc_library {
    apex_available: [
        "//apex_available:platform",
        "com.android.media.swcodec",
        "test_com.android.media.swcodec",
    ],

    defaults: [
        "libcodec2_hal_selection",
    ],

    srcs: [
+2 −34
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
// #include <android/sysprop/MediaProperties.sysprop.h>
#include <android-base/properties.h>
#include <codec2/aidl/ParamTypes.h>
#include <codec2/common/HalSelection.h>
#include <codec2/common/ParamTypes.h>

#include "ParamTypes-specialization.h"
@@ -162,40 +163,7 @@ namespace c2 {
namespace utils {

bool IsSelected() {
    // TODO: read from aconfig flags
    const bool enabled = false;

    if (!enabled) {
        // Cannot select AIDL if not enabled
        return false;
    }
#if 0
    // NOTE: due to dependency from mainline modules cannot use libsysprop
    using ::android::sysprop::MediaProperties::codec2_hal_selection;
    using ::android::sysprop::MediaProperties::codec2_hal_selection_values;
    constexpr codec2_hal_selection_values AIDL = codec2_hal_selection_values::AIDL;
    constexpr codec2_hal_selection_values HIDL = codec2_hal_selection_values::HIDL;
    codec2_hal_selection_values selection = codec2_hal_selection().value_or(HIDL);
    switch (selection) {
    case AIDL:
        return true;
    case HIDL:
        return false;
    default:
        LOG(FATAL) << "Unexpected codec2 HAL selection value: " << (int)selection;
    }
#else
    std::string selection = ::android::base::GetProperty("media.c2.hal.selection", "hidl");
    if (selection == "aidl") {
        return true;
    } else if (selection == "hidl") {
        return false;
    } else {
        LOG(FATAL) << "Unexpected codec2 HAL selection value: " << selection;
    }
#endif

    return false;
    return ::android::IsCodec2AidlHalSelected();
}

const char* asString(Status status, const char* def) {
+37 −0
Original line number Diff line number Diff line
@@ -28,3 +28,40 @@ cc_library {
        "libstagefright_foundation",
    ],
}

cc_library_static {
    name: "libcodec2_hal_selection_static",
    double_loadable: true,
    vendor_available: true,
    apex_available: [
        "//apex_available:platform",
        "com.android.media",
        "com.android.media.swcodec",
    ],
    min_sdk_version: "29",

    srcs: [
        "HalSelection.cpp",
    ],

    export_include_dirs: ["include/"],

    shared_libs: [
        "libbase",
        "server_configurable_flags",
    ],

    static_libs: ["aconfig_mediacodec_flags_c_lib"],
}

cc_defaults {
    name: "libcodec2_hal_selection",
    static_libs: [
        "aconfig_mediacodec_flags_c_lib",
        "libcodec2_hal_selection_static",
    ],
    shared_libs: [
        "libbase",
        "server_configurable_flags",
    ],
}
Loading