summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul McLean <pmclean@google.com> 2019-01-31 16:36:13 -0700
committer Paul McLean <pmclean@google.com> 2019-02-08 09:30:34 -0700
commit0e52f7a1a4269a8b4e2fda389149c4ac5671f05f (patch)
treeba4a47306f9c7d213a5eca24a48616cc910d18b5
parent9d67bb2c2d88d69073b28069ae47f9ebcb78bee9 (diff)
Un-@hide MicrophoneDirection API
Bug: 123720049 Test: N/A Change-Id: Ic1f875ccebf6970a7f31db06b6b0c9046940705d
-rw-r--r--api/current.txt13
-rw-r--r--api/system-current.txt2
-rw-r--r--media/java/android/media/AudioRecord.java17
-rw-r--r--media/java/android/media/MicrophoneDirection.java41
4 files changed, 45 insertions, 28 deletions
diff --git a/api/current.txt b/api/current.txt
index 529f2918f94f..af6ca1dabc96 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -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();
diff --git a/api/system-current.txt b/api/system-current.txt
index 83770233bb9a..a9183bcc2984 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -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;
}
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 92afe7ede8f2..24a3a9b32f77 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -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;
}
//---------------------------------------------------------
diff --git a/media/java/android/media/MicrophoneDirection.java b/media/java/android/media/MicrophoneDirection.java
index 99201c0279bf..489e2683259e 100644
--- a/media/java/android/media/MicrophoneDirection.java
+++ b/media/java/android/media/MicrophoneDirection.java
@@ -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);
}