Bug 1465877 - [1.0] Add a mechanic to test whether we're running GeckoView in Fennec environment. r=snorp a=lizzard
authorEugen Sawin <esawin@mozilla.com>
Wed, 27 Jun 2018 21:54:47 +0200
changeset 477820 e0394cc8f42d7f46ac3878193ef4fde9ee92b8dd
parent 477819 94d94a0e3473e6398e36a54f59676f05440a4158
child 477821 5a6eba66a37822ac6ea8b0ae1dd2f8526d024b37
push id9436
push userarchaeopteryx@coole-files.de
push dateThu, 05 Jul 2018 15:15:35 +0000
treeherdermozilla-beta@5a6eba66a378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lizzard
bugs1465877
milestone62.0
Bug 1465877 - [1.0] Add a mechanic to test whether we're running GeckoView in Fennec environment. r=snorp a=lizzard
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
@@ -1951,9 +1951,22 @@ public class GeckoAppShell
         if (Build.VERSION.SDK_INT >= 21) {
             locales[0] = locale.toLanguageTag();
             return locales;
         }
 
         locales[0] = getLanguageTag(locale);
         return locales;
     }
+
+    private static Boolean sIsFennec;
+
+    public static boolean isFennec() {
+        if (sIsFennec == null) {
+            try {
+                sIsFennec = Class.forName("org.mozilla.gecko.GeckoApp") != null;
+            } catch (ClassNotFoundException e) {
+                sIsFennec = false;
+            }
+        }
+        return sIsFennec;
+    }
 }