Backed out changeset 7a434b18855a (bug 1258450)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 30 Mar 2016 14:02:13 +0200
changeset 290872 353d5e668129eb0e808abed59aff1976c18b8271
parent 290871 d085c3aaf69df9f799340339a4f73eb4cb8973f5
child 290873 e2787bb704a7f72249da646598d5afdc85b8ae47
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1258450
milestone48.0a1
backs out7a434b18855a9439a98480a2261509ab5596f315
Backed out changeset 7a434b18855a (bug 1258450)
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,14 +151,9 @@ 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
@@ -1369,17 +1369,16 @@ 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,21 +86,25 @@ public class GeckoAccessibility {
                     }
 
                     GeckoAppShell.notifyObservers("Accessibility:Settings", ret.toString());
                     return null;
                 }
 
                 @Override
                 public void onPostExecute(Void args) {
-                    final GeckoAppShell.GeckoInterface geckoInterface = GeckoAppShell.getGeckoInterface();
-                    if (geckoInterface == null) {
-                        return;
+                    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);
                     }
-                    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,18 +2123,16 @@ 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;
     }