diff --git a/core/api/system-current.txt b/core/api/system-current.txt index d5c35cd25add5..a126782541bed 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -7952,7 +7952,7 @@ package android.media.tv.tuner.frontend { public class FrontendStatus { method public int getAgc(); - method @NonNull public android.media.tv.tuner.frontend.Atsc3PlpInfo[] getAllAtsc3PlpInfo(); + method @NonNull public java.util.List getAllAtsc3PlpInfo(); method @NonNull public android.media.tv.tuner.frontend.FrontendStatus.Atsc3PlpTuningInfo[] getAtsc3PlpTuningInfo(); method public int getBandwidth(); method public int getBer(); diff --git a/media/java/android/media/tv/tuner/frontend/FrontendStatus.java b/media/java/android/media/tv/tuner/frontend/FrontendStatus.java index c1e9b38a13b00..9fbea724f491d 100644 --- a/media/java/android/media/tv/tuner/frontend/FrontendStatus.java +++ b/media/java/android/media/tv/tuner/frontend/FrontendStatus.java @@ -25,6 +25,9 @@ import android.media.tv.tuner.Lnb; import android.media.tv.tuner.TunerVersionChecker; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; /** * A Frontend Status class that contains the metrics of the active frontend. @@ -1086,22 +1089,26 @@ public class FrontendStatus { } /** - * Gets an array of all PLPs information of ATSC3 frontend, which includes both tuned and not + * Gets a list of all PLPs information of ATSC3 frontend, which includes both tuned and not * tuned PLPs for currently watching service. * - *

This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL - * doesn't return all PLPs information will throw IllegalStateException. Use - * {@link TunerVersionChecker#getTunerVersion()} to check the version. + *

This query is only supported by Tuner HAL 2.0 or higher. Unsupported version will throw + * UnsupportedOperationException. Use {@link TunerVersionChecker#getTunerVersion()} to check + * the version. + * + * @return a list of all PLPs information. It is empty if HAL doesn't return all PLPs + * information status. */ - @SuppressLint("ArrayReturn") @NonNull - public Atsc3PlpInfo[] getAllAtsc3PlpInfo() { - TunerVersionChecker.checkHigherOrEqualVersionTo( - TunerVersionChecker.TUNER_VERSION_2_0, "Atsc3PlpInfo all status"); - if (mAllPlpInfo == null) { - throw new IllegalStateException("Atsc3PlpInfo all status is empty"); + public List getAllAtsc3PlpInfo() { + if (!TunerVersionChecker.checkHigherOrEqualVersionTo( + TunerVersionChecker.TUNER_VERSION_2_0, "Atsc3PlpInfo all status")) { + throw new UnsupportedOperationException("Atsc3PlpInfo all status is empty"); } - return mAllPlpInfo; + if (mAllPlpInfo == null) { + return Collections.EMPTY_LIST; + } + return Arrays.asList(mAllPlpInfo); } /**