Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05392d63 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Publish new Broadcast Radio APIs.

Also, rename FEATURE_RADIO to FEATURE_BROADCASTRADIO.

Bug: b/34348946
Bug: b/63405337
Test: instrumentalization
Change-Id: Ibf5851a10b94f9e82db85f740fde6f28efe48666
parent 3c3acf8b
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -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_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 = "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_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 = "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_ANY = "android.hardware.camera.any";
    field public static final java.lang.String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
    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 int getNumTuners();
    method public java.lang.String getProduct();
    method public java.lang.String getProduct();
    method public java.lang.String getSerial();
    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 java.lang.String getVersion();
    method public boolean isBackgroundScanningSupported();
    method public boolean isCaptureSupported();
    method public boolean isCaptureSupported();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ModuleProperties> CREATOR;
    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 android.hardware.radio.RadioMetadata getMetadata();
    method public int getSignalStrength();
    method public int getSignalStrength();
    method public int getSubChannel();
    method public int getSubChannel();
    method public java.lang.String getVendorExension();
    method public boolean isDigital();
    method public boolean isDigital();
    method public boolean isLive();
    method public boolean isMuted();
    method public boolean isStereo();
    method public boolean isStereo();
    method public boolean isTuned();
    method public boolean isTuned();
    method public void writeToParcel(android.os.Parcel, int);
    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 int getConfiguration(android.hardware.radio.RadioManager.BandConfig[]);
    method public abstract boolean getMute();
    method public abstract boolean getMute();
    method public abstract int getProgramInformation(android.hardware.radio.RadioManager.ProgramInfo[]);
    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 hasControl();
    method public abstract boolean isAnalogForced();
    method public abstract boolean isAntennaConnected();
    method public abstract boolean isAntennaConnected();
    method public abstract int scan(int, boolean);
    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 setConfiguration(android.hardware.radio.RadioManager.BandConfig);
    method public abstract int setMute(boolean);
    method public abstract int setMute(boolean);
    method public abstract boolean startBackgroundScan();
    method public abstract int step(int, boolean);
    method public abstract int step(int, boolean);
    method public abstract int tune(int, int);
    method public abstract int tune(int, int);
    field public static final int DIRECTION_DOWN = 1; // 0x1
    field public static final int DIRECTION_DOWN = 1; // 0x1
    field public static final int DIRECTION_UP = 0; // 0x0
    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_CANCELLED = 2; // 0x2
    field public static final int ERROR_CONFIG = 4; // 0x4
    field public static final int ERROR_CONFIG = 4; // 0x4
    field public static final int ERROR_HARDWARE_FAILURE = 0; // 0x0
    field public static final int ERROR_HARDWARE_FAILURE = 0; // 0x0
@@ -17404,12 +17417,15 @@ package android.hardware.radio {
  public static abstract class RadioTuner.Callback {
  public static abstract class RadioTuner.Callback {
    ctor public RadioTuner.Callback();
    ctor public RadioTuner.Callback();
    method public void onAntennaState(boolean);
    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 onConfigurationChanged(android.hardware.radio.RadioManager.BandConfig);
    method public void onControlChanged(boolean);
    method public void onControlChanged(boolean);
    method public void onEmergencyAnnouncement(boolean);
    method public void onEmergencyAnnouncement(boolean);
    method public void onError(int);
    method public void onError(int);
    method public void onMetadataChanged(android.hardware.radio.RadioMetadata);
    method public void onMetadataChanged(android.hardware.radio.RadioMetadata);
    method public void onProgramInfoChanged(android.hardware.radio.RadioManager.ProgramInfo);
    method public void onProgramInfoChanged(android.hardware.radio.RadioManager.ProgramInfo);
    method public void onProgramListChanged();
    method public void onTrafficAnnouncement(boolean);
    method public void onTrafficAnnouncement(boolean);
  }
  }
+5 −5
Original line number Original line Diff line number Diff line
@@ -54,7 +54,6 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.os.storage.StorageManager;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeInfo;
import android.provider.Settings;
import android.util.AndroidException;
import android.util.AndroidException;
import android.util.Log;
import android.util.Log;


@@ -1901,12 +1900,13 @@ public abstract class PackageManager {
    public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
    public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";


    /**
    /**
     * The device includes broadcast radio tuner.
     * Feature for {@link #getSystemAvailableFeatures} and
     *
     * {@link #hasSystemFeature}: The device includes broadcast radio tuner.
     * @hide FutureFeature
     * @hide
     */
     */
    @SystemApi
    @SdkConstant(SdkConstantType.FEATURE)
    @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
     * Feature for {@link #getSystemAvailableFeatures} and
+0 −12
Original line number Original line Diff line number Diff line
@@ -153,8 +153,6 @@ public class RadioManager {
        /**
        /**
         * Module service (driver) name as registered with HIDL.
         * Module service (driver) name as registered with HIDL.
         * @return the module service name.
         * @return the module service name.
         *
         * @hide FutureFeature
         */
         */
        public @NonNull String getServiceName() {
        public @NonNull String getServiceName() {
            return mServiceName;
            return mServiceName;
@@ -229,8 +227,6 @@ public class RadioManager {
         *
         *
         * @return {@code true} if background scanning is supported (not necessary available
         * @return {@code true} if background scanning is supported (not necessary available
         * at a given time), {@code false} otherwise.
         * at a given time), {@code false} otherwise.
         *
         * @hide FutureFeature
         */
         */
        public boolean isBackgroundScanningSupported() {
        public boolean isBackgroundScanningSupported() {
            return mIsBgScanSupported;
            return mIsBgScanSupported;
@@ -245,8 +241,6 @@ public class RadioManager {
         *
         *
         * Client application MUST verify vendor/product name from the
         * Client application MUST verify vendor/product name from the
         * ModuleProperties class before doing any interpretation of this value.
         * ModuleProperties class before doing any interpretation of this value.
         *
         * @hide FutureFeature
         */
         */
        public @NonNull String getVendorExension() {
        public @NonNull String getVendorExension() {
            return mVendorExension == null ? "" : mVendorExension;
            return mVendorExension == null ? "" : mVendorExension;
@@ -1324,8 +1318,6 @@ public class RadioManager {
         * {@code true} if the program is currently playing live stream.
         * {@code true} if the program is currently playing live stream.
         * This may result in a slightly altered reception parameters,
         * This may result in a slightly altered reception parameters,
         * usually targetted at reduced latency.
         * usually targetted at reduced latency.
         *
         * @hide FutureFeature
         */
         */
        public boolean isLive() {
        public boolean isLive() {
            return (mFlags & FLAG_LIVE) != 0;
            return (mFlags & FLAG_LIVE) != 0;
@@ -1336,8 +1328,6 @@ public class RadioManager {
         * conditions or buffering. In this state volume knob MAY be disabled to
         * conditions or buffering. In this state volume knob MAY be disabled to
         * prevent user increasing volume too much.
         * prevent user increasing volume too much.
         * It does NOT mean the user has muted audio.
         * It does NOT mean the user has muted audio.
         *
         * @hide FutureFeature
         */
         */
        public boolean isMuted() {
        public boolean isMuted() {
            return (mFlags & FLAG_MUTED) != 0;
            return (mFlags & FLAG_MUTED) != 0;
@@ -1366,8 +1356,6 @@ public class RadioManager {
         *
         *
         * Client application MUST verify vendor/product name from the
         * Client application MUST verify vendor/product name from the
         * ModuleProperties class before doing any interpretation of this value.
         * ModuleProperties class before doing any interpretation of this value.
         *
         * @hide FutureFeature
         */
         */
        public @NonNull String getVendorExension() {
        public @NonNull String getVendorExension() {
            return mVendorExension == null ? "" : mVendorExension;
            return mVendorExension == null ? "" : mVendorExension;
+2 −17
Original line number Original line Diff line number Diff line
@@ -219,7 +219,6 @@ public abstract class RadioTuner {
     * is unavailable; ie. temporarily due to ongoing foreground playback in single-tuner device
     * is unavailable; ie. temporarily due to ongoing foreground playback in single-tuner device
     * or permanently if the feature is not supported
     * or permanently if the feature is not supported
     * (see ModuleProperties#isBackgroundScanningSupported()).
     * (see ModuleProperties#isBackgroundScanningSupported()).
     * @hide FutureFeature
     */
     */
    public abstract boolean startBackgroundScan();
    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,
     * @throws IllegalStateException if the scan is in progress or has not been started,
     *         startBackgroundScan() call may fix it.
     *         startBackgroundScan() call may fix it.
     * @throws IllegalArgumentException if the filter argument is not valid.
     * @throws IllegalArgumentException if the filter argument is not valid.
     * @hide FutureFeature
     */
     */
    public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter);
    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
     * @throws IllegalStateException if the switch is not supported at current
     *         configuration.
     *         configuration.
     * @return {@code true} if analog is forced, {@code false} otherwise.
     * @return {@code true} if analog is forced, {@code false} otherwise.
     * @hide FutureFeature
     */
     */
    public abstract boolean isAnalogForced();
    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.
     * @param isForced {@code true} to force analog, {@code false} for a default behaviour.
     * @throws IllegalStateException if the switch is not supported at current
     * @throws IllegalStateException if the switch is not supported at current
     *         configuration.
     *         configuration.
     * @hide FutureFeature
     */
     */
    public abstract void setAnalogForced(boolean isForced);
    public abstract void setAnalogForced(boolean isForced);


@@ -298,15 +294,9 @@ public abstract class RadioTuner {
    public static final  int ERROR_SCAN_TIMEOUT = 3;
    public static final  int ERROR_SCAN_TIMEOUT = 3;
    /** The requested configuration could not be applied */
    /** The requested configuration could not be applied */
    public static final  int ERROR_CONFIG = 4;
    public static final  int ERROR_CONFIG = 4;
    /**
    /** Background scan was interrupted due to hardware becoming temporarily unavailable. */
     * Background scan was interrupted due to hardware becoming temporarily unavailable.
     * @hide FutureFeature
     */
    public static final int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5;
    public static final int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5;
    /**
    /** Background scan failed due to other error, ie. HW failure. */
     * Background scan failed due to other error, ie. HW failure.
     * @hide FutureFeature
     */
    public static final int ERROR_BACKGROUND_SCAN_FAILED = 6;
    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-
         * @param isAvailable true, if the tuner turned temporarily background-
         *                    capable, false in the other case.
         *                    capable, false in the other case.
         * @hide FutureFeature
         */
         */
        public void onBackgroundScanAvailabilityChange(boolean isAvailable) {}
        public void onBackgroundScanAvailabilityChange(boolean isAvailable) {}


        /**
        /**
         * Called when a background scan completes successfully.
         * Called when a background scan completes successfully.
         *
         * @hide FutureFeature
         */
         */
        public void onBackgroundScanComplete() {}
        public void onBackgroundScanComplete() {}


@@ -388,8 +375,6 @@ public abstract class RadioTuner {
         * Called when available program list changed.
         * Called when available program list changed.
         *
         *
         * Use getProgramList() to get the actual list.
         * Use getProgramList() to get the actual list.
         *
         * @hide FutureFeature
         */
         */
        public void onProgramListChanged() {}
        public void onProgramListChanged() {}
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -1213,8 +1213,8 @@ public final class SystemServer {
            mSystemServiceManager.startService(AudioService.Lifecycle.class);
            mSystemServiceManager.startService(AudioService.Lifecycle.class);
            traceEnd();
            traceEnd();


            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_RADIO)) {
            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_BROADCAST_RADIO)) {
                traceBeginAndSlog("StartRadioService");
                traceBeginAndSlog("StartBroadcastRadioService");
                mSystemServiceManager.startService(RadioService.class);
                mSystemServiceManager.startService(RadioService.class);
                traceEnd();
                traceEnd();
            }
            }
Loading