Loading api/system-current.txt +3 −3 Original line number Original line Diff line number Diff line Loading @@ -17395,7 +17395,7 @@ package android.hardware.radio { 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 getServiceName(); method public java.lang.String getVendorInfo(); method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo(); method public java.lang.String getVersion(); method public java.lang.String getVersion(); method public boolean isBackgroundScanningSupported(); method public boolean isBackgroundScanningSupported(); method public boolean isCaptureSupported(); method public boolean isCaptureSupported(); Loading @@ -17412,7 +17412,7 @@ package android.hardware.radio { method public android.hardware.radio.ProgramSelector getSelector(); method public android.hardware.radio.ProgramSelector getSelector(); method public int getSignalStrength(); method public int getSignalStrength(); method public deprecated int getSubChannel(); method public deprecated int getSubChannel(); method public java.lang.String getVendorInfo(); method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo(); method public boolean isDigital(); method public boolean isDigital(); method public boolean isLive(); method public boolean isLive(); method public boolean isMuted(); method public boolean isMuted(); Loading Loading @@ -17476,7 +17476,7 @@ 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 java.util.List<android.hardware.radio.RadioManager.ProgramInfo> getProgramList(java.util.Map<java.lang.String, java.lang.String>); method public abstract boolean hasControl(); method public abstract boolean hasControl(); method public abstract boolean isAnalogForced(); method public abstract boolean isAnalogForced(); method public abstract boolean isAntennaConnected(); method public abstract boolean isAntennaConnected(); core/java/android/hardware/radio/ITuner.aidl +2 −1 Original line number Original line Diff line number Diff line Loading @@ -74,12 +74,13 @@ interface ITuner { boolean startBackgroundScan(); boolean startBackgroundScan(); /** /** * @param vendorFilter Vendor-specific filter, must be Map<String, String> * @returns the list, or null if scan is in progress * @returns the list, or null if scan is in progress * @throws IllegalArgumentException if invalid arguments are passed * @throws IllegalArgumentException if invalid arguments are passed * @throws IllegalStateException if the scan has not been started, client may * @throws IllegalStateException if the scan has not been started, client may * call startBackgroundScan to fix this. * call startBackgroundScan to fix this. */ */ List<RadioManager.ProgramInfo> getProgramList(String filter); List<RadioManager.ProgramInfo> getProgramList(in Map vendorFilter); /** /** * @throws IllegalStateException if the switch is not supported at current * @throws IllegalStateException if the switch is not supported at current Loading core/java/android/hardware/radio/RadioManager.java +49 −28 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,9 @@ import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Collectors; Loading Loading @@ -117,6 +119,25 @@ public class RadioManager { * @see BandDescriptor */ * @see BandDescriptor */ public static final int REGION_KOREA = 4; public static final int REGION_KOREA = 4; private static void writeStringMap(@NonNull Parcel dest, @NonNull Map<String, String> map) { dest.writeInt(map.size()); for (Map.Entry<String, String> entry : map.entrySet()) { dest.writeString(entry.getKey()); dest.writeString(entry.getValue()); } } private static @NonNull Map<String, String> readStringMap(@NonNull Parcel in) { int size = in.readInt(); Map<String, String> map = new HashMap<>(); while (size-- > 0) { String key = in.readString(); String value = in.readString(); map.put(key, value); } return map; } /***************************************************************************** /***************************************************************************** * Lists properties, options and radio bands supported by a given broadcast radio module. * Lists properties, options and radio bands supported by a given broadcast radio module. * Each module has a unique ID used to address it when calling RadioManager APIs. * Each module has a unique ID used to address it when calling RadioManager APIs. Loading @@ -138,14 +159,14 @@ public class RadioManager { private final boolean mIsBgScanSupported; private final boolean mIsBgScanSupported; private final Set<Integer> mSupportedProgramTypes; private final Set<Integer> mSupportedProgramTypes; private final Set<Integer> mSupportedIdentifierTypes; private final Set<Integer> mSupportedIdentifierTypes; private final String mVendorInfo; @NonNull private final Map<String, String> mVendorInfo; ModuleProperties(int id, String serviceName, int classId, String implementor, ModuleProperties(int id, String serviceName, int classId, String implementor, String product, String version, String serial, int numTuners, int numAudioSources, String product, String version, String serial, int numTuners, int numAudioSources, boolean isCaptureSupported, BandDescriptor[] bands, boolean isBgScanSupported, boolean isCaptureSupported, BandDescriptor[] bands, boolean isBgScanSupported, @ProgramSelector.ProgramType int[] supportedProgramTypes, @ProgramSelector.ProgramType int[] supportedProgramTypes, @ProgramSelector.IdentifierType int[] supportedIdentifierTypes, @ProgramSelector.IdentifierType int[] supportedIdentifierTypes, String vendorInfo) { Map<String, String> vendorInfo) { mId = id; mId = id; mServiceName = TextUtils.isEmpty(serviceName) ? "default" : serviceName; mServiceName = TextUtils.isEmpty(serviceName) ? "default" : serviceName; mClassId = classId; mClassId = classId; Loading @@ -160,7 +181,7 @@ public class RadioManager { mIsBgScanSupported = isBgScanSupported; mIsBgScanSupported = isBgScanSupported; mSupportedProgramTypes = arrayToSet(supportedProgramTypes); mSupportedProgramTypes = arrayToSet(supportedProgramTypes); mSupportedIdentifierTypes = arrayToSet(supportedIdentifierTypes); mSupportedIdentifierTypes = arrayToSet(supportedIdentifierTypes); mVendorInfo = vendorInfo; mVendorInfo = (vendorInfo == null) ? new HashMap<>() : vendorInfo; } } private static Set<Integer> arrayToSet(int[] arr) { private static Set<Integer> arrayToSet(int[] arr) { Loading Loading @@ -287,17 +308,17 @@ public class RadioManager { } } /** /** * Opaque vendor-specific string, passed from HAL without changes. * A map of vendor-specific opaque strings, passed from HAL without changes. * Format of this string can vary across vendors. * Format of these strings can vary across vendors. * * * It may be used for extra features, that's not supported by a platform, * It may be used for extra features, that's not supported by a platform, * for example: "preset-slots=6;ultra-hd-capable=false". * for example: preset-slots=6; ultra-hd-capable=false. * * * Client application MUST verify vendor/product name from the * Keys must be prefixed with unique vendor Java-style namespace, * ModuleProperties class before doing any interpretation of this value. * eg. 'com.somecompany.parameter1'. */ */ public @NonNull String getVendorInfo() { public @NonNull Map<String, String> getVendorInfo() { return mVendorInfo == null ? "" : mVendorInfo; return mVendorInfo; } } /** List of descriptors for all bands supported by this module. /** List of descriptors for all bands supported by this module. Loading Loading @@ -327,7 +348,7 @@ public class RadioManager { mIsBgScanSupported = in.readInt() == 1; mIsBgScanSupported = in.readInt() == 1; mSupportedProgramTypes = arrayToSet(in.createIntArray()); mSupportedProgramTypes = arrayToSet(in.createIntArray()); mSupportedIdentifierTypes = arrayToSet(in.createIntArray()); mSupportedIdentifierTypes = arrayToSet(in.createIntArray()); mVendorInfo = in.readString(); mVendorInfo = readStringMap(in); } } public static final Parcelable.Creator<ModuleProperties> CREATOR public static final Parcelable.Creator<ModuleProperties> CREATOR Loading Loading @@ -357,7 +378,7 @@ public class RadioManager { dest.writeInt(mIsBgScanSupported ? 1 : 0); dest.writeInt(mIsBgScanSupported ? 1 : 0); dest.writeIntArray(setToArray(mSupportedProgramTypes)); dest.writeIntArray(setToArray(mSupportedProgramTypes)); dest.writeIntArray(setToArray(mSupportedIdentifierTypes)); dest.writeIntArray(setToArray(mSupportedIdentifierTypes)); dest.writeString(mVendorInfo); writeStringMap(dest, mVendorInfo); } } @Override @Override Loading Loading @@ -394,7 +415,7 @@ public class RadioManager { result = prime * result + (mIsCaptureSupported ? 1 : 0); result = prime * result + (mIsCaptureSupported ? 1 : 0); result = prime * result + Arrays.hashCode(mBands); result = prime * result + Arrays.hashCode(mBands); result = prime * result + (mIsBgScanSupported ? 1 : 0); result = prime * result + (mIsBgScanSupported ? 1 : 0); result = prime * result + ((mVendorInfo == null) ? 0 : mVendorInfo.hashCode()); result = prime * result + mVendorInfo.hashCode(); return result; return result; } } Loading Loading @@ -440,7 +461,7 @@ public class RadioManager { return false; return false; if (mIsBgScanSupported != other.isBackgroundScanningSupported()) if (mIsBgScanSupported != other.isBackgroundScanningSupported()) return false; return false; if (!TextUtils.equals(mVendorInfo, other.mVendorInfo)) return false; if (!mVendorInfo.equals(other.mVendorInfo)) return false; return true; return true; } } } } Loading Loading @@ -1324,11 +1345,11 @@ public class RadioManager { private final int mFlags; private final int mFlags; private final int mSignalStrength; private final int mSignalStrength; private final RadioMetadata mMetadata; private final RadioMetadata mMetadata; private final String mVendorInfo; @NonNull private final Map<String, String> mVendorInfo; ProgramInfo(@NonNull ProgramSelector selector, boolean tuned, boolean stereo, ProgramInfo(@NonNull ProgramSelector selector, boolean tuned, boolean stereo, boolean digital, int signalStrength, RadioMetadata metadata, int flags, boolean digital, int signalStrength, RadioMetadata metadata, int flags, String vendorInfo) { Map<String, String> vendorInfo) { mSelector = selector; mSelector = selector; mTuned = tuned; mTuned = tuned; mStereo = stereo; mStereo = stereo; Loading @@ -1336,7 +1357,7 @@ public class RadioManager { mFlags = flags; mFlags = flags; mSignalStrength = signalStrength; mSignalStrength = signalStrength; mMetadata = metadata; mMetadata = metadata; mVendorInfo = vendorInfo; mVendorInfo = (vendorInfo == null) ? new HashMap<>() : vendorInfo; } } /** /** Loading Loading @@ -1447,17 +1468,17 @@ public class RadioManager { } } /** /** * Opaque vendor-specific string, passed from HAL without changes. * A map of vendor-specific opaque strings, passed from HAL without changes. * Format of this string can vary across vendors. * Format of these strings can vary across vendors. * * * It may be used for extra features, that's not supported by a platform, * It may be used for extra features, that's not supported by a platform, * for example: "paid-service=true;bitrate=320kbps". * for example: paid-service=true; bitrate=320kbps. * * * Client application MUST verify vendor/product name from the * Keys must be prefixed with unique vendor Java-style namespace, * ModuleProperties class before doing any interpretation of this value. * eg. 'com.somecompany.parameter1'. */ */ public @NonNull String getVendorInfo() { public @NonNull Map<String, String> getVendorInfo() { return mVendorInfo == null ? "" : mVendorInfo; return mVendorInfo; } } private ProgramInfo(Parcel in) { private ProgramInfo(Parcel in) { Loading @@ -1472,7 +1493,7 @@ public class RadioManager { mMetadata = null; mMetadata = null; } } mFlags = in.readInt(); mFlags = in.readInt(); mVendorInfo = in.readString(); mVendorInfo = readStringMap(in); } } public static final Parcelable.Creator<ProgramInfo> CREATOR public static final Parcelable.Creator<ProgramInfo> CREATOR Loading Loading @@ -1500,7 +1521,7 @@ public class RadioManager { mMetadata.writeToParcel(dest, flags); mMetadata.writeToParcel(dest, flags); } } dest.writeInt(mFlags); dest.writeInt(mFlags); dest.writeString(mVendorInfo); writeStringMap(dest, mVendorInfo); } } @Override @Override Loading Loading @@ -1528,7 +1549,7 @@ public class RadioManager { result = prime * result + mFlags; result = prime * result + mFlags; result = prime * result + mSignalStrength; result = prime * result + mSignalStrength; result = prime * result + ((mMetadata == null) ? 0 : mMetadata.hashCode()); result = prime * result + ((mMetadata == null) ? 0 : mMetadata.hashCode()); result = prime * result + ((mVendorInfo == null) ? 0 : mVendorInfo.hashCode()); result = prime * result + mVendorInfo.hashCode(); return result; return result; } } Loading @@ -1555,7 +1576,7 @@ public class RadioManager { return false; return false; } else if (!mMetadata.equals(other.getMetadata())) } else if (!mMetadata.equals(other.getMetadata())) return false; return false; if (!TextUtils.equals(mVendorInfo, other.mVendorInfo)) return false; if (!mVendorInfo.equals(other.mVendorInfo)) return false; return true; return true; } } } } Loading core/java/android/hardware/radio/RadioTuner.java +8 −5 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.Bitmap; import android.os.Handler; import android.os.Handler; import java.util.List; import java.util.List; import java.util.Map; /** /** * RadioTuner interface provides methods to control a radio tuner on the device: selecting and * RadioTuner interface provides methods to control a radio tuner on the device: selecting and Loading Loading @@ -270,16 +271,18 @@ public abstract class RadioTuner { /** /** * Get the list of discovered radio stations. * Get the list of discovered radio stations. * * * To get the full list, set filter to null or empty string. Otherwise, client application * To get the full list, set filter to null or empty map. * must verify vendor product/name before setting this parameter to anything else. * Keys must be prefixed with unique vendor Java-style namespace, * eg. 'com.somecompany.parameter1'. * * * @param filter vendor-specific selector for radio stations. * @param vendorFilter vendor-specific selector for radio stations. * @return a list of radio stations. * @return a list of radio stations. * @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 vendorFilter argument is not valid. */ */ public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter); public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable Map<String, String> vendorFilter); /** /** * Checks, if the analog playback is forced, see setAnalogForced. * Checks, if the analog playback is forced, see setAnalogForced. Loading core/java/android/hardware/radio/TunerAdapter.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.RemoteException; import android.util.Log; import android.util.Log; import java.util.List; import java.util.List; import java.util.Map; /** /** * Implements the RadioTuner interface by forwarding calls to radio service. * Implements the RadioTuner interface by forwarding calls to radio service. Loading Loading @@ -222,9 +223,10 @@ class TunerAdapter extends RadioTuner { } } @Override @Override public @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter) { public @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable Map<String, String> vendorFilter) { try { try { return mTuner.getProgramList(filter); return mTuner.getProgramList(vendorFilter); } catch (RemoteException e) { } catch (RemoteException e) { throw new RuntimeException("service died", e); throw new RuntimeException("service died", e); } } Loading Loading
api/system-current.txt +3 −3 Original line number Original line Diff line number Diff line Loading @@ -17395,7 +17395,7 @@ package android.hardware.radio { 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 getServiceName(); method public java.lang.String getVendorInfo(); method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo(); method public java.lang.String getVersion(); method public java.lang.String getVersion(); method public boolean isBackgroundScanningSupported(); method public boolean isBackgroundScanningSupported(); method public boolean isCaptureSupported(); method public boolean isCaptureSupported(); Loading @@ -17412,7 +17412,7 @@ package android.hardware.radio { method public android.hardware.radio.ProgramSelector getSelector(); method public android.hardware.radio.ProgramSelector getSelector(); method public int getSignalStrength(); method public int getSignalStrength(); method public deprecated int getSubChannel(); method public deprecated int getSubChannel(); method public java.lang.String getVendorInfo(); method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo(); method public boolean isDigital(); method public boolean isDigital(); method public boolean isLive(); method public boolean isLive(); method public boolean isMuted(); method public boolean isMuted(); Loading Loading @@ -17476,7 +17476,7 @@ 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 java.util.List<android.hardware.radio.RadioManager.ProgramInfo> getProgramList(java.util.Map<java.lang.String, java.lang.String>); method public abstract boolean hasControl(); method public abstract boolean hasControl(); method public abstract boolean isAnalogForced(); method public abstract boolean isAnalogForced(); method public abstract boolean isAntennaConnected(); method public abstract boolean isAntennaConnected();
core/java/android/hardware/radio/ITuner.aidl +2 −1 Original line number Original line Diff line number Diff line Loading @@ -74,12 +74,13 @@ interface ITuner { boolean startBackgroundScan(); boolean startBackgroundScan(); /** /** * @param vendorFilter Vendor-specific filter, must be Map<String, String> * @returns the list, or null if scan is in progress * @returns the list, or null if scan is in progress * @throws IllegalArgumentException if invalid arguments are passed * @throws IllegalArgumentException if invalid arguments are passed * @throws IllegalStateException if the scan has not been started, client may * @throws IllegalStateException if the scan has not been started, client may * call startBackgroundScan to fix this. * call startBackgroundScan to fix this. */ */ List<RadioManager.ProgramInfo> getProgramList(String filter); List<RadioManager.ProgramInfo> getProgramList(in Map vendorFilter); /** /** * @throws IllegalStateException if the switch is not supported at current * @throws IllegalStateException if the switch is not supported at current Loading
core/java/android/hardware/radio/RadioManager.java +49 −28 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,9 @@ import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Collectors; Loading Loading @@ -117,6 +119,25 @@ public class RadioManager { * @see BandDescriptor */ * @see BandDescriptor */ public static final int REGION_KOREA = 4; public static final int REGION_KOREA = 4; private static void writeStringMap(@NonNull Parcel dest, @NonNull Map<String, String> map) { dest.writeInt(map.size()); for (Map.Entry<String, String> entry : map.entrySet()) { dest.writeString(entry.getKey()); dest.writeString(entry.getValue()); } } private static @NonNull Map<String, String> readStringMap(@NonNull Parcel in) { int size = in.readInt(); Map<String, String> map = new HashMap<>(); while (size-- > 0) { String key = in.readString(); String value = in.readString(); map.put(key, value); } return map; } /***************************************************************************** /***************************************************************************** * Lists properties, options and radio bands supported by a given broadcast radio module. * Lists properties, options and radio bands supported by a given broadcast radio module. * Each module has a unique ID used to address it when calling RadioManager APIs. * Each module has a unique ID used to address it when calling RadioManager APIs. Loading @@ -138,14 +159,14 @@ public class RadioManager { private final boolean mIsBgScanSupported; private final boolean mIsBgScanSupported; private final Set<Integer> mSupportedProgramTypes; private final Set<Integer> mSupportedProgramTypes; private final Set<Integer> mSupportedIdentifierTypes; private final Set<Integer> mSupportedIdentifierTypes; private final String mVendorInfo; @NonNull private final Map<String, String> mVendorInfo; ModuleProperties(int id, String serviceName, int classId, String implementor, ModuleProperties(int id, String serviceName, int classId, String implementor, String product, String version, String serial, int numTuners, int numAudioSources, String product, String version, String serial, int numTuners, int numAudioSources, boolean isCaptureSupported, BandDescriptor[] bands, boolean isBgScanSupported, boolean isCaptureSupported, BandDescriptor[] bands, boolean isBgScanSupported, @ProgramSelector.ProgramType int[] supportedProgramTypes, @ProgramSelector.ProgramType int[] supportedProgramTypes, @ProgramSelector.IdentifierType int[] supportedIdentifierTypes, @ProgramSelector.IdentifierType int[] supportedIdentifierTypes, String vendorInfo) { Map<String, String> vendorInfo) { mId = id; mId = id; mServiceName = TextUtils.isEmpty(serviceName) ? "default" : serviceName; mServiceName = TextUtils.isEmpty(serviceName) ? "default" : serviceName; mClassId = classId; mClassId = classId; Loading @@ -160,7 +181,7 @@ public class RadioManager { mIsBgScanSupported = isBgScanSupported; mIsBgScanSupported = isBgScanSupported; mSupportedProgramTypes = arrayToSet(supportedProgramTypes); mSupportedProgramTypes = arrayToSet(supportedProgramTypes); mSupportedIdentifierTypes = arrayToSet(supportedIdentifierTypes); mSupportedIdentifierTypes = arrayToSet(supportedIdentifierTypes); mVendorInfo = vendorInfo; mVendorInfo = (vendorInfo == null) ? new HashMap<>() : vendorInfo; } } private static Set<Integer> arrayToSet(int[] arr) { private static Set<Integer> arrayToSet(int[] arr) { Loading Loading @@ -287,17 +308,17 @@ public class RadioManager { } } /** /** * Opaque vendor-specific string, passed from HAL without changes. * A map of vendor-specific opaque strings, passed from HAL without changes. * Format of this string can vary across vendors. * Format of these strings can vary across vendors. * * * It may be used for extra features, that's not supported by a platform, * It may be used for extra features, that's not supported by a platform, * for example: "preset-slots=6;ultra-hd-capable=false". * for example: preset-slots=6; ultra-hd-capable=false. * * * Client application MUST verify vendor/product name from the * Keys must be prefixed with unique vendor Java-style namespace, * ModuleProperties class before doing any interpretation of this value. * eg. 'com.somecompany.parameter1'. */ */ public @NonNull String getVendorInfo() { public @NonNull Map<String, String> getVendorInfo() { return mVendorInfo == null ? "" : mVendorInfo; return mVendorInfo; } } /** List of descriptors for all bands supported by this module. /** List of descriptors for all bands supported by this module. Loading Loading @@ -327,7 +348,7 @@ public class RadioManager { mIsBgScanSupported = in.readInt() == 1; mIsBgScanSupported = in.readInt() == 1; mSupportedProgramTypes = arrayToSet(in.createIntArray()); mSupportedProgramTypes = arrayToSet(in.createIntArray()); mSupportedIdentifierTypes = arrayToSet(in.createIntArray()); mSupportedIdentifierTypes = arrayToSet(in.createIntArray()); mVendorInfo = in.readString(); mVendorInfo = readStringMap(in); } } public static final Parcelable.Creator<ModuleProperties> CREATOR public static final Parcelable.Creator<ModuleProperties> CREATOR Loading Loading @@ -357,7 +378,7 @@ public class RadioManager { dest.writeInt(mIsBgScanSupported ? 1 : 0); dest.writeInt(mIsBgScanSupported ? 1 : 0); dest.writeIntArray(setToArray(mSupportedProgramTypes)); dest.writeIntArray(setToArray(mSupportedProgramTypes)); dest.writeIntArray(setToArray(mSupportedIdentifierTypes)); dest.writeIntArray(setToArray(mSupportedIdentifierTypes)); dest.writeString(mVendorInfo); writeStringMap(dest, mVendorInfo); } } @Override @Override Loading Loading @@ -394,7 +415,7 @@ public class RadioManager { result = prime * result + (mIsCaptureSupported ? 1 : 0); result = prime * result + (mIsCaptureSupported ? 1 : 0); result = prime * result + Arrays.hashCode(mBands); result = prime * result + Arrays.hashCode(mBands); result = prime * result + (mIsBgScanSupported ? 1 : 0); result = prime * result + (mIsBgScanSupported ? 1 : 0); result = prime * result + ((mVendorInfo == null) ? 0 : mVendorInfo.hashCode()); result = prime * result + mVendorInfo.hashCode(); return result; return result; } } Loading Loading @@ -440,7 +461,7 @@ public class RadioManager { return false; return false; if (mIsBgScanSupported != other.isBackgroundScanningSupported()) if (mIsBgScanSupported != other.isBackgroundScanningSupported()) return false; return false; if (!TextUtils.equals(mVendorInfo, other.mVendorInfo)) return false; if (!mVendorInfo.equals(other.mVendorInfo)) return false; return true; return true; } } } } Loading Loading @@ -1324,11 +1345,11 @@ public class RadioManager { private final int mFlags; private final int mFlags; private final int mSignalStrength; private final int mSignalStrength; private final RadioMetadata mMetadata; private final RadioMetadata mMetadata; private final String mVendorInfo; @NonNull private final Map<String, String> mVendorInfo; ProgramInfo(@NonNull ProgramSelector selector, boolean tuned, boolean stereo, ProgramInfo(@NonNull ProgramSelector selector, boolean tuned, boolean stereo, boolean digital, int signalStrength, RadioMetadata metadata, int flags, boolean digital, int signalStrength, RadioMetadata metadata, int flags, String vendorInfo) { Map<String, String> vendorInfo) { mSelector = selector; mSelector = selector; mTuned = tuned; mTuned = tuned; mStereo = stereo; mStereo = stereo; Loading @@ -1336,7 +1357,7 @@ public class RadioManager { mFlags = flags; mFlags = flags; mSignalStrength = signalStrength; mSignalStrength = signalStrength; mMetadata = metadata; mMetadata = metadata; mVendorInfo = vendorInfo; mVendorInfo = (vendorInfo == null) ? new HashMap<>() : vendorInfo; } } /** /** Loading Loading @@ -1447,17 +1468,17 @@ public class RadioManager { } } /** /** * Opaque vendor-specific string, passed from HAL without changes. * A map of vendor-specific opaque strings, passed from HAL without changes. * Format of this string can vary across vendors. * Format of these strings can vary across vendors. * * * It may be used for extra features, that's not supported by a platform, * It may be used for extra features, that's not supported by a platform, * for example: "paid-service=true;bitrate=320kbps". * for example: paid-service=true; bitrate=320kbps. * * * Client application MUST verify vendor/product name from the * Keys must be prefixed with unique vendor Java-style namespace, * ModuleProperties class before doing any interpretation of this value. * eg. 'com.somecompany.parameter1'. */ */ public @NonNull String getVendorInfo() { public @NonNull Map<String, String> getVendorInfo() { return mVendorInfo == null ? "" : mVendorInfo; return mVendorInfo; } } private ProgramInfo(Parcel in) { private ProgramInfo(Parcel in) { Loading @@ -1472,7 +1493,7 @@ public class RadioManager { mMetadata = null; mMetadata = null; } } mFlags = in.readInt(); mFlags = in.readInt(); mVendorInfo = in.readString(); mVendorInfo = readStringMap(in); } } public static final Parcelable.Creator<ProgramInfo> CREATOR public static final Parcelable.Creator<ProgramInfo> CREATOR Loading Loading @@ -1500,7 +1521,7 @@ public class RadioManager { mMetadata.writeToParcel(dest, flags); mMetadata.writeToParcel(dest, flags); } } dest.writeInt(mFlags); dest.writeInt(mFlags); dest.writeString(mVendorInfo); writeStringMap(dest, mVendorInfo); } } @Override @Override Loading Loading @@ -1528,7 +1549,7 @@ public class RadioManager { result = prime * result + mFlags; result = prime * result + mFlags; result = prime * result + mSignalStrength; result = prime * result + mSignalStrength; result = prime * result + ((mMetadata == null) ? 0 : mMetadata.hashCode()); result = prime * result + ((mMetadata == null) ? 0 : mMetadata.hashCode()); result = prime * result + ((mVendorInfo == null) ? 0 : mVendorInfo.hashCode()); result = prime * result + mVendorInfo.hashCode(); return result; return result; } } Loading @@ -1555,7 +1576,7 @@ public class RadioManager { return false; return false; } else if (!mMetadata.equals(other.getMetadata())) } else if (!mMetadata.equals(other.getMetadata())) return false; return false; if (!TextUtils.equals(mVendorInfo, other.mVendorInfo)) return false; if (!mVendorInfo.equals(other.mVendorInfo)) return false; return true; return true; } } } } Loading
core/java/android/hardware/radio/RadioTuner.java +8 −5 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.Bitmap; import android.os.Handler; import android.os.Handler; import java.util.List; import java.util.List; import java.util.Map; /** /** * RadioTuner interface provides methods to control a radio tuner on the device: selecting and * RadioTuner interface provides methods to control a radio tuner on the device: selecting and Loading Loading @@ -270,16 +271,18 @@ public abstract class RadioTuner { /** /** * Get the list of discovered radio stations. * Get the list of discovered radio stations. * * * To get the full list, set filter to null or empty string. Otherwise, client application * To get the full list, set filter to null or empty map. * must verify vendor product/name before setting this parameter to anything else. * Keys must be prefixed with unique vendor Java-style namespace, * eg. 'com.somecompany.parameter1'. * * * @param filter vendor-specific selector for radio stations. * @param vendorFilter vendor-specific selector for radio stations. * @return a list of radio stations. * @return a list of radio stations. * @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 vendorFilter argument is not valid. */ */ public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter); public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable Map<String, String> vendorFilter); /** /** * Checks, if the analog playback is forced, see setAnalogForced. * Checks, if the analog playback is forced, see setAnalogForced. Loading
core/java/android/hardware/radio/TunerAdapter.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.RemoteException; import android.util.Log; import android.util.Log; import java.util.List; import java.util.List; import java.util.Map; /** /** * Implements the RadioTuner interface by forwarding calls to radio service. * Implements the RadioTuner interface by forwarding calls to radio service. Loading Loading @@ -222,9 +223,10 @@ class TunerAdapter extends RadioTuner { } } @Override @Override public @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter) { public @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable Map<String, String> vendorFilter) { try { try { return mTuner.getProgramList(filter); return mTuner.getProgramList(vendorFilter); } catch (RemoteException e) { } catch (RemoteException e) { throw new RuntimeException("service died", e); throw new RuntimeException("service died", e); } } Loading