Loading api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -17418,7 +17418,7 @@ package android.hardware.radio { public final class RadioMetadata implements android.os.Parcelable { method public boolean containsKey(java.lang.String); method public int describeContents(); method public android.graphics.Bitmap getBitmap(java.lang.String); method public deprecated android.graphics.Bitmap getBitmap(java.lang.String); method public android.hardware.radio.RadioMetadata.Clock getClock(java.lang.String); method public int getInt(java.lang.String); method public java.lang.String getString(java.lang.String); core/java/android/hardware/radio/ITuner.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.radio; import android.graphics.Bitmap; import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; Loading Loading @@ -64,6 +65,8 @@ interface ITuner { RadioManager.ProgramInfo getProgramInformation(); Bitmap getImage(int id); /** * @returns {@code true} if the scan was properly scheduled, * {@code false} if the scan feature is unavailable Loading core/java/android/hardware/radio/RadioMetadata.java +41 −10 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package android.hardware.radio; import android.annotation.NonNull; import android.annotation.SystemApi; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading Loading @@ -240,6 +241,14 @@ public final class RadioMetadata implements Parcelable { return mBundle.getString(key); } private static void putInt(Bundle bundle, String key, int value) { int type = METADATA_KEYS_TYPE.getOrDefault(key, METADATA_TYPE_INVALID); if (type != METADATA_TYPE_INT && type != METADATA_TYPE_BITMAP) { throw new IllegalArgumentException("The " + key + " key cannot be used to put an int"); } bundle.putInt(key, value); } /** * Returns the value associated with the given key, * or 0 if the key is not found in the meta data. Loading @@ -256,7 +265,9 @@ public final class RadioMetadata implements Parcelable { * * @param key The key the value is stored under * @return a {@link Bitmap} or null * @deprecated Use getBitmapId(String) instead */ @Deprecated public Bitmap getBitmap(String key) { Bitmap bmp = null; try { Loading @@ -268,6 +279,30 @@ public final class RadioMetadata implements Parcelable { return bmp; } /** * Retrieves an identifier for a bitmap. * * The format of an identifier is opaque to the application, * with a special case of value 0 being invalid. * An identifier for a given image-tuner pair is unique, so an application * may cache images and determine if there is a necessity to fetch them * again - if identifier changes, it means the image has changed. * * Only bitmap keys may be used with this method: * <ul> * <li>{@link #METADATA_KEY_ICON}</li> * <li>{@link #METADATA_KEY_ART}</li> * </ul> * * @param key The key the value is stored under. * @return a bitmap identifier or 0 if it's missing. * @hide This API is not thoroughly elaborated yet */ public int getBitmapId(@NonNull String key) { if (!METADATA_KEY_ICON.equals(key) && !METADATA_KEY_ART.equals(key)) return 0; return getInt(key); } public Clock getClock(String key) { Clock clock = null; try { Loading Loading @@ -416,18 +451,14 @@ public final class RadioMetadata implements Parcelable { * <li>{@link #METADATA_KEY_RDS_PTY}</li> * <li>{@link #METADATA_KEY_RBDS_PTY}</li> * </ul> * or any bitmap represented by its identifier. * * @param key The key for referencing this value * @param value The int value to store * @return the same Builder instance */ public Builder putInt(String key, int value) { if (!METADATA_KEYS_TYPE.containsKey(key) || METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_INT) { throw new IllegalArgumentException("The " + key + " key cannot be used to put a long"); } mBundle.putInt(key, value); RadioMetadata.putInt(mBundle, key, value); return this; } Loading Loading @@ -498,12 +529,12 @@ public final class RadioMetadata implements Parcelable { int putIntFromNative(int nativeKey, int value) { String key = getKeyFromNativeKey(nativeKey); if (!METADATA_KEYS_TYPE.containsKey(key) || METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_INT) { try { putInt(mBundle, key, value); return 0; } catch (IllegalArgumentException ex) { return -1; } mBundle.putInt(key, value); return 0; } int putStringFromNative(int nativeKey, String value) { Loading core/java/android/hardware/radio/RadioTuner.java +22 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.hardware.radio; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.graphics.Bitmap; import android.os.Handler; import java.util.List; Loading Loading @@ -229,6 +230,27 @@ public abstract class RadioTuner { */ public abstract int getProgramInformation(RadioManager.ProgramInfo[] info); /** * Retrieves a {@link Bitmap} for the given image ID or null, * if the image was missing from the tuner. * * This involves doing a call to the tuner, so the bitmap should be cached * on the application side. * * If the method returns null for non-zero ID, it means the image was * updated on the tuner side. There is a race conditon between fetching * image for an old ID and tuner updating the image (and cleaning up the * old image). In such case, a new ProgramInfo with updated image id will * be sent with a {@link onProgramInfoChanged} callback. * * @param id The image identifier, retrieved with * {@link RadioMetadata#getBitmapId(String)}. * @return A {@link Bitmap} or null. * @throws IllegalArgumentException if id==0 * @hide This API is not thoroughly elaborated yet */ public abstract @Nullable Bitmap getMetadataImage(int id); /** * Initiates a background scan to update internally cached program list. * Loading core/java/android/hardware/radio/TunerAdapter.java +10 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.hardware.radio; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Bitmap; import android.os.RemoteException; import android.util.Log; Loading Loading @@ -202,6 +203,15 @@ class TunerAdapter extends RadioTuner { } } @Override public @Nullable Bitmap getMetadataImage(int id) { try { return mTuner.getImage(id); } catch (RemoteException e) { throw new RuntimeException("service died", e); } } @Override public boolean startBackgroundScan() { try { Loading Loading
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -17418,7 +17418,7 @@ package android.hardware.radio { public final class RadioMetadata implements android.os.Parcelable { method public boolean containsKey(java.lang.String); method public int describeContents(); method public android.graphics.Bitmap getBitmap(java.lang.String); method public deprecated android.graphics.Bitmap getBitmap(java.lang.String); method public android.hardware.radio.RadioMetadata.Clock getClock(java.lang.String); method public int getInt(java.lang.String); method public java.lang.String getString(java.lang.String);
core/java/android/hardware/radio/ITuner.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.radio; import android.graphics.Bitmap; import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; Loading Loading @@ -64,6 +65,8 @@ interface ITuner { RadioManager.ProgramInfo getProgramInformation(); Bitmap getImage(int id); /** * @returns {@code true} if the scan was properly scheduled, * {@code false} if the scan feature is unavailable Loading
core/java/android/hardware/radio/RadioMetadata.java +41 −10 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package android.hardware.radio; import android.annotation.NonNull; import android.annotation.SystemApi; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading Loading @@ -240,6 +241,14 @@ public final class RadioMetadata implements Parcelable { return mBundle.getString(key); } private static void putInt(Bundle bundle, String key, int value) { int type = METADATA_KEYS_TYPE.getOrDefault(key, METADATA_TYPE_INVALID); if (type != METADATA_TYPE_INT && type != METADATA_TYPE_BITMAP) { throw new IllegalArgumentException("The " + key + " key cannot be used to put an int"); } bundle.putInt(key, value); } /** * Returns the value associated with the given key, * or 0 if the key is not found in the meta data. Loading @@ -256,7 +265,9 @@ public final class RadioMetadata implements Parcelable { * * @param key The key the value is stored under * @return a {@link Bitmap} or null * @deprecated Use getBitmapId(String) instead */ @Deprecated public Bitmap getBitmap(String key) { Bitmap bmp = null; try { Loading @@ -268,6 +279,30 @@ public final class RadioMetadata implements Parcelable { return bmp; } /** * Retrieves an identifier for a bitmap. * * The format of an identifier is opaque to the application, * with a special case of value 0 being invalid. * An identifier for a given image-tuner pair is unique, so an application * may cache images and determine if there is a necessity to fetch them * again - if identifier changes, it means the image has changed. * * Only bitmap keys may be used with this method: * <ul> * <li>{@link #METADATA_KEY_ICON}</li> * <li>{@link #METADATA_KEY_ART}</li> * </ul> * * @param key The key the value is stored under. * @return a bitmap identifier or 0 if it's missing. * @hide This API is not thoroughly elaborated yet */ public int getBitmapId(@NonNull String key) { if (!METADATA_KEY_ICON.equals(key) && !METADATA_KEY_ART.equals(key)) return 0; return getInt(key); } public Clock getClock(String key) { Clock clock = null; try { Loading Loading @@ -416,18 +451,14 @@ public final class RadioMetadata implements Parcelable { * <li>{@link #METADATA_KEY_RDS_PTY}</li> * <li>{@link #METADATA_KEY_RBDS_PTY}</li> * </ul> * or any bitmap represented by its identifier. * * @param key The key for referencing this value * @param value The int value to store * @return the same Builder instance */ public Builder putInt(String key, int value) { if (!METADATA_KEYS_TYPE.containsKey(key) || METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_INT) { throw new IllegalArgumentException("The " + key + " key cannot be used to put a long"); } mBundle.putInt(key, value); RadioMetadata.putInt(mBundle, key, value); return this; } Loading Loading @@ -498,12 +529,12 @@ public final class RadioMetadata implements Parcelable { int putIntFromNative(int nativeKey, int value) { String key = getKeyFromNativeKey(nativeKey); if (!METADATA_KEYS_TYPE.containsKey(key) || METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_INT) { try { putInt(mBundle, key, value); return 0; } catch (IllegalArgumentException ex) { return -1; } mBundle.putInt(key, value); return 0; } int putStringFromNative(int nativeKey, String value) { Loading
core/java/android/hardware/radio/RadioTuner.java +22 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.hardware.radio; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.graphics.Bitmap; import android.os.Handler; import java.util.List; Loading Loading @@ -229,6 +230,27 @@ public abstract class RadioTuner { */ public abstract int getProgramInformation(RadioManager.ProgramInfo[] info); /** * Retrieves a {@link Bitmap} for the given image ID or null, * if the image was missing from the tuner. * * This involves doing a call to the tuner, so the bitmap should be cached * on the application side. * * If the method returns null for non-zero ID, it means the image was * updated on the tuner side. There is a race conditon between fetching * image for an old ID and tuner updating the image (and cleaning up the * old image). In such case, a new ProgramInfo with updated image id will * be sent with a {@link onProgramInfoChanged} callback. * * @param id The image identifier, retrieved with * {@link RadioMetadata#getBitmapId(String)}. * @return A {@link Bitmap} or null. * @throws IllegalArgumentException if id==0 * @hide This API is not thoroughly elaborated yet */ public abstract @Nullable Bitmap getMetadataImage(int id); /** * Initiates a background scan to update internally cached program list. * Loading
core/java/android/hardware/radio/TunerAdapter.java +10 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.hardware.radio; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Bitmap; import android.os.RemoteException; import android.util.Log; Loading Loading @@ -202,6 +203,15 @@ class TunerAdapter extends RadioTuner { } } @Override public @Nullable Bitmap getMetadataImage(int id) { try { return mTuner.getImage(id); } catch (RemoteException e) { throw new RuntimeException("service died", e); } } @Override public boolean startBackgroundScan() { try { Loading