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

Commit 42630144 authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge "[MQ] Update TV input HAL to V3" into main

parents 47bf2907 cf920bf8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ final class TvInputHal implements Handler.Callback {
    private static native void nativeClose(long ptr);
    private static native int nativeSetTvMessageEnabled(long ptr, int deviceId, int streamId,
            int type, boolean enabled);
    private static native int nativeSetPictureProfile(
            long ptr, int deviceId, int streamId, long profileHandle);

    private final Object mLock = new Object();
    private long mPtr = 0;
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ cc_defaults {
        "android.hardware.thermal@1.0",
        "android.hardware.thermal-V3-ndk",
        "android.hardware.tv.input@1.0",
        "android.hardware.tv.input-V2-ndk",
        "android.hardware.tv.input-V3-ndk",
        "android.hardware.vibrator-V3-ndk",
        "android.hardware.vr@1.0",
        "android.hidl.token@1.0-utils",
+7 −0
Original line number Diff line number Diff line
@@ -91,6 +91,12 @@ static int nativeSetTvMessageEnabled(JNIEnv* env, jclass clazz, jlong ptr, jint
    return tvInputHal->setTvMessageEnabled(deviceId, streamId, type, enabled);
}

static int nativeSetPictureProfile(JNIEnv* env, jclass clazz, jlong ptr, jint deviceId,
                                   jint streamId, jlong profileHandle) {
    JTvInputHal* tvInputHal = (JTvInputHal*)ptr;
    return tvInputHal->setPictureProfileId(deviceId, streamId, profileHandle);
}

static void nativeClose(JNIEnv* env, jclass clazz, jlong ptr) {
    JTvInputHal* tvInputHal = (JTvInputHal*)ptr;
    delete tvInputHal;
@@ -104,6 +110,7 @@ static const JNINativeMethod gTvInputHalMethods[] = {
        {"nativeGetStreamConfigs", "(JII)[Landroid/media/tv/TvStreamConfig;",
         (void*)nativeGetStreamConfigs},
        {"nativeSetTvMessageEnabled", "(JIIIZ)I", (void*)nativeSetTvMessageEnabled},
        {"nativeSetPictureProfile", "(JIIJ)I", (void*)nativeSetPictureProfile},
        {"nativeClose", "(J)V", (void*)nativeClose},
};

+19 −0
Original line number Diff line number Diff line
@@ -156,6 +156,15 @@ int JTvInputHal::setTvMessageEnabled(int deviceId, int streamId, int type, bool
    return NO_ERROR;
}

int JTvInputHal::setPictureProfileId(int deviceId, int streamId, long profileHandle) {
    ::ndk::ScopedAStatus status = mTvInput->setPictureProfileId(deviceId, streamId, profileHandle);
    if (!status.isOk()) {
        ALOGE("Error in setPictureProfileId. device id:%d stream id:%d", deviceId, streamId);
        return status.getStatus();
    }
    return NO_ERROR;
}

const std::vector<AidlTvStreamConfig> JTvInputHal::getStreamConfigs(int deviceId) {
    std::vector<AidlTvStreamConfig> list;
    ::ndk::ScopedAStatus status = mTvInput->getStreamConfigurations(deviceId, &list);
@@ -551,6 +560,16 @@ JTvInputHal::ITvInputWrapper::ITvInputWrapper(std::shared_ptr<AidlITvInput>& aid
    }
}

::ndk::ScopedAStatus JTvInputHal::ITvInputWrapper::setPictureProfileId(int32_t deviceId,
                                                                       int32_t streamId,
                                                                       long profileHandle) {
    if (mIsHidl) {
        return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
    } else {
        return mAidlTvInput->setPictureProfileId(deviceId, streamId, profileHandle);
    }
}

::ndk::ScopedAStatus JTvInputHal::ITvInputWrapper::getTvMessageQueueDesc(
        MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
        int32_t in_streamId) {
+2 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public:

    int addOrUpdateStream(int deviceId, int streamId, const sp<Surface>& surface);
    int setTvMessageEnabled(int deviceId, int streamId, int type, bool enabled);
    int setPictureProfileId(int deviceId, int streamId, long profileHandle);
    int removeStream(int deviceId, int streamId);
    const std::vector<AidlTvStreamConfig> getStreamConfigs(int deviceId);

@@ -208,6 +209,7 @@ private:
        ::ndk::ScopedAStatus closeStream(int32_t in_deviceId, int32_t in_streamId);
        ::ndk::ScopedAStatus setTvMessageEnabled(int32_t deviceId, int32_t streamId,
                                                 TvMessageEventType in_type, bool enabled);
        ::ndk::ScopedAStatus setPictureProfileId(int deviceId, int streamId, long profileHandle);
        ::ndk::ScopedAStatus getTvMessageQueueDesc(
                MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
                int32_t in_streamId);