mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge b2g-inbound to m-c.
This commit is contained in:
commit
e41d40d2e1
@ -19,8 +19,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="0292e64ef8451df104dcf9ac3b2c6749b81684dd"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="85f9690323b235f4dcf2901ea2240d3c60fc22a0"/>
|
||||
|
@ -17,8 +17,8 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -15,9 +15,9 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="65fba428f8d76336b33ddd9e15900357953600ba">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -19,8 +19,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="0292e64ef8451df104dcf9ac3b2c6749b81684dd"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="85f9690323b235f4dcf2901ea2240d3c60fc22a0"/>
|
||||
|
@ -18,8 +18,8 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "a0017eff21d39da46b6e8cf993f8fecf9ccb2af2",
|
||||
"revision": "949df3be29b432b53a4ee232e7fd19881b5aca6b",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
|
@ -15,8 +15,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
|
@ -19,8 +19,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
|
@ -17,8 +17,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
|
@ -17,8 +17,8 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -17,8 +17,8 @@
|
||||
<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="56f79456db5dc3ca010a56d09e1e8cc15a2408db"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="265e1ac4ee71ad6190335c974bfce33f783edfce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2f28398184d20480254ca275a441a1c79a1a9d8c"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
|
@ -395,14 +395,14 @@ endif
|
||||
# Build it
|
||||
|
||||
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE)
|
||||
+$(MOZ_MAKE)
|
||||
|
||||
####################################
|
||||
# Other targets
|
||||
|
||||
# Pass these target onto the real build system
|
||||
$(OBJDIR_TARGETS):: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) $@
|
||||
+$(MOZ_MAKE) $@
|
||||
|
||||
####################################
|
||||
# Postflight
|
||||
|
@ -24,6 +24,9 @@
|
||||
#define CHANNEL_WIDTH_100KHZ 100
|
||||
#define CHANNEL_WIDTH_50KHZ 50
|
||||
|
||||
#define MOZSETTINGS_CHANGED_ID "mozsettings-changed"
|
||||
#define SETTING_KEY_AIRPLANEMODE_ENABLED "airplaneMode.enabled"
|
||||
|
||||
using namespace mozilla::hal;
|
||||
using mozilla::Preferences;
|
||||
|
||||
@ -45,8 +48,8 @@ StaticRefPtr<FMRadioService> FMRadioService::sFMRadioService;
|
||||
FMRadioService::FMRadioService()
|
||||
: mPendingFrequencyInKHz(0)
|
||||
, mState(Disabled)
|
||||
, mHasReadRilSetting(false)
|
||||
, mRilDisabled(false)
|
||||
, mHasReadAirplaneModeSetting(false)
|
||||
, mAirplaneModeEnabled(false)
|
||||
, mPendingRequest(nullptr)
|
||||
, mObserverList(FMRadioEventObserverList())
|
||||
{
|
||||
@ -90,6 +93,12 @@ FMRadioService::FMRadioService()
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
|
||||
if (obs && NS_FAILED(obs->AddObserver(this,
|
||||
MOZSETTINGS_CHANGED_ID,
|
||||
/* useWeak */ false))) {
|
||||
NS_WARNING("Failed to add settings change observer!");
|
||||
}
|
||||
|
||||
RegisterFMRadioObserver(this);
|
||||
}
|
||||
|
||||
@ -128,12 +137,12 @@ private:
|
||||
* Read the airplane-mode setting, if the airplane-mode is not enabled, we
|
||||
* enable the FM radio.
|
||||
*/
|
||||
class ReadRilSettingTask MOZ_FINAL : public nsISettingsServiceCallback
|
||||
class ReadAirplaneModeSettingTask MOZ_FINAL : public nsISettingsServiceCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
ReadRilSettingTask(nsRefPtr<FMRadioReplyRunnable> aPendingRequest)
|
||||
ReadAirplaneModeSettingTask(nsRefPtr<FMRadioReplyRunnable> aPendingRequest)
|
||||
: mPendingRequest(aPendingRequest) { }
|
||||
|
||||
NS_IMETHOD
|
||||
@ -142,7 +151,7 @@ public:
|
||||
FMRadioService* fmRadioService = FMRadioService::Singleton();
|
||||
MOZ_ASSERT(mPendingRequest == fmRadioService->mPendingRequest);
|
||||
|
||||
fmRadioService->mHasReadRilSetting = true;
|
||||
fmRadioService->mHasReadAirplaneModeSetting = true;
|
||||
|
||||
if (!aResult.isBoolean()) {
|
||||
// Failed to read the setting value, set the state back to Disabled.
|
||||
@ -151,8 +160,8 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
fmRadioService->mRilDisabled = aResult.toBoolean();
|
||||
if (!fmRadioService->mRilDisabled) {
|
||||
fmRadioService->mAirplaneModeEnabled = aResult.toBoolean();
|
||||
if (!fmRadioService->mAirplaneModeEnabled) {
|
||||
EnableRunnable* runnable =
|
||||
new EnableRunnable(fmRadioService->mUpperBoundInKHz,
|
||||
fmRadioService->mLowerBoundInKHz,
|
||||
@ -183,7 +192,7 @@ private:
|
||||
nsRefPtr<FMRadioReplyRunnable> mPendingRequest;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ReadRilSettingTask, nsISettingsServiceCallback)
|
||||
NS_IMPL_ISUPPORTS1(ReadAirplaneModeSettingTask, nsISettingsServiceCallback)
|
||||
|
||||
class DisableRunnable MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
@ -407,7 +416,7 @@ FMRadioService::Enable(double aFrequencyInMHz,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mHasReadRilSetting && mRilDisabled) {
|
||||
if (mHasReadAirplaneModeSetting && mAirplaneModeEnabled) {
|
||||
aReplyRunnable->SetReply(ErrorResponse(
|
||||
NS_LITERAL_STRING("Airplane mode currently enabled")));
|
||||
NS_DispatchToMainThread(aReplyRunnable);
|
||||
@ -422,7 +431,7 @@ FMRadioService::Enable(double aFrequencyInMHz,
|
||||
// Cache the frequency value, and set it after the FM radio HW is enabled
|
||||
mPendingFrequencyInKHz = roundedFrequency;
|
||||
|
||||
if (!mHasReadRilSetting) {
|
||||
if (!mHasReadAirplaneModeSetting) {
|
||||
nsCOMPtr<nsISettingsService> settings =
|
||||
do_GetService("@mozilla.org/settingsService;1");
|
||||
|
||||
@ -434,10 +443,10 @@ FMRadioService::Enable(double aFrequencyInMHz,
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<ReadRilSettingTask> callback =
|
||||
new ReadRilSettingTask(mPendingRequest);
|
||||
nsRefPtr<ReadAirplaneModeSettingTask> callback =
|
||||
new ReadAirplaneModeSettingTask(mPendingRequest);
|
||||
|
||||
rv = settingsLock->Get("ril.radio.disabled", callback);
|
||||
rv = settingsLock->Get(SETTING_KEY_AIRPLANEMODE_ENABLED, callback);
|
||||
if (NS_FAILED(rv)) {
|
||||
TransitionState(ErrorResponse(
|
||||
NS_LITERAL_STRING("Can't get settings lock")), Disabled);
|
||||
@ -454,18 +463,25 @@ FMRadioService::Enable(double aFrequencyInMHz,
|
||||
void
|
||||
FMRadioService::Disable(FMRadioReplyRunnable* aReplyRunnable)
|
||||
{
|
||||
// When airplane-mode is enabled, we will call this function from
|
||||
// FMRadioService::Observe without passing a FMRadioReplyRunnable,
|
||||
// so we have to check if |aReplyRunnable| is null before we dispatch it.
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
switch (mState) {
|
||||
case Disabling:
|
||||
if (aReplyRunnable) {
|
||||
aReplyRunnable->SetReply(
|
||||
ErrorResponse(NS_LITERAL_STRING("FM radio currently disabling")));
|
||||
NS_DispatchToMainThread(aReplyRunnable);
|
||||
}
|
||||
return;
|
||||
case Disabled:
|
||||
if (aReplyRunnable) {
|
||||
aReplyRunnable->SetReply(
|
||||
ErrorResponse(NS_LITERAL_STRING("FM radio currently disabled")));
|
||||
NS_DispatchToMainThread(aReplyRunnable);
|
||||
}
|
||||
return;
|
||||
case Enabled:
|
||||
case Enabling:
|
||||
@ -494,14 +510,16 @@ FMRadioService::Disable(FMRadioReplyRunnable* aReplyRunnable)
|
||||
ErrorResponse(NS_LITERAL_STRING("Enable action is cancelled")));
|
||||
NS_DispatchToMainThread(enablingRequest);
|
||||
|
||||
// If we haven't read the ril settings yet we won't enable the FM radio HW,
|
||||
// so fail the disable request immediately.
|
||||
if (!mHasReadRilSetting) {
|
||||
// If we haven't read the airplane mode settings yet we won't enable the
|
||||
// FM radio HW, so fail the disable request immediately.
|
||||
if (!mHasReadAirplaneModeSetting) {
|
||||
SetState(Disabled);
|
||||
|
||||
if (aReplyRunnable) {
|
||||
aReplyRunnable->SetReply(SuccessResponse());
|
||||
NS_DispatchToMainThread(aReplyRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@ -631,6 +649,66 @@ FMRadioService::CancelSeek(FMRadioReplyRunnable* aReplyRunnable)
|
||||
NS_DispatchToMainThread(aReplyRunnable);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FMRadioService::Observe(nsISupports * aSubject,
|
||||
const char * aTopic,
|
||||
const char16_t * aData)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(sFMRadioService);
|
||||
|
||||
if (strcmp(aTopic, MOZSETTINGS_CHANGED_ID) != 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// The string that we're interested in will be a JSON string looks like:
|
||||
// {"key":"airplaneMode.enabled","value":true}
|
||||
AutoSafeJSContext cx;
|
||||
const nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
!val.isObject()) {
|
||||
NS_WARNING("Bad JSON string format.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
NS_WARNING("Failed to get string property `key`.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> jsKey(cx, key.toString());
|
||||
nsDependentJSString keyStr;
|
||||
if (!keyStr.init(cx, jsKey)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (keyStr.EqualsLiteral(SETTING_KEY_AIRPLANEMODE_ENABLED)) {
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)) {
|
||||
NS_WARNING("Failed to get property `value`.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!value.isBoolean()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mAirplaneModeEnabled = value.toBoolean();
|
||||
mHasReadAirplaneModeSetting = true;
|
||||
|
||||
// Disable the FM radio HW if Airplane mode is enabled.
|
||||
if (mAirplaneModeEnabled) {
|
||||
Disable(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
FMRadioService::NotifyFMRadioEvent(FMRadioEventType aType)
|
||||
{
|
||||
@ -732,7 +810,7 @@ FMRadioService::Singleton()
|
||||
return sFMRadioService;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS0(FMRadioService)
|
||||
NS_IMPL_ISUPPORTS1(FMRadioService, nsIObserver)
|
||||
|
||||
END_FMRADIO_NAMESPACE
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
BEGIN_FMRADIO_NAMESPACE
|
||||
@ -136,10 +137,10 @@ enum FMRadioState
|
||||
};
|
||||
|
||||
class FMRadioService MOZ_FINAL : public IFMRadioService
|
||||
, public nsISupports
|
||||
, public hal::FMRadioObserver
|
||||
, public nsIObserver
|
||||
{
|
||||
friend class ReadRilSettingTask;
|
||||
friend class ReadAirplaneModeSettingTask;
|
||||
friend class SetFrequencyRunnable;
|
||||
|
||||
public:
|
||||
@ -171,6 +172,8 @@ public:
|
||||
/* FMRadioObserver */
|
||||
void Notify(const hal::FMRadioOperationInformation& aInfo) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
protected:
|
||||
FMRadioService();
|
||||
|
||||
@ -191,8 +194,8 @@ private:
|
||||
|
||||
FMRadioState mState;
|
||||
|
||||
bool mHasReadRilSetting;
|
||||
bool mRilDisabled;
|
||||
bool mHasReadAirplaneModeSetting;
|
||||
bool mAirplaneModeEnabled;
|
||||
|
||||
double mUpperBoundInKHz;
|
||||
double mLowerBoundInKHz;
|
||||
|
@ -10,4 +10,5 @@ qemu = false
|
||||
[test_one_seek_at_once.js]
|
||||
[test_seek_up_and_down.js]
|
||||
[test_bug862672.js]
|
||||
[test_bug876597.js]
|
||||
|
||||
|
90
dom/fmradio/test/marionette/test_bug876597.js
Normal file
90
dom/fmradio/test/marionette/test_bug876597.js
Normal file
@ -0,0 +1,90 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 10000;
|
||||
|
||||
SpecialPowers.addPermission("fmradio", true, document);
|
||||
SpecialPowers.addPermission("settings-read", true, document);
|
||||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
|
||||
let FMRadio = window.navigator.mozFMRadio;
|
||||
let mozSettings = window.navigator.mozSettings;
|
||||
let KEY = "airplaneMode.enabled";
|
||||
|
||||
function verifyInitialState() {
|
||||
log("Verifying initial state.");
|
||||
ok(FMRadio);
|
||||
is(FMRadio.enabled, false);
|
||||
ok(mozSettings);
|
||||
|
||||
checkAirplaneModeSettings();
|
||||
}
|
||||
|
||||
function checkAirplaneModeSettings() {
|
||||
log("Checking airplane mode settings");
|
||||
let req = mozSettings.createLock().get(KEY);
|
||||
req.onsuccess = function(event) {
|
||||
ok(!req.result[KEY], "Airplane mode is disabled.");
|
||||
enableFMRadio();
|
||||
};
|
||||
|
||||
req.onerror = function() {
|
||||
ok(false, "Error occurs when reading settings value.");
|
||||
finish();
|
||||
};
|
||||
}
|
||||
|
||||
function enableFMRadio() {
|
||||
log("Enable FM radio");
|
||||
let frequency = FMRadio.frequencyLowerBound + FMRadio.channelWidth;
|
||||
let req = FMRadio.enable(frequency);
|
||||
|
||||
req.onsuccess = function() {
|
||||
enableAirplaneMode();
|
||||
};
|
||||
|
||||
req.onerror = function() {
|
||||
ok(false, "Failed to enable FM radio.");
|
||||
};
|
||||
}
|
||||
|
||||
function enableAirplaneMode() {
|
||||
log("Enable airplane mode");
|
||||
FMRadio.ondisabled = function() {
|
||||
FMRadio.ondisabled = null;
|
||||
enableFMRadioWithAirplaneModeEnabled();
|
||||
};
|
||||
|
||||
let settings = {};
|
||||
settings[KEY] = true;
|
||||
mozSettings.createLock().set(settings);
|
||||
}
|
||||
|
||||
function enableFMRadioWithAirplaneModeEnabled() {
|
||||
log("Enable FM radio with airplane mode enabled");
|
||||
let frequency = FMRadio.frequencyLowerBound + FMRadio.channelWidth;
|
||||
let req = FMRadio.enable(frequency);
|
||||
req.onerror = cleanUp();
|
||||
|
||||
req.onsuccess = function() {
|
||||
ok(false, "FMRadio could be enabled when airplane mode is enabled.");
|
||||
};
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
let settings = {};
|
||||
settings[KEY] = false;
|
||||
let req = mozSettings.createLock().set(settings);
|
||||
|
||||
req.onsuccess = function() {
|
||||
ok(!FMRadio.enabled);
|
||||
finish();
|
||||
};
|
||||
|
||||
req.onerror = function() {
|
||||
ok(false, "Error occurs when setting value");
|
||||
};
|
||||
}
|
||||
|
||||
verifyInitialState();
|
||||
|
@ -1551,6 +1551,8 @@ RilObject.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
call.hangUpLocal = true;
|
||||
|
||||
if (call.state === CALL_STATE_HOLDING) {
|
||||
this.sendHangUpBackgroundRequest(callIndex);
|
||||
} else {
|
||||
@ -1629,6 +1631,8 @@ RilObject.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
call.hangUpLocal = true;
|
||||
|
||||
let Buf = this.context.Buf;
|
||||
if (this._isCdma) {
|
||||
// AT+CHLD=0 means "release held or UDUB."
|
||||
@ -3762,7 +3766,9 @@ RilObject.prototype = {
|
||||
if (this.currentConference.participants[currentCall.callIndex]) {
|
||||
conferenceChanged = true;
|
||||
}
|
||||
this._removeVoiceCall(currentCall);
|
||||
this._removeVoiceCall(currentCall,
|
||||
currentCall.hangUpLocal ?
|
||||
GECKO_CALL_ERROR_NORMAL_CALL_CLEARING : null);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user