Merge "Verify that AudioRecord object is initialized for more APIs"
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 4f69cf0..78306ac 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -694,6 +694,9 @@
* {@link #ERROR_INVALID_OPERATION}
*/
public int setNotificationMarkerPosition(int markerInFrames) {
+ if (mState == STATE_UNINITIALIZED) {
+ return ERROR_INVALID_OPERATION;
+ }
return native_set_marker_pos(markerInFrames);
}
@@ -706,6 +709,9 @@
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_INVALID_OPERATION}
*/
public int setPositionNotificationPeriod(int periodInFrames) {
+ if (mState == STATE_UNINITIALIZED) {
+ return ERROR_INVALID_OPERATION;
+ }
return native_set_pos_update_period(periodInFrames);
}