[automerger skipped] Merge "Merge Android R" am: 54558abf56 -s ours am: 3696266179 -s ours am: 3e1613cef9 -s ours am: 0554040401 -s ours am: f5c7f3755f -s ours am: 426d492ae6 -s ours

am skip reason: Change-Id I2ed2c7209e2e6ce7364a8a6450c953a3920d8acb with SHA-1 94601bb987 is in history

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Camera2/+/1421781

Change-Id: I348f79db5e986b894f57147957d37e7a32ccc620
diff --git a/Android.mk b/Android.mk
index b24a2df..68c9cec 100644
--- a/Android.mk
+++ b/Android.mk
@@ -34,7 +34,7 @@
 
 LOCAL_PACKAGE_NAME := Camera2
 
-LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := system_current
 
 LOCAL_PRODUCT_MODULE := true
 
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 6c9752e..427ad35 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -56,6 +56,7 @@
 import com.android.camera.app.MemoryManager.MemoryListener;
 import com.android.camera.app.OrientationManager;
 import com.android.camera.debug.Log;
+import com.android.camera.debug.DebugPropertyHelper;
 import com.android.camera.exif.ExifInterface;
 import com.android.camera.hardware.HardwareSpec;
 import com.android.camera.hardware.HardwareSpecImpl;
@@ -1141,9 +1142,17 @@
         }
 
         mMediaRecorder.setCamera(camera);
-        mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
         mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
-        mMediaRecorder.setProfile(mProfile);
+        if (DebugPropertyHelper.isAudioDisabled()) {
+            mMediaRecorder.setOutputFormat(mProfile.fileFormat);
+            mMediaRecorder.setVideoFrameRate(mProfile.videoFrameRate);
+            mMediaRecorder.setVideoEncodingBitRate(mProfile.videoBitRate);
+            mMediaRecorder.setVideoEncoder(mProfile.videoCodec);
+            Log.w(TAG, "Audio is disabled");
+        } else {
+            mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
+            mMediaRecorder.setProfile(mProfile);
+        }
         mMediaRecorder.setVideoSize(mProfile.videoFrameWidth, mProfile.videoFrameHeight);
         mMediaRecorder.setMaxDuration(mMaxVideoDurationInMs);
 
diff --git a/src/com/android/camera/debug/DebugPropertyHelper.java b/src/com/android/camera/debug/DebugPropertyHelper.java
index 66ccaaf..cc8d2fb 100644
--- a/src/com/android/camera/debug/DebugPropertyHelper.java
+++ b/src/com/android/camera/debug/DebugPropertyHelper.java
@@ -16,7 +16,7 @@
 
 package com.android.camera.debug;
 
-import com.android.camera.util.SystemProperties;
+import android.os.SystemProperties;
 
 public class DebugPropertyHelper {
     private static final String OFF_VALUE = "0";
@@ -38,6 +38,8 @@
     private static final String PROP_WRITE_CAPTURE_DATA = PREFIX + ".capture_write";
     /** Is RAW support enabled. */
     private static final String PROP_CAPTURE_DNG = PREFIX + ".capture_dng";
+    /** Is audio disabled. */
+    private static final String PROP_DISABLE_AUDIO = PREFIX + ".disable_audio";
 
     private static boolean isPropertyOn(String property) {
         return ON_VALUE.equals(SystemProperties.get(property, OFF_VALUE));
@@ -58,4 +60,7 @@
     public static boolean isCaptureDngEnabled() {
         return isPropertyOn(PROP_CAPTURE_DNG);
     }
+    public static boolean isAudioDisabled() {
+        return isPropertyOn(PROP_DISABLE_AUDIO);
+    }
 }