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

Commit 2bdc1e9d authored by Devin Moore's avatar Devin Moore
Browse files

Stop serving HIDL media.c2 software instance in 202404 devices

New launching devices targeting 202404 vendor interface will not use
HIDL, so mediaserver can stop serving it.
max-level="8" means that the entry is removed from the manifest on
devices targeting vendor interfaces after 8 (Android U), so
hwservicemanager will now prevent it from being registered on those
devices.
Mediaserver checks to see if the HIDL service is declared, if it is
declared then it throws an error when there is an issue with registering
the service with hwservicemanager. If it is not declared, it does not
try to register the service.

Test: atest CtsMediaCodecTestCases
Bug: 218588089
Change-Id: I97858271ef60e4c11e4fce28acc68439b31a49ec
parent 7e7ca03e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
<manifest version="1.0" type="framework">
    <hal>
    <hal format="hidl" max-level="8">
        <name>android.hardware.media.c2</name>
        <transport>hwbinder</transport>
        <version>1.2</version>
+20 −8
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <C2Component.h>
#include <C2PlatformSupport.h>

#include <android/hidl/manager/1.2/IServiceManager.h>
#include <codec2/hidl/1.0/ComponentStore.h>
#include <codec2/hidl/1.1/ComponentStore.h>
#include <codec2/hidl/1.2/ComponentStore.h>
@@ -834,6 +835,13 @@ extern "C" void RegisterCodecServices() {
        }
    }

    // If the software component store isn't declared in the manifest, we don't
    // need to create the service and register it.
    using ::android::hidl::manager::V1_2::IServiceManager;
    IServiceManager::Transport transport =
            android::hardware::defaultServiceManager1_2()->getTransport(
                    V1_2::utils::ComponentStore::descriptor, "software");
    if (transport == IServiceManager::Transport::HWBINDER) {
        if (!hidlStore) {
            hidlStore = ::android::sp<V1_2::utils::ComponentStore>::make(
                    std::make_shared<H2C2ComponentStore>(nullptr));
@@ -844,6 +852,10 @@ extern "C" void RegisterCodecServices() {
        } else {
            LOG(ERROR) << "Cannot register software Codec2 v" << hidlVer << " service.";
        }
    } else {
        LOG(INFO) << "The HIDL software Codec2 service is deprecated"
                     " so it is not being registered with hwservicemanager.";
    }

    if (registered) {
        LOG(INFO) << "Software Codec2 service created and registered.";