Merge "Return a collection in getAllAtsc3PlpInfo()"

This commit is contained in:
TreeHugger Robot
2022-02-03 07:05:39 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 12 deletions

View File

@@ -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<android.media.tv.tuner.frontend.Atsc3PlpInfo> getAllAtsc3PlpInfo();
method @NonNull public android.media.tv.tuner.frontend.FrontendStatus.Atsc3PlpTuningInfo[] getAtsc3PlpTuningInfo();
method public int getBandwidth();
method public int getBer();

View File

@@ -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.
*
* <p>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.
* <p>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<Atsc3PlpInfo> 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);
}
/**