From bf32449dbe9491ab6f1d97435101a263edcdc891 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 16:05:27 -0700 Subject: [PATCH 01/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/31b4142ae6e2 Author: Kevin Grandon Desc: Merge pull request #21504 from KevinGrandon/bug_1036053_vertical_app_uninstall_pending_test Bug 1036053 - Intermittent failing test, TEST-UNEXPECTED-FAIL | /builds/slave/test/gaia/apps/verticalhome/test/marionette/app_uninstall_pending_test.js ======== https://hg.mozilla.org/integration/gaia-central/rev/38a7d43f99ce Author: Kevin Grandon Desc: Bug 1036053 - Intermittent failing test, TEST-UNEXPECTED-FAIL | /builds/slave/test/gaia/apps/verticalhome/test/marionette/app_uninstall_pending_test.js r=me --- 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 1a44d33c0f8..c7782a10312 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "4d2c0a0848326ad805ccc89f0a3893d35f90a9ef", + "revision": "31b4142ae6e2b4800a3245b4e5a4554550340c65", "repo_path": "/integration/gaia-central" } From 033f93b32387ea359e281fed0f0ddc5857f9f377 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 16:11:13 -0700 Subject: [PATCH 02/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 90aeca1a797..9db221869b2 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 f56fac25cbe..4750e54bec9 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 1266c1a8713..fad6b629e4c 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 90aeca1a797..9db221869b2 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index e6272babefd..aeacf1d049a 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 5a844708f3c..56e0d976f0e 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 df685ffdbd9..0de25710d93 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 52e066748b6..c7a57eab098 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 190d3ee9117..a7f76c83a90 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 2a7a56a0a9e4a7643d2686f1abe59edb277c4171 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 16:20:26 -0700 Subject: [PATCH 03/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/1b1b21f51115 Author: Michael Henretty Desc: Merge pull request #21488 from shufang-xu/bug1033889xsf_master Bug 1033889 - unable to read cell broadcast message on lock screen. r=ferjmoreno,Michael Henretty ======== https://hg.mozilla.org/integration/gaia-central/rev/1862a1f9beb7 Author: arvin zhang Desc: Bug 1033889 - unable to read cell broadcast message on lock screen. r=ferjmoreno,Michael Henretty --- 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 c7782a10312..ec1e2c4cf85 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "31b4142ae6e2b4800a3245b4e5a4554550340c65", + "revision": "1b1b21f5111593d70fb4e165c88a5fc3b15cd964", "repo_path": "/integration/gaia-central" } From 38ac1ac5cb8dba82a4905d6637212e47aecd9492 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 16:26:41 -0700 Subject: [PATCH 04/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9db221869b2..c3789c53b8c 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 4750e54bec9..cea11724a58 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 fad6b629e4c..527a662e47e 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 9db221869b2..c3789c53b8c 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index aeacf1d049a..a4eefa36712 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 56e0d976f0e..32c142758a6 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 0de25710d93..c46da6729ef 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index c7a57eab098..f5f016f8a12 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a7f76c83a90..ab8f2b15978 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From f60d0ed5c8257fd20e3970166a5c0f0730531aad Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 17:45:31 -0700 Subject: [PATCH 05/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/69fb04742e82 Author: Diego Marcos Desc: Merge pull request #21199 from dmarcos/bug1024692master Bug 1024692: limit image decode size to 3mp on 256mb devices ======== https://hg.mozilla.org/integration/gaia-central/rev/37278f96aeb6 Author: David Flanagan Desc: Bug 1024692 - camera app is killed during zoom in/zoom out (out of memory) on 256 MB target --- 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 ec1e2c4cf85..b0a4ab2a31b 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "1b1b21f5111593d70fb4e165c88a5fc3b15cd964", + "revision": "69fb04742e822b40c952188bd0d8bdae2e97c244", "repo_path": "/integration/gaia-central" } From 6fdaca3b30c3227a4169d86b60579ab51e24a229 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 17:51:16 -0700 Subject: [PATCH 06/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index c3789c53b8c..936baca4b85 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 cea11724a58..939e08ce2bb 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 527a662e47e..1dff5ad377d 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 c3789c53b8c..936baca4b85 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index a4eefa36712..882d7ecf264 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 32c142758a6..9b909c3888f 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 c46da6729ef..1cfbf0c29ef 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index f5f016f8a12..5346be34603 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index ab8f2b15978..26c34609354 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 66461e6980a11a627385809ef703773baae2ba00 Mon Sep 17 00:00:00 2001 From: Jamin Liu Date: Wed, 9 Jul 2014 09:52:11 +0800 Subject: [PATCH 07/32] Bug 1030536 - Write a marionette test for verifying the setters of adapter based on bluetooth API v2. r=btian --- dom/bluetooth2/tests/marionette/head.js | 58 +++++++++ dom/bluetooth2/tests/marionette/manifest.ini | 1 + .../test_dom_BluetoothAdapter_setters_API2.js | 111 ++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 dom/bluetooth2/tests/marionette/test_dom_BluetoothAdapter_setters_API2.js diff --git a/dom/bluetooth2/tests/marionette/head.js b/dom/bluetooth2/tests/marionette/head.js index d73176f53b0..8fd146dd3d2 100644 --- a/dom/bluetooth2/tests/marionette/head.js +++ b/dom/bluetooth2/tests/marionette/head.js @@ -503,6 +503,64 @@ function waitForAdapterStateChanged(aAdapter, aStateChangesInOrder) { return deferred.promise; } +/** + * Wait for an 'onattributechanged' event for a specified attribute and compare + * the new value with the expected value. + * + * Resolve if the specified event occurs. Never reject. + * + * Fulfill params: a BluetoothAttributeEvent with property attrs that contains + * changed BluetoothAdapterAttributes. + * + * @param aAdapter + * The BluetoothAdapter you want to use. + * @param aAttrName + * The name of the attribute of adapter. + * @param aExpectedValue + * The expected new value of the attribute. + * + * @return A deferred promise. + */ +function waitForAdapterAttributeChanged(aAdapter, aAttrName, aExpectedValue) { + let deferred = Promise.defer(); + + aAdapter.onattributechanged = function(aEvent) { + let i = aEvent.attrs.indexOf(aAttrName); + if (i >= 0) { + switch (aEvent.attrs[i]) { + case "state": + log(" 'state' changed to " + aAdapter.state); + is(aAdapter.state, aExpectedValue, "adapter.state"); + break; + case "name": + log(" 'name' changed to " + aAdapter.name); + is(aAdapter.name, aExpectedValue, "adapter.name"); + break; + case "address": + log(" 'address' changed to " + aAdapter.address); + is(aAdapter.address, aExpectedValue, "adapter.address"); + break; + case "discoverable": + log(" 'discoverable' changed to " + aAdapter.discoverable); + is(aAdapter.discoverable, aExpectedValue, "adapter.discoverable"); + break; + case "discovering": + log(" 'discovering' changed to " + aAdapter.discovering); + is(aAdapter.discovering, aExpectedValue, "adapter.discovering"); + break; + case "unknown": + default: + ok(false, "Unknown attribute '" + aAttrName + "' changed." ); + break; + } + aAdapter.onattributechanged = null; + deferred.resolve(aEvent); + } + }; + + return deferred.promise; +} + /** * Flush permission settings and call |finish()|. */ diff --git a/dom/bluetooth2/tests/marionette/manifest.ini b/dom/bluetooth2/tests/marionette/manifest.ini index d3ed382f7f5..88c6fe50b95 100644 --- a/dom/bluetooth2/tests/marionette/manifest.ini +++ b/dom/bluetooth2/tests/marionette/manifest.ini @@ -5,3 +5,4 @@ qemu = false [test_dom_BluetoothManager_API2.js] [test_dom_BluetoothAdapter_enable_API2.js] +[test_dom_BluetoothAdapter_setters_API2.js] diff --git a/dom/bluetooth2/tests/marionette/test_dom_BluetoothAdapter_setters_API2.js b/dom/bluetooth2/tests/marionette/test_dom_BluetoothAdapter_setters_API2.js new file mode 100644 index 00000000000..91293292d26 --- /dev/null +++ b/dom/bluetooth2/tests/marionette/test_dom_BluetoothAdapter_setters_API2.js @@ -0,0 +1,111 @@ +/* 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/. */ + +/////////////////////////////////////////////////////////////////////////////// +// Test Purpose: +// To verify that all setters of BluetoothAdapter (except for pairing related +// APIs) can change properties correctly. +// +// Test Procedure: +// [0] Set Bluetooth permission and enable default adapter. +// [1] Verify the functionality of 'setName'. +// [2] Verify the functionality of 'setDiscoverable'. +// [3] Disable Bluetooth and collect changed attributes. +// [4] Verify the changes of attributes when BT is disabled. +// [5] Set properties when Bluetooth is disabled. +// [6] Enable Bluetooth and collect changed attributes. +// [7] Verify the changes of attributes when BT is enabled. +// [8] Restore the original 'adapter.name'. +// [9] Check the validity of setting properties to their present value. +// +// Test Coverage: +// - BluetoothAdapter.setName() +// - BluetoothAdapter.setDiscoverable() +// - BluetoothAdapter.onattributechanged() +// - BluetoothAdapter.state +// - BluetoothAdapter.name +// - BluetoothAdapter.discoverable +// +/////////////////////////////////////////////////////////////////////////////// + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = 'head.js'; + +startBluetoothTest(true, function testCaseMain(aAdapter) { + log("Checking adapter attributes ..."); + + is(aAdapter.state, "enabled", "adapter.state"); + isnot(aAdapter.address, "", "adapter.address"); + + // Since adapter has just been re-enabled, these properties should be 'false'. + is(aAdapter.discovering, false, "adapter.discovering"); + is(aAdapter.discoverable, false, "adapter.discoverable at step [0]"); + + log("adapter.address: " + aAdapter.address); + log("adapter.name: " + aAdapter.name); + + let originalName = aAdapter.name; + return Promise.resolve() + .then(function() { + log("[1] Set 'name' ... "); + let promises = []; + promises.push(waitForAdapterAttributeChanged(aAdapter, "name", originalName + "_modified")); + promises.push(aAdapter.setName(originalName + "_modified")); + return Promise.all(promises); + }) + .then(function() { + log("[2] Set 'discoverable' ... "); + let promises = []; + promises.push(waitForAdapterAttributeChanged(aAdapter, "discoverable", !aAdapter.discoverable)); + promises.push(aAdapter.setDiscoverable(!aAdapter.discoverable)); + return Promise.all(promises); + }) + .then(function() { + log("[3] Disable Bluetooth ..."); + let promises = []; + promises.push(waitForAdapterStateChanged(aAdapter, ["disabling", "disabled"])); + promises.push(aAdapter.disable()); + return Promise.all(promises); + }) + .then(function(aResults) { + log("[4] Verify the changes of attributes ..."); + isnot(aResults[0].indexOf("name"), -1, "Indicator of 'name' changed event"); + isnot(aResults[0].indexOf("discoverable"), -1, "Indicator of 'discoverable' changed event"); + is(aAdapter.name, "", "adapter.name"); + is(aAdapter.discoverable, false, "adapter.discoverable at step [4]"); + }) + .then(() => log("[5] Set properties when Bluetooth is disabled ...")) + .then(() => aAdapter.setName(originalName)) + .then(() => ok(false, "Failed to handle 'setName' when BT is disabled."), + () => aAdapter.setDiscoverable(true)) + .then(() => ok(false, "Failed to handle 'setDiscoverable' when BT is disabled."), + () => null) + .then(function() { + log("[6] Enable Bluetooth ..."); + let promises = []; + promises.push(waitForAdapterStateChanged(aAdapter, ["enabling", "enabled"])); + promises.push(aAdapter.enable()); + return Promise.all(promises); + }) + .then(function(aResults) { + log("[7] Verify the changes of attributes ..."); + isnot(aResults[0].indexOf("name"), -1, "Indicator of 'name' changed event"); + is(aAdapter.name, originalName + "_modified", "adapter.name"); + is(aAdapter.discoverable, false, "adapter.discoverable at step [7]"); + }) + .then(function() { + log("[8] Restore the original 'name' ..."); + let promises = []; + promises.push(waitForAdapterAttributeChanged(aAdapter, "name", originalName)); + promises.push(aAdapter.setName(originalName)); + return Promise.all(promises); + }) + .then(function() { + log("[9] Check the validity of setting properties to their present value ..."); + let promises = []; + promises.push(aAdapter.setName(aAdapter.name)); + promises.push(aAdapter.setDiscoverable(aAdapter.discoverable)); + return Promise.all(promises); + }); +}); From 712497043876e5ded0a9f3bc1766e753e50a2777 Mon Sep 17 00:00:00 2001 From: Krzysztof Mioduszewski Date: Mon, 7 Jul 2014 20:40:01 +0200 Subject: [PATCH 08/32] Bug 1033218 - [NFC] use emulator command triggering tech-lost. r=allstars.chh --- .../marionette/test_nfc_error_messages.js | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/dom/nfc/tests/marionette/test_nfc_error_messages.js b/dom/nfc/tests/marionette/test_nfc_error_messages.js index afadd6f3e57..bf5ef15c1e6 100644 --- a/dom/nfc/tests/marionette/test_nfc_error_messages.js +++ b/dom/nfc/tests/marionette/test_nfc_error_messages.js @@ -4,7 +4,7 @@ 'use strict'; /* globals log, is, ok, runTests, toggleNFC, runNextTest, - SpecialPowers, nfc, enableRE0, MozNDEFRecord */ + SpecialPowers, nfc, MozNDEFRecord, emulator */ const MARIONETTE_TIMEOUT = 60000; const MARIONETTE_HEAD_JS = 'head.js'; @@ -27,7 +27,7 @@ let sessionTokens = []; function testNfcNotEnabledError() { log('testNfcNotEnabledError'); toggleNFC(true) - .then(enableRE0) + .then(() => emulator.activateRE(0)) .then(registerAndFireOnpeerready) .then(() => toggleNFC(false)) .then(() => sendNDEFExpectError(nfcPeers[0], 'NfcNotEnabledError')) @@ -45,11 +45,10 @@ function testNfcNotEnabledError() { function testNfcBadSessionIdError() { log('testNfcBadSessionIdError'); toggleNFC(true) - .then(enableRE0) + .then(() => emulator.activateRE(0)) .then(registerAndFireOnpeerready) - .then(() => toggleNFC(false)) - .then(() => toggleNFC(true)) - .then(enableRE0) + .then(() => emulator.deactivate()) + .then(() => emulator.activateRE(0)) .then(registerAndFireOnpeerready) // we have 2 peers in nfcPeers array, peer0 has old/invalid session token .then(() => sendNDEFExpectError(nfcPeers[0], 'NfcBadSessionIdError')) @@ -66,7 +65,7 @@ function testNfcBadSessionIdError() { function testNfcConnectError() { log('testNfcConnectError'); toggleNFC(true) - .then(enableRE0) + .then(() => emulator.activateRE(0)) .then(registerAndFireOnpeerready) .then(() => connectToNFCTagExpectError(sessionTokens[0], 'NDEF', @@ -84,9 +83,10 @@ function testNfcConnectError() { function testNoErrorInTechMsg() { log('testNoErrorInTechMsg'); toggleNFC(true) - .then(enableRE0) + .then(() => emulator.activateRE(0)) .then(setTechDiscoveredHandler) .then(setAndFireTechLostHandler) + .then(() => toggleNFC(false)) .then(endTest) .catch(handleRejectedPromise); } @@ -201,8 +201,9 @@ function setAndFireTechLostHandler() { window.navigator.mozSetMessageHandler('nfc-manager-tech-lost', techLostHandler); - // TODO should be refactored once Bug 1023079 lands - toggleNFC(false); + + // triggers tech-lost + emulator.deactivate(); return deferred.promise; } From 4434b53bb8139d2f679da792b3d10af64f97ad48 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 23:00:26 -0700 Subject: [PATCH 09/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/3dc289644918 Author: Alive.Kuo Desc: Merge pull request #21258 from alivedise/bugzilla/1032068_master/drop-activity-on-demand Bug 1032068 - Maintain id pool of activity chaining instances to keep on...r=timdream ======== https://hg.mozilla.org/integration/gaia-central/rev/a2b8d2aa8831 Author: Alive Kuo Desc: Bug 1032068 - Maintain id pool of activity chaining instances to keep only one chaining --- 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 b0a4ab2a31b..a2d2decd3d7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "69fb04742e822b40c952188bd0d8bdae2e97c244", + "revision": "3dc2896449189d18a6f02e4b72926c9bf07d9ce3", "repo_path": "/integration/gaia-central" } From 7239b393c6a4628c3d47ef9db9381423f02c61c5 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 23:06:41 -0700 Subject: [PATCH 10/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 936baca4b85..52ded405086 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 939e08ce2bb..7dbe97e9750 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 1dff5ad377d..5cd7e2bd497 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 936baca4b85..52ded405086 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 882d7ecf264..8cda38aa630 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 9b909c3888f..ca954b19d53 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 1cfbf0c29ef..377b3e73720 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 5346be34603..0982056c5d5 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 26c34609354..649f2e87af2 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From c437b1c34e7b2519af0009f20623bb0678e2c477 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 23:45:30 -0700 Subject: [PATCH 11/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/6680a4aa31f0 Author: Arnau Desc: Merge pull request #19083 from rnowm/948856 Bug 948856 - [Settings] Update setting icons to use Icon Fonts r=arthurcc ======== https://hg.mozilla.org/integration/gaia-central/rev/eeb7849bcf86 Author: rnowm Desc: Bug 948856 - [Settings] Update setting icons to use Icon Fonts --- 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 a2d2decd3d7..6a8ffd50a8e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "3dc2896449189d18a6f02e4b72926c9bf07d9ce3", + "revision": "6680a4aa31f0e8395a53a98175263a73dc57456d", "repo_path": "/integration/gaia-central" } From 756e26ec822f8857a81384fdf08dbaf9d1a21118 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 8 Jul 2014 23:51:19 -0700 Subject: [PATCH 12/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 52ded405086..dec8f77072a 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 7dbe97e9750..0afea68b366 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 5cd7e2bd497..9151d92146d 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 52ded405086..dec8f77072a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 8cda38aa630..e3153ee0c4d 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index ca954b19d53..1f03b736716 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 377b3e73720..7aa59850c32 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 0982056c5d5..2cf389af48f 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 649f2e87af2..8d90ba43729 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 6df22626088de0be3ea1fcfd98980294d98f7ff7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 00:00:28 -0700 Subject: [PATCH 13/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/7e913d93cc2b Author: Dominic Kuo Desc: Merge pull request #21104 from dominickuo/bug-1015042 Bug 1015042 - [Music] Use the backup duration when the audio.duration is Infinity, r=jimporter ======== https://hg.mozilla.org/integration/gaia-central/rev/0a3c0dd88374 Author: Dominic Kuo Desc: Bug 1015042 - [Music] Make sure the audio duration is not NaN or Infinity --- 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 6a8ffd50a8e..24d3f08d5c8 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "6680a4aa31f0e8395a53a98175263a73dc57456d", + "revision": "7e913d93cc2b5f14a05d78977005e02e05d9bbb3", "repo_path": "/integration/gaia-central" } From 37ebceb2f257bdc120e62e1f6c15b73d5af89d79 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 00:06:12 -0700 Subject: [PATCH 14/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index dec8f77072a..3699db59c86 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 0afea68b366..f5121e5c427 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 9151d92146d..15b1501c02d 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 dec8f77072a..3699db59c86 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index e3153ee0c4d..d46ff9b5eeb 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 1f03b736716..c06132f8a01 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 7aa59850c32..e8b2d632497 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 2cf389af48f..c49aa074d56 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 8d90ba43729..a993e548f8b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 0c966d0375670d90dca5562ba1231778bcf10f02 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 00:10:29 -0700 Subject: [PATCH 15/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/ad1160c3a8dd Author: Timothy Guan-tin Chien Desc: Merge pull request #21477 from timdream/settings-disable-lock-passcode Bug 1034183 - Disable lock screen also disables pass code lock, r=arthurcc ======== https://hg.mozilla.org/integration/gaia-central/rev/3369cf651b17 Author: Timothy Guan-tin Chien Desc: Bug 1034183 - Disable lock screen also disables pass code lock --- 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 24d3f08d5c8..2cc99f9f5f9 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "7e913d93cc2b5f14a05d78977005e02e05d9bbb3", + "revision": "ad1160c3a8dd6be058428c68dcf7b4c425c4fae4", "repo_path": "/integration/gaia-central" } From 3b5d88b3005e36d44f860ffb0d5e8b0ead6ed2eb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 00:16:17 -0700 Subject: [PATCH 16/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3699db59c86..86a049b6f9e 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 f5121e5c427..8dd02a0bbc8 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 15b1501c02d..c3700e38d0c 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 3699db59c86..86a049b6f9e 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index d46ff9b5eeb..ab60b1129d8 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index c06132f8a01..a26c9efae92 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 e8b2d632497..109fa85db3b 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index c49aa074d56..2fb721779c7 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a993e548f8b..1d923a9427a 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 300611466e2080cf4909042bda7479079631912d Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:37:40 +0200 Subject: [PATCH 17/32] Bug 1033961: Add result handler for Bluetooth Core profile (under bluetooth2/), r=btian The result-handler class contains a method for each interface in the Core profile and a method for failed calls. The patch also adds runnable classes that execute a result handler's method on the main thread. --- .../bluedroid/BluetoothInterface.cpp | 87 +++++++++++++++++++ dom/bluetooth2/bluedroid/BluetoothInterface.h | 44 ++++++++++ 2 files changed, 131 insertions(+) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index d17359f3e11..619555ac6be 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -5,6 +5,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "BluetoothInterface.h" +#include "nsAutoPtr.h" +#include "nsThreadUtils.h" BEGIN_BLUETOOTH_NAMESPACE @@ -12,6 +14,61 @@ template struct interface_traits { }; +// +// Result handling +// + +template +class BluetoothInterfaceRunnable0 : public nsRunnable +{ +public: + BluetoothInterfaceRunnable0(Obj* aObj, Res (Obj::*aMethod)()) + : mObj(aObj) + , mMethod(aMethod) + { + MOZ_ASSERT(mObj); + MOZ_ASSERT(mMethod); + } + + NS_METHOD + Run() MOZ_OVERRIDE + { + ((*mObj).*mMethod)(); + return NS_OK; + } + +private: + nsRefPtr mObj; + void (Obj::*mMethod)(); +}; + +template +class BluetoothInterfaceRunnable1 : public nsRunnable +{ +public: + BluetoothInterfaceRunnable1(Obj* aObj, Res (Obj::*aMethod)(Arg1), + const Arg1& aArg1) + : mObj(aObj) + , mMethod(aMethod) + , mArg1(aArg1) + { + MOZ_ASSERT(mObj); + MOZ_ASSERT(mMethod); + } + + NS_METHOD + Run() MOZ_OVERRIDE + { + ((*mObj).*mMethod)(mArg1); + return NS_OK; + } + +private: + nsRefPtr mObj; + void (Obj::*mMethod)(Arg1); + Arg1 mArg1; +}; + // // Socket Interface // @@ -371,6 +428,36 @@ BluetoothAvrcpInterface::SetVolume(uint8_t aVolume) // Bluetooth Core Interface // +typedef + BluetoothInterfaceRunnable0 + BluetoothResultRunnable; + +typedef + BluetoothInterfaceRunnable1 + BluetoothErrorRunnable; + +static nsresult +DispatchBluetoothResult(BluetoothResultHandler* aRes, + void (BluetoothResultHandler::*aMethod)(), + int aStatus) +{ + MOZ_ASSERT(aRes); + + nsRunnable* runnable; + + if (aStatus == BT_STATUS_SUCCESS) { + runnable = new BluetoothResultRunnable(aRes, aMethod); + } else { + runnable = new + BluetoothErrorRunnable(aRes, &BluetoothResultHandler::OnError, aStatus); + } + nsresult rv = NS_DispatchToMainThread(runnable); + if (NS_FAILED(rv)) { + BT_LOGR("NS_DispatchToMainThread failed: %X", rv); + } + return rv; +} + /* returns the container structure of a variable; _t is the container's * type, _v the name of the variable, and _m is _v's field within _t */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index 91c93ca92ae..a9673a2c06f 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -181,6 +181,50 @@ private: // Bluetooth Core Interface // +class BluetoothResultHandler +{ +public: + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothResultHandler) + + virtual ~BluetoothResultHandler() { } + + virtual void OnError(int aStatus) + { + BT_LOGR("Received error code %d", aStatus); + } + + virtual void Init() { } + virtual void Cleanup() { } + virtual void Enable() { } + virtual void Disable() { } + + virtual void GetAdapterProperties() { } + virtual void GetAdapterProperty() { } + virtual void SetAdapterProperty() { } + + virtual void GetRemoteDeviceProperties() { } + virtual void GetRemoteDeviceProperty() { } + virtual void SetRemoteDeviceProperty() { } + + virtual void GetRemoteServiceRecord() { } + virtual void GetRemoteServices() { } + + virtual void StartDiscovery() { } + virtual void CancelDiscovery() { } + + virtual void CreateBond() { } + virtual void RemoveBond() { } + virtual void CancelBond() { } + + virtual void PinReply() { } + virtual void SspReply() { } + + virtual void DutModeConfigure() { } + virtual void DutModeSend() { } + + virtual void LeTestMode() { } +}; + class BluetoothInterface { public: From 1988138e46fa8c7679f4382af56520cb4180c65d Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:37:53 +0200 Subject: [PATCH 18/32] Bug 1033961: Split Bluedroid start/stop code (under bluetooth2/), r=btian This patch prepares refactoring of the Bluedroid start and stop code towards an asynchronous design. --- .../bluedroid/BluetoothServiceBluedroid.cpp | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index 1e90cb734ff..e5e20ef2124 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -831,7 +831,7 @@ EnableInternal() } static nsresult -StartStopGonkBluetooth(bool aShouldEnable) +StartGonkBluetooth() { MOZ_ASSERT(NS_IsMainThread()); @@ -840,17 +840,43 @@ StartStopGonkBluetooth(bool aShouldEnable) BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE); - if (bs->IsEnabled() == aShouldEnable) { + if (bs->IsEnabled()) { // Keep current enable status nsRefPtr runnable = - new BluetoothService::ToggleBtAck(aShouldEnable); + new BluetoothService::ToggleBtAck(true); if (NS_FAILED(NS_DispatchToMainThread(runnable))) { BT_WARNING("Failed to dispatch to main thread!"); } return NS_OK; } - int ret = aShouldEnable ? EnableInternal() : sBtInterface->Disable(); + int ret = EnableInternal(); + NS_ENSURE_TRUE(ret == BT_STATUS_SUCCESS, NS_ERROR_FAILURE); + + return NS_OK; +} + +static nsresult +StopGonkBluetooth() +{ + MOZ_ASSERT(NS_IsMainThread()); + + NS_ENSURE_TRUE(sBtInterface, NS_ERROR_FAILURE); + + BluetoothService* bs = BluetoothService::Get(); + NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE); + + if (!bs->IsEnabled()) { + // Keep current enable status + nsRefPtr runnable = + new BluetoothService::ToggleBtAck(false); + if (NS_FAILED(NS_DispatchToMainThread(runnable))) { + BT_WARNING("Failed to dispatch to main thread!"); + } + return NS_OK; + } + + int ret = sBtInterface->Disable(); NS_ENSURE_TRUE(ret == BT_STATUS_SUCCESS, NS_ERROR_FAILURE); return NS_OK; @@ -910,7 +936,7 @@ BluetoothServiceBluedroid::StartInternal(BluetoothReplyRunnable* aRunnable) sChangeAdapterStateRunnableArray.AppendElement(aRunnable); } - nsresult ret = StartStopGonkBluetooth(true); + nsresult ret = StartGonkBluetooth(); if (NS_FAILED(ret)) { nsRefPtr runnable = new BluetoothService::ToggleBtAck(false); @@ -942,7 +968,7 @@ BluetoothServiceBluedroid::StopInternal(BluetoothReplyRunnable* aRunnable) sChangeAdapterStateRunnableArray.AppendElement(aRunnable); } - nsresult ret = StartStopGonkBluetooth(false); + nsresult ret = StopGonkBluetooth(); if (NS_FAILED(ret)) { nsRefPtr runnable = new BluetoothService::ToggleBtAck(true); From 5a28ab6e1b2fd8ec49688f5a1dac986426d7e32e Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:38:06 +0200 Subject: [PATCH 19/32] Bug 1033961: Asynchronous Bluedroid starting and stopping (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 38 +++++--- dom/bluetooth2/bluedroid/BluetoothInterface.h | 9 +- .../bluedroid/BluetoothServiceBluedroid.cpp | 86 ++++++++++++++----- 3 files changed, 96 insertions(+), 37 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 619555ac6be..b1b42107b07 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -529,28 +529,46 @@ BluetoothInterface::BluetoothInterface(const bt_interface_t* aInterface) BluetoothInterface::~BluetoothInterface() { } -int -BluetoothInterface::Init(bt_callbacks_t* aCallbacks) +void +BluetoothInterface::Init(bt_callbacks_t* aCallbacks, + BluetoothResultHandler* aRes) { - return mInterface->init(aCallbacks); + int status = mInterface->init(aCallbacks); + + if (aRes) { + DispatchBluetoothResult(aRes, &BluetoothResultHandler::Init, status); + } } void -BluetoothInterface::Cleanup() +BluetoothInterface::Cleanup(BluetoothResultHandler* aRes) { mInterface->cleanup(); + + if (aRes) { + DispatchBluetoothResult(aRes, &BluetoothResultHandler::Cleanup, + BT_STATUS_SUCCESS); + } } -int -BluetoothInterface::Enable() +void +BluetoothInterface::Enable(BluetoothResultHandler* aRes) { - return mInterface->enable(); + int status = mInterface->enable(); + + if (aRes) { + DispatchBluetoothResult(aRes, &BluetoothResultHandler::Enable, status); + } } -int -BluetoothInterface::Disable() +void +BluetoothInterface::Disable(BluetoothResultHandler* aRes) { - return mInterface->disable(); + int status = mInterface->disable(); + + if (aRes) { + DispatchBluetoothResult(aRes, &BluetoothResultHandler::Disable, status); + } } /* Adapter Properties */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index a9673a2c06f..41c797f1f84 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -230,11 +230,12 @@ class BluetoothInterface public: static BluetoothInterface* GetInstance(); - int Init(bt_callbacks_t* aCallbacks); - void Cleanup(); + void Init(bt_callbacks_t* aCallbacks, BluetoothResultHandler* aRes); + void Cleanup(BluetoothResultHandler* aRes); + + void Enable(BluetoothResultHandler* aRes); + void Disable(BluetoothResultHandler* aRes); - int Enable(); - int Disable(); /* Adapter Properties */ diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index e5e20ef2124..d1bc4f0aee9 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -177,7 +177,7 @@ public: // Cleanup bluetooth interfaces after BT state becomes BT_STATE_OFF. BluetoothHfpManager::DeinitHfpInterface(); BluetoothA2dpManager::DeinitA2dpInterface(); - sBtInterface->Cleanup(); + sBtInterface->Cleanup(nullptr); return NS_OK; } @@ -812,23 +812,51 @@ EnsureBluetoothHalLoad() return true; } -static bool -EnableInternal() +class EnableResultHandler MOZ_FINAL : public BluetoothResultHandler { - int ret = sBtInterface->Init(&sBluetoothCallbacks); - if (ret != BT_STATUS_SUCCESS) { - BT_LOGR("Error while setting the callbacks"); - sBtInterface = nullptr; - return false; +public: + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + + BT_LOGR("BluetoothInterface::Enable failed: %d", aStatus); + + nsRefPtr runnable = new BluetoothService::ToggleBtAck(false); + if (NS_FAILED(NS_DispatchToMainThread(runnable))) { + BT_WARNING("Failed to dispatch to main thread!"); + } + } +}; + +class InitResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + void Init() MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + + // Register all the bluedroid callbacks before enable() get called + // It is required to register a2dp callbacks before a2dp media task starts up. + // If any interface cannot be initialized, turn on bluetooth core anyway. + BluetoothHfpManager::InitHfpInterface(); + BluetoothA2dpManager::InitA2dpInterface(); + sBtInterface->Enable(new EnableResultHandler()); } - // Register all the bluedroid callbacks before enable() get called - // It is required to register a2dp callbacks before a2dp media task starts up. - // If any interface cannot be initialized, turn on bluetooth core anyway. - BluetoothHfpManager::InitHfpInterface(); - BluetoothA2dpManager::InitA2dpInterface(); - return sBtInterface->Enable(); -} + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + + BT_LOGR("BluetoothInterface::Init failed: %d", aStatus); + + sBtInterface = nullptr; + + nsRefPtr runnable = new BluetoothService::ToggleBtAck(false); + if (NS_FAILED(NS_DispatchToMainThread(runnable))) { + BT_WARNING("Failed to dispatch to main thread!"); + } + } +}; static nsresult StartGonkBluetooth() @@ -842,20 +870,34 @@ StartGonkBluetooth() if (bs->IsEnabled()) { // Keep current enable status - nsRefPtr runnable = - new BluetoothService::ToggleBtAck(true); + nsRefPtr runnable = new BluetoothService::ToggleBtAck(true); if (NS_FAILED(NS_DispatchToMainThread(runnable))) { BT_WARNING("Failed to dispatch to main thread!"); } return NS_OK; } - int ret = EnableInternal(); - NS_ENSURE_TRUE(ret == BT_STATUS_SUCCESS, NS_ERROR_FAILURE); + sBtInterface->Init(&sBluetoothCallbacks, new InitResultHandler()); return NS_OK; } +class DisableResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + + BT_LOGR("BluetoothInterface::Disable failed: %d", aStatus); + + nsRefPtr runnable = new BluetoothService::ToggleBtAck(true); + if (NS_FAILED(NS_DispatchToMainThread(runnable))) { + BT_WARNING("Failed to dispatch to main thread!"); + } + } +}; + static nsresult StopGonkBluetooth() { @@ -868,16 +910,14 @@ StopGonkBluetooth() if (!bs->IsEnabled()) { // Keep current enable status - nsRefPtr runnable = - new BluetoothService::ToggleBtAck(false); + nsRefPtr runnable = new BluetoothService::ToggleBtAck(false); if (NS_FAILED(NS_DispatchToMainThread(runnable))) { BT_WARNING("Failed to dispatch to main thread!"); } return NS_OK; } - int ret = sBtInterface->Disable(); - NS_ENSURE_TRUE(ret == BT_STATUS_SUCCESS, NS_ERROR_FAILURE); + sBtInterface->Disable(new DisableResultHandler()); return NS_OK; } From 2244cbf6c31a64b775cdfe40bdb2ab23766c3191 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:38:20 +0200 Subject: [PATCH 20/32] Bug 1033961: Asynchronous Bluedroid adapter methods (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 38 +++++++++++++---- dom/bluetooth2/bluedroid/BluetoothInterface.h | 8 ++-- .../bluedroid/BluetoothServiceBluedroid.cpp | 41 ++++++++++++++----- 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index b1b42107b07..8e3fa13d9b4 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -573,22 +573,42 @@ BluetoothInterface::Disable(BluetoothResultHandler* aRes) /* Adapter Properties */ -int -BluetoothInterface::GetAdapterProperties() +void +BluetoothInterface::GetAdapterProperties(BluetoothResultHandler* aRes) { - return mInterface->get_adapter_properties(); + int status = mInterface->get_adapter_properties(); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::GetAdapterProperties, + status); + } } -int -BluetoothInterface::GetAdapterProperty(bt_property_type_t aType) +void +BluetoothInterface::GetAdapterProperty(bt_property_type_t aType, + BluetoothResultHandler* aRes) { - return mInterface->get_adapter_property(aType); + int status = mInterface->get_adapter_property(aType); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::GetAdapterProperty, + status); + } } -int -BluetoothInterface::SetAdapterProperty(const bt_property_t* aProperty) +void +BluetoothInterface::SetAdapterProperty(const bt_property_t* aProperty, + BluetoothResultHandler* aRes) { - return mInterface->set_adapter_property(aProperty); + int status = mInterface->set_adapter_property(aProperty); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::SetAdapterProperty, + status); + } } /* Remote Device Properties */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index 41c797f1f84..abb52be505d 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -239,9 +239,11 @@ public: /* Adapter Properties */ - int GetAdapterProperties(); - int GetAdapterProperty(bt_property_type_t aType); - int SetAdapterProperty(const bt_property_t* aProperty); + void GetAdapterProperties(BluetoothResultHandler* aRes); + void GetAdapterProperty(bt_property_type_t aType, + BluetoothResultHandler* aRes); + void SetAdapterProperty(const bt_property_t* aProperty, + BluetoothResultHandler* aRes); /* Remote Device Properties */ diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index d1bc4f0aee9..1f28d0c2f0f 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -105,6 +105,16 @@ private: class SetupAfterEnabledTask MOZ_FINAL : public nsRunnable { public: + class SetAdapterPropertyResultHandler MOZ_FINAL + : public BluetoothResultHandler + { + public: + void OnError(int aStatus) MOZ_OVERRIDE + { + BT_LOGR("Fail to set: BT_SCAN_MODE_CONNECTABLE"); + } + }; + NS_IMETHOD Run() { @@ -126,11 +136,8 @@ public: prop.len = sizeof(mode); NS_ENSURE_TRUE(sBtInterface, NS_ERROR_FAILURE); - - int ret = sBtInterface->SetAdapterProperty(&prop); - if (ret != BT_STATUS_SUCCESS) { - BT_LOGR("Fail to set: BT_SCAN_MODE_CONNECTABLE"); - } + sBtInterface->SetAdapterProperty(&prop, + new SetAdapterPropertyResultHandler()); // Trigger BluetoothOppManager to listen BluetoothOppManager* opp = BluetoothOppManager::Get(); @@ -1193,6 +1200,23 @@ BluetoothServiceBluedroid::StopDiscoveryInternal( return NS_OK; } +class SetAdapterPropertyResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + SetAdapterPropertyResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { } + + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + sSetPropertyRunnableArray.RemoveElement(mRunnable); + ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("SetProperty")); + } +private: + BluetoothReplyRunnable* mRunnable; +}; + nsresult BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType, const BluetoothNamedValue& aValue, @@ -1247,11 +1271,8 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType, sSetPropertyRunnableArray.AppendElement(aRunnable); - int ret = sBtInterface->SetAdapterProperty(&prop); - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING(ERR_SET_PROPERTY)); - sSetPropertyRunnableArray.RemoveElement(aRunnable); - } + sBtInterface->SetAdapterProperty(&prop, + new SetAdapterPropertyResultHandler(aRunnable)); return NS_OK; } From 06ae3603652fbf93acc153bb01d313d18f9378e4 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:38:35 +0200 Subject: [PATCH 21/32] Bug 1033961: Asynchronous Bluedroid device-property methods (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 39 ++++++++--- dom/bluetooth2/bluedroid/BluetoothInterface.h | 13 ++-- .../bluedroid/BluetoothServiceBluedroid.cpp | 65 +++++++++++++------ 3 files changed, 83 insertions(+), 34 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 8e3fa13d9b4..78fd03d7b24 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -613,24 +613,45 @@ BluetoothInterface::SetAdapterProperty(const bt_property_t* aProperty, /* Remote Device Properties */ -int -BluetoothInterface::GetRemoteDeviceProperties(bt_bdaddr_t *aRemoteAddr) +void +BluetoothInterface::GetRemoteDeviceProperties(bt_bdaddr_t *aRemoteAddr, + BluetoothResultHandler* aRes) { - return mInterface->get_remote_device_properties(aRemoteAddr); + int status = mInterface->get_remote_device_properties(aRemoteAddr); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::GetRemoteDeviceProperties, + status); + } } -int +void BluetoothInterface::GetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, - bt_property_type_t aType) + bt_property_type_t aType, + BluetoothResultHandler* aRes) { - return mInterface->get_remote_device_property(aRemoteAddr, aType); + int status = mInterface->get_remote_device_property(aRemoteAddr, aType); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::GetRemoteDeviceProperty, + status); + } } -int +void BluetoothInterface::SetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, - const bt_property_t* aProperty) + const bt_property_t* aProperty, + BluetoothResultHandler* aRes) { - return mInterface->set_remote_device_property(aRemoteAddr, aProperty); + int status = mInterface->set_remote_device_property(aRemoteAddr, aProperty); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::SetRemoteDeviceProperty, + status); + } } /* Remote Services */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index abb52be505d..db9fb6d481d 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -247,11 +247,14 @@ public: /* Remote Device Properties */ - int GetRemoteDeviceProperties(bt_bdaddr_t *aRemoteAddr); - int GetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, - bt_property_type_t aType); - int SetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, - const bt_property_t* aProperty); + void GetRemoteDeviceProperties(bt_bdaddr_t *aRemoteAddr, + BluetoothResultHandler* aRes); + void GetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, + bt_property_type_t aType, + BluetoothResultHandler* aRes); + void SetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, + const bt_property_t* aProperty, + BluetoothResultHandler* aRes); /* Remote Services */ diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index 1f28d0c2f0f..fde58d99e1a 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -57,6 +57,7 @@ static InfallibleTArray sAdapterBondedAddressArray; // Static variables below should only be used on *main thread* static BluetoothInterface* sBtInterface; static nsTArray > sControllerArray; +static InfallibleTArray sRemoteDevicesPack; static nsTArray sRequestedDeviceCountArray; static nsTArray > sChangeAdapterStateRunnableArray; static nsTArray > sChangeDiscoveryRunnableArray; @@ -491,8 +492,6 @@ public: return NS_OK; } - static InfallibleTArray sRemoteDevicesPack; - // Use address as the index sRemoteDevicesPack.AppendElement( BluetoothNamedValue(mRemoteDeviceBdAddress, mProps)); @@ -1079,6 +1078,39 @@ BluetoothServiceBluedroid::GetAdaptersInternal( return NS_OK; } +class GetRemoteDevicePropertiesResultHandler MOZ_FINAL +: public BluetoothResultHandler +{ +public: + GetRemoteDevicePropertiesResultHandler(const nsAString& aDeviceAddress) + : mDeviceAddress(aDeviceAddress) + { } + + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + + BT_WARNING("GetRemoteDeviceProperties(%s) failed: %d", + NS_ConvertUTF16toUTF8(mDeviceAddress).get(), aStatus); + + /* dispatch result after final pending operation */ + if (--sRequestedDeviceCountArray[0] == 0) { + if (!sGetDeviceRunnableArray.IsEmpty()) { + DispatchBluetoothReply( + sGetDeviceRunnableArray[0], sRemoteDevicesPack, + NS_LITERAL_STRING("GetRemoteDeviceProperties failed")); + sGetDeviceRunnableArray.RemoveElementAt(0); + } + + sRequestedDeviceCountArray.RemoveElementAt(0); + sRemoteDevicesPack.Clear(); + } + } + +private: + nsString mDeviceAddress; +}; + nsresult BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal( uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) @@ -1110,22 +1142,18 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal( return NS_OK; } + sRequestedDeviceCountArray.AppendElement(requestedDeviceCount); + sGetDeviceRunnableArray.AppendElement(aRunnable); + for (int i = 0; i < requestedDeviceCount; i++) { // Retrieve all properties of devices bt_bdaddr_t addressType; StringToBdAddressType(deviceAddresses[i], &addressType); - int ret = sBtInterface->GetRemoteDeviceProperties(&addressType); - if (ret != BT_STATUS_SUCCESS) { - DispatchBluetoothReply(aRunnable, BluetoothValue(true), - NS_LITERAL_STRING("GetConnectedDeviceFailed")); - return NS_OK; - } + sBtInterface->GetRemoteDeviceProperties(&addressType, + new GetRemoteDevicePropertiesResultHandler(deviceAddresses[i])); } - sRequestedDeviceCountArray.AppendElement(requestedDeviceCount); - sGetDeviceRunnableArray.AppendElement(aRunnable); - return NS_OK; } @@ -1144,20 +1172,17 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal( return NS_OK; } + sRequestedDeviceCountArray.AppendElement(requestedDeviceCount); + sGetDeviceRunnableArray.AppendElement(aRunnable); + for (int i = 0; i < requestedDeviceCount; i++) { // Retrieve all properties of devices bt_bdaddr_t addressType; StringToBdAddressType(aDeviceAddress[i], &addressType); - int ret = sBtInterface->GetRemoteDeviceProperties(&addressType); - if (ret != BT_STATUS_SUCCESS) { - DispatchBluetoothReply(aRunnable, BluetoothValue(true), - NS_LITERAL_STRING("GetPairedDeviceFailed")); - return NS_OK; - } - } - sRequestedDeviceCountArray.AppendElement(requestedDeviceCount); - sGetDeviceRunnableArray.AppendElement(aRunnable); + sBtInterface->GetRemoteDeviceProperties(&addressType, + new GetRemoteDevicePropertiesResultHandler(aDeviceAddress[i])); + } return NS_OK; } From 16d0770aea6170a40737625a879a55e97d9713a0 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:38:49 +0200 Subject: [PATCH 22/32] Bug 1033961: Asynchronous remote-service methods in Bluedroid (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 26 ++++++++++++++----- dom/bluetooth2/bluedroid/BluetoothInterface.h | 8 +++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 78fd03d7b24..df53d145e1f 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -656,17 +656,31 @@ BluetoothInterface::SetRemoteDeviceProperty(bt_bdaddr_t* aRemoteAddr, /* Remote Services */ -int +void BluetoothInterface::GetRemoteServiceRecord(bt_bdaddr_t* aRemoteAddr, - bt_uuid_t* aUuid) + bt_uuid_t* aUuid, + BluetoothResultHandler* aRes) { - return mInterface->get_remote_service_record(aRemoteAddr, aUuid); + int status = mInterface->get_remote_service_record(aRemoteAddr, aUuid); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::GetRemoteServiceRecord, + status); + } } -int -BluetoothInterface::GetRemoteServices(bt_bdaddr_t* aRemoteAddr) +void +BluetoothInterface::GetRemoteServices(bt_bdaddr_t* aRemoteAddr, + BluetoothResultHandler* aRes) { - return mInterface->get_remote_services(aRemoteAddr); + int status = mInterface->get_remote_services(aRemoteAddr); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::GetRemoteServices, + status); + } } /* Discovery */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index db9fb6d481d..73dc674d576 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -258,9 +258,11 @@ public: /* Remote Services */ - int GetRemoteServiceRecord(bt_bdaddr_t* aRemoteAddr, - bt_uuid_t* aUuid); - int GetRemoteServices(bt_bdaddr_t* aRemoteAddr); + void GetRemoteServiceRecord(bt_bdaddr_t* aRemoteAddr, + bt_uuid_t* aUuid, + BluetoothResultHandler* aRes); + void GetRemoteServices(bt_bdaddr_t* aRemoteAddr, + BluetoothResultHandler* aRes); /* Discovery */ From 164d45aec75f1c2cfb49095a8f538891bb3777f9 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:39:04 +0200 Subject: [PATCH 23/32] Bug 1033961: Asynchronous discovery methods in Bluedroid (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 24 ++++++--- dom/bluetooth2/bluedroid/BluetoothInterface.h | 4 +- .../bluedroid/BluetoothServiceBluedroid.cpp | 52 ++++++++++++++----- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index df53d145e1f..86a04d6c32a 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -685,16 +685,28 @@ BluetoothInterface::GetRemoteServices(bt_bdaddr_t* aRemoteAddr, /* Discovery */ -int -BluetoothInterface::StartDiscovery() +void +BluetoothInterface::StartDiscovery(BluetoothResultHandler* aRes) { - return mInterface->start_discovery(); + int status = mInterface->start_discovery(); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::StartDiscovery, + status); + } } -int -BluetoothInterface::CancelDiscovery() +void +BluetoothInterface::CancelDiscovery(BluetoothResultHandler* aRes) { - return mInterface->cancel_discovery(); + int status = mInterface->cancel_discovery(); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::CancelDiscovery, + status); + } } /* Bonds */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index 73dc674d576..ec3028ad572 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -266,8 +266,8 @@ public: /* Discovery */ - int StartDiscovery(); - int CancelDiscovery(); + void StartDiscovery(BluetoothResultHandler* aRes); + void CancelDiscovery(BluetoothResultHandler* aRes); /* Bonds */ diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index fde58d99e1a..62941d4c81e 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -1187,6 +1187,24 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal( return NS_OK; } +class StartDiscoveryResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + StartDiscoveryResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { } + + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + sChangeDiscoveryRunnableArray.RemoveElement(mRunnable); + ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("StartDiscovery")); + } + +private: + BluetoothReplyRunnable* mRunnable; +}; + nsresult BluetoothServiceBluedroid::StartDiscoveryInternal( BluetoothReplyRunnable* aRunnable) @@ -1195,17 +1213,30 @@ BluetoothServiceBluedroid::StartDiscoveryInternal( ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); - int ret = sBtInterface->StartDiscovery(); - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StartDiscovery")); - - return NS_OK; - } - sChangeDiscoveryRunnableArray.AppendElement(aRunnable); + sBtInterface->StartDiscovery(new StartDiscoveryResultHandler(aRunnable)); + return NS_OK; } +class CancelDiscoveryResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + CancelDiscoveryResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { } + + void OnError(int aStatus) MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + sChangeDiscoveryRunnableArray.RemoveElement(mRunnable); + ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("StopDiscovery")); + } + +private: + BluetoothReplyRunnable* mRunnable; +}; + nsresult BluetoothServiceBluedroid::StopDiscoveryInternal( BluetoothReplyRunnable* aRunnable) @@ -1214,13 +1245,8 @@ BluetoothServiceBluedroid::StopDiscoveryInternal( ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); - int ret = sBtInterface->CancelDiscovery(); - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StopDiscovery")); - return NS_OK; - } - sChangeDiscoveryRunnableArray.AppendElement(aRunnable); + sBtInterface->CancelDiscovery(new CancelDiscoveryResultHandler(aRunnable)); return NS_OK; } From bea0ee1af9af87db9f27a0d04a66c7795437abc5 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:39:18 +0200 Subject: [PATCH 24/32] Bug 1033961: Asynchronous Bluedroid device bonding (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 39 ++++++++++--- dom/bluetooth2/bluedroid/BluetoothInterface.h | 6 +- .../bluedroid/BluetoothServiceBluedroid.cpp | 58 ++++++++++++++----- 3 files changed, 78 insertions(+), 25 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 86a04d6c32a..1e40cccf141 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -711,22 +711,43 @@ BluetoothInterface::CancelDiscovery(BluetoothResultHandler* aRes) /* Bonds */ -int -BluetoothInterface::CreateBond(const bt_bdaddr_t* aBdAddr) +void +BluetoothInterface::CreateBond(const bt_bdaddr_t* aBdAddr, + BluetoothResultHandler* aRes) { - return mInterface->create_bond(aBdAddr); + int status = mInterface->create_bond(aBdAddr); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::CreateBond, + status); + } } -int -BluetoothInterface::RemoveBond(const bt_bdaddr_t* aBdAddr) +void +BluetoothInterface::RemoveBond(const bt_bdaddr_t* aBdAddr, + BluetoothResultHandler* aRes) { - return mInterface->remove_bond(aBdAddr); + int status = mInterface->remove_bond(aBdAddr); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::RemoveBond, + status); + } } -int -BluetoothInterface::CancelBond(const bt_bdaddr_t* aBdAddr) +void +BluetoothInterface::CancelBond(const bt_bdaddr_t* aBdAddr, + BluetoothResultHandler* aRes) { - return mInterface->cancel_bond(aBdAddr); + int status = mInterface->cancel_bond(aBdAddr); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::CancelBond, + status); + } } /* Authentication */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index ec3028ad572..ab61b18a4f7 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -271,9 +271,9 @@ public: /* Bonds */ - int CreateBond(const bt_bdaddr_t* aBdAddr); - int RemoveBond(const bt_bdaddr_t* aBdAddr); - int CancelBond(const bt_bdaddr_t* aBdAddr); + void CreateBond(const bt_bdaddr_t* aBdAddr, BluetoothResultHandler* aRes); + void RemoveBond(const bt_bdaddr_t* aBdAddr, BluetoothResultHandler* aRes); + void CancelBond(const bt_bdaddr_t* aBdAddr, BluetoothResultHandler* aRes); /* Authentication */ diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index 62941d4c81e..6a3d1ec5fc2 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -1345,6 +1345,25 @@ BluetoothServiceBluedroid::UpdateSdpRecords( return true; } +class CreateBondResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + CreateBondResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { + MOZ_ASSERT(mRunnable); + } + + void OnError(int aStatus) MOZ_OVERRIDE + { + sBondingRunnableArray.RemoveElement(mRunnable); + ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("CreatedPairedDevice")); + } + +private: + BluetoothReplyRunnable* mRunnable; +}; + nsresult BluetoothServiceBluedroid::CreatePairedDeviceInternal( const nsAString& aDeviceAddress, int aTimeout, @@ -1357,16 +1376,32 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal( bt_bdaddr_t remoteAddress; StringToBdAddressType(aDeviceAddress, &remoteAddress); - int ret = sBtInterface->CreateBond(&remoteAddress); - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("CreatedPairedDevice")); - } else { - sBondingRunnableArray.AppendElement(aRunnable); - } + sBondingRunnableArray.AppendElement(aRunnable); + sBtInterface->CreateBond(&remoteAddress, + new CreateBondResultHandler(aRunnable)); return NS_OK; } +class RemoveBondResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + RemoveBondResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { + MOZ_ASSERT(mRunnable); + } + + void OnError(int aStatus) MOZ_OVERRIDE + { + sUnbondingRunnableArray.RemoveElement(mRunnable); + ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("RemoveDevice")); + } + +private: + BluetoothReplyRunnable* mRunnable; +}; + nsresult BluetoothServiceBluedroid::RemoveDeviceInternal( const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable) @@ -1378,13 +1413,10 @@ BluetoothServiceBluedroid::RemoveDeviceInternal( bt_bdaddr_t remoteAddress; StringToBdAddressType(aDeviceAddress, &remoteAddress); - int ret = sBtInterface->RemoveBond(&remoteAddress); - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, - NS_LITERAL_STRING("RemoveDevice")); - } else { - sUnbondingRunnableArray.AppendElement(aRunnable); - } + sUnbondingRunnableArray.AppendElement(aRunnable); + + sBtInterface->RemoveBond(&remoteAddress, + new RemoveBondResultHandler(aRunnable)); return NS_OK; } From 0ef51543652f119e07fd183670ee63469ecf05b7 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:39:31 +0200 Subject: [PATCH 25/32] Bug 1033961: Asynchronous authentification in Bluedroid (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 26 +++++-- dom/bluetooth2/bluedroid/BluetoothInterface.h | 10 +-- .../bluedroid/BluetoothServiceBluedroid.cpp | 67 ++++++++++++++----- 3 files changed, 75 insertions(+), 28 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 1e40cccf141..7f509ab813c 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -752,19 +752,33 @@ BluetoothInterface::CancelBond(const bt_bdaddr_t* aBdAddr, /* Authentication */ -int +void BluetoothInterface::PinReply(const bt_bdaddr_t* aBdAddr, uint8_t aAccept, - uint8_t aPinLen, bt_pin_code_t* aPinCode) + uint8_t aPinLen, bt_pin_code_t* aPinCode, + BluetoothResultHandler* aRes) { - return mInterface->pin_reply(aBdAddr, aAccept, aPinLen, aPinCode); + int status = mInterface->pin_reply(aBdAddr, aAccept, aPinLen, aPinCode); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::PinReply, + status); + } } -int +void BluetoothInterface::SspReply(const bt_bdaddr_t* aBdAddr, bt_ssp_variant_t aVariant, - uint8_t aAccept, uint32_t aPasskey) + uint8_t aAccept, uint32_t aPasskey, + BluetoothResultHandler* aRes) { - return mInterface->ssp_reply(aBdAddr, aVariant, aAccept, aPasskey); + int status = mInterface->ssp_reply(aBdAddr, aVariant, aAccept, aPasskey); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::SspReply, + status); + } } /* DUT Mode */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index ab61b18a4f7..4eeafe3a735 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -277,11 +277,13 @@ public: /* Authentication */ - int PinReply(const bt_bdaddr_t* aBdAddr, uint8_t aAccept, - uint8_t aPinLen, bt_pin_code_t* aPinCode); + void PinReply(const bt_bdaddr_t* aBdAddr, uint8_t aAccept, + uint8_t aPinLen, bt_pin_code_t* aPinCode, + BluetoothResultHandler* aRes); - int SspReply(const bt_bdaddr_t* aBdAddr, bt_ssp_variant_t aVariant, - uint8_t aAccept, uint32_t aPasskey); + void SspReply(const bt_bdaddr_t* aBdAddr, bt_ssp_variant_t aVariant, + uint8_t aAccept, uint32_t aPasskey, + BluetoothResultHandler* aRes); /* DUT Mode */ diff --git a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp index 6a3d1ec5fc2..74dce091926 100644 --- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp @@ -1421,6 +1421,27 @@ BluetoothServiceBluedroid::RemoveDeviceInternal( return NS_OK; } +class PinReplyResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + PinReplyResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { } + + void PinReply() MOZ_OVERRIDE + { + DispatchBluetoothReply(mRunnable, BluetoothValue(true), EmptyString()); + } + + void OnError(int aStatus) MOZ_OVERRIDE + { + ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("SetPinCode")); + } + +private: + BluetoothReplyRunnable* mRunnable; +}; + bool BluetoothServiceBluedroid::SetPinCodeInternal( const nsAString& aDeviceAddress, const nsAString& aPinCode, @@ -1433,15 +1454,10 @@ BluetoothServiceBluedroid::SetPinCodeInternal( bt_bdaddr_t remoteAddress; StringToBdAddressType(aDeviceAddress, &remoteAddress); - int ret = sBtInterface->PinReply( - &remoteAddress, true, aPinCode.Length(), - (bt_pin_code_t*)NS_ConvertUTF16toUTF8(aPinCode).get()); - - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("SetPinCode")); - } else { - DispatchBluetoothReply(aRunnable, BluetoothValue(true), EmptyString()); - } + sBtInterface->PinReply( + &remoteAddress, true, aPinCode.Length(), + (bt_pin_code_t*)NS_ConvertUTF16toUTF8(aPinCode).get(), + new PinReplyResultHandler(aRunnable)); return true; } @@ -1454,6 +1470,28 @@ BluetoothServiceBluedroid::SetPasskeyInternal( return true; } +class SspReplyResultHandler MOZ_FINAL : public BluetoothResultHandler +{ +public: + SspReplyResultHandler(BluetoothReplyRunnable* aRunnable) + : mRunnable(aRunnable) + { } + + void SspReply() MOZ_OVERRIDE + { + DispatchBluetoothReply(mRunnable, BluetoothValue(true), EmptyString()); + } + + void OnError(int aStatus) MOZ_OVERRIDE + { + ReplyStatusError(mRunnable, aStatus, + NS_LITERAL_STRING("SetPairingConfirmation")); + } + +private: + BluetoothReplyRunnable* mRunnable; +}; + bool BluetoothServiceBluedroid::SetPairingConfirmationInternal( const nsAString& aDeviceAddress, bool aConfirm, @@ -1466,15 +1504,8 @@ BluetoothServiceBluedroid::SetPairingConfirmationInternal( bt_bdaddr_t remoteAddress; StringToBdAddressType(aDeviceAddress, &remoteAddress); - int ret = sBtInterface->SspReply(&remoteAddress, (bt_ssp_variant_t)0, - aConfirm, 0); - if (ret != BT_STATUS_SUCCESS) { - ReplyStatusError(aRunnable, ret, - NS_LITERAL_STRING("SetPairingConfirmation")); - } else { - DispatchBluetoothReply(aRunnable, BluetoothValue(true), EmptyString()); - } - + sBtInterface->SspReply(&remoteAddress, (bt_ssp_variant_t)0, aConfirm, 0, + new SspReplyResultHandler(aRunnable)); return true; } From 007b4fd7ccab4d16e61dafd90c3bb968954a86f3 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 9 Jul 2014 09:39:43 +0200 Subject: [PATCH 26/32] Bug 1033961: Asynchronous Bluedroid DUT and LE interfaces (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 43 +++++++++++++++---- dom/bluetooth2/bluedroid/BluetoothInterface.h | 8 ++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 7f509ab813c..54d3dd54026 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -783,24 +783,49 @@ BluetoothInterface::SspReply(const bt_bdaddr_t* aBdAddr, /* DUT Mode */ -int -BluetoothInterface::DutModeConfigure(uint8_t aEnable) +void +BluetoothInterface::DutModeConfigure(uint8_t aEnable, + BluetoothResultHandler* aRes) { - return mInterface->dut_mode_configure(aEnable); + int status = mInterface->dut_mode_configure(aEnable); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::DutModeConfigure, + status); + } } -int -BluetoothInterface::DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen) +void +BluetoothInterface::DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen, + BluetoothResultHandler* aRes) { - return mInterface->dut_mode_send(aOpcode, aBuf, aLen); + int status = mInterface->dut_mode_send(aOpcode, aBuf, aLen); + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::DutModeSend, + status); + } } /* LE Mode */ -int -BluetoothInterface::LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen) +void +BluetoothInterface::LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen, + BluetoothResultHandler* aRes) { - return mInterface->le_test_mode(aOpcode, aBuf, aLen); +#if ANDROID_VERSION >= 18 + int status = mInterface->le_test_mode(aOpcode, aBuf, aLen); +#else + int status = BT_STATUS_UNSUPPORTED; +#endif + + if (aRes) { + DispatchBluetoothResult(aRes, + &BluetoothResultHandler::LeTestMode, + status); + } } /* Profile Interfaces */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index 4eeafe3a735..ebb62fe5804 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -287,12 +287,14 @@ public: /* DUT Mode */ - int DutModeConfigure(uint8_t aEnable); - int DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen); + void DutModeConfigure(uint8_t aEnable, BluetoothResultHandler* aRes); + void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen, + BluetoothResultHandler* aRes); /* LE Mode */ - int LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen); + void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen, + BluetoothResultHandler* aRes); /* Profile Interfaces */ From f6917558033b71915e7ddde46852dc84554d35fd Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 00:55:29 -0700 Subject: [PATCH 27/32] Bumping gaia.json for 3 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/795c9583c57b Author: na-matsumoto Desc: Bug 974878 - [MMS]Create new contact/ add to exist contact with email address r=julien ======== https://hg.mozilla.org/integration/gaia-central/rev/2f01749fa20b Author: Cristian Rodriguez Desc: Merge pull request #21493 from crdlc/bug-1033531 Bug 1033531 - [Vertical Homescreen] Apps dont appear in custom smart col... ======== https://hg.mozilla.org/integration/gaia-central/rev/e9adb33bbcb8 Author: crdlc Desc: Bug 1033531 - [Vertical Homescreen] Apps dont appear in custom smart collections if Smart Collection is entered too quickly --- 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 2cc99f9f5f9..03724ac5a05 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "ad1160c3a8dd6be058428c68dcf7b4c425c4fae4", + "revision": "795c9583c57b42a1ea002d88136c974e145bb155", "repo_path": "/integration/gaia-central" } From be772ccb68e0dbdd3f18f45611165e1712a7d0f8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 01:01:14 -0700 Subject: [PATCH 28/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 86a049b6f9e..47f5c5c8535 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 8dd02a0bbc8..0af716f7a5c 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 c3700e38d0c..fe1927b703b 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 86a049b6f9e..47f5c5c8535 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index ab60b1129d8..a128582fede 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a26c9efae92..4d0a1ec6f56 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 109fa85db3b..a6e4ccc41ce 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 2fb721779c7..848ff5b6444 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 1d923a9427a..490e5bfcc1f 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 0e9ff088d452a914537a006ff97c8fa09d09f51c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 01:10:28 -0700 Subject: [PATCH 29/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/198e6ff0d117 Author: Alive.Kuo Desc: Merge pull request #21444 from alivedise/bugzilla/1027401_v2.1/reset-orientation-on-popupclose Bug 1027401 - Change child event mechanism, r=etienne ======== https://hg.mozilla.org/integration/gaia-central/rev/7b16e55f0aba Author: Alive Kuo Desc: Bug 1027401 - Change child event mechanism --- 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 03724ac5a05..5c4c41057d7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "795c9583c57b42a1ea002d88136c974e145bb155", + "revision": "198e6ff0d117dc8b51aea1d761a1e0779ff39523", "repo_path": "/integration/gaia-central" } From 473c7c41f35d3c123b534492895260786a9c8615 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 01:16:47 -0700 Subject: [PATCH 30/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 47f5c5c8535..157e60bc82a 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 0af716f7a5c..7ffad9b39e4 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 fe1927b703b..49e490934af 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 47f5c5c8535..157e60bc82a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index a128582fede..5f6a08bcf8e 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 4d0a1ec6f56..a5cbca9546d 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 a6e4ccc41ce..fefd6ba93f4 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 848ff5b6444..d5d38caafd3 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 490e5bfcc1f..ffb6b616d59 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From e59ebba392fa0c3e6681acaf9986ff860b2dc75e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 01:25:26 -0700 Subject: [PATCH 31/32] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/8749f2b7d799 Author: Greg Weng Desc: Merge pull request #20736 from snowmantw/issue1027471 Bug 1027471 - [LockScreen][System] Split notification.js into LockScreen... ======== https://hg.mozilla.org/integration/gaia-central/rev/02402032a172 Author: Greg Weng Desc: Bug 1027471 - [LockScreen][System] Split notification.js into LockScreen and System parts ======== https://hg.mozilla.org/integration/gaia-central/rev/eaafe11b8f73 Author: Dominic Kuo Desc: Merge pull request #21294 from dominickuo/bug-1009133 Bug 1009133 - [Music] Add hidden style to the player and done icons, r=jimporter ======== https://hg.mozilla.org/integration/gaia-central/rev/0f0c6d1db2a7 Author: Dominic Kuo Desc: Bug 1009133 - [Music] Add hidden style to the player and done icons --- 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 5c4c41057d7..f2ec6100f97 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "198e6ff0d117dc8b51aea1d761a1e0779ff39523", + "revision": "8749f2b7d7998019d04618b46d28b5cb9d77aadb", "repo_path": "/integration/gaia-central" } From 2350c400da95c226f48a8e55d0daa294661a6e37 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 9 Jul 2014 01:26:51 -0700 Subject: [PATCH 32/32] 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/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 157e60bc82a..93de83c93c8 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 7ffad9b39e4..eb2c2840d3b 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 49e490934af..d8f3ac50fa5 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 157e60bc82a..93de83c93c8 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5f6a08bcf8e..0322d020bae 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a5cbca9546d..5fa58ad34de 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 fefd6ba93f4..8e56614fb23 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index d5d38caafd3..f9a6dc6773c 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index ffb6b616d59..6a4a9b02585 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - +