From 852f5504dded438e591ea0b60467a757fc0ad01f Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Wed, 12 Mar 2014 17:31:09 -0700 Subject: [PATCH 1/9] Bug 971633 - Add filtering of expired input events. r=mwu --- widget/gonk/nsAppShell.cpp | 76 +++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/widget/gonk/nsAppShell.cpp b/widget/gonk/nsAppShell.cpp index 0afca33b6b8..9bf21594258 100644 --- a/widget/gonk/nsAppShell.cpp +++ b/widget/gonk/nsAppShell.cpp @@ -96,8 +96,17 @@ static bool sDevInputAudioJack; static int32_t sHeadphoneState; static int32_t sMicrophoneState; +// Amount of time in MS before an input is considered expired. +static const uint64_t kInputExpirationThresholdMs = 1000; + NS_IMPL_ISUPPORTS_INHERITED1(nsAppShell, nsBaseAppShell, nsIObserver) +static uint64_t +nanosecsToMillisecs(nsecs_t nsecs) +{ + return nsecs / 1000000; +} + namespace mozilla { bool ProcessNextEvent() @@ -559,6 +568,10 @@ public: GeckoInputDispatcher(sp &aEventHub) : mQueueLock("GeckoInputDispatcher::mQueueMutex") , mEventHub(aEventHub) + , mTouchDownCount(0) + , mKeyDownCount(0) + , mTouchEventsFiltered(false) + , mKeyEventsFiltered(false) {} virtual void dump(String8& dump); @@ -603,6 +616,11 @@ private: mozilla::Mutex mQueueLock; std::queue mEventQueue; sp mEventHub; + + int mTouchDownCount; + int mKeyDownCount; + bool mTouchEventsFiltered; + bool mKeyEventsFiltered; }; // GeckoInputReaderPolicy @@ -650,6 +668,14 @@ GeckoInputDispatcher::dump(String8& dump) { } +static bool +isExpired(const UserInputData& data) +{ + uint64_t timeNowMs = + nanosecsToMillisecs(systemTime(SYSTEM_TIME_MONOTONIC)); + return (timeNowMs - data.timeMs) > kInputExpirationThresholdMs; +} + void GeckoInputDispatcher::dispatchOnce() { @@ -666,9 +692,37 @@ GeckoInputDispatcher::dispatchOnce() switch (data.type) { case UserInputData::MOTION_DATA: { + if (!mTouchDownCount) { + // No pending events, the filter state can be updated. + mTouchEventsFiltered = isExpired(data); + } + + int32_t action = data.action & AMOTION_EVENT_ACTION_MASK; + switch (action) { + case AMOTION_EVENT_ACTION_DOWN: + case AMOTION_EVENT_ACTION_POINTER_DOWN: + mTouchDownCount++; + break; + case AMOTION_EVENT_ACTION_MOVE: + case AMOTION_EVENT_ACTION_HOVER_MOVE: + // No need to update the count on move. + break; + case AMOTION_EVENT_ACTION_UP: + case AMOTION_EVENT_ACTION_POINTER_UP: + case AMOTION_EVENT_ACTION_OUTSIDE: + case AMOTION_EVENT_ACTION_CANCEL: + mTouchDownCount--; + break; + default: + break; + } + + if (mTouchEventsFiltered) { + return; + } + nsEventStatus status = nsEventStatus_eIgnore; - if ((data.action & AMOTION_EVENT_ACTION_MASK) != - AMOTION_EVENT_ACTION_HOVER_MOVE) { + if (action != AMOTION_EVENT_ACTION_HOVER_MOVE) { bool captured; status = sendTouchEvent(data, &captured); if (captured) { @@ -677,7 +731,7 @@ GeckoInputDispatcher::dispatchOnce() } uint32_t msg; - switch (data.action & AMOTION_EVENT_ACTION_MASK) { + switch (action) { case AMOTION_EVENT_ACTION_DOWN: msg = NS_MOUSE_BUTTON_DOWN; break; @@ -703,6 +757,16 @@ GeckoInputDispatcher::dispatchOnce() break; } case UserInputData::KEY_DATA: { + if (!mKeyDownCount) { + // No pending events, the filter state can be updated. + mKeyEventsFiltered = isExpired(data); + } + + mKeyDownCount += (data.action == AKEY_EVENT_ACTION_DOWN) ? 1 : -1; + if (mKeyEventsFiltered) { + return; + } + sp kcm = mEventHub->getKeyCharacterMap(data.deviceId); KeyEventDispatcher dispatcher(data, kcm.get()); dispatcher.Dispatch(); @@ -716,12 +780,6 @@ GeckoInputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChange { } -static uint64_t -nanosecsToMillisecs(nsecs_t nsecs) -{ - return nsecs / 1000000; -} - void GeckoInputDispatcher::notifyKey(const NotifyKeyArgs* args) { From 8ccc3d964dd791a5d9cf268eb8e70bde3caaee97 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 20 Mar 2014 17:35:41 -0700 Subject: [PATCH 2/9] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/38ce454dc452 Author: Michael Henretty Desc: Merge pull request #17398 from zacc/bug_986117 Bug 986117 - Debug intermittents in test_settings_app_permissions.py, r=mhenretty ======== https://hg.mozilla.org/integration/gaia-central/rev/7cd0d3ae228b Author: Zac Desc: Bug 986117 - Resolve intermittents in test_settings_app_permissions.py with enhanced wait for Settings app initialisation r=mhenrtty --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 0db45ebda2a..6c1eb382b27 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "branch": "", "revision": "" }, - "revision": "a9008fd903e2b258d481ef072353b5219f74c158", + "revision": "38ce454dc4524b88d7208a3d40bdb3834839adb7", "repo_path": "/integration/gaia-central" } From c880d55c8a320963fc7868d79df44988dfaff0e8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 20 Mar 2014 17:46:05 -0700 Subject: [PATCH 3/9] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 2421da950d3..3cf93a11846 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 53ee1febebb..c405c8792e6 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 380a27d2ea2..a391baaf3a8 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 2421da950d3..3cf93a11846 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 63f1d64e90a..33675addce8 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 55235de10d1..2645ccbcc6e 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index a9f801ca3ee..86d6b5a34be 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 46d165ae406..2b7834d58e7 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 6464f5d739c..c001b7c6a0a 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 65da5ffc200..cd1ec6b29a6 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From dc027d65f6c9c8ca59f37da1c6781b7ef4b10bf9 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 20 Mar 2014 19:49:29 -0700 Subject: [PATCH 4/9] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9f7ea9db8ff2 Author: Kevin Grandon Desc: Merge pull request #17203 from KevinGrandon/bug_983663_contacts_unit_test_lint Bug 983663 - [Contacts] JSHint fixes for contact unit tests ======== https://hg.mozilla.org/integration/gaia-central/rev/2c99aceb1b7f Author: Kevin Grandon Desc: Bug 983663 - [Contacts] JSHint fixes for contact unit tests r=arcturus --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 6c1eb382b27..0542e8c0059 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "branch": "", "revision": "" }, - "revision": "38ce454dc4524b88d7208a3d40bdb3834839adb7", + "revision": "9f7ea9db8ff2e395268c1412336b72e1c897687b", "repo_path": "/integration/gaia-central" } From 8423415e84d1e819e2216f330cddabac5c1e1283 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 20 Mar 2014 19:49:40 -0700 Subject: [PATCH 5/9] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3cf93a11846..9ce7cdc741b 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index c405c8792e6..5b0287daaff 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index a391baaf3a8..9a602e73c17 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 3cf93a11846..9ce7cdc741b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 33675addce8..bcbc124a624 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 2645ccbcc6e..445f4e6fc1d 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 86d6b5a34be..a02ea849b97 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 2b7834d58e7..31a7bda1178 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index c001b7c6a0a..84857804e5a 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index cd1ec6b29a6..0a0e9db765e 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 92521f06de8fe24b2e8d6f565824cc5d27c0cdc9 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 21 Mar 2014 00:06:01 -0700 Subject: [PATCH 6/9] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/3045bf73d5cc Author: Carsten Book -Tomcat- Desc: Revert "Bug 983663 - [Contacts] JSHint fixes for contact unit tests r=arcturus" for Gaia Unit Test Bustage This reverts commit 4de450bb6f1a6407aa9a23bf211a7e8e9742b913. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 0542e8c0059..4062164e347 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "branch": "", "revision": "" }, - "revision": "9f7ea9db8ff2e395268c1412336b72e1c897687b", + "revision": "3045bf73d5cc752ba8c548d82ea567987743c3bd", "repo_path": "/integration/gaia-central" } From 341796949a93d1ff59d8104a8cdc1392cd114f64 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 21 Mar 2014 00:11:20 -0700 Subject: [PATCH 7/9] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9ce7cdc741b..4359d1aa8a8 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 5b0287daaff..ef019efc8d8 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 9a602e73c17..4a3155e09d7 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 9ce7cdc741b..4359d1aa8a8 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index bcbc124a624..6c97834ad6a 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 445f4e6fc1d..68802d004a6 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index a02ea849b97..790a0f1d981 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 31a7bda1178..45d8867f509 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 84857804e5a..379a134748d 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0a0e9db765e..41ddab73b4b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From b2143328451ffba49fb4c80f94c4e7ba9c55d2d8 Mon Sep 17 00:00:00 2001 From: Shawn Huang Date: Fri, 21 Mar 2014 17:12:16 +0800 Subject: [PATCH 8/9] Bug 986352 - [bluedroid] Fix hfp-fallback build break due to miss Reset() for BluetoothHfpManager, r=echou --- .../bluedroid/hfp-fallback/BluetoothHfpManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp b/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp index 31447eb9602..cc55ca7c189 100644 --- a/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp @@ -180,4 +180,10 @@ BluetoothHfpManager::DisconnectSco() return false; } +void +BluetoothHfpManager::Reset() +{ + MOZ_ASSERT(NS_IsMainThread()); +} + NS_IMPL_ISUPPORTS1(BluetoothHfpManager, nsIObserver) From 809ef82ba2b754d80804725653f40d6e9b9b71ae Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 21 Mar 2014 02:17:41 -0700 Subject: [PATCH 9/9] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4359d1aa8a8..41a8d1793b6 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -23,7 +23,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4359d1aa8a8..41a8d1793b6 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -23,7 +23,7 @@ - +