Bug 1549699 - Don't use communication mode and speakerphone mode methods of AudioManager. r=snorp
authorPaul Adenot <paul@paul.cx>
Tue, 07 May 2019 15:20:02 +0000
changeset 531724 90cb2313723f7106ae2521ff42c14a631d65b62f
parent 531723 50f2bf78b087afcb2ad78e1f6d176326121c2f3d
child 531725 19907c1f0f10b740510ae828b6db2d1891e9d7a8
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1549699
milestone68.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 1549699 - Don't use communication mode and speakerphone mode methods of AudioManager. r=snorp This is more related to telephony than anything else, and are more suited to real telephony app. Differential Revision: https://phabricator.services.mozilla.com/D30071
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -2001,39 +2001,29 @@ public class GeckoAppShell {
     @WrapForJNI(calledFrom = "any")
     public static void setCommunicationAudioModeOn(final boolean on) {
         final AudioManager am = (AudioManager)getApplicationContext()
                                 .getSystemService(Context.AUDIO_SERVICE);
         if (am == null) {
             return;
         }
 
-        if (sPreviousAudioMode == AudioManager.MODE_INVALID) {
-            sPreviousAudioMode = am.getMode();
-        }
-
         try {
             if (on)  {
                 Log.e(LOGTAG, "Setting communication mode ON");
-                sPreviousAudioMode = am.getMode();
                 am.startBluetoothSco();
                 am.setBluetoothScoOn(true);
-                am.setMode(AudioManager.MODE_IN_COMMUNICATION);
             } else {
                 Log.e(LOGTAG, "Setting communication mode OFF");
-                am.setMode(sPreviousAudioMode);
-                sPreviousAudioMode = AudioManager.MODE_INVALID;
                 am.stopBluetoothSco();
                 am.setBluetoothScoOn(false);
             }
         } catch (SecurityException e) {
             Log.e(LOGTAG, "could not set communication mode", e);
         }
-
-        am.setSpeakerphoneOn(!on);
     }
 
     private static String getLanguageTag(final Locale locale) {
         final StringBuilder out = new StringBuilder(locale.getLanguage());
         final String country = locale.getCountry();
         final String variant = locale.getVariant();
         if (!TextUtils.isEmpty(country)) {
             out.append('-').append(country);