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

Commit c5516dcd authored by Pawin Vongmasa's avatar Pawin Vongmasa Committed by Android (Google) Code Review
Browse files

Merge "Add an option to connect OMXClient to a Treble service."

parents a1ee4c28 94e36c56
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ public:
    OMXClient();

    status_t connect();
    status_t connectTreble();
    void disconnect();

    sp<IOMX> interface() {
+3 −1
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ LOCAL_SHARED_LIBRARIES += \
        libdl \
        libRScpp \
        libhidlbase \
        android.hardware.media.omx@1.0 \
        android.hardware.media.omx@1.0-utils \

LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia

+17 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@

#include "include/OMX.h"

#include "omx/hal/1.0/utils/WOmx.h"

namespace android {

OMXClient::OMXClient() {
@@ -53,6 +55,21 @@ status_t OMXClient::connect() {
    return OK;
}

status_t OMXClient::connectTreble() {
    using namespace ::android::hardware::media::omx::V1_0;
    sp<IOmx> tOmx = IOmx::getService("default");
    if (tOmx.get() == nullptr) {
        ALOGE("Cannot obtain Treble IOmx.");
        return NO_INIT;
    }
    if (!tOmx->isRemote()) {
        ALOGE("Treble IOmx is in passthrough mode.");
        return NO_INIT;
    }
    mOMX = new utils::LWOmx(tOmx);
    return OK;
}

void OMXClient::disconnect() {
    mOMX.clear();
}