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

Commit 14cf911e 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 6db8d2d7 5cb473bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -12,5 +12,11 @@ java_aconfig_library {


cc_aconfig_library {
cc_aconfig_library {
    name: "aconfig_mediacodec_flags_c_lib",
    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",
    aconfig_declarations: "aconfig_mediacodec_flags",
}
}
+7 −0
Original line number Original line Diff line number Diff line
@@ -13,3 +13,10 @@ flag {
  description: "Feature flags for media codec importance"
  description: "Feature flags for media codec importance"
  bug: "297929011"
  bug: "297929011"
}
}

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


    defaults: [
        "libcodec2_hal_selection",
    ],

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

    defaults: [
        "libcodec2_hal_selection",
    ],
    ],


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


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


bool IsSelected() {
bool IsSelected() {
    // TODO: read from aconfig flags
    return ::android::IsCodec2AidlHalSelected();
    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;
}
}


const char* asString(Status status, const char* def) {
const char* asString(Status status, const char* def) {
+37 −0
Original line number Original line Diff line number Diff line
@@ -28,3 +28,40 @@ cc_library {
        "libstagefright_foundation",
        "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