summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jay Aliomer <aaliomer@google.com> 2020-10-02 11:40:59 -0400
committer Jay Aliomer <aaliomer@google.com> 2020-10-02 11:40:59 -0400
commita9e81c1d215bb309f293fdf55aecdb457a7677cf (patch)
tree95dcae8e548a25ccf57380e7adb30d677bc44ebc
parent40388abe3c8fb1c7e62b5ab7f9ea891333b8dacc (diff)
Imporove screen audio recorder logs and code
Bugs: 169492619 Test: manual Change-Id: Ic862f102a76b25eccec2653a9955075d402563ed
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenrecord/ScreenInternalAudioRecorder.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenInternalAudioRecorder.java b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenInternalAudioRecorder.java
index df03c3e08f08..0aa9d4d662a5 100644
--- a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenInternalAudioRecorder.java
+++ b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenInternalAudioRecorder.java
@@ -48,6 +48,7 @@ public class ScreenInternalAudioRecorder {
private long mTotalBytes;
private MediaMuxer mMuxer;
private boolean mMic;
+ private boolean mStarted;
private int mTrackId = -1;
@@ -263,10 +264,14 @@ public class ScreenInternalAudioRecorder {
* start recording
* @throws IllegalStateException if recording fails to initialize
*/
- public void start() throws IllegalStateException {
- if (mThread != null) {
- Log.e(TAG, "a recording is being done in parallel or stop is not called");
+ public synchronized void start() throws IllegalStateException {
+ if (mStarted) {
+ if (mThread == null) {
+ throw new IllegalStateException("Recording stopped and can't restart (single use)");
+ }
+ throw new IllegalStateException("Recording already started");
}
+ mStarted = true;
mAudioRecord.startRecording();
if (mMic) mAudioRecordMic.startRecording();
Log.d(TAG, "channel count " + mAudioRecord.getChannelCount());