Merge "Complete frontend APIs"

This commit is contained in:
TreeHugger Robot
2019-12-21 00:02:29 +00:00
committed by Android (Google) Code Review
2 changed files with 58 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;",