Bug 1701269 - Remove ui.android.mouse_as_touch. r=botond,owlish
authorAgi Sferro <agi@sferro.dev>
Thu, 20 May 2021 22:03:05 +0000
changeset 580365 850e11d0f56f082e6eff8bd92eb83d71cd96a657
parent 580364 7b7f64c71396ccb89b6dc8291a4c54bc3fffd9ce
child 580366 874c8fd768b18510cbfc57446e35aa3885107bb3
push id143520
push userasferro@mozilla.com
push dateThu, 20 May 2021 22:25:27 +0000
treeherderautoland@f66caa78f074 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, owlish
bugs1701269
milestone90.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 1701269 - Remove ui.android.mouse_as_touch. r=botond,owlish Differential Revision: https://phabricator.services.mozilla.com/D109924
mobile/android/app/geckoview-prefs.js
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
modules/libpref/init/all.js
--- a/mobile/android/app/geckoview-prefs.js
+++ b/mobile/android/app/geckoview-prefs.js
@@ -65,19 +65,16 @@ pref("browser.safebrowsing.features.malw
 pref("browser.safebrowsing.features.trackingAnnotation.update", true);
 pref("browser.safebrowsing.features.trackingProtection.update", true);
 
 // Enable cryptomining protection blocklist updates
 pref("browser.safebrowsing.features.cryptomining.update", true);
 // Enable fingerprinting protection blocklist updates
 pref("browser.safebrowsing.features.fingerprinting.update", true);
 
-// Treat mouse as touch only on TV-ish devices
-pref("ui.android.mouse_as_touch", 2);
-
 // Enable autoplay permission prompts
 pref("media.geckoview.autoplay.request", true);
 
 // Enable EME permission prompts
 pref("media.eme.require-app-approval", true);
 
 // Enable the Process Priority Manager
 pref("dom.ipc.processPriorityManager.enabled", true);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
@@ -1,17 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.geckoview;
 
 import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.PrefsHelper;
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.app.UiModeManager;
 import android.content.Context;
 import android.content.res.Configuration;
@@ -32,17 +31,16 @@ import java.lang.annotation.RetentionPol
 import java.util.ArrayList;
 
 @UiThread
 public class PanZoomController {
     private static final String LOGTAG = "GeckoNPZC";
     private static final int EVENT_SOURCE_SCROLL = 0;
     private static final int EVENT_SOURCE_MOTION = 1;
     private static final int EVENT_SOURCE_MOUSE = 2;
-    private static final String PREF_MOUSE_AS_TOUCH = "ui.android.mouse_as_touch";
     private static boolean sTreatMouseAsTouch = true;
 
     private final GeckoSession mSession;
     private final Rect mTempRect = new Rect();
     private boolean mAttached;
     private float mPointerScrollFactor = 64.0f;
     private long mLastDownTime;
 
@@ -433,36 +431,20 @@ public class PanZoomController {
 
     protected PanZoomController(final GeckoSession session) {
         mSession = session;
         enableEventQueue();
         initMouseAsTouch();
     }
 
     private static void initMouseAsTouch() {
-        final PrefsHelper.PrefHandler prefHandler = new PrefsHelper.PrefHandlerBase() {
-            @Override
-            public void prefValue(final String pref, final int value) {
-                if (!PREF_MOUSE_AS_TOUCH.equals(pref)) {
-                    return;
-                }
-                if (value == 0) {
-                    sTreatMouseAsTouch = false;
-                } else if (value == 1) {
-                    sTreatMouseAsTouch = true;
-                } else if (value == 2) {
-                    final Context c = GeckoAppShell.getApplicationContext();
-                    final UiModeManager m = (UiModeManager)c.getSystemService(Context.UI_MODE_SERVICE);
-                    // on TV devices, treat mouse as touch. everywhere else, don't
-                    sTreatMouseAsTouch = (m.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION);
-                }
-            }
-        };
-        PrefsHelper.addObserver(new String[] { PREF_MOUSE_AS_TOUCH }, prefHandler);
-        PrefsHelper.getPref(PREF_MOUSE_AS_TOUCH, prefHandler);
+        final Context c = GeckoAppShell.getApplicationContext();
+        final UiModeManager m = (UiModeManager)c.getSystemService(Context.UI_MODE_SERVICE);
+        // on TV devices, treat mouse as touch. everywhere else, don't
+        sTreatMouseAsTouch = (m.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION);
     }
 
     /**
      * Set the current scroll factor. The scroll factor is the maximum scroll amount that
      * one scroll event may generate, in device pixels.
      *
      * @param factor Scroll factor.
      */
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -292,18 +292,16 @@ pref("dom.keyboardevent.keypress.hack.us
 // on window global or document. The format is exactly same as
 // "dom.keyboardevent.keypress.hack.dispatch_non_printable_keys". So, check its
 // explanation for the detail.
 pref("dom.mouseevent.click.hack.use_legacy_non-primary_dispatch", "");
 
 // Fastback caching - if this pref is negative, then we calculate the number
 // of content viewers to cache based on the amount of available memory.
 pref("browser.sessionhistory.max_total_viewers", -1);
-// 0 = false, 1 = true, 2 = autodetect.
-pref("ui.android.mouse_as_touch", 1);
 
 pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
 // 0 = no external leading,
 // 1 = use external leading only when font provides,
 // 2 = add extra leading both internal leading and external leading are zero
 pref("browser.display.normal_lineheight_calc_control", 2);
 // enable showing image placeholders while image is loading or when image is broken
 pref("browser.display.show_image_placeholders", true);