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

Commit 0e52f7a1 authored by Paul McLean's avatar Paul McLean
Browse files

Un-@hide MicrophoneDirection API

Bug: 123720049
Test: N/A
Change-Id: Ic1f875ccebf6970a7f31db06b6b0c9046940705d
parent 9d67bb2c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -23320,7 +23320,7 @@ package android.media {
    method @NonNull public android.media.AudioPresentation.Builder setProgramId(int);
  }
  public class AudioRecord implements android.media.AudioRecordingMonitor android.media.AudioRouting {
  public class AudioRecord implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection {
    ctor public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException;
    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
    method @Deprecated public void addOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener, android.os.Handler);
@@ -23355,6 +23355,8 @@ package android.media {
    method public void release();
    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
    method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener);
    method public boolean setMicrophoneDirection(int);
    method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float);
    method public int setNotificationMarkerPosition(int);
    method public int setPositionNotificationPeriod(int);
    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
@@ -25980,6 +25982,15 @@ package android.media {
    field public static final android.media.MediaTimestamp TIMESTAMP_UNKNOWN;
  }
  public interface MicrophoneDirection {
    method public boolean setMicrophoneDirection(int);
    method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float);
    field public static final int MIC_DIRECTION_BACK = 2; // 0x2
    field public static final int MIC_DIRECTION_EXTERNAL = 3; // 0x3
    field public static final int MIC_DIRECTION_FRONT = 1; // 0x1
    field public static final int MIC_DIRECTION_UNSPECIFIED = 0; // 0x0
  }
  public final class MicrophoneInfo {
    method @NonNull public String getAddress();
    method public java.util.List<android.util.Pair<java.lang.Integer,java.lang.Integer>> getChannelMapping();
+1 −1
Original line number Diff line number Diff line
@@ -3349,7 +3349,7 @@ package android.media {
    field public static final int PLAYER_TYPE_UNKNOWN = -1; // 0xffffffff
  }
  public class AudioRecord implements android.media.AudioRecordingMonitor android.media.AudioRouting {
  public class AudioRecord implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection {
    ctor public AudioRecord(android.media.AudioAttributes, android.media.AudioFormat, int, int) throws java.lang.IllegalArgumentException;
  }
+8 −9
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media;

import android.annotation.CallbackExecutor;
import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -1713,12 +1714,11 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection,
    /**
     * Specifies the logical microphone (for processing).
     *
     * @param direction Direction constant (MicrophoneDirection.MIC_DIRECTION_*)
     * @return retval OK if the call is successful, an error code otherwise.
     * @hide
     * @param direction Direction constant.
     * @return true if sucessful.
     */
    public int setMicrophoneDirection(int direction) {
        return native_set_microphone_direction(direction);
    public boolean setMicrophoneDirection(int direction) {
        return native_set_microphone_direction(direction) == 0;
    }

    /**
@@ -1727,11 +1727,10 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection,
     *
     * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle),
     * though 0 (no zoom) to 1 (maximum zoom).
     * @return retval OK if the call is successful, an error code otherwise.
     * @hide
     * @return true if sucessful.
     */
    public int setMicrophoneFieldDimension(float zoom) {
        return native_set_microphone_field_dimension(zoom);
    public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) {
        return native_set_microphone_field_dimension(zoom) == 0;
    }

    //---------------------------------------------------------
+24 −17
Original line number Diff line number Diff line
@@ -16,38 +16,46 @@

package android.media;

/**
 * @hide
 */
import android.annotation.FloatRange;
import android.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public interface MicrophoneDirection {
    /**
     * @hide
     * Don't do any directionality processing of the activated microphone(s).
     */
    int MIC_DIRECTION_UNSPECIFIED = 0;

    /**
     * @hide
     * Optimize capture for audio coming from the screen-side of the device.
     */
    int MIC_DIRECTION_FRONT = 1;

    /**
     * @hide
     * Optimize capture for audio coming from the side of the device opposite the screen.
     */
    int MIC_DIRECTION_BACK = 2;

    /**
     * @hide
     * Optimize capture for audio coming from an off-device microphone.
     */
    int MIC_DIRECTION_EXTERNAL = 3;

    /** @hide */
    @IntDef({
            MIC_DIRECTION_UNSPECIFIED,
            MIC_DIRECTION_FRONT,
            MIC_DIRECTION_BACK,
            MIC_DIRECTION_EXTERNAL
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Directionmode{};
    /**
     * Specifies the logical microphone (for processing).
     *
     * @param direction Direction constant (MicrophoneDirection.MIC_DIRECTION_*)
     * @return retval OK if the call is successful, an error code otherwise.
     * @hide
     * @param direction Direction constant.
     * @return true if sucessful.
     */
    int setMicrophoneDirection(int direction);
    boolean setMicrophoneDirection(@Directionmode int direction);

    /**
     * Specifies the zoom factor (i.e. the field dimension) for the selected microphone
@@ -55,8 +63,7 @@ public interface MicrophoneDirection {
     *
     * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle),
     * though 0 (no zoom) to 1 (maximum zoom).
     * @return retval OK if the call is successful, an error code otherwise.
     * @hide
     * @return true if sucessful.
     */
    int setMicrophoneFieldDimension(float zoom);
    boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom);
}