Merge b2g-inbound to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-08-25 10:34:03 -04:00
commit 0ec317e4ee
34 changed files with 858 additions and 576 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="bfdb6348725a33bdcdc4e17999cb500be6beedb5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "b441bde54293bea5254dc340845effe951fa3906",
"git_revision": "a8a462ab783a5bbab508d3c29483cff260672e3c",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "f1a55165dcd312394c553f763defd95b4b166b12",
"revision": "4470d59428b583f2a393ecec55c192a3b2e3a40e",
"repo_path": "integration/gaia-central"
}

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="bfdb6348725a33bdcdc4e17999cb500be6beedb5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

View File

@ -860,6 +860,10 @@ this.DOMApplicationRegistry = {
if (!root.messages || !Array.isArray(root.messages) ||
root.messages.length == 0) {
dump("Could not register invalid system message entry\n");
try {
dump(JSON.stringify(root.messages) + "\n");
} catch(e) {}
return;
}
@ -869,28 +873,32 @@ this.DOMApplicationRegistry = {
root.messages.forEach(function registerPages(aMessage) {
let handlerPageURI = launchPathURI;
let messageName;
if (typeof(aMessage) === "object" && Object.keys(aMessage).length === 1) {
messageName = Object.keys(aMessage)[0];
let handlerPath = aMessage[messageName];
// Resolve the handler path from origin. If |handler_path| is absent,
// simply skip.
let fullHandlerPath;
if (typeof(aMessage) !== "object" || Object.keys(aMessage).length !== 1) {
dump("Could not register invalid system message entry\n");
try {
if (handlerPath && handlerPath.trim()) {
fullHandlerPath = manifest.resolveURL(handlerPath);
} else {
throw new Error("Empty or blank handler path.");
}
} catch(e) {
debug("system message handler path (" + handlerPath + ") is " +
"invalid, skipping. Error is: " + e);
return;
}
handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
} else {
messageName = aMessage;
dump(JSON.stringify(aMessage) + "\n");
} catch(e) {}
return;
}
messageName = Object.keys(aMessage)[0];
let handlerPath = aMessage[messageName];
// Resolve the handler path from origin. If |handler_path| is absent,
// simply skip.
let fullHandlerPath;
try {
if (handlerPath && handlerPath.trim()) {
fullHandlerPath = manifest.resolveURL(handlerPath);
} else {
throw new Error("Empty or blank handler path.");
}
} catch(e) {
debug("system message handler path (" + handlerPath + ") is " +
"invalid, skipping. Error is: " + e);
return;
}
handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
if (SystemMessagePermissionsChecker
.isSystemMessagePermittedToRegister(messageName,
aApp.manifestURL,

View File

@ -17,25 +17,6 @@ extern bool gBluetoothDebugFlag;
#define SWITCH_BT_DEBUG(V) (gBluetoothDebugFlag = V)
#if MOZ_IS_GCC
# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
/* use designated array initializers if supported */
# define INIT_ARRAY_AT(in_, out_) \
[in_] = out_
# else
/* otherwise init array element by position */
# define INIT_ARRAY_AT(in_, out_) \
out_
# endif
#else
/* otherwise init array element by position */
#define INIT_ARRAY_AT(in_, out_) \
out_
#endif
#define CONVERT(in_, out_) \
INIT_ARRAY_AT(in_, out_)
#undef BT_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>

View File

@ -215,8 +215,10 @@ BroadcastSystemMessage(const nsAString& aType,
return false;
}
nsCOMPtr<nsISupports> promise;
systemMessenger->BroadcastMessage(aType, value,
JS::UndefinedHandleValue);
JS::UndefinedHandleValue,
getter_AddRefs(promise));
return true;
}
@ -245,8 +247,10 @@ BroadcastSystemMessage(const nsAString& aType,
NS_ENSURE_TRUE(systemMessenger, false);
JS::Rooted<JS::Value> value(cx, JS::ObjectValue(*obj));
nsCOMPtr<nsISupports> promise;
systemMessenger->BroadcastMessage(aType, value,
JS::UndefinedHandleValue);
JS::UndefinedHandleValue,
getter_AddRefs(promise));
return true;
}

View File

@ -47,8 +47,8 @@ BluetoothDaemonA2dpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
{
static void (BluetoothDaemonA2dpModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf),
[0] = &BluetoothDaemonA2dpModule::HandleRsp,
[1] = &BluetoothDaemonA2dpModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@ -145,12 +145,9 @@ BluetoothDaemonA2dpModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothA2dpResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonA2dpModule::ErrorRsp),
INIT_ARRAY_AT(OPCODE_CONNECT,
&BluetoothDaemonA2dpModule::ConnectRsp),
INIT_ARRAY_AT(OPCODE_DISCONNECT,
&BluetoothDaemonA2dpModule::DisconnectRsp),
[OPCODE_ERROR] = &BluetoothDaemonA2dpModule::ErrorRsp,
[OPCODE_CONNECT] = &BluetoothDaemonA2dpModule::ConnectRsp,
[OPCODE_DISCONNECT] = &BluetoothDaemonA2dpModule::DisconnectRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@ -322,10 +319,10 @@ BluetoothDaemonA2dpModule::HandleNtf(
{
static void (BluetoothDaemonA2dpModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf),
[0] = &BluetoothDaemonA2dpModule::ConnectionStateNtf,
[1] = &BluetoothDaemonA2dpModule::AudioStateNtf,
#if ANDROID_VERSION >= 21
INIT_ARRAY_AT(2, &BluetoothDaemonA2dpModule::AudioConfigNtf),
[2] = &BluetoothDaemonA2dpModule::AudioConfigNtf
#endif
};

View File

@ -47,8 +47,8 @@ BluetoothDaemonAvrcpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
{
static void (BluetoothDaemonAvrcpModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::HandleNtf),
[0] = &BluetoothDaemonAvrcpModule::HandleRsp,
[1] = &BluetoothDaemonAvrcpModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@ -427,28 +427,28 @@ BluetoothDaemonAvrcpModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothAvrcpResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonAvrcpModule::ErrorRsp),
INIT_ARRAY_AT(OPCODE_GET_PLAY_STATUS_RSP,
&BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp),
INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_ATTR_RSP,
&BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp),
INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_VALUE_RSP,
&BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp),
INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_RSP,
&BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp),
INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP,
&BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp),
INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP,
&BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp),
INIT_ARRAY_AT(OPCODE_GET_ELEMENT_ATTR_RSP,
&BluetoothDaemonAvrcpModule::GetElementAttrRspRsp),
INIT_ARRAY_AT(OPCODE_SET_PLAYER_APP_VALUE_RSP,
&BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp),
INIT_ARRAY_AT(OPCODE_REGISTER_NOTIFICATION_RSP,
&BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp),
INIT_ARRAY_AT(OPCODE_SET_VOLUME,
&BluetoothDaemonAvrcpModule::SetVolumeRsp)
[OPCODE_ERROR] =
&BluetoothDaemonAvrcpModule::ErrorRsp,
[OPCODE_GET_PLAY_STATUS_RSP] =
&BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp,
[OPCODE_LIST_PLAYER_APP_ATTR_RSP] =
&BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp,
[OPCODE_LIST_PLAYER_APP_VALUE_RSP] =
&BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp,
[OPCODE_GET_PLAYER_APP_VALUE_RSP] =
&BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp,
[OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP] =
&BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp,
[OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP] =
&BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp,
[OPCODE_GET_ELEMENT_ATTR_RSP]=
&BluetoothDaemonAvrcpModule::GetElementAttrRspRsp,
[OPCODE_SET_PLAYER_APP_VALUE_RSP] =
&BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp,
[OPCODE_REGISTER_NOTIFICATION_RSP] =
&BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp,
[OPCODE_SET_VOLUME] =
&BluetoothDaemonAvrcpModule::SetVolumeRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@ -797,28 +797,28 @@ BluetoothDaemonAvrcpModule::HandleNtf(
static void (BluetoothDaemonAvrcpModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
#if ANDROID_VERSION >= 19
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::RemoteFeatureNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf),
INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf),
INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf),
INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf),
INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf),
INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf),
INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::GetElementAttrNtf),
INIT_ARRAY_AT(9, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf),
INIT_ARRAY_AT(10, &BluetoothDaemonAvrcpModule::VolumeChangeNtf),
INIT_ARRAY_AT(11, &BluetoothDaemonAvrcpModule::PassthroughCmdNtf)
[0] = &BluetoothDaemonAvrcpModule::RemoteFeatureNtf,
[1] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf,
[2] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf,
[3] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf,
[4] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf,
[5] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf,
[6] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf,
[7] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf,
[8] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf,
[9] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf,
[10] = &BluetoothDaemonAvrcpModule::VolumeChangeNtf,
[11] = &BluetoothDaemonAvrcpModule::PassthroughCmdNtf
#else
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf),
INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf),
INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf),
INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf),
INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf),
INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::GetElementAttrNtf),
INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf)
[0] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf,
[1] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf,
[2] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf,
[3] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf,
[4] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf,
[5] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf,
[6] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf,
[7] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf,
[8] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf
#endif
};

View File

@ -47,8 +47,8 @@ BluetoothDaemonGattModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
{
static void (BluetoothDaemonGattModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::HandleNtf),
[0] = &BluetoothDaemonGattModule::HandleRsp,
[1] = &BluetoothDaemonGattModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@ -1411,78 +1411,78 @@ BluetoothDaemonGattModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothGattResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonGattModule::ErrorRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER,
&BluetoothDaemonGattModule::ClientRegisterRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_UNREGISTER,
&BluetoothDaemonGattModule::ClientUnregisterRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_SCAN,
&BluetoothDaemonGattModule::ClientScanRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_CONNECT,
&BluetoothDaemonGattModule::ClientConnectRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_DISCONNECT,
&BluetoothDaemonGattModule::ClientDisconnectRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_LISTEN,
&BluetoothDaemonGattModule::ClientListenRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_REFRESH,
&BluetoothDaemonGattModule::ClientRefreshRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_SEARCH_SERVICE,
&BluetoothDaemonGattModule::ClientSearchServiceRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_GET_INCLUDED_SERVICE,
&BluetoothDaemonGattModule::ClientGetIncludedServiceRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_GET_CHARACTERISTIC,
&BluetoothDaemonGattModule::ClientGetCharacteristicRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_GET_DESCRIPTOR,
&BluetoothDaemonGattModule::ClientGetDescriptorRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_READ_CHARACTERISTIC,
&BluetoothDaemonGattModule::ClientReadCharacteristicRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_CHARACTERISTIC,
&BluetoothDaemonGattModule::ClientWriteCharacteristicRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_READ_DESCRIPTOR,
&BluetoothDaemonGattModule::ClientReadDescriptorRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_DESCRIPTOR,
&BluetoothDaemonGattModule::ClientWriteDescriptorRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_EXECUTE_WRITE,
&BluetoothDaemonGattModule::ClientExecuteWriteRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER_NOTIFICATION,
&BluetoothDaemonGattModule::ClientRegisterNotificationRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_DEREGISTER_NOTIFICATION,
&BluetoothDaemonGattModule::ClientDeregisterNotificationRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_READ_REMOTE_RSSI,
&BluetoothDaemonGattModule::ClientReadRemoteRssiRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_GET_DEVICE_TYPE,
&BluetoothDaemonGattModule::ClientGetDeviceTypeRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_SET_ADV_DATA,
&BluetoothDaemonGattModule::ClientSetAdvDataRsp),
INIT_ARRAY_AT(OPCODE_CLIENT_TEST_COMMAND,
&BluetoothDaemonGattModule::ClientTestCommandRsp),
INIT_ARRAY_AT(OPCODE_SERVER_REGISTER,
&BluetoothDaemonGattModule::ServerRegisterRsp),
INIT_ARRAY_AT(OPCODE_SERVER_UNREGISTER,
&BluetoothDaemonGattModule::ServerUnregisterRsp),
INIT_ARRAY_AT(OPCODE_SERVER_CONNECT_PERIPHERAL,
&BluetoothDaemonGattModule::ServerConnectPeripheralRsp),
INIT_ARRAY_AT(OPCODE_SERVER_DISCONNECT_PERIPHERAL,
&BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp),
INIT_ARRAY_AT(OPCODE_SERVER_ADD_SERVICE,
&BluetoothDaemonGattModule::ServerAddServiceRsp),
INIT_ARRAY_AT(OPCODE_SERVER_ADD_INCLUDED_SERVICE,
&BluetoothDaemonGattModule::ServerAddIncludedServiceRsp),
INIT_ARRAY_AT(OPCODE_SERVER_ADD_CHARACTERISTIC,
&BluetoothDaemonGattModule::ServerAddCharacteristicRsp),
INIT_ARRAY_AT(OPCODE_SERVER_ADD_DESCRIPTOR,
&BluetoothDaemonGattModule::ServerAddDescriptorRsp),
INIT_ARRAY_AT(OPCODE_SERVER_START_SERVICE,
&BluetoothDaemonGattModule::ServerStartServiceRsp),
INIT_ARRAY_AT(OPCODE_SERVER_STOP_SERVICE,
&BluetoothDaemonGattModule::ServerStopServiceRsp),
INIT_ARRAY_AT(OPCODE_SERVER_DELETE_SERVICE,
&BluetoothDaemonGattModule::ServerDeleteServiceRsp),
INIT_ARRAY_AT(OPCODE_SERVER_SEND_INDICATION,
&BluetoothDaemonGattModule::ServerSendIndicationRsp),
INIT_ARRAY_AT(OPCODE_SERVER_SEND_RESPONSE,
&BluetoothDaemonGattModule::ServerSendResponseRsp)
[OPCODE_ERROR] =
&BluetoothDaemonGattModule::ErrorRsp,
[OPCODE_CLIENT_REGISTER] =
&BluetoothDaemonGattModule::ClientRegisterRsp,
[OPCODE_CLIENT_UNREGISTER] =
&BluetoothDaemonGattModule::ClientUnregisterRsp,
[OPCODE_CLIENT_SCAN] =
&BluetoothDaemonGattModule::ClientScanRsp,
[OPCODE_CLIENT_CONNECT] =
&BluetoothDaemonGattModule::ClientConnectRsp,
[OPCODE_CLIENT_DISCONNECT] =
&BluetoothDaemonGattModule::ClientDisconnectRsp,
[OPCODE_CLIENT_LISTEN] =
&BluetoothDaemonGattModule::ClientListenRsp,
[OPCODE_CLIENT_REFRESH] =
&BluetoothDaemonGattModule::ClientRefreshRsp,
[OPCODE_CLIENT_SEARCH_SERVICE] =
&BluetoothDaemonGattModule::ClientSearchServiceRsp,
[OPCODE_CLIENT_GET_INCLUDED_SERVICE] =
&BluetoothDaemonGattModule::ClientGetIncludedServiceRsp,
[OPCODE_CLIENT_GET_CHARACTERISTIC] =
&BluetoothDaemonGattModule::ClientGetCharacteristicRsp,
[OPCODE_CLIENT_GET_DESCRIPTOR] =
&BluetoothDaemonGattModule::ClientGetDescriptorRsp,
[OPCODE_CLIENT_READ_CHARACTERISTIC] =
&BluetoothDaemonGattModule::ClientReadCharacteristicRsp,
[OPCODE_CLIENT_WRITE_CHARACTERISTIC] =
&BluetoothDaemonGattModule::ClientWriteCharacteristicRsp,
[OPCODE_CLIENT_READ_DESCRIPTOR] =
&BluetoothDaemonGattModule::ClientReadDescriptorRsp,
[OPCODE_CLIENT_WRITE_DESCRIPTOR] =
&BluetoothDaemonGattModule::ClientWriteDescriptorRsp,
[OPCODE_CLIENT_EXECUTE_WRITE] =
&BluetoothDaemonGattModule::ClientExecuteWriteRsp,
[OPCODE_CLIENT_REGISTER_NOTIFICATION] =
&BluetoothDaemonGattModule::ClientRegisterNotificationRsp,
[OPCODE_CLIENT_DEREGISTER_NOTIFICATION] =
&BluetoothDaemonGattModule::ClientDeregisterNotificationRsp,
[OPCODE_CLIENT_READ_REMOTE_RSSI] =
&BluetoothDaemonGattModule::ClientReadRemoteRssiRsp,
[OPCODE_CLIENT_GET_DEVICE_TYPE] =
&BluetoothDaemonGattModule::ClientGetDeviceTypeRsp,
[OPCODE_CLIENT_SET_ADV_DATA] =
&BluetoothDaemonGattModule::ClientSetAdvDataRsp,
[OPCODE_CLIENT_TEST_COMMAND] =
&BluetoothDaemonGattModule::ClientTestCommandRsp,
[OPCODE_SERVER_REGISTER] =
&BluetoothDaemonGattModule::ServerRegisterRsp,
[OPCODE_SERVER_UNREGISTER] =
&BluetoothDaemonGattModule::ServerUnregisterRsp,
[OPCODE_SERVER_CONNECT_PERIPHERAL] =
&BluetoothDaemonGattModule::ServerConnectPeripheralRsp,
[OPCODE_SERVER_DISCONNECT_PERIPHERAL] =
&BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp,
[OPCODE_SERVER_ADD_SERVICE] =
&BluetoothDaemonGattModule::ServerAddServiceRsp,
[OPCODE_SERVER_ADD_INCLUDED_SERVICE] =
&BluetoothDaemonGattModule::ServerAddIncludedServiceRsp,
[OPCODE_SERVER_ADD_CHARACTERISTIC] =
&BluetoothDaemonGattModule::ServerAddCharacteristicRsp,
[OPCODE_SERVER_ADD_DESCRIPTOR] =
&BluetoothDaemonGattModule::ServerAddDescriptorRsp,
[OPCODE_SERVER_START_SERVICE] =
&BluetoothDaemonGattModule::ServerStartServiceRsp,
[OPCODE_SERVER_STOP_SERVICE] =
&BluetoothDaemonGattModule::ServerStopServiceRsp,
[OPCODE_SERVER_DELETE_SERVICE] =
&BluetoothDaemonGattModule::ServerDeleteServiceRsp,
[OPCODE_SERVER_SEND_INDICATION] =
&BluetoothDaemonGattModule::ServerSendIndicationRsp,
[OPCODE_SERVER_SEND_RESPONSE] =
&BluetoothDaemonGattModule::ServerSendResponseRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@ -2156,37 +2156,37 @@ BluetoothDaemonGattModule::HandleNtf(
{
static void (BluetoothDaemonGattModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::ClientRegisterNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::ClientScanResultNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonGattModule::ClientConnectNtf),
INIT_ARRAY_AT(3, &BluetoothDaemonGattModule::ClientDisconnectNtf),
INIT_ARRAY_AT(4, &BluetoothDaemonGattModule::ClientSearchCompleteNtf),
INIT_ARRAY_AT(5, &BluetoothDaemonGattModule::ClientSearchResultNtf),
INIT_ARRAY_AT(6, &BluetoothDaemonGattModule::ClientGetCharacteristicNtf),
INIT_ARRAY_AT(7, &BluetoothDaemonGattModule::ClientGetDescriptorNtf),
INIT_ARRAY_AT(8, &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf),
INIT_ARRAY_AT(9, &BluetoothDaemonGattModule::ClientRegisterNotificationNtf),
INIT_ARRAY_AT(10, &BluetoothDaemonGattModule::ClientNotifyNtf),
INIT_ARRAY_AT(11, &BluetoothDaemonGattModule::ClientReadCharacteristicNtf),
INIT_ARRAY_AT(12, &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf),
INIT_ARRAY_AT(13, &BluetoothDaemonGattModule::ClientReadDescriptorNtf),
INIT_ARRAY_AT(14, &BluetoothDaemonGattModule::ClientWriteDescriptorNtf),
INIT_ARRAY_AT(15, &BluetoothDaemonGattModule::ClientExecuteWriteNtf),
INIT_ARRAY_AT(16, &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf),
INIT_ARRAY_AT(17, &BluetoothDaemonGattModule::ClientListenNtf),
INIT_ARRAY_AT(18, &BluetoothDaemonGattModule::ServerRegisterNtf),
INIT_ARRAY_AT(19, &BluetoothDaemonGattModule::ServerConnectionNtf),
INIT_ARRAY_AT(20, &BluetoothDaemonGattModule::ServerServiceAddedNtf),
INIT_ARRAY_AT(21, &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf),
INIT_ARRAY_AT(22, &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf),
INIT_ARRAY_AT(23, &BluetoothDaemonGattModule::ServerDescriptorAddedNtf),
INIT_ARRAY_AT(24, &BluetoothDaemonGattModule::ServerServiceStartedNtf),
INIT_ARRAY_AT(25, &BluetoothDaemonGattModule::ServerServiceStoppedNtf),
INIT_ARRAY_AT(26, &BluetoothDaemonGattModule::ServerServiceDeletedNtf),
INIT_ARRAY_AT(27, &BluetoothDaemonGattModule::ServerRequestReadNtf),
INIT_ARRAY_AT(28, &BluetoothDaemonGattModule::ServerRequestWriteNtf),
INIT_ARRAY_AT(29, &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf),
INIT_ARRAY_AT(30, &BluetoothDaemonGattModule::ServerResponseConfirmationNtf)
[0] = &BluetoothDaemonGattModule::ClientRegisterNtf,
[1] = &BluetoothDaemonGattModule::ClientScanResultNtf,
[2] = &BluetoothDaemonGattModule::ClientConnectNtf,
[3] = &BluetoothDaemonGattModule::ClientDisconnectNtf,
[4] = &BluetoothDaemonGattModule::ClientSearchCompleteNtf,
[5] = &BluetoothDaemonGattModule::ClientSearchResultNtf,
[6] = &BluetoothDaemonGattModule::ClientGetCharacteristicNtf,
[7] = &BluetoothDaemonGattModule::ClientGetDescriptorNtf,
[8] = &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf,
[9] = &BluetoothDaemonGattModule::ClientRegisterNotificationNtf,
[10] = &BluetoothDaemonGattModule::ClientNotifyNtf,
[11] = &BluetoothDaemonGattModule::ClientReadCharacteristicNtf,
[12] = &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf,
[13] = &BluetoothDaemonGattModule::ClientReadDescriptorNtf,
[14] = &BluetoothDaemonGattModule::ClientWriteDescriptorNtf,
[15] = &BluetoothDaemonGattModule::ClientExecuteWriteNtf,
[16] = &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf,
[17] = &BluetoothDaemonGattModule::ClientListenNtf,
[18] = &BluetoothDaemonGattModule::ServerRegisterNtf,
[19] = &BluetoothDaemonGattModule::ServerConnectionNtf,
[20] = &BluetoothDaemonGattModule::ServerServiceAddedNtf,
[21] = &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf,
[22] = &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf,
[23] = &BluetoothDaemonGattModule::ServerDescriptorAddedNtf,
[24] = &BluetoothDaemonGattModule::ServerServiceStartedNtf,
[25] = &BluetoothDaemonGattModule::ServerServiceStoppedNtf,
[26] = &BluetoothDaemonGattModule::ServerServiceDeletedNtf,
[27] = &BluetoothDaemonGattModule::ServerRequestReadNtf,
[28] = &BluetoothDaemonGattModule::ServerRequestWriteNtf,
[29] = &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf,
[30] = &BluetoothDaemonGattModule::ServerResponseConfirmationNtf
};
MOZ_ASSERT(!NS_IsMainThread());

View File

@ -50,8 +50,8 @@ BluetoothDaemonHandsfreeModule::HandleSvc(
{
static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::HandleNtf),
[0] = &BluetoothDaemonHandsfreeModule::HandleRsp,
[1] = &BluetoothDaemonHandsfreeModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@ -685,38 +685,38 @@ BluetoothDaemonHandsfreeModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothHandsfreeResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonHandsfreeModule::ErrorRsp),
INIT_ARRAY_AT(OPCODE_CONNECT,
&BluetoothDaemonHandsfreeModule::ConnectRsp),
INIT_ARRAY_AT(OPCODE_DISCONNECT,
&BluetoothDaemonHandsfreeModule::DisconnectRsp),
INIT_ARRAY_AT(OPCODE_CONNECT_AUDIO,
&BluetoothDaemonHandsfreeModule::ConnectAudioRsp),
INIT_ARRAY_AT(OPCODE_DISCONNECT_AUDIO,
&BluetoothDaemonHandsfreeModule::DisconnectAudioRsp),
INIT_ARRAY_AT(OPCODE_START_VOICE_RECOGNITION,
&BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp),
INIT_ARRAY_AT(OPCODE_STOP_VOICE_RECOGNITION,
&BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp),
INIT_ARRAY_AT(OPCODE_VOLUME_CONTROL,
&BluetoothDaemonHandsfreeModule::VolumeControlRsp),
INIT_ARRAY_AT(OPCODE_DEVICE_STATUS_NOTIFICATION,
&BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp),
INIT_ARRAY_AT(OPCODE_COPS_RESPONSE,
&BluetoothDaemonHandsfreeModule::CopsResponseRsp),
INIT_ARRAY_AT(OPCODE_CIND_RESPONSE,
&BluetoothDaemonHandsfreeModule::CindResponseRsp),
INIT_ARRAY_AT(OPCODE_FORMATTED_AT_RESPONSE,
&BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp),
INIT_ARRAY_AT(OPCODE_AT_RESPONSE,
&BluetoothDaemonHandsfreeModule::AtResponseRsp),
INIT_ARRAY_AT(OPCODE_CLCC_RESPONSE,
&BluetoothDaemonHandsfreeModule::ClccResponseRsp),
INIT_ARRAY_AT(OPCODE_PHONE_STATE_CHANGE,
&BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp),
INIT_ARRAY_AT(OPCODE_CONFIGURE_WBS,
&BluetoothDaemonHandsfreeModule::ConfigureWbsRsp)
[OPCODE_ERROR] =
&BluetoothDaemonHandsfreeModule::ErrorRsp,
[OPCODE_CONNECT] =
&BluetoothDaemonHandsfreeModule::ConnectRsp,
[OPCODE_DISCONNECT] =
&BluetoothDaemonHandsfreeModule::DisconnectRsp,
[OPCODE_CONNECT_AUDIO] =
&BluetoothDaemonHandsfreeModule::ConnectAudioRsp,
[OPCODE_DISCONNECT_AUDIO] =
&BluetoothDaemonHandsfreeModule::DisconnectAudioRsp,
[OPCODE_START_VOICE_RECOGNITION] =
&BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp,
[OPCODE_STOP_VOICE_RECOGNITION] =
&BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp,
[OPCODE_VOLUME_CONTROL] =
&BluetoothDaemonHandsfreeModule::VolumeControlRsp,
[OPCODE_DEVICE_STATUS_NOTIFICATION] =
&BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp,
[OPCODE_COPS_RESPONSE] =
&BluetoothDaemonHandsfreeModule::CopsResponseRsp,
[OPCODE_CIND_RESPONSE] =
&BluetoothDaemonHandsfreeModule::CindResponseRsp,
[OPCODE_FORMATTED_AT_RESPONSE] =
&BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp,
[OPCODE_AT_RESPONSE] =
&BluetoothDaemonHandsfreeModule::AtResponseRsp,
[OPCODE_CLCC_RESPONSE] =
&BluetoothDaemonHandsfreeModule::ClccResponseRsp,
[OPCODE_PHONE_STATE_CHANGE] =
&BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp,
[OPCODE_CONFIGURE_WBS] =
&BluetoothDaemonHandsfreeModule::ConfigureWbsRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@ -1426,22 +1426,22 @@ BluetoothDaemonHandsfreeModule::HandleNtf(
{
static void (BluetoothDaemonHandsfreeModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::ConnectionStateNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::AudioStateNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf),
INIT_ARRAY_AT(3, &BluetoothDaemonHandsfreeModule::AnswerCallNtf),
INIT_ARRAY_AT(4, &BluetoothDaemonHandsfreeModule::HangupCallNtf),
INIT_ARRAY_AT(5, &BluetoothDaemonHandsfreeModule::VolumeNtf),
INIT_ARRAY_AT(6, &BluetoothDaemonHandsfreeModule::DialCallNtf),
INIT_ARRAY_AT(7, &BluetoothDaemonHandsfreeModule::DtmfNtf),
INIT_ARRAY_AT(8, &BluetoothDaemonHandsfreeModule::NRECNtf),
INIT_ARRAY_AT(9, &BluetoothDaemonHandsfreeModule::CallHoldNtf),
INIT_ARRAY_AT(10, &BluetoothDaemonHandsfreeModule::CnumNtf),
INIT_ARRAY_AT(11, &BluetoothDaemonHandsfreeModule::CindNtf),
INIT_ARRAY_AT(12, &BluetoothDaemonHandsfreeModule::CopsNtf),
INIT_ARRAY_AT(13, &BluetoothDaemonHandsfreeModule::ClccNtf),
INIT_ARRAY_AT(14, &BluetoothDaemonHandsfreeModule::UnknownAtNtf),
INIT_ARRAY_AT(15, &BluetoothDaemonHandsfreeModule::KeyPressedNtf)
[0] = &BluetoothDaemonHandsfreeModule::ConnectionStateNtf,
[1] = &BluetoothDaemonHandsfreeModule::AudioStateNtf,
[2] = &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf,
[3] = &BluetoothDaemonHandsfreeModule::AnswerCallNtf,
[4] = &BluetoothDaemonHandsfreeModule::HangupCallNtf,
[5] = &BluetoothDaemonHandsfreeModule::VolumeNtf,
[6] = &BluetoothDaemonHandsfreeModule::DialCallNtf,
[7] = &BluetoothDaemonHandsfreeModule::DtmfNtf,
[8] = &BluetoothDaemonHandsfreeModule::NRECNtf,
[9] = &BluetoothDaemonHandsfreeModule::CallHoldNtf,
[10] = &BluetoothDaemonHandsfreeModule::CnumNtf,
[11] = &BluetoothDaemonHandsfreeModule::CindNtf,
[12] = &BluetoothDaemonHandsfreeModule::CopsNtf,
[13] = &BluetoothDaemonHandsfreeModule::ClccNtf,
[14] = &BluetoothDaemonHandsfreeModule::UnknownAtNtf,
[15] = &BluetoothDaemonHandsfreeModule::KeyPressedNtf
};
MOZ_ASSERT(!NS_IsMainThread());

View File

@ -22,8 +22,8 @@ nsresult
Convert(bool aIn, BluetoothScanMode& aOut)
{
static const BluetoothScanMode sScanMode[] = {
CONVERT(false, SCAN_MODE_CONNECTABLE),
CONVERT(true, SCAN_MODE_CONNECTABLE_DISCOVERABLE)
[false] = SCAN_MODE_CONNECTABLE,
[true] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
aOut = SCAN_MODE_NONE; // silences compiler warning
@ -37,10 +37,10 @@ nsresult
Convert(int32_t aIn, BluetoothTypeOfDevice& aOut)
{
static const BluetoothTypeOfDevice sTypeOfDevice[] = {
CONVERT(0x00, static_cast<BluetoothTypeOfDevice>(0)), // invalid, required by gcc
CONVERT(0x01, TYPE_OF_DEVICE_BREDR),
CONVERT(0x02, TYPE_OF_DEVICE_BLE),
CONVERT(0x03, TYPE_OF_DEVICE_DUAL)
[0x00] = static_cast<BluetoothTypeOfDevice>(0), // invalid, required by gcc
[0x01] = TYPE_OF_DEVICE_BREDR,
[0x02] = TYPE_OF_DEVICE_BLE,
[0x03] = TYPE_OF_DEVICE_DUAL
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sTypeOfDevice))) {
@ -54,9 +54,9 @@ nsresult
Convert(int32_t aIn, BluetoothScanMode& aOut)
{
static const BluetoothScanMode sScanMode[] = {
CONVERT(0x00, SCAN_MODE_NONE),
CONVERT(0x01, SCAN_MODE_CONNECTABLE),
CONVERT(0x02, SCAN_MODE_CONNECTABLE_DISCOVERABLE)
[0x00] = SCAN_MODE_NONE,
[0x01] = SCAN_MODE_CONNECTABLE,
[0x02] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
};
if (NS_WARN_IF(aIn < 0) ||
NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sScanMode))) {
@ -70,9 +70,9 @@ nsresult
Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut)
{
static const BluetoothA2dpAudioState sAudioState[] = {
CONVERT(0x00, A2DP_AUDIO_STATE_REMOTE_SUSPEND),
CONVERT(0x01, A2DP_AUDIO_STATE_STOPPED),
CONVERT(0x02, A2DP_AUDIO_STATE_STARTED)
[0x00] = A2DP_AUDIO_STATE_REMOTE_SUSPEND,
[0x01] = A2DP_AUDIO_STATE_STOPPED,
[0x02] = A2DP_AUDIO_STATE_STARTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -85,10 +85,10 @@ nsresult
Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut)
{
static const BluetoothA2dpConnectionState sConnectionState[] = {
CONVERT(0x00, A2DP_CONNECTION_STATE_DISCONNECTED),
CONVERT(0x01, A2DP_CONNECTION_STATE_CONNECTING),
CONVERT(0x02, A2DP_CONNECTION_STATE_CONNECTED),
CONVERT(0x03, A2DP_CONNECTION_STATE_DISCONNECTING)
[0x00] = A2DP_CONNECTION_STATE_DISCONNECTED,
[0x01] = A2DP_CONNECTION_STATE_CONNECTING,
[0x02] = A2DP_CONNECTION_STATE_CONNECTED,
[0x03] = A2DP_CONNECTION_STATE_DISCONNECTING
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -101,8 +101,8 @@ nsresult
Convert(uint8_t aIn, BluetoothAclState& aOut)
{
static const BluetoothAclState sAclState[] = {
CONVERT(0x00, ACL_STATE_CONNECTED),
CONVERT(0x01, ACL_STATE_DISCONNECTED),
[0x00] = ACL_STATE_CONNECTED,
[0x01] = ACL_STATE_DISCONNECTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAclState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -115,15 +115,15 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpEvent& aOut)
{
static const BluetoothAvrcpEvent sAvrcpEvent[] = {
CONVERT(0x00, static_cast<BluetoothAvrcpEvent>(0)),
CONVERT(0x01, AVRCP_EVENT_PLAY_STATUS_CHANGED),
CONVERT(0x02, AVRCP_EVENT_TRACK_CHANGE),
CONVERT(0x03, AVRCP_EVENT_TRACK_REACHED_END),
CONVERT(0x04, AVRCP_EVENT_TRACK_REACHED_START),
CONVERT(0x05, AVRCP_EVENT_PLAY_POS_CHANGED),
CONVERT(0x06, static_cast<BluetoothAvrcpEvent>(0)),
CONVERT(0x07, static_cast<BluetoothAvrcpEvent>(0)),
CONVERT(0x08, AVRCP_EVENT_APP_SETTINGS_CHANGED)
[0x00] = static_cast<BluetoothAvrcpEvent>(0),
[0x01] = AVRCP_EVENT_PLAY_STATUS_CHANGED,
[0x02] = AVRCP_EVENT_TRACK_CHANGE,
[0x03] = AVRCP_EVENT_TRACK_REACHED_END,
[0x04] = AVRCP_EVENT_TRACK_REACHED_START,
[0x05] = AVRCP_EVENT_PLAY_POS_CHANGED,
[0x06] = static_cast<BluetoothAvrcpEvent>(0),
[0x07] = static_cast<BluetoothAvrcpEvent>(0),
[0x08] = AVRCP_EVENT_APP_SETTINGS_CHANGED
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn == 0x06) ||
@ -140,14 +140,14 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpMediaAttribute& aOut)
{
static const BluetoothAvrcpMediaAttribute sAvrcpMediaAttribute[] = {
CONVERT(0x00, static_cast<BluetoothAvrcpMediaAttribute>(0)),
CONVERT(0x01, AVRCP_MEDIA_ATTRIBUTE_TITLE),
CONVERT(0x02, AVRCP_MEDIA_ATTRIBUTE_ARTIST),
CONVERT(0x03, AVRCP_MEDIA_ATTRIBUTE_ALBUM),
CONVERT(0x04, AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM),
CONVERT(0x05, AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS),
CONVERT(0x06, AVRCP_MEDIA_ATTRIBUTE_GENRE),
CONVERT(0x07, AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME)
[0x00] = static_cast<BluetoothAvrcpMediaAttribute>(0),
[0x01] = AVRCP_MEDIA_ATTRIBUTE_TITLE,
[0x02] = AVRCP_MEDIA_ATTRIBUTE_ARTIST,
[0x03] = AVRCP_MEDIA_ATTRIBUTE_ALBUM,
[0x04] = AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM,
[0x05] = AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS,
[0x06] = AVRCP_MEDIA_ATTRIBUTE_GENRE,
[0x07] = AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpMediaAttribute))) {
@ -163,11 +163,11 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpPlayerAttribute& aOut)
{
static const BluetoothAvrcpPlayerAttribute sAvrcpPlayerAttribute[] = {
CONVERT(0x00, static_cast<BluetoothAvrcpPlayerAttribute>(0)),
CONVERT(0x01, AVRCP_PLAYER_ATTRIBUTE_EQUALIZER),
CONVERT(0x02, AVRCP_PLAYER_ATTRIBUTE_REPEAT),
CONVERT(0x03, AVRCP_PLAYER_ATTRIBUTE_SHUFFLE),
CONVERT(0x04, AVRCP_PLAYER_ATTRIBUTE_SCAN)
[0x00] = static_cast<BluetoothAvrcpPlayerAttribute>(0),
[0x01] = AVRCP_PLAYER_ATTRIBUTE_EQUALIZER,
[0x02] = AVRCP_PLAYER_ATTRIBUTE_REPEAT,
[0x03] = AVRCP_PLAYER_ATTRIBUTE_SHUFFLE,
[0x04] = AVRCP_PLAYER_ATTRIBUTE_SCAN
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpPlayerAttribute))) {
@ -183,10 +183,10 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpRemoteFeature& aOut)
{
static const BluetoothAvrcpRemoteFeature sAvrcpRemoteFeature[] = {
CONVERT(0x00, AVRCP_REMOTE_FEATURE_NONE),
CONVERT(0x01, AVRCP_REMOTE_FEATURE_METADATA),
CONVERT(0x02, AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME),
CONVERT(0x03, AVRCP_REMOTE_FEATURE_BROWSE)
[0x00] = AVRCP_REMOTE_FEATURE_NONE,
[0x01] = AVRCP_REMOTE_FEATURE_METADATA,
[0x02] = AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME,
[0x03] = AVRCP_REMOTE_FEATURE_BROWSE
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature))) {
@ -202,9 +202,9 @@ nsresult
Convert(uint8_t aIn, BluetoothBondState& aOut)
{
static const BluetoothBondState sBondState[] = {
CONVERT(0x00, BOND_STATE_NONE),
CONVERT(0x01, BOND_STATE_BONDING),
CONVERT(0x02, BOND_STATE_BONDED)
[0x00] = BOND_STATE_NONE,
[0x01] = BOND_STATE_BONDING,
[0x02] = BOND_STATE_BONDED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBondState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -217,10 +217,10 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeAudioState& aOut)
{
static const BluetoothHandsfreeAudioState sAudioState[] = {
CONVERT(0x00, HFP_AUDIO_STATE_DISCONNECTED),
CONVERT(0x01, HFP_AUDIO_STATE_CONNECTING),
CONVERT(0x02, HFP_AUDIO_STATE_CONNECTED),
CONVERT(0x03, HFP_AUDIO_STATE_DISCONNECTING)
[0x00] = HFP_AUDIO_STATE_DISCONNECTED,
[0x01] = HFP_AUDIO_STATE_CONNECTING,
[0x02] = HFP_AUDIO_STATE_CONNECTED,
[0x03] = HFP_AUDIO_STATE_DISCONNECTING
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -233,10 +233,10 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeCallHoldType& aOut)
{
static const BluetoothHandsfreeCallHoldType sCallHoldType[] = {
CONVERT(0x00, HFP_CALL_HOLD_RELEASEHELD),
CONVERT(0x01, HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD),
CONVERT(0x02, HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD),
CONVERT(0x03, HFP_CALL_HOLD_ADDHELDTOCONF)
[0x00] = HFP_CALL_HOLD_RELEASEHELD,
[0x01] = HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD,
[0x02] = HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD,
[0x03] = HFP_CALL_HOLD_ADDHELDTOCONF
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallHoldType))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -249,11 +249,11 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeConnectionState& aOut)
{
static const BluetoothHandsfreeConnectionState sConnectionState[] = {
CONVERT(0x00, HFP_CONNECTION_STATE_DISCONNECTED),
CONVERT(0x01, HFP_CONNECTION_STATE_CONNECTING),
CONVERT(0x02, HFP_CONNECTION_STATE_CONNECTED),
CONVERT(0x03, HFP_CONNECTION_STATE_SLC_CONNECTED),
CONVERT(0x04, HFP_CONNECTION_STATE_DISCONNECTING)
[0x00] = HFP_CONNECTION_STATE_DISCONNECTED,
[0x01] = HFP_CONNECTION_STATE_CONNECTING,
[0x02] = HFP_CONNECTION_STATE_CONNECTED,
[0x03] = HFP_CONNECTION_STATE_SLC_CONNECTED,
[0x04] = HFP_CONNECTION_STATE_DISCONNECTING
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -266,8 +266,8 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeNRECState& aOut)
{
static const BluetoothHandsfreeNRECState sNRECState[] = {
CONVERT(0x00, HFP_NREC_STOPPED),
CONVERT(0x01, HFP_NREC_STARTED)
[0x00] = HFP_NREC_STOPPED,
[0x01] = HFP_NREC_STARTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNRECState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -280,8 +280,8 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeVoiceRecognitionState& aOut)
{
static const BluetoothHandsfreeVoiceRecognitionState sState[] = {
CONVERT(0x00, HFP_VOICE_RECOGNITION_STOPPED),
CONVERT(0x01, HFP_VOICE_RECOGNITION_STOPPED)
[0x00] = HFP_VOICE_RECOGNITION_STOPPED,
[0x01] = HFP_VOICE_RECOGNITION_STARTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sState))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -294,8 +294,8 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeVolumeType& aOut)
{
static const BluetoothHandsfreeVolumeType sVolumeType[] = {
CONVERT(0x00, HFP_VOLUME_TYPE_SPEAKER),
CONVERT(0x01, HFP_VOLUME_TYPE_MICROPHONE)
[0x00] = HFP_VOLUME_TYPE_SPEAKER,
[0x01] = HFP_VOLUME_TYPE_MICROPHONE
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -308,9 +308,9 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeWbsConfig& aOut)
{
static const BluetoothHandsfreeWbsConfig sWbsConfig[] = {
CONVERT(0x00, HFP_WBS_NONE),
CONVERT(0x01, HFP_WBS_NO),
CONVERT(0x02, HFP_WBS_YES)
[0x00] = HFP_WBS_NONE,
[0x01] = HFP_WBS_NO,
[0x02] = HFP_WBS_YES
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -329,19 +329,19 @@ nsresult
Convert(uint8_t aIn, BluetoothPropertyType& aOut)
{
static const BluetoothPropertyType sPropertyType[] = {
CONVERT(0x00, static_cast<BluetoothPropertyType>(0)), // invalid, required by gcc
CONVERT(0x01, PROPERTY_BDNAME),
CONVERT(0x02, PROPERTY_BDADDR),
CONVERT(0x03, PROPERTY_UUIDS),
CONVERT(0x04, PROPERTY_CLASS_OF_DEVICE),
CONVERT(0x05, PROPERTY_TYPE_OF_DEVICE),
CONVERT(0x06, PROPERTY_SERVICE_RECORD),
CONVERT(0x07, PROPERTY_ADAPTER_SCAN_MODE),
CONVERT(0x08, PROPERTY_ADAPTER_BONDED_DEVICES),
CONVERT(0x09, PROPERTY_ADAPTER_DISCOVERY_TIMEOUT),
CONVERT(0x0a, PROPERTY_REMOTE_FRIENDLY_NAME),
CONVERT(0x0b, PROPERTY_REMOTE_RSSI),
CONVERT(0x0c, PROPERTY_REMOTE_VERSION_INFO)
[0x00] = static_cast<BluetoothPropertyType>(0), // invalid, required by gcc
[0x01] = PROPERTY_BDNAME,
[0x02] = PROPERTY_BDADDR,
[0x03] = PROPERTY_UUIDS,
[0x04] = PROPERTY_CLASS_OF_DEVICE,
[0x05] = PROPERTY_TYPE_OF_DEVICE,
[0x06] = PROPERTY_SERVICE_RECORD,
[0x07] = PROPERTY_ADAPTER_SCAN_MODE,
[0x08] = PROPERTY_ADAPTER_BONDED_DEVICES,
[0x09] = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
[0x0a] = PROPERTY_REMOTE_FRIENDLY_NAME,
[0x0b] = PROPERTY_REMOTE_RSSI,
[0x0c] = PROPERTY_REMOTE_VERSION_INFO
};
if (aIn == 0xff) {
/* This case is handled separately to not populate
@ -361,10 +361,10 @@ nsresult
Convert(BluetoothSocketType aIn, uint8_t& aOut)
{
static const uint8_t sSocketType[] = {
CONVERT(0, 0), // silences compiler warning
CONVERT(BluetoothSocketType::RFCOMM, 0x01),
CONVERT(BluetoothSocketType::SCO, 0x02),
CONVERT(BluetoothSocketType::L2CAP, 0x03)
[0] = 0, // silences compiler warning
[BluetoothSocketType::RFCOMM] = 0x01,
[BluetoothSocketType::SCO] = 0x02,
[BluetoothSocketType::L2CAP] = 0x03
// EL2CAP not supported
};
if (NS_WARN_IF(aIn == BluetoothSocketType::EL2CAP) ||
@ -381,10 +381,10 @@ nsresult
Convert(uint8_t aIn, BluetoothSspVariant& aOut)
{
static const BluetoothSspVariant sSspVariant[] = {
CONVERT(0x00, SSP_VARIANT_PASSKEY_CONFIRMATION),
CONVERT(0x01, SSP_VARIANT_PASSKEY_ENTRY),
CONVERT(0x02, SSP_VARIANT_CONSENT),
CONVERT(0x03, SSP_VARIANT_PASSKEY_NOTIFICATION)
[0x00] = SSP_VARIANT_PASSKEY_CONFIRMATION,
[0x01] = SSP_VARIANT_PASSKEY_ENTRY,
[0x02] = SSP_VARIANT_CONSENT,
[0x03] = SSP_VARIANT_PASSKEY_NOTIFICATION
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSspVariant))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -397,17 +397,17 @@ nsresult
Convert(uint8_t aIn, BluetoothStatus& aOut)
{
static const BluetoothStatus sStatus[] = {
CONVERT(0x00, STATUS_SUCCESS),
CONVERT(0x01, STATUS_FAIL),
CONVERT(0x02, STATUS_NOT_READY),
CONVERT(0x03, STATUS_NOMEM),
CONVERT(0x04, STATUS_BUSY),
CONVERT(0x05, STATUS_DONE),
CONVERT(0x06, STATUS_UNSUPPORTED),
CONVERT(0x07, STATUS_PARM_INVALID),
CONVERT(0x08, STATUS_UNHANDLED),
CONVERT(0x09, STATUS_AUTH_FAILURE),
CONVERT(0x0a, STATUS_RMT_DEV_DOWN)
[0x00] = STATUS_SUCCESS,
[0x01] = STATUS_FAIL,
[0x02] = STATUS_NOT_READY,
[0x03] = STATUS_NOMEM,
[0x04] = STATUS_BUSY,
[0x05] = STATUS_DONE,
[0x06] = STATUS_UNSUPPORTED,
[0x07] = STATUS_PARM_INVALID,
[0x08] = STATUS_UNHANDLED,
[0x09] = STATUS_AUTH_FAILURE,
[0x0a] = STATUS_RMT_DEV_DOWN
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sStatus))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -421,24 +421,24 @@ Convert(int32_t aIn, BluetoothGattStatus& aOut)
{
/* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
static const BluetoothGattStatus sGattStatus[] = {
CONVERT(0x0000, GATT_STATUS_SUCCESS),
CONVERT(0x0001, GATT_STATUS_INVALID_HANDLE),
CONVERT(0x0002, GATT_STATUS_READ_NOT_PERMITTED),
CONVERT(0x0003, GATT_STATUS_WRITE_NOT_PERMITTED),
CONVERT(0x0004, GATT_STATUS_INVALID_PDU),
CONVERT(0x0005, GATT_STATUS_INSUFFICIENT_AUTHENTICATION),
CONVERT(0x0006, GATT_STATUS_REQUEST_NOT_SUPPORTED),
CONVERT(0x0007, GATT_STATUS_INVALID_OFFSET),
CONVERT(0x0008, GATT_STATUS_INSUFFICIENT_AUTHORIZATION),
CONVERT(0x0009, GATT_STATUS_PREPARE_QUEUE_FULL),
CONVERT(0x000a, GATT_STATUS_ATTRIBUTE_NOT_FOUND),
CONVERT(0x000b, GATT_STATUS_ATTRIBUTE_NOT_LONG),
CONVERT(0x000c, GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE),
CONVERT(0x000d, GATT_STATUS_INVALID_ATTRIBUTE_LENGTH),
CONVERT(0x000e, GATT_STATUS_UNLIKELY_ERROR),
CONVERT(0x000f, GATT_STATUS_INSUFFICIENT_ENCRYPTION),
CONVERT(0x0010, GATT_STATUS_UNSUPPORTED_GROUP_TYPE),
CONVERT(0x0011, GATT_STATUS_INSUFFICIENT_RESOURCES)
[0x0000] = GATT_STATUS_SUCCESS,
[0x0001] = GATT_STATUS_INVALID_HANDLE,
[0x0002] = GATT_STATUS_READ_NOT_PERMITTED,
[0x0003] = GATT_STATUS_WRITE_NOT_PERMITTED,
[0x0004] = GATT_STATUS_INVALID_PDU,
[0x0005] = GATT_STATUS_INSUFFICIENT_AUTHENTICATION,
[0x0006] = GATT_STATUS_REQUEST_NOT_SUPPORTED,
[0x0007] = GATT_STATUS_INVALID_OFFSET,
[0x0008] = GATT_STATUS_INSUFFICIENT_AUTHORIZATION,
[0x0009] = GATT_STATUS_PREPARE_QUEUE_FULL,
[0x000a] = GATT_STATUS_ATTRIBUTE_NOT_FOUND,
[0x000b] = GATT_STATUS_ATTRIBUTE_NOT_LONG,
[0x000c] = GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE,
[0x000d] = GATT_STATUS_INVALID_ATTRIBUTE_LENGTH,
[0x000e] = GATT_STATUS_UNLIKELY_ERROR,
[0x000f] = GATT_STATUS_INSUFFICIENT_ENCRYPTION,
[0x0010] = GATT_STATUS_UNSUPPORTED_GROUP_TYPE,
[0x0011] = GATT_STATUS_INSUFFICIENT_RESOURCES
};
if (NS_WARN_IF(aIn < 0) ||
NS_WARN_IF(aIn >= static_cast<ssize_t>(MOZ_ARRAY_LENGTH(sGattStatus)))) {
@ -541,8 +541,8 @@ nsresult
Convert(BluetoothAclState aIn, bool& aOut)
{
static const bool sBool[] = {
CONVERT(ACL_STATE_CONNECTED, true),
CONVERT(ACL_STATE_DISCONNECTED, false)
[ACL_STATE_CONNECTED] = true,
[ACL_STATE_DISCONNECTED] = false
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBool))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -578,12 +578,12 @@ nsresult
Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
CONVERT(AVRCP_EVENT_PLAY_STATUS_CHANGED, 0x01),
CONVERT(AVRCP_EVENT_TRACK_CHANGE, 0x02),
CONVERT(AVRCP_EVENT_TRACK_REACHED_END, 0x03),
CONVERT(AVRCP_EVENT_TRACK_REACHED_START, 0x04),
CONVERT(AVRCP_EVENT_PLAY_POS_CHANGED, 0x05),
CONVERT(AVRCP_EVENT_APP_SETTINGS_CHANGED, 0x08)
[AVRCP_EVENT_PLAY_STATUS_CHANGED] = 0x01,
[AVRCP_EVENT_TRACK_CHANGE] = 0x02,
[AVRCP_EVENT_TRACK_REACHED_END] = 0x03,
[AVRCP_EVENT_TRACK_REACHED_START] = 0x04,
[AVRCP_EVENT_PLAY_POS_CHANGED] = 0x05,
[AVRCP_EVENT_APP_SETTINGS_CHANGED] = 0x08
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -596,8 +596,8 @@ nsresult
Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut)
{
static const bool sValue[] = {
CONVERT(AVRCP_NTF_INTERIM, 0x00),
CONVERT(AVRCP_NTF_CHANGED, 0x01)
[AVRCP_NTF_INTERIM] = 0x00,
[AVRCP_NTF_CHANGED] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -610,10 +610,10 @@ nsresult
Convert(BluetoothAvrcpPlayerAttribute aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
CONVERT(AVRCP_PLAYER_ATTRIBUTE_EQUALIZER, 0x01),
CONVERT(AVRCP_PLAYER_ATTRIBUTE_REPEAT, 0x02),
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SHUFFLE, 0x03),
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SCAN, 0x04)
[AVRCP_PLAYER_ATTRIBUTE_EQUALIZER] = 0x01,
[AVRCP_PLAYER_ATTRIBUTE_REPEAT] = 0x02,
[AVRCP_PLAYER_ATTRIBUTE_SHUFFLE] = 0x03,
[AVRCP_PLAYER_ATTRIBUTE_SCAN] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -638,11 +638,11 @@ nsresult
Convert(BluetoothAvrcpStatus aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
CONVERT(AVRCP_STATUS_BAD_COMMAND, 0x00),
CONVERT(AVRCP_STATUS_BAD_PARAMETER, 0x01),
CONVERT(AVRCP_STATUS_NOT_FOUND, 0x02),
CONVERT(AVRCP_STATUS_INTERNAL_ERROR, 0x03),
CONVERT(AVRCP_STATUS_SUCCESS, 0x04)
[AVRCP_STATUS_BAD_COMMAND] = 0x00,
[AVRCP_STATUS_BAD_PARAMETER] = 0x01,
[AVRCP_STATUS_NOT_FOUND] = 0x02,
[AVRCP_STATUS_INTERNAL_ERROR] = 0x03,
[AVRCP_STATUS_SUCCESS] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@ -655,8 +655,8 @@ nsresult
Convert(BluetoothHandsfreeAtResponse aIn, uint8_t& aOut)
{
static const uint8_t sAtResponse[] = {
CONVERT(HFP_AT_RESPONSE_ERROR, 0x00),
CONVERT(HFP_AT_RESPONSE_OK, 0x01)
[HFP_AT_RESPONSE_ERROR] = 0x00,
[HFP_AT_RESPONSE_OK] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAtResponse))) {
aOut = 0x00; // silences compiler warning
@ -670,8 +670,8 @@ nsresult
Convert(BluetoothHandsfreeCallAddressType aIn, uint8_t& aOut)
{
static const uint8_t sCallAddressType[] = {
CONVERT(HFP_CALL_ADDRESS_TYPE_UNKNOWN, 0x81),
CONVERT(HFP_CALL_ADDRESS_TYPE_INTERNATIONAL, 0x91)
[HFP_CALL_ADDRESS_TYPE_UNKNOWN] = 0x81,
[HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = 0x91
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallAddressType))) {
aOut = 0x00; // silences compiler warning
@ -685,8 +685,8 @@ nsresult
Convert(BluetoothHandsfreeCallDirection aIn, uint8_t& aOut)
{
static const uint8_t sCallDirection[] = {
CONVERT(HFP_CALL_DIRECTION_OUTGOING, 0x00),
CONVERT(HFP_CALL_DIRECTION_INCOMING, 0x01)
[HFP_CALL_DIRECTION_OUTGOING] = 0x00,
[HFP_CALL_DIRECTION_INCOMING] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallDirection))) {
aOut = 0x00; // silences compiler warning
@ -700,13 +700,13 @@ nsresult
Convert(BluetoothHandsfreeCallState aIn, uint8_t& aOut)
{
static const uint8_t sCallState[] = {
CONVERT(HFP_CALL_STATE_ACTIVE, 0x00),
CONVERT(HFP_CALL_STATE_HELD, 0x01),
CONVERT(HFP_CALL_STATE_DIALING, 0x02),
CONVERT(HFP_CALL_STATE_ALERTING, 0x03),
CONVERT(HFP_CALL_STATE_INCOMING, 0x04),
CONVERT(HFP_CALL_STATE_WAITING, 0x05),
CONVERT(HFP_CALL_STATE_IDLE, 0x06)
[HFP_CALL_STATE_ACTIVE] = 0x00,
[HFP_CALL_STATE_HELD] = 0x01,
[HFP_CALL_STATE_DIALING] = 0x02,
[HFP_CALL_STATE_ALERTING] = 0x03,
[HFP_CALL_STATE_INCOMING] = 0x04,
[HFP_CALL_STATE_WAITING] = 0x05,
[HFP_CALL_STATE_IDLE] = 0x06
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallState))) {
aOut = 0x00; // silences compiler warning
@ -720,9 +720,9 @@ nsresult
Convert(BluetoothHandsfreeCallMode aIn, uint8_t& aOut)
{
static const uint8_t sCallMode[] = {
CONVERT(HFP_CALL_MODE_VOICE, 0x00),
CONVERT(HFP_CALL_MODE_DATA, 0x01),
CONVERT(HFP_CALL_MODE_FAX, 0x02)
[HFP_CALL_MODE_VOICE] = 0x00,
[HFP_CALL_MODE_DATA] = 0x01,
[HFP_CALL_MODE_FAX] = 0x02
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMode))) {
aOut = 0x00; // silences compiler warning
@ -736,8 +736,8 @@ nsresult
Convert(BluetoothHandsfreeCallMptyType aIn, uint8_t& aOut)
{
static const uint8_t sCallMptyType[] = {
CONVERT(HFP_CALL_MPTY_TYPE_SINGLE, 0x00),
CONVERT(HFP_CALL_MPTY_TYPE_MULTI, 0x01)
[HFP_CALL_MPTY_TYPE_SINGLE] = 0x00,
[HFP_CALL_MPTY_TYPE_MULTI] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMptyType))) {
aOut = 0x00; // silences compiler warning
@ -751,8 +751,8 @@ nsresult
Convert(BluetoothHandsfreeNetworkState aIn, uint8_t& aOut)
{
static const uint8_t sNetworkState[] = {
CONVERT(HFP_NETWORK_STATE_NOT_AVAILABLE, 0x00),
CONVERT(HFP_NETWORK_STATE_AVAILABLE, 0x01)
[HFP_NETWORK_STATE_NOT_AVAILABLE] = 0x00,
[HFP_NETWORK_STATE_AVAILABLE] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNetworkState))) {
aOut = 0x00; // silences compiler warning
@ -766,8 +766,8 @@ nsresult
Convert(BluetoothHandsfreeServiceType aIn, uint8_t& aOut)
{
static const uint8_t sServiceType[] = {
CONVERT(HFP_SERVICE_TYPE_HOME, 0x00),
CONVERT(HFP_SERVICE_TYPE_ROAMING, 0x01)
[HFP_SERVICE_TYPE_HOME] = 0x00,
[HFP_SERVICE_TYPE_ROAMING] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sServiceType))) {
aOut = 0x00; // silences compiler warning
@ -781,8 +781,8 @@ nsresult
Convert(BluetoothHandsfreeVolumeType aIn, uint8_t& aOut)
{
static const uint8_t sVolumeType[] = {
CONVERT(HFP_VOLUME_TYPE_SPEAKER, 0x00),
CONVERT(HFP_VOLUME_TYPE_MICROPHONE, 0x01)
[HFP_VOLUME_TYPE_SPEAKER] = 0x00,
[HFP_VOLUME_TYPE_MICROPHONE] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
aOut = 0x00; // silences compiler warning
@ -796,9 +796,9 @@ nsresult
Convert(BluetoothHandsfreeWbsConfig aIn, uint8_t& aOut)
{
static const uint8_t sWbsConfig[] = {
CONVERT(HFP_WBS_NONE, 0x00),
CONVERT(HFP_WBS_NO, 0x01),
CONVERT(HFP_WBS_YES, 0x02)
[HFP_WBS_NONE] = 0x00,
[HFP_WBS_NO] = 0x01,
[HFP_WBS_YES] = 0x02
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
aOut = 0x00; // silences compiler warning
@ -812,20 +812,20 @@ nsresult
Convert(BluetoothPropertyType aIn, uint8_t& aOut)
{
static const uint8_t sPropertyType[] = {
CONVERT(PROPERTY_UNKNOWN, 0x00),
CONVERT(PROPERTY_BDNAME, 0x01),
CONVERT(PROPERTY_BDADDR, 0x02),
CONVERT(PROPERTY_UUIDS, 0x03),
CONVERT(PROPERTY_CLASS_OF_DEVICE, 0x04),
CONVERT(PROPERTY_TYPE_OF_DEVICE, 0x05),
CONVERT(PROPERTY_SERVICE_RECORD, 0x06),
CONVERT(PROPERTY_ADAPTER_SCAN_MODE, 0x07),
CONVERT(PROPERTY_ADAPTER_BONDED_DEVICES, 0x08),
CONVERT(PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, 0x09),
CONVERT(PROPERTY_REMOTE_FRIENDLY_NAME, 0x0a),
CONVERT(PROPERTY_REMOTE_RSSI, 0x0b),
CONVERT(PROPERTY_REMOTE_VERSION_INFO, 0x0c),
CONVERT(PROPERTY_REMOTE_DEVICE_TIMESTAMP, 0xff)
[PROPERTY_UNKNOWN] = 0x00,
[PROPERTY_BDNAME] = 0x01,
[PROPERTY_BDADDR] = 0x02,
[PROPERTY_UUIDS] = 0x03,
[PROPERTY_CLASS_OF_DEVICE] = 0x04,
[PROPERTY_TYPE_OF_DEVICE] = 0x05,
[PROPERTY_SERVICE_RECORD] = 0x06,
[PROPERTY_ADAPTER_SCAN_MODE] = 0x07,
[PROPERTY_ADAPTER_BONDED_DEVICES] = 0x08,
[PROPERTY_ADAPTER_DISCOVERY_TIMEOUT] = 0x09,
[PROPERTY_REMOTE_FRIENDLY_NAME] = 0x0a,
[PROPERTY_REMOTE_RSSI] = 0x0b,
[PROPERTY_REMOTE_VERSION_INFO] = 0x0c,
[PROPERTY_REMOTE_DEVICE_TIMESTAMP] = 0xff
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sPropertyType))) {
aOut = 0x00; // silences compiler warning
@ -851,9 +851,9 @@ nsresult
Convert(BluetoothScanMode aIn, int32_t& aOut)
{
static const int32_t sScanMode[] = {
CONVERT(SCAN_MODE_NONE, 0x00),
CONVERT(SCAN_MODE_CONNECTABLE, 0x01),
CONVERT(SCAN_MODE_CONNECTABLE_DISCOVERABLE, 0x02)
[SCAN_MODE_NONE] = 0x00,
[SCAN_MODE_CONNECTABLE] = 0x01,
[SCAN_MODE_CONNECTABLE_DISCOVERABLE] = 0x02
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
aOut = 0; // silences compiler warning
@ -867,10 +867,10 @@ nsresult
Convert(BluetoothSspVariant aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
CONVERT(SSP_VARIANT_PASSKEY_CONFIRMATION, 0x00),
CONVERT(SSP_VARIANT_PASSKEY_ENTRY, 0x01),
CONVERT(SSP_VARIANT_CONSENT, 0x02),
CONVERT(SSP_VARIANT_PASSKEY_NOTIFICATION, 0x03)
[SSP_VARIANT_PASSKEY_CONFIRMATION] = 0x00,
[SSP_VARIANT_PASSKEY_ENTRY] = 0x01,
[SSP_VARIANT_CONSENT] = 0x02,
[SSP_VARIANT_PASSKEY_NOTIFICATION] = 0x03
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
aOut = 0; // silences compiler warning
@ -884,11 +884,11 @@ nsresult
Convert(ControlPlayStatus aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
CONVERT(PLAYSTATUS_STOPPED, 0x00),
CONVERT(PLAYSTATUS_PLAYING, 0x01),
CONVERT(PLAYSTATUS_PAUSED, 0x02),
CONVERT(PLAYSTATUS_FWD_SEEK, 0x03),
CONVERT(PLAYSTATUS_REV_SEEK, 0x04)
[PLAYSTATUS_STOPPED] = 0x00,
[PLAYSTATUS_PLAYING] = 0x01,
[PLAYSTATUS_PAUSED] = 0x02,
[PLAYSTATUS_FWD_SEEK] = 0x03,
[PLAYSTATUS_REV_SEEK] = 0x04
};
if (aIn == PLAYSTATUS_ERROR) {
/* This case is handled separately to not populate
@ -908,11 +908,11 @@ nsresult
Convert(BluetoothGattAuthReq aIn, int32_t& aOut)
{
static const int32_t sGattAuthReq[] = {
CONVERT(GATT_AUTH_REQ_NONE, 0x00),
CONVERT(GATT_AUTH_REQ_NO_MITM, 0x01),
CONVERT(GATT_AUTH_REQ_MITM, 0x02),
CONVERT(GATT_AUTH_REQ_SIGNED_NO_MITM, 0x03),
CONVERT(GATT_AUTH_REQ_SIGNED_MITM, 0x04)
[GATT_AUTH_REQ_NONE] = 0x00,
[GATT_AUTH_REQ_NO_MITM] = 0x01,
[GATT_AUTH_REQ_MITM] = 0x02,
[GATT_AUTH_REQ_SIGNED_NO_MITM] = 0x03,
[GATT_AUTH_REQ_SIGNED_MITM] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattAuthReq))) {
aOut = GATT_AUTH_REQ_NONE; // silences compiler warning
@ -926,10 +926,10 @@ nsresult
Convert(BluetoothGattWriteType aIn, int32_t& aOut)
{
static const int32_t sGattWriteType[] = {
CONVERT(GATT_WRITE_TYPE_NO_RESPONSE, 0x01),
CONVERT(GATT_WRITE_TYPE_NORMAL, 0x02),
CONVERT(GATT_WRITE_TYPE_PREPARE, 0x03),
CONVERT(GATT_WRITE_TYPE_SIGNED, 0x04)
[GATT_WRITE_TYPE_NO_RESPONSE] = 0x01,
[GATT_WRITE_TYPE_NORMAL] = 0x02,
[GATT_WRITE_TYPE_PREPARE] = 0x03,
[GATT_WRITE_TYPE_SIGNED] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattWriteType))) {
aOut = GATT_WRITE_TYPE_NORMAL; // silences compiler warning

View File

@ -113,10 +113,10 @@ protected:
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothSetupResultHandler*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonSetupModule::ErrorRsp),
INIT_ARRAY_AT(0x01, &BluetoothDaemonSetupModule::RegisterModuleRsp),
INIT_ARRAY_AT(0x02, &BluetoothDaemonSetupModule::UnregisterModuleRsp),
INIT_ARRAY_AT(0x03, &BluetoothDaemonSetupModule::ConfigurationRsp)
[0x00] = &BluetoothDaemonSetupModule::ErrorRsp,
[0x01] = &BluetoothDaemonSetupModule::RegisterModuleRsp,
[0x02] = &BluetoothDaemonSetupModule::UnregisterModuleRsp,
[0x03] = &BluetoothDaemonSetupModule::ConfigurationRsp
};
if (NS_WARN_IF(aHeader.mOpcode >= MOZ_ARRAY_LENGTH(HandleRsp)) ||
@ -604,8 +604,8 @@ protected:
{
static void (BluetoothDaemonCoreModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::HandleNtf),
[0] = &BluetoothDaemonCoreModule::HandleRsp,
[1] = &BluetoothDaemonCoreModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@ -831,31 +831,27 @@ private:
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothResultHandler*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonCoreModule::ErrorRsp),
INIT_ARRAY_AT(0x01, &BluetoothDaemonCoreModule::EnableRsp),
INIT_ARRAY_AT(0x02, &BluetoothDaemonCoreModule::DisableRsp),
INIT_ARRAY_AT(0x03, &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp),
INIT_ARRAY_AT(0x04, &BluetoothDaemonCoreModule::GetAdapterPropertyRsp),
INIT_ARRAY_AT(0x05, &BluetoothDaemonCoreModule::SetAdapterPropertyRsp),
INIT_ARRAY_AT(0x06,
&BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp),
INIT_ARRAY_AT(0x07,
&BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp),
INIT_ARRAY_AT(0x08,
&BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp),
INIT_ARRAY_AT(0x09,
&BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp),
INIT_ARRAY_AT(0x0a, &BluetoothDaemonCoreModule::GetRemoteServicesRsp),
INIT_ARRAY_AT(0x0b, &BluetoothDaemonCoreModule::StartDiscoveryRsp),
INIT_ARRAY_AT(0x0c, &BluetoothDaemonCoreModule::CancelDiscoveryRsp),
INIT_ARRAY_AT(0x0d, &BluetoothDaemonCoreModule::CreateBondRsp),
INIT_ARRAY_AT(0x0e, &BluetoothDaemonCoreModule::RemoveBondRsp),
INIT_ARRAY_AT(0x0f, &BluetoothDaemonCoreModule::CancelBondRsp),
INIT_ARRAY_AT(0x10, &BluetoothDaemonCoreModule::PinReplyRsp),
INIT_ARRAY_AT(0x11, &BluetoothDaemonCoreModule::SspReplyRsp),
INIT_ARRAY_AT(0x12, &BluetoothDaemonCoreModule::DutModeConfigureRsp),
INIT_ARRAY_AT(0x13, &BluetoothDaemonCoreModule::DutModeSendRsp),
INIT_ARRAY_AT(0x14, &BluetoothDaemonCoreModule::LeTestModeRsp),
[0x00] = &BluetoothDaemonCoreModule::ErrorRsp,
[0x01] = &BluetoothDaemonCoreModule::EnableRsp,
[0x02] = &BluetoothDaemonCoreModule::DisableRsp,
[0x03] = &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp,
[0x04] = &BluetoothDaemonCoreModule::GetAdapterPropertyRsp,
[0x05] = &BluetoothDaemonCoreModule::SetAdapterPropertyRsp,
[0x06] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp,
[0x07] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp,
[0x08] = &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp,
[0x09] = &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp,
[0x0a] = &BluetoothDaemonCoreModule::GetRemoteServicesRsp,
[0x0b] = &BluetoothDaemonCoreModule::StartDiscoveryRsp,
[0x0c] = &BluetoothDaemonCoreModule::CancelDiscoveryRsp,
[0x0d] = &BluetoothDaemonCoreModule::CreateBondRsp,
[0x0e] = &BluetoothDaemonCoreModule::RemoveBondRsp,
[0x0f] = &BluetoothDaemonCoreModule::CancelBondRsp,
[0x10] = &BluetoothDaemonCoreModule::PinReplyRsp,
[0x11] = &BluetoothDaemonCoreModule::SspReplyRsp,
[0x12] = &BluetoothDaemonCoreModule::DutModeConfigureRsp,
[0x13] = &BluetoothDaemonCoreModule::DutModeSendRsp,
[0x14] = &BluetoothDaemonCoreModule::LeTestModeRsp,
};
MOZ_ASSERT(!NS_IsMainThread());
@ -1353,17 +1349,17 @@ private:
{
static void (BluetoothDaemonCoreModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::AdapterStateChangedNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::AdapterPropertiesNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf),
INIT_ARRAY_AT(3, &BluetoothDaemonCoreModule::DeviceFoundNtf),
INIT_ARRAY_AT(4, &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf),
INIT_ARRAY_AT(5, &BluetoothDaemonCoreModule::PinRequestNtf),
INIT_ARRAY_AT(6, &BluetoothDaemonCoreModule::SspRequestNtf),
INIT_ARRAY_AT(7, &BluetoothDaemonCoreModule::BondStateChangedNtf),
INIT_ARRAY_AT(8, &BluetoothDaemonCoreModule::AclStateChangedNtf),
INIT_ARRAY_AT(9, &BluetoothDaemonCoreModule::DutModeRecvNtf),
INIT_ARRAY_AT(10, &BluetoothDaemonCoreModule::LeTestModeNtf)
[0] = &BluetoothDaemonCoreModule::AdapterStateChangedNtf,
[1] = &BluetoothDaemonCoreModule::AdapterPropertiesNtf,
[2] = &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf,
[3] = &BluetoothDaemonCoreModule::DeviceFoundNtf,
[4] = &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf,
[5] = &BluetoothDaemonCoreModule::PinRequestNtf,
[6] = &BluetoothDaemonCoreModule::SspRequestNtf,
[7] = &BluetoothDaemonCoreModule::BondStateChangedNtf,
[8] = &BluetoothDaemonCoreModule::AclStateChangedNtf,
[9] = &BluetoothDaemonCoreModule::DutModeRecvNtf,
[10] = &BluetoothDaemonCoreModule::LeTestModeNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@ -1594,20 +1590,20 @@ BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU)
{
static void (BluetoothDaemonProtocol::* const HandleSvc[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonProtocol::HandleSetupSvc),
INIT_ARRAY_AT(0x01, &BluetoothDaemonProtocol::HandleCoreSvc),
INIT_ARRAY_AT(0x02, &BluetoothDaemonProtocol::HandleSocketSvc),
INIT_ARRAY_AT(0x03, nullptr), // HID host
INIT_ARRAY_AT(0x04, nullptr), // PAN
INIT_ARRAY_AT(BluetoothDaemonHandsfreeModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleHandsfreeSvc),
INIT_ARRAY_AT(BluetoothDaemonA2dpModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleA2dpSvc),
INIT_ARRAY_AT(0x07, nullptr), // Health
INIT_ARRAY_AT(BluetoothDaemonAvrcpModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleAvrcpSvc),
INIT_ARRAY_AT(BluetoothDaemonGattModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleGattSvc)
[0x00] = &BluetoothDaemonProtocol::HandleSetupSvc,
[0x01] = &BluetoothDaemonProtocol::HandleCoreSvc,
[0x02] = &BluetoothDaemonProtocol::HandleSocketSvc,
[0x03] = nullptr, // HID host
[0x04] = nullptr, // PAN
[BluetoothDaemonHandsfreeModule::SERVICE_ID] =
&BluetoothDaemonProtocol::HandleHandsfreeSvc,
[BluetoothDaemonA2dpModule::SERVICE_ID] =
&BluetoothDaemonProtocol::HandleA2dpSvc,
[0x07] = nullptr, // Health
[BluetoothDaemonAvrcpModule::SERVICE_ID] =
&BluetoothDaemonProtocol::HandleAvrcpSvc,
[BluetoothDaemonGattModule::SERVICE_ID] =
&BluetoothDaemonProtocol::HandleGattSvc
};
DaemonSocketPDUHeader header;

View File

@ -166,9 +166,9 @@ BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothSocketResultHandler*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonSocketModule::ErrorRsp),
INIT_ARRAY_AT(0x01, &BluetoothDaemonSocketModule::ListenRsp),
INIT_ARRAY_AT(0x02, &BluetoothDaemonSocketModule::ConnectRsp),
[0x00] = &BluetoothDaemonSocketModule::ErrorRsp,
[0x01] = &BluetoothDaemonSocketModule::ListenRsp,
[0x02] = &BluetoothDaemonSocketModule::ConnectRsp
};
if (NS_WARN_IF(MOZ_ARRAY_LENGTH(HandleRsp) <= aHeader.mOpcode) ||

View File

@ -128,9 +128,9 @@ BluetoothDeviceType
BluetoothDevice::ConvertUint32ToDeviceType(const uint32_t aValue)
{
static const BluetoothDeviceType sDeviceType[] = {
CONVERT(TYPE_OF_DEVICE_BREDR, BluetoothDeviceType::Classic),
CONVERT(TYPE_OF_DEVICE_BLE, BluetoothDeviceType::Le),
CONVERT(TYPE_OF_DEVICE_DUAL, BluetoothDeviceType::Dual),
[TYPE_OF_DEVICE_BREDR] = BluetoothDeviceType::Classic,
[TYPE_OF_DEVICE_BLE] = BluetoothDeviceType::Le,
[TYPE_OF_DEVICE_DUAL] = BluetoothDeviceType::Dual,
};
BluetoothTypeOfDevice type = static_cast<BluetoothTypeOfDevice>(aValue);

View File

@ -273,7 +273,7 @@ SystemMessageInternal.prototype = {
type: aType,
msg: aMessage,
extra: aExtra });
return;
return Promise.resolve();
}
// Give this message an ID so that we can identify the message and
@ -285,37 +285,50 @@ SystemMessageInternal.prototype = {
let shouldDispatchFunc = this._getMessageConfigurator(aType).shouldDispatch;
// Find pages that registered an handler for this type.
this._pages.forEach(function(aPage) {
if (aPage.type !== aType) {
return;
}
if (!this._pages.length) {
return Promise.resolve();
}
let doDispatch = () => {
let result = this._sendMessageCommon(aType,
aMessage,
messageID,
aPage.pageURL,
aPage.manifestURL,
aExtra);
debug("Returned status of sending message: " + result);
};
if ('function' !== typeof shouldDispatchFunc) {
// If the configurator has no 'shouldDispatch' defined,
// always dispatch this message.
doDispatch();
return;
}
shouldDispatchFunc(aPage.manifestURL, aPage.pageURL, aType, aMessage, aExtra)
.then(aShouldDispatch => {
if (aShouldDispatch) {
doDispatch();
// Find pages that registered a handler for this type.
let promises = [];
for (let i = 0; i < this._pages.length; i++) {
let promise = ((page) => {
return new Promise((resolve, reject) => {
if (page.type !== aType) {
resolve();
return;
}
});
}, this);
let doDispatch = () => {
let result = this._sendMessageCommon(aType,
aMessage,
messageID,
page.pageURL,
page.manifestURL,
aExtra);
debug("Returned status of sending message: " + result);
resolve();
};
if ('function' !== typeof shouldDispatchFunc) {
// If the configurator has no 'shouldDispatch' defined,
// always dispatch this message.
doDispatch();
return;
}
shouldDispatchFunc(page.manifestURL, page.pageURL, aType, aMessage, aExtra)
.then(aShouldDispatch => {
if (aShouldDispatch) {
doDispatch();
}
});
});
})(this._pages[i]);
promises.push(promise);
}
return Promise.all(promises);
},
registerPage: function(aType, aPageURI, aManifestURI) {

View File

@ -10,7 +10,7 @@ interface nsIMessageSender;
// Implemented by the contract id @mozilla.org/system-message-internal;1
[scriptable, uuid(54c8e274-decb-4258-9a24-4ebfcbf3d00a)]
[scriptable, uuid(59b6beda-f911-4d47-a296-8c81e6abcfb9)]
interface nsISystemMessagesInternal : nsISupports
{
/*
@ -36,8 +36,10 @@ interface nsISystemMessagesInternal : nsISupports
* @param message The message payload.
* @param extra Extra opaque information that will be passed around in the observer
* notification to open the page.
* returns a Promise
*/
void broadcastMessage(in DOMString type, in jsval message, [optional] in jsval extra);
nsISupports broadcastMessage(in DOMString type, in jsval message,
[optional] in jsval extra);
/*
* Registration of a page that wants to be notified of a message type.

View File

@ -1,3 +1,11 @@
[test_hasPendingMessage.html]
[DEFAULT]
skip-if = (buildapp != "browser") || e10s
support-files = file_hasPendingMessage.html
support-files =
file_hasPendingMessage.html
invalid_manifest.webapp
invalid_manifest.webapp^headers^
manifest.webapp
manifest.webapp^headers^
[test_hasPendingMessage.html]
[test_sysmsg_registration.html]

View File

@ -0,0 +1,8 @@
{
"name": "Random app",
"launch_path": "/index.html",
"messages": [{
"dummy-system-message": "/index.html",
"dummy-system-message2": "/index.html"
}]
}

View File

@ -0,0 +1 @@
Content-Type: application/manifest+json

View File

@ -0,0 +1,9 @@
{
"name": "Random app",
"launch_path": "/index.html",
"messages": [{
"dummy-system-message": "/index.html"
}, {
"dummy-system-message2": "/index.html"
}]
}

View File

@ -0,0 +1 @@
Content-Type: application/manifest+json

View File

@ -11,6 +11,7 @@
const { utils: Cu, interfaces: Ci, classes: Cc } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
SimpleTest.waitForExplicitFinish();
@ -70,10 +71,23 @@
test_frame.src = testURL + "#setMessageHandler2";
return expectAlert(test_frame, "handle message", "message handled");
}).then(() => {
// Setp 7. Check hasPendingMessages2
// Step 7. Check hasPendingMessages2
return expectAlert(test_frame, "no hasPendingMessages",
"no hasPendingMessages after mozSetMessageHandler");
}).then(() => {
// Be nice with the rest of the tests and clean up what we registered.
let appsSvc = Cc["@mozilla.org/AppsService;1"]
.getService(Ci.nsIAppsService);
let appId = appsSvc.getAppLocalIdByManifestURL(manifestURL);
let subject = {
appId: appId,
browserOnly: false,
QueryInterface: XPCOMUtils.generateQI([
Ci.mozIApplicationClearPrivateDataParams
])
};
Services.obs.notifyObservers(subject, "webapps-clear-data", null);
test_frame.remove();
finish();
});

View File

@ -0,0 +1,232 @@
<!DOCTYPE html>
<html>
<head>
<title>System messages registration tests</title>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1162281}">Mozilla Bug {1162281}</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="application/javascript;version=1.7">
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
// We need to keep the same CID as the one used on activities tests.
// Check https://bugzilla.mozilla.org/show_bug.cgi?id=1176712#c13
const SYS_MSG_GLUE_CID = Components.ID("{b0b6b9af-bc4e-4200-bffe-fb7691065ec9}");
XPCOMUtils.defineLazyGetter(this, "messenger", () => {
return Cc["@mozilla.org/system-message-internal;1"]
.getService(Ci.nsISystemMessagesInternal);
});
let gRootUrl = "http://test/chrome/dom/messages/test/";
let validAppUrl = gRootUrl + "manifest.webapp";
let invalidAppUrl = gRootUrl + "invalid_manifest.webapp";
let validApp;
let initialAppsCount;
let index = 0;
SimpleTest.waitForExplicitFinish();
function go() {
SpecialPowers.pushPermissions(
[{ "type": "webapps-manage", "allow": 1, "context": document },
{ "type": "browser", "allow": 1, "context": document },
{ "type": "embed-apps", "allow": 1, "context": document }],
function() {
SpecialPowers.pushPrefEnv(
{'set': [["dom.mozBrowserFramesEnabled", true],
["dom.sysmsg.enabled", true]]},
next) });
}
function finish() {
unregisterComponent(SystemMessageGlue);
SimpleTest.finish();
}
function next() {
info("Step " + index);
if (index >= steps.length) {
ok(false, "Shouldn't get here!");
return;
}
try {
let i = index++;
steps[i]();
} catch(ex) {
ok(false, "Caught exception", ex);
}
}
function cbError(aEvent) {
ok(false, "Error callback invoked " +
aEvent.target.error.name + " " + aEvent.target.error.message);
finish();
}
function uninstall(aApp) {
info("Uninstalling " + (aApp ? aApp.manifestURL : "NO APP!!"));
}
function registerComponent(aObject, aDescription, aContract) {
info("Registering " + SYS_MSG_GLUE_CID);
let componentManager =
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
componentManager.registerFactory(SYS_MSG_GLUE_CID, aDescription, aContract, aObject);
}
function unregisterComponent(aObject) {
info("Unregistering " + SYS_MSG_GLUE_CID);
let componentManager =
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
componentManager.unregisterFactory(SYS_MSG_GLUE_CID, aObject);
}
let SystemMessageGlue = {
// nsISupports implementation.
QueryInterface: function(iid) {
if (iid.equals(Ci.nsISupports) ||
iid.equals(Ci.nsIFactory) ||
iid.equals(Ci.nsISystemMessageGlue)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
},
// nsIFactory implementation.
createInstance: function(outer, iid) {
return this.QueryInterface(iid);
},
_lastManifestURL: null,
// nsISystemMessageGlue implementation.
openApp(pageURL, manifestURL, type, target, showApp, onlyShowApp, extra) {
this._lastManifestURL = manifestURL;
}
};
registerComponent(SystemMessageGlue,
"System Message Glue",
"@mozilla.org/dom/messages/system-message-glue;1");
function testBroadcastMessage(aMessage, aExpectedManifestURL, aMsg) {
SystemMessageGlue._lastManifestURL = null;
messenger.broadcastMessage(aMessage, {}, {})
.then(() => {
is(SystemMessageGlue._lastManifestURL, aExpectedManifestURL, aMsg);
next();
})
.catch(cbError);
}
/**
* TESTS
*/
let steps = [() => {
Services.obs.notifyObservers(null, "webapps-registry-ready", null);
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.autoConfirmAppInstall(next);
}, () => {
SpecialPowers.autoConfirmAppUninstall(next);
}, () => {
// Check how many apps we are starting with.
let request = navigator.mozApps.mgmt.getAll();
request.onerror = cbError;
request.onsuccess = () => {
initialAppsCount = request.result.length;
info("Starting with " + initialAppsCount + " apps installed.");
next();
};
}, () => {
// We still have not installed any app handling dummy-system-message.
testBroadcastMessage("dummy-system-message", null,
"no system message should be sent");
}, () => {
testBroadcastMessage("dummy-system-message2", null,
"no system message should be sent");
}, () => {
navigator.mozApps.mgmt.oninstall = () => {
validApp = request.result;
next();
};
let request = navigator.mozApps.install(validAppUrl, { });
request.error = cbError;
request.onsuccess = () => {
validApp = request.result;
};
}, () => {
// Installing the test app should register the system message.
testBroadcastMessage("dummy-system-message", validAppUrl,
"system message should be sent");
}, () => {
// Installing the test app should register the system message.
testBroadcastMessage("dummy-system-message2", validAppUrl,
"system message should be sent");
}, () => {
navigator.mozApps.mgmt.onuninstall = () => {
validApp = null;
next();
};
let request = navigator.mozApps.mgmt.uninstall(validApp);
request.onerror = cbError;
}, () => {
// Uninstalling the app should unregister the system messages.
testBroadcastMessage("dummy-system-message", null,
"no system message should be sent");
}, () => {
// Uninstalling the app should unregister the system messages.
testBroadcastMessage("dummy-system-message2", null,
"no system message should be sent");
}, () => {
navigator.mozApps.mgmt.oninstall = () => {
validApp = request.result;
next();
};
let request = navigator.mozApps.install(invalidAppUrl, { });
request.onerror = () => {
ok(true, "should not install invalid app");
next();
};
request.onsuccess = () => {
ok(false, "should not install invalid app");
finish();
};
}, () => {
testBroadcastMessage("dummy-system-message", null,
"no system message should be sent");
}, () => {
testBroadcastMessage("dummy-system-message2", null,
"no system message should be sent");
}, () => {
// Check how many apps we are finishing with.
let request = navigator.mozApps.mgmt.getAll();
request.onerror = cbError;
request.onsuccess = () => {
info("Finishing with " + request.result.length + " apps installed.");
is(initialAppsCount, request.result.length, "All apps are uninstalled");
next();
};
}, finish];
addLoadEvent(go);
</script>
</pre>
</body>
</html>

View File

@ -25,11 +25,9 @@ NS_IMPL_ADDREF_INHERITED(AudioChannelManager, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(AudioChannelManager, DOMEventTargetHelper)
AudioChannelManager::AudioChannelManager()
: mState(SWITCH_STATE_UNKNOWN)
, mVolumeChannel(-1)
: mVolumeChannel(-1)
{
RegisterSwitchObserver(SWITCH_HEADPHONES, this);
mState = GetCurrentSwitchState(SWITCH_HEADPHONES);
}
AudioChannelManager::~AudioChannelManager()
@ -68,7 +66,7 @@ AudioChannelManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProt
void
AudioChannelManager::Notify(const SwitchEvent& aEvent)
{
mState = aEvent.status();
mState = Some(aEvent.status());
DispatchTrustedEvent(NS_LITERAL_STRING("headphoneschange"));
}

View File

@ -8,6 +8,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/Hal.h"
#include "mozilla/HalTypes.h"
#include "mozilla/Maybe.h"
#include "AudioChannelService.h"
namespace mozilla {
@ -45,14 +46,17 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
bool Headphones() const
bool Headphones()
{
// Bug 929139 - Remove the assert check for SWITCH_STATE_UNKNOWN.
// If any devices (ex: emulator) didn't have the corresponding sys node for
// headset switch state then GonkSwitch will report the unknown state.
// So it is possible to get unknown state here.
return mState != hal::SWITCH_STATE_OFF &&
mState != hal::SWITCH_STATE_UNKNOWN;
if (mState.isNothing()) {
mState = Some(hal::GetCurrentSwitchState(hal::SWITCH_HEADPHONES));
}
return mState.value() != hal::SWITCH_STATE_OFF &&
mState.value() != hal::SWITCH_STATE_UNKNOWN;
}
bool SetVolumeControlChannel(const nsAString& aChannel);
@ -67,7 +71,7 @@ protected:
private:
void NotifyVolumeControlChannelChanged();
hal::SwitchState mState;
Maybe<hal::SwitchState> mState;
int32_t mVolumeChannel;
};

View File

@ -287,7 +287,13 @@ GonkDisplayJB::Post(buffer_handle_t buf, int fence)
#endif
mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
mDispSurface->setReleaseFenceFd(mList->hwLayers[1].releaseFenceFd);
if (!mBootAnimDispSurface.get()) {
mDispSurface->setReleaseFenceFd(mList->hwLayers[1].releaseFenceFd);
} else {
mBootAnimDispSurface->setReleaseFenceFd(mList->hwLayers[1].releaseFenceFd);
}
if (mList->retireFenceFd >= 0)
close(mList->retireFenceFd);
return !err;