Bug 1381924 - Include WebRTC bits for GeckoView; r=nalexander
authorJim Chen <nchen@mozilla.com>
Thu, 20 Jul 2017 18:24:12 -0400
changeset 418780 aa10d14239126225de73ea948a0cefe71e4f283a
parent 418779 83363abc4db1a7a5ca44896f8a7cd2077efdb748
child 418781 446be06fd42e76142716c5ac62b38efbb2d7ce44
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1381924
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1381924 - Include WebRTC bits for GeckoView; r=nalexander Include necessary WebRTC files and permissions for GeckoView. For permissions, we need to add the RECORD_AUDIO permission to GeckoView's AndroidManifest.xml, but since the file is not preprocessed, we can't use an `#ifdef MOZ_WEBRTC` block, so I think we'll just have to unconditionally include the permission. MozReview-Commit-ID: IUd8FFMsW99
mobile/android/app/build.gradle
mobile/android/base/Makefile.in
mobile/android/geckoview/build.gradle
mobile/android/geckoview/src/main/AndroidManifest.xml
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -143,23 +143,16 @@ android {
                 if (!mozconfig.substs.MOZ_NATIVE_DEVICES) {
                     exclude 'org/mozilla/gecko/ChromeCastDisplay.java'
                     exclude 'org/mozilla/gecko/ChromeCastPlayer.java'
                     exclude 'org/mozilla/gecko/GeckoMediaPlayer.java'
                     exclude 'org/mozilla/gecko/GeckoPresentationDisplay.java'
                     exclude 'org/mozilla/gecko/MediaPlayerManager.java'
                 }
 
-                if (mozconfig.substs.MOZ_WEBRTC) {
-                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/base/java/src"
-                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src"
-                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src"
-                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_render/android/java/src"
-                }
-
                 if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
                     exclude 'org/mozilla/gecko/adjust/StubAdjustHelper.java'
                 } else {
                     exclude 'org/mozilla/gecko/adjust/AdjustHelper.java'
                 }
 
                 if (mozconfig.substs.MOZ_ANDROID_MMA) {
                     exclude 'org/mozilla/gecko/mma/MmaStubImp.java'
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -149,36 +149,36 @@ GECKOVIEW_JARS = \
   gecko-view.jar \
   sync-thirdparty.jar \
   $(NULL)
 
 ifdef MOZ_ANDROID_HLS_SUPPORT
 GECKOVIEW_JARS += exoplayer2.jar
 endif
 
+ifdef MOZ_WEBRTC
+GECKOVIEW_JARS += webrtc.jar
+endif
+
 ifdef MOZ_INSTALL_TRACKING
 GECKOVIEW_JARS += gecko-thirdparty-adjust_sdk.jar
 endif
 
 ifdef MOZ_ANDROID_MMA
 GECKOVIEW_JARS += gecko-thirdparty-leanplum_sdk.jar
 endif
 
 geckoview_jars_classpath := $(subst $(NULL) ,:,$(strip $(GECKOVIEW_JARS)))
 
 FENNEC_JARS = \
   gecko-browser.jar \
   gecko-thirdparty.jar \
   services.jar \
   $(NULL)
 
-ifdef MOZ_WEBRTC
-FENNEC_JARS += webrtc.jar
-endif
-
 ifdef MOZ_ANDROID_SEARCH_ACTIVITY
 FENNEC_JARS += search-activity.jar
 endif
 
 ifdef MOZ_ANDROID_MLS_STUMBLER
 FENNEC_JARS += ../stumbler/stumbler.jar
 endif
 
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -74,22 +74,21 @@ android {
         main {
             java {
                 srcDir "${topsrcdir}/mobile/android/geckoview/src/thirdparty/java"
 
                 if (!mozconfig.substs.MOZ_ANDROID_HLS_SUPPORT) {
                     exclude 'com/google/android/exoplayer2/**'
                 }
 
-                // TODO: support WebRTC.
-                // if (mozconfig.substs.MOZ_WEBRTC) {
-                //     srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src"
-                //     srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src"
-                //     srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_render/android/java/src"
-                // }
+                if (mozconfig.substs.MOZ_WEBRTC) {
+                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/base/java/src"
+                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src"
+                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src"
+                }
 
                 // TODO: don't use AppConstants.
                 srcDir "${project.buildDir}/generated/source/preprocessed_code" // See syncPreprocessedCode.
             }
 
             assets {
             }
         }
--- a/mobile/android/geckoview/src/main/AndroidManifest.xml
+++ b/mobile/android/geckoview/src/main/AndroidManifest.xml
@@ -17,27 +17,29 @@
 
     <uses-permission android:name="android.permission.WAKE_LOCK"/>
     <uses-permission android:name="android.permission.VIBRATE"/>
 
     <uses-feature android:name="android.hardware.location" android:required="false"/>
     <uses-feature android:name="android.hardware.location.gps" android:required="false"/>
     <uses-feature android:name="android.hardware.touchscreen"/>
 
-    <!--#ifdef MOZ_WEBRTC-->
-    <!--<uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
-    <!--<uses-feature android:name="android.hardware.audio.low_latency" android:required="false"/>-->
-    <!--<uses-feature android:name="android.hardware.camera.any" android:required="false"/>-->
-    <!--<uses-feature android:name="android.hardware.microphone" android:required="false"/>-->
-    <!--#endif-->
-
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-feature android:name="android.hardware.camera" android:required="false"/>
     <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
 
+    <!--#ifdef MOZ_WEBRTC-->
+    <!-- TODO preprocess AndroidManifest.xml so that we can
+         conditionally include WebRTC permissions based on MOZ_WEBRTC. -->
+    <uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
+    <uses-feature android:name="android.hardware.audio.low_latency" android:required="false"/>-->
+    <uses-feature android:name="android.hardware.microphone" android:required="false"/>-->
+    <uses-feature android:name="android.hardware.camera.any" android:required="false"/>-->
+    <!--#endif-->
+
     <!-- App requires OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" android:required="true" />
 
     <application>
         <!-- New child services must also be added to the Fennec AndroidManifest.xml.in -->
         <service
             android:name="org.mozilla.gecko.media.MediaManager"
             android:enabled="true"