Bug 1307779 - Only start long-press timer for back button r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 05 Oct 2016 18:14:12 +0200
changeset 316627 23b4707ed4f9de2bf97d50857cf3547e525eefee
parent 316626 71346fd5e1ecc3e0b88af57d8ae3a147b435cfb7
child 316628 dc1926812404261239dd147031a18141ecca0d55
push id32875
push userahunt@mozilla.com
push dateWed, 05 Oct 2016 19:48:39 +0000
treeherderautoland@23b4707ed4f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1307779
milestone52.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 1307779 - Only start long-press timer for back button r=sebastian Huge oversight in my original patch. Pressing any hardware button will result in the history list being shown after the long-press delay (regardless of long-pressing). MozReview-Commit-ID: KO8u0NzTxaO
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -565,17 +565,18 @@ public class BrowserApp extends GeckoApp
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         // Bug 1304688: Android N has broken passing onKeyLongPress events for the back button, so we
         // instead copy the long-press-handler technique from Android's KeyButtonView.
         // - For short presses, we cancel the callback in onKeyUp
         // - For long presses, the normal keypress is marked as cancelled, hence won't be handled elsewhere
         //   (but Android still provides the haptic feedback), and the runnable is run.
-        if (!Versions.preN) {
+        if (!Versions.preN &&
+                keyCode == KeyEvent.KEYCODE_BACK) {
             ThreadUtils.getUiHandler().removeCallbacks(mCheckLongPress);
             ThreadUtils.getUiHandler().postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
         }
 
         if (!mBrowserToolbar.isEditing() && onKey(null, keyCode, event)) {
             return true;
         }
         return super.onKeyDown(keyCode, event);