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

Commit ce4483cb authored by Benson Huang's avatar Benson Huang Committed by Leo Wang
Browse files

[FM] Add FM_TUNER audio source to support L version FM radio app

    1.MediaRecorder.java: Add FM_TUNER audio source type for FM record.
    2.AudioRecord.java: For FM output to the other device,
     (except the headset case), record the FM tuner signal to a track
      and playback the recorded signal by a track.
    3.AudioAttributes.java: Thus we use AudioRecord, need to modify
      setCapturePreset to support MediaRecorder.AudioSource.FM_TUNER.

    Review: https://partner-android-review.git.corp.google.com/#/c/182071



    Signed-off-by: default avatarBenson Huang <benson.huang@mediatek.com>

Change-Id: If068d0bbbffb4848887004396a8a8d9bcba1334e
parent 937d6a64
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -518,14 +518,15 @@ public final class AudioAttributes implements Parcelable {

        /**
         * @hide
         * Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD and
         * REMOTE_SUBMIX.
         * Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD,
         * REMOTE_SUBMIX and FM_TUNER.
         * @param preset
         * @return the same Builder instance.
         */
        public Builder setInternalCapturePreset(int preset) {
            if ((preset == MediaRecorder.AudioSource.HOTWORD)
                    || (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX)) {
                    || (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX)
                    || (preset == MediaRecorder.AudioSource.FM_TUNER)) {
                mSource = preset;
            } else {
                setCapturePreset(preset);
+1 −0
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ public class AudioRecord
        // audio source
        if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) ||
             ((audioSource > MediaRecorder.getAudioSourceMax()) &&
              (audioSource != MediaRecorder.AudioSource.FM_TUNER) &&
              (audioSource != MediaRecorder.AudioSource.HOTWORD)) )  {
            throw new IllegalArgumentException("Invalid audio source.");
        }
+8 −0
Original line number Diff line number Diff line
@@ -221,6 +221,14 @@ 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).
         * @hide
         */
        public static final int FM_TUNER = 1998;

        /**
         * Audio source for preemptible, low-priority software hotword detection
         * It presents the same gain and pre processing tuning as {@link #VOICE_RECOGNITION}.