Bug 1513912 - Null check return from TextToSpeech.getFeatures(). r=agi, a=RyanVM DEVEDITION_65_0b7_BUILD1 DEVEDITION_65_0b7_RELEASE FENNEC_65_0b7_BUILD1 FENNEC_65_0b7_RELEASE FIREFOX_65_0b7_BUILD1 FIREFOX_65_0b7_RELEASE
authorEitan Isaacson <eitan@monotonous.org>
Thu, 20 Dec 2018 16:03:00 -0500
changeset 509173 22da6211feb61217fa832da075ebfd79940dfa52
parent 509172 6e7f4acecc9fa24166718c3bcbd942711569dee9
child 509174 486cd9719c07f79f641cb6861c153dd74c8ffdf5
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersagi, RyanVM
bugs1513912
milestone65.0
Bug 1513912 - Null check return from TextToSpeech.getFeatures(). r=agi, a=RyanVM
mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
@@ -48,20 +48,22 @@ public class SpeechSynthesisService  {
             }
         });
     }
 
     private static void registerVoicesByLocale() {
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
-                Locale defaultLocale = sTTS.getDefaultLanguage();
+                Locale defaultLocale = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
+                        ? sTTS.getDefaultLanguage()
+                        : sTTS.getLanguage();
                 for (Locale locale : getAvailableLanguages()) {
                     final Set<String> features = sTTS.getFeatures(locale);
-                    boolean isLocal = features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
+                    boolean isLocal = features != null && features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
                     String localeStr = locale.toString();
                     registerVoice("moz-tts:android:" + localeStr, locale.getDisplayName(), localeStr.replace("_", "-"), !isLocal, defaultLocale == locale);
                 }
                 doneRegisteringVoices();
             }
         });
     }