Bug 1258450 - Route setAccessibilityEnabled through GeckoInterface. r=snorp,jchen
authorNick Alexander <nalexander@mozilla.com>
Wed, 30 Mar 2016 10:21:29 -0700
changeset 291281 46a922adb14f8fdbcf2a7539dcafeb3784465313
parent 291280 53b8d9973481a0795c30e6daeac2fae25f8b51ae
child 291282 7eaf58b44b29144de2844056f4578e2603b6a06d
push id74545
push userkwierso@gmail.com
push dateFri, 01 Apr 2016 23:05:42 +0000
treeherdermozilla-inbound@c410d4e20586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, jchen
bugs1258450
milestone48.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 1258450 - Route setAccessibilityEnabled through GeckoInterface. r=snorp,jchen MozReview-Commit-ID: 9DXQ8mxtg2Q
mobile/android/base/java/org/mozilla/gecko/BaseGeckoInterface.java
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoAccessibility.java
mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
--- a/mobile/android/base/java/org/mozilla/gecko/BaseGeckoInterface.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BaseGeckoInterface.java
@@ -151,9 +151,14 @@ public class BaseGeckoInterface implemen
     public void markUriVisited(final String uri) {
         // By default, no URIs are marked as visited.
     }
 
     @Override
     public void setUriTitle(final String uri, final String title) {
         // By default, no titles are associated with URIs.
     }
+
+    @Override
+    public void setAccessibilityEnabled(boolean enabled) {
+        // By default, take no action when accessibility is toggled on or off.
+    }
 }
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -1370,16 +1370,17 @@ public class BrowserApp extends GeckoApp
             return true;
         }
 
         return false;
     }
 
     @Override
     public void setAccessibilityEnabled(boolean enabled) {
+        super.setAccessibilityEnabled(enabled);
         mDynamicToolbar.setAccessibilityEnabled(enabled);
     }
 
     @Override
     public void onDestroy() {
         if (!HardwareUtils.isSupportedSystem()) {
             // This build does not support the Android version of the device; Exit early.
             super.onDestroy();
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAccessibility.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAccessibility.java
@@ -86,25 +86,21 @@ public class GeckoAccessibility {
                     }
 
                     GeckoAppShell.notifyObservers("Accessibility:Settings", ret.toString());
                     return null;
                 }
 
                 @Override
                 public void onPostExecute(Void args) {
-                    boolean isGeckoApp = false;
-                    try {
-                        isGeckoApp = context instanceof GeckoApp;
-                    } catch (NoClassDefFoundError ex) {}
-                    if (isGeckoApp) {
-                        // Disable the dynamic toolbar when enabling accessibility.
-                        // These features tend not to interact well.
-                        ((GeckoApp) context).setAccessibilityEnabled(sEnabled);
+                    final GeckoAppShell.GeckoInterface geckoInterface = GeckoAppShell.getGeckoInterface();
+                    if (geckoInterface == null) {
+                        return;
                     }
+                    geckoInterface.setAccessibilityEnabled(sEnabled);
                 }
             }.execute();
     }
 
     private static void populateEventFromJSON (AccessibilityEvent event, JSONObject message) {
         final JSONArray textArray = message.optJSONArray("text");
         if (textArray != null) {
             for (int i = 0; i < textArray.length(); i++)
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
@@ -2123,16 +2123,18 @@ public class GeckoAppShell
          * Set the title of the given URI, as determined by Gecko.
          * <p/>
          * This method is always invoked on the Gecko thread.
          *
          * @param uri given.
          * @param title to associate with the given URI.
          */
         public void setUriTitle(final String uri, final String title);
+
+        public void setAccessibilityEnabled(boolean enabled);
     };
 
     private static GeckoInterface sGeckoInterface;
 
     public static GeckoInterface getGeckoInterface() {
         return sGeckoInterface;
     }