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

Commit d71c0bc3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Complete frontend APIs"

parents c9cf8c1e e65b686c
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ public final class Tuner implements AutoCloseable {
     */
    private native Frontend nativeOpenFrontendById(int id);
    private native int nativeTune(int type, FrontendSettings settings);
    private native int nativeStopTune();
    private native int nativeSetLnb(int lnbId);
    private native int nativeSetLna(boolean enable);

    private native Filter nativeOpenFilter(int type, int subType, int bufferSize);

@@ -256,6 +259,46 @@ public final class Tuner implements AutoCloseable {
        return nativeTune(settings.getType(), settings);
    }

    /**
     * Stops a previous tuning.
     *
     * If the method completes successfully the frontend is no longer tuned and no data
     * will be sent to attached filters.
     *
     * @return result status of the operation.
     * @hide
     */
    public int stopTune() {
        return nativeStopTune();
    }

    /**
     * Sets Low-Noise Block downconverter (LNB) for satellite frontend.
     *
     * This assigns a hardware LNB resource to the satellite tuner. It can be
     * called multiple times to update LNB assignment.
     *
     * @param lnb the LNB instance.
     *
     * @return result status of the operation.
     * @hide
     */
    public int setLnb(@NonNull Lnb lnb) {
        return nativeSetLnb(lnb.mId);
    }

    /**
     * Enable or Disable Low Noise Amplifier (LNA).
     *
     * @param enable true to activate LNA module; false to deactivate LNA
     *
     * @return result status of the operation.
     * @hide
     */
    public int setLna(boolean enable) {
        return nativeSetLna(enable);
    }

    private List<Integer> getFrontendIds() {
        mFrontendIds = nativeGetFrontendIds();
        return mFrontendIds;
+15 −0
Original line number Diff line number Diff line
@@ -600,6 +600,18 @@ static int android_media_tv_Tuner_tune(JNIEnv *env, jobject thiz, jint type, job
    return tuner->tune(getFrontendSettings(env, type, settings));
}

static int android_media_tv_Tuner_stop_tune(JNIEnv, jobject) {
    return 0;
}

static int android_media_tv_Tuner_set_lnb(JNIEnv, jobject, jint) {
    return 0;
}

static int android_media_tv_Tuner_set_lna(JNIEnv, jobject, jint, jboolean) {
    return 0;
}

static jobject android_media_tv_Tuner_get_lnb_ids(JNIEnv *env, jobject thiz) {
    sp<JTuner> tuner = getTuner(env, thiz);
    return tuner->getLnbIds();
@@ -850,6 +862,9 @@ static const JNINativeMethod gTunerMethods[] = {
            (void *)android_media_tv_Tuner_open_frontend_by_id },
    { "nativeTune", "(ILandroid/media/tv/tuner/FrontendSettings;)I",
            (void *)android_media_tv_Tuner_tune },
    { "nativeStopTune", "()I", (void *)android_media_tv_Tuner_stop_tune },
    { "nativeSetLnb", "(I)I", (void *)android_media_tv_Tuner_set_lnb },
    { "nativeSetLna", "(Z)I", (void *)android_media_tv_Tuner_set_lna },
    { "nativeOpenFilter", "(III)Landroid/media/tv/tuner/Tuner$Filter;",
            (void *)android_media_tv_Tuner_open_filter },
    { "nativeGetLnbIds", "()Ljava/util/List;",