Merge "Unhide FrontendSettings part 1 with super Builder class"
diff --git a/api/system-current.txt b/api/system-current.txt
index 5d2260d..2dbd7f5 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4665,11 +4665,6 @@
method public int getVideoFilterCount();
}
- public abstract class FrontendSettings {
- method public final int getFrequency();
- method public abstract int getType();
- }
-
public class Lnb implements java.lang.AutoCloseable {
method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void close();
method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int sendDiseqcMessage(@NonNull byte[]);
@@ -4698,7 +4693,7 @@
method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Tuner.Descrambler openDescrambler();
method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void setOnTuneEventListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.frontend.OnTuneEventListener);
method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int stopTune();
- method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int tune(@NonNull android.media.tv.tuner.FrontendSettings);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int tune(@NonNull android.media.tv.tuner.frontend.FrontendSettings);
}
public class Tuner.Descrambler {
@@ -4781,6 +4776,60 @@
package android.media.tv.tuner.frontend {
+ public class AnalogFrontendSettings extends android.media.tv.tuner.frontend.FrontendSettings {
+ method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public static android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder builder(@NonNull android.content.Context);
+ method public int getSifStandard();
+ method public int getSignalType();
+ method public int getType();
+ field public static final int SIF_BG = 1; // 0x1
+ field public static final int SIF_BG_A2 = 2; // 0x2
+ field public static final int SIF_BG_NICAM = 4; // 0x4
+ field public static final int SIF_DK = 16; // 0x10
+ field public static final int SIF_DK1 = 32; // 0x20
+ field public static final int SIF_DK2 = 64; // 0x40
+ field public static final int SIF_DK3 = 128; // 0x80
+ field public static final int SIF_DK_NICAM = 256; // 0x100
+ field public static final int SIF_I = 8; // 0x8
+ field public static final int SIF_I_NICAM = 16384; // 0x4000
+ field public static final int SIF_L = 512; // 0x200
+ field public static final int SIF_L_NICAM = 32768; // 0x8000
+ field public static final int SIF_L_PRIME = 65536; // 0x10000
+ field public static final int SIF_M = 1024; // 0x400
+ field public static final int SIF_M_A2 = 4096; // 0x1000
+ field public static final int SIF_M_BTSC = 2048; // 0x800
+ field public static final int SIF_M_EIA_J = 8192; // 0x2000
+ field public static final int SIF_UNDEFINED = 0; // 0x0
+ field public static final int SIGNAL_TYPE_NTSC = 4; // 0x4
+ field public static final int SIGNAL_TYPE_PAL = 1; // 0x1
+ field public static final int SIGNAL_TYPE_SECAM = 2; // 0x2
+ field public static final int SIGNAL_TYPE_UNDEFINED = 0; // 0x0
+ }
+
+ public static class AnalogFrontendSettings.Builder extends android.media.tv.tuner.frontend.FrontendSettings.Builder<android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder> {
+ method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings build();
+ method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setASignalType(int);
+ method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setSifStandard(int);
+ }
+
+ public abstract class FrontendSettings {
+ method public int getFrequency();
+ method public abstract int getType();
+ field public static final int TYPE_ANALOG = 1; // 0x1
+ field public static final int TYPE_ATSC = 2; // 0x2
+ field public static final int TYPE_ATSC3 = 3; // 0x3
+ field public static final int TYPE_DVBC = 4; // 0x4
+ field public static final int TYPE_DVBS = 5; // 0x5
+ field public static final int TYPE_DVBT = 6; // 0x6
+ field public static final int TYPE_ISDBS = 7; // 0x7
+ field public static final int TYPE_ISDBS3 = 8; // 0x8
+ field public static final int TYPE_ISDBT = 9; // 0x9
+ field public static final int TYPE_UNDEFINED = 0; // 0x0
+ }
+
+ public abstract static class FrontendSettings.Builder<T extends android.media.tv.tuner.frontend.FrontendSettings.Builder<T>> {
+ method @IntRange(from=1) @NonNull public T setFrequency(int);
+ }
+
public interface OnTuneEventListener {
method public void onTuneEvent(int);
field public static final int SIGNAL_LOCKED = 0; // 0x0
diff --git a/media/java/android/media/tv/tuner/FrontendSettings.java b/media/java/android/media/tv/tuner/FrontendSettings.java
index ad8422c..7f9b982 100644
--- a/media/java/android/media/tv/tuner/FrontendSettings.java
+++ b/media/java/android/media/tv/tuner/FrontendSettings.java
@@ -16,33 +16,10 @@
package android.media.tv.tuner;
-import android.annotation.SystemApi;
-
/**
* Frontend settings for tune and scan operations.
+ * TODO: remove
* @hide
*/
-@SystemApi
public abstract class FrontendSettings {
- private final int mFrequency;
-
- /** @hide */
- public FrontendSettings(int frequency) {
- mFrequency = frequency;
- }
-
- /**
- * Returns the frontend type.
- */
- public abstract int getType();
-
- /**
- * Gets the frequency setting.
- *
- * @return the frequency in Hz.
- */
- public final int getFrequency() {
- return mFrequency;
- }
-
}
diff --git a/media/java/android/media/tv/tuner/Tuner.java b/media/java/android/media/tv/tuner/Tuner.java
index b76001f..4457954 100644
--- a/media/java/android/media/tv/tuner/Tuner.java
+++ b/media/java/android/media/tv/tuner/Tuner.java
@@ -33,6 +33,7 @@
import android.media.tv.tuner.filter.FilterEvent;
import android.media.tv.tuner.filter.TimeFilter;
import android.media.tv.tuner.frontend.FrontendInfo;
+import android.media.tv.tuner.frontend.FrontendSettings;
import android.media.tv.tuner.frontend.FrontendStatus;
import android.media.tv.tuner.frontend.OnTuneEventListener;
import android.media.tv.tuner.frontend.ScanCallback;
diff --git a/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java
index a30ddc7..849b007 100644
--- a/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java
@@ -18,7 +18,11 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
+import android.annotation.SystemApi;
+import android.content.Context;
import android.hardware.tv.tuner.V1_0.Constants;
+import android.media.tv.tuner.TunerUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -28,6 +32,7 @@
*
* @hide
*/
+@SystemApi
public class AnalogFrontendSettings extends FrontendSettings {
/** @hide */
@IntDef(flag = true,
@@ -137,7 +142,7 @@
public static final int SIF_L_PRIME = Constants.FrontendAnalogSifStandard.L_PRIME;
- private final int mAnalogType;
+ private final int mSignalType;
private final int mSifStandard;
@Override
@@ -150,8 +155,8 @@
* Gets analog signal type.
*/
@SignalType
- public int getAnalogType() {
- return mAnalogType;
+ public int getSignalType() {
+ return mSignalType;
}
/**
@@ -164,43 +169,37 @@
/**
* Creates a builder for {@link AnalogFrontendSettings}.
+ *
+ * @parm the context of the caller.
*/
+ @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
@NonNull
- public static Builder newBuilder() {
+ public static Builder builder(@NonNull Context context) {
+ TunerUtils.checkTunerPermission(context);
return new Builder();
}
- private AnalogFrontendSettings(int frequency, int analogType, int sifStandard) {
+ private AnalogFrontendSettings(int frequency, int signalType, int sifStandard) {
super(frequency);
- mAnalogType = analogType;
+ mSignalType = signalType;
mSifStandard = sifStandard;
}
/**
* Builder for {@link AnalogFrontendSettings}.
*/
- public static class Builder {
- private int mFrequency;
- private int mAnalogType;
+ public static class Builder extends FrontendSettings.Builder<Builder> {
+ private int mSignalType;
private int mSifStandard;
private Builder() {}
/**
- * Sets frequency in Hz.
+ * Sets analog signal type.
*/
@NonNull
- public Builder setFrequency(int frequency) {
- mFrequency = frequency;
- return this;
- }
-
- /**
- * Sets analog type.
- */
- @NonNull
- public Builder setAnalogType(@SignalType int analogType) {
- mAnalogType = analogType;
+ public Builder setASignalType(@SignalType int signalType) {
+ mSignalType = signalType;
return this;
}
@@ -218,7 +217,12 @@
*/
@NonNull
public AnalogFrontendSettings build() {
- return new AnalogFrontendSettings(mFrequency, mAnalogType, mSifStandard);
+ return new AnalogFrontendSettings(mFrequency, mSignalType, mSifStandard);
+ }
+
+ @Override
+ Builder self() {
+ return this;
}
}
}
diff --git a/media/java/android/media/tv/tuner/frontend/FrontendSettings.java b/media/java/android/media/tv/tuner/frontend/FrontendSettings.java
index 617d608..b80b7cd 100644
--- a/media/java/android/media/tv/tuner/frontend/FrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/FrontendSettings.java
@@ -19,6 +19,7 @@
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.hardware.tv.tuner.V1_0.Constants;
import java.lang.annotation.Retention;
@@ -29,6 +30,7 @@
*
* @hide
*/
+@SystemApi
public abstract class FrontendSettings {
/** @hide */
@IntDef({TYPE_UNDEFINED, TYPE_ANALOG, TYPE_ATSC, TYPE_ATSC3, TYPE_DVBC, TYPE_DVBS, TYPE_DVBT,