Publish new Broadcast Radio APIs.

Also, rename FEATURE_RADIO to FEATURE_BROADCASTRADIO.

Bug: b/34348946
Bug: b/63405337
Test: instrumentalization
Change-Id: Ibf5851a10b94f9e82db85f740fde6f28efe48666
This commit is contained in:
Tomasz Wasilczyk
2017-07-10 19:33:22 -07:00
parent 3c3acf8bf1
commit 05392d6360
6 changed files with 27 additions and 37 deletions

View File

@@ -11398,6 +11398,7 @@ package android.content.pm {
field public static final java.lang.String FEATURE_BACKUP = "android.software.backup";
field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
field public static final java.lang.String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
field public static final java.lang.String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera";
field public static final java.lang.String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
field public static final java.lang.String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
@@ -17315,7 +17316,10 @@ package android.hardware.radio {
method public int getNumTuners();
method public java.lang.String getProduct();
method public java.lang.String getSerial();
method public java.lang.String getServiceName();
method public java.lang.String getVendorExension();
method public java.lang.String getVersion();
method public boolean isBackgroundScanningSupported();
method public boolean isCaptureSupported();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ModuleProperties> CREATOR;
@@ -17327,7 +17331,10 @@ package android.hardware.radio {
method public android.hardware.radio.RadioMetadata getMetadata();
method public int getSignalStrength();
method public int getSubChannel();
method public java.lang.String getVendorExension();
method public boolean isDigital();
method public boolean isLive();
method public boolean isMuted();
method public boolean isStereo();
method public boolean isTuned();
method public void writeToParcel(android.os.Parcel, int);
@@ -17385,15 +17392,21 @@ package android.hardware.radio {
method public abstract int getConfiguration(android.hardware.radio.RadioManager.BandConfig[]);
method public abstract boolean getMute();
method public abstract int getProgramInformation(android.hardware.radio.RadioManager.ProgramInfo[]);
method public abstract java.util.List<android.hardware.radio.RadioManager.ProgramInfo> getProgramList(java.lang.String);
method public abstract boolean hasControl();
method public abstract boolean isAnalogForced();
method public abstract boolean isAntennaConnected();
method public abstract int scan(int, boolean);
method public abstract void setAnalogForced(boolean);
method public abstract int setConfiguration(android.hardware.radio.RadioManager.BandConfig);
method public abstract int setMute(boolean);
method public abstract boolean startBackgroundScan();
method public abstract int step(int, boolean);
method public abstract int tune(int, int);
field public static final int DIRECTION_DOWN = 1; // 0x1
field public static final int DIRECTION_UP = 0; // 0x0
field public static final int ERROR_BACKGROUND_SCAN_FAILED = 6; // 0x6
field public static final int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5; // 0x5
field public static final int ERROR_CANCELLED = 2; // 0x2
field public static final int ERROR_CONFIG = 4; // 0x4
field public static final int ERROR_HARDWARE_FAILURE = 0; // 0x0
@@ -17404,12 +17417,15 @@ package android.hardware.radio {
public static abstract class RadioTuner.Callback {
ctor public RadioTuner.Callback();
method public void onAntennaState(boolean);
method public void onBackgroundScanAvailabilityChange(boolean);
method public void onBackgroundScanComplete();
method public void onConfigurationChanged(android.hardware.radio.RadioManager.BandConfig);
method public void onControlChanged(boolean);
method public void onEmergencyAnnouncement(boolean);
method public void onError(int);
method public void onMetadataChanged(android.hardware.radio.RadioMetadata);
method public void onProgramInfoChanged(android.hardware.radio.RadioManager.ProgramInfo);
method public void onProgramListChanged();
method public void onTrafficAnnouncement(boolean);
}

View File

@@ -54,7 +54,6 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.provider.Settings;
import android.util.AndroidException;
import android.util.Log;
@@ -1901,12 +1900,13 @@ public abstract class PackageManager {
public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
/**
* The device includes broadcast radio tuner.
*
* @hide FutureFeature
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device includes broadcast radio tuner.
* @hide
*/
@SystemApi
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_RADIO = "android.hardware.radio";
public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
/**
* Feature for {@link #getSystemAvailableFeatures} and

View File

@@ -153,8 +153,6 @@ public class RadioManager {
/**
* Module service (driver) name as registered with HIDL.
* @return the module service name.
*
* @hide FutureFeature
*/
public @NonNull String getServiceName() {
return mServiceName;
@@ -229,8 +227,6 @@ public class RadioManager {
*
* @return {@code true} if background scanning is supported (not necessary available
* at a given time), {@code false} otherwise.
*
* @hide FutureFeature
*/
public boolean isBackgroundScanningSupported() {
return mIsBgScanSupported;
@@ -245,8 +241,6 @@ public class RadioManager {
*
* Client application MUST verify vendor/product name from the
* ModuleProperties class before doing any interpretation of this value.
*
* @hide FutureFeature
*/
public @NonNull String getVendorExension() {
return mVendorExension == null ? "" : mVendorExension;
@@ -1324,8 +1318,6 @@ public class RadioManager {
* {@code true} if the program is currently playing live stream.
* This may result in a slightly altered reception parameters,
* usually targetted at reduced latency.
*
* @hide FutureFeature
*/
public boolean isLive() {
return (mFlags & FLAG_LIVE) != 0;
@@ -1336,8 +1328,6 @@ public class RadioManager {
* conditions or buffering. In this state volume knob MAY be disabled to
* prevent user increasing volume too much.
* It does NOT mean the user has muted audio.
*
* @hide FutureFeature
*/
public boolean isMuted() {
return (mFlags & FLAG_MUTED) != 0;
@@ -1366,8 +1356,6 @@ public class RadioManager {
*
* Client application MUST verify vendor/product name from the
* ModuleProperties class before doing any interpretation of this value.
*
* @hide FutureFeature
*/
public @NonNull String getVendorExension() {
return mVendorExension == null ? "" : mVendorExension;

View File

@@ -219,7 +219,6 @@ public abstract class RadioTuner {
* is unavailable; ie. temporarily due to ongoing foreground playback in single-tuner device
* or permanently if the feature is not supported
* (see ModuleProperties#isBackgroundScanningSupported()).
* @hide FutureFeature
*/
public abstract boolean startBackgroundScan();
@@ -234,7 +233,6 @@ public abstract class RadioTuner {
* @throws IllegalStateException if the scan is in progress or has not been started,
* startBackgroundScan() call may fix it.
* @throws IllegalArgumentException if the filter argument is not valid.
* @hide FutureFeature
*/
public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter);
@@ -244,7 +242,6 @@ public abstract class RadioTuner {
* @throws IllegalStateException if the switch is not supported at current
* configuration.
* @return {@code true} if analog is forced, {@code false} otherwise.
* @hide FutureFeature
*/
public abstract boolean isAnalogForced();
@@ -260,7 +257,6 @@ public abstract class RadioTuner {
* @param isForced {@code true} to force analog, {@code false} for a default behaviour.
* @throws IllegalStateException if the switch is not supported at current
* configuration.
* @hide FutureFeature
*/
public abstract void setAnalogForced(boolean isForced);
@@ -298,15 +294,9 @@ public abstract class RadioTuner {
public static final int ERROR_SCAN_TIMEOUT = 3;
/** The requested configuration could not be applied */
public static final int ERROR_CONFIG = 4;
/**
* Background scan was interrupted due to hardware becoming temporarily unavailable.
* @hide FutureFeature
*/
/** Background scan was interrupted due to hardware becoming temporarily unavailable. */
public static final int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5;
/**
* Background scan failed due to other error, ie. HW failure.
* @hide FutureFeature
*/
/** Background scan failed due to other error, ie. HW failure. */
public static final int ERROR_BACKGROUND_SCAN_FAILED = 6;
/**
@@ -373,14 +363,11 @@ public abstract class RadioTuner {
*
* @param isAvailable true, if the tuner turned temporarily background-
* capable, false in the other case.
* @hide FutureFeature
*/
public void onBackgroundScanAvailabilityChange(boolean isAvailable) {}
/**
* Called when a background scan completes successfully.
*
* @hide FutureFeature
*/
public void onBackgroundScanComplete() {}
@@ -388,8 +375,6 @@ public abstract class RadioTuner {
* Called when available program list changed.
*
* Use getProgramList() to get the actual list.
*
* @hide FutureFeature
*/
public void onProgramListChanged() {}
}

View File

@@ -1213,8 +1213,8 @@ public final class SystemServer {
mSystemServiceManager.startService(AudioService.Lifecycle.class);
traceEnd();
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_RADIO)) {
traceBeginAndSlog("StartRadioService");
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_BROADCAST_RADIO)) {
traceBeginAndSlog("StartBroadcastRadioService");
mSystemServiceManager.startService(RadioService.class);
traceEnd();
}

View File

@@ -81,7 +81,8 @@ public class RadioTest {
// check if radio is supported and skip the test if it's not
PackageManager packageManager = mContext.getPackageManager();
boolean isRadioSupported = packageManager.hasSystemFeature(PackageManager.FEATURE_RADIO);
boolean isRadioSupported = packageManager.hasSystemFeature(
PackageManager.FEATURE_BROADCAST_RADIO);
assumeTrue(isRadioSupported);
// Check radio access permission