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

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

Merge "Add the Treble version of OMX to the service."

parents c5516dcd 033975f9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@ include $(CLEAR_VARS)
LOCAL_REQUIRED_MODULES_arm := mediacodec-seccomp.policy
LOCAL_SRC_FILES := main_codecservice.cpp minijail/minijail.cpp
LOCAL_SHARED_LIBRARIES := libmedia libmediacodecservice libbinder libutils \
	liblog libminijail
    liblog libminijail libcutils \
    android.hardware.media.omx@1.0
LOCAL_C_INCLUDES := \
    $(TOP)/frameworks/av/media/libstagefright \
    $(TOP)/frameworks/native/include/media/openmax
+18 −0
Original line number Diff line number Diff line
@@ -25,11 +25,14 @@
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <utils/Log.h>
#include <cutils/properties.h>

// from LOCAL_C_INCLUDES
#include "MediaCodecService.h"
#include "minijail/minijail.h"

#include <android/hardware/media/omx/1.0/IOmx.h>

using namespace android;

int main(int argc __unused, char** argv)
@@ -42,6 +45,21 @@ int main(int argc __unused, char** argv)
    sp<ProcessState> proc(ProcessState::self());
    sp<IServiceManager> sm = defaultServiceManager();
    MediaCodecService::instantiate();

    // Treble
    bool useTrebleOmx = bool(property_get_bool("debug.treble_omx", 0));
    if (useTrebleOmx) {
        using namespace ::android::hardware::media::omx::V1_0;
        sp<IOmx> omx = IOmx::getService(true);
        if (omx == nullptr) {
            ALOGE("Cannot create a Treble IOmx service.");
        } else if (omx->registerAsService("default") != OK) {
            ALOGE("Cannot register a Treble IOmx service.");
        } else {
            ALOGV("Treble IOmx service created.");
        }
    }

    ProcessState::self()->startThreadPool();
    IPCThreadState::self()->joinThreadPool();
}