diff options
author | Eric Laurent <elaurent@google.com> | 2015-03-09 09:25:45 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2015-03-09 13:06:05 -0700 |
commit | 00a009204e51997249d60eab4f147eff566e2b1f (patch) | |
tree | 36d6ede9e88a9fb7c0fab5ca755c59c778e7a011 /media | |
parent | 93891686eb28f8c0da6545d277965e4db50d5065 (diff) | |
download | frameworks_base-00a009204e51997249d60eab4f147eff566e2b1f.zip frameworks_base-00a009204e51997249d60eab4f147eff566e2b1f.tar.gz frameworks_base-00a009204e51997249d60eab4f147eff566e2b1f.tar.bz2 |
enable FM tuner and hotword capture for system apps.
AudioRecord constructor with AudioAttributes and session ID as well
as HOTWORD and RADIO_TUNER audio sources are now system APIs.
Renamed MediaRecorder.AudioSource.FM_TUNER to
MediaRecorder.AudioSource.RADIO_TUNER.
Change-Id: I231c20c21e3e8cffe1837482976ebe284c9af541
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioAttributes.java | 6 | ||||
-rw-r--r-- | media/java/android/media/AudioRecord.java | 5 | ||||
-rw-r--r-- | media/java/android/media/MediaRecorder.java | 11 |
3 files changed, 13 insertions, 9 deletions
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java index 09f4bac..4526839 100644 --- a/media/java/android/media/AudioAttributes.java +++ b/media/java/android/media/AudioAttributes.java @@ -279,6 +279,7 @@ public final class AudioAttributes implements Parcelable { * Internal use only * @return a combined mask of all flags */ + @SystemApi public int getAllFlags() { return (mFlags & FLAG_ALL); } @@ -541,14 +542,15 @@ public final class AudioAttributes implements Parcelable { /** * @hide * Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD, - * REMOTE_SUBMIX and FM_TUNER. + * REMOTE_SUBMIX and RADIO_TUNER. * @param preset * @return the same Builder instance. */ + @SystemApi public Builder setInternalCapturePreset(int preset) { if ((preset == MediaRecorder.AudioSource.HOTWORD) || (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX) - || (preset == MediaRecorder.AudioSource.FM_TUNER)) { + || (preset == MediaRecorder.AudioSource.RADIO_TUNER)) { mSource = preset; } else { setCapturePreset(preset); diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index de10ef9..259fe37 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -20,6 +20,7 @@ import java.lang.ref.WeakReference; import java.nio.ByteBuffer; import java.util.Iterator; +import android.annotation.SystemApi; import android.os.Binder; import android.os.Handler; import android.os.IBinder; @@ -238,7 +239,6 @@ public class AudioRecord /** * @hide - * CANDIDATE FOR PUBLIC API * Class constructor with {@link AudioAttributes} and {@link AudioFormat}. * @param attributes a non-null {@link AudioAttributes} instance. Use * {@link AudioAttributes.Builder#setCapturePreset(int)} for configuring the capture @@ -257,6 +257,7 @@ public class AudioRecord * construction. * @throws IllegalArgumentException */ + @SystemApi public AudioRecord(AudioAttributes attributes, AudioFormat format, int bufferSizeInBytes, int sessionId) throws IllegalArgumentException { mRecordingState = RECORDSTATE_STOPPED; @@ -376,7 +377,7 @@ public class AudioRecord // audio source if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || ((audioSource > MediaRecorder.getAudioSourceMax()) && - (audioSource != MediaRecorder.AudioSource.FM_TUNER) && + (audioSource != MediaRecorder.AudioSource.RADIO_TUNER) && (audioSource != MediaRecorder.AudioSource.HOTWORD)) ) { throw new IllegalArgumentException("Invalid audio source."); } diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index 97b3f63..58c86f2 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -16,6 +16,7 @@ package android.media; +import android.annotation.SystemApi; import android.app.ActivityThread; import android.hardware.Camera; import android.os.Handler; @@ -222,12 +223,11 @@ public class MediaRecorder public static final int REMOTE_SUBMIX = 8; /** - * Audio source for FM, which is used to capture current FM tuner output by FMRadio app. - * There are two use cases, one is for record FM stream for later listening, another is - * for FM indirect mode(the routing except FM to headset(headphone) device routing). + * Audio source for capturing broadcast radio tuner output. * @hide */ - public static final int FM_TUNER = 1998; + @SystemApi + public static final int RADIO_TUNER = 1998; /** * Audio source for preemptible, low-priority software hotword detection @@ -240,7 +240,8 @@ public class MediaRecorder * This is a hidden audio source. * @hide */ - protected static final int HOTWORD = 1999; + @SystemApi + public static final int HOTWORD = 1999; } /** |