Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Use 'bluetooth.enabled' in mozSettings to represent bluetooth status. #2492

Merged
merged 3 commits into from
Jul 17, 2012

Conversation

evelynhung
Copy link
Contributor

#2402: [System][Settings] Reorganize bluetooth module

use 'bluetooth.enabled' in mozSettings to represent bluetooth status.
all user setting inputs is going to change this value, instead of enable/disable bluetooth.
system/js/bluetooth.js implements desired state.

use 'bluetooth.enabled' in mozSettings to represent bluetooth status.
all user setting inputs is going to change this value, instead of enable/disable bluetooth.
system/js/bluetooth.js implements desired state.
settings.getLock().set({'ril.data.disabled': this.reservedSettings.data});
if (settings) {
settings.getLock().set({'ril.data.enabled': this.reservedSettings.data});
settings.getLock().set({'bluetooth.enabled': this.reservedSettings.bluetooth});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (settings && this.reservedSettings.bluetooth) {
    settings.getLock().set({'bluetooth.enabled': true});
}

It is to say, turn on bluetooth status iff the status of the reserved value is true.
Otherwise do nothing.

Same as ril.data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I remove it simply because the value will be checked again in system/js/bluetooth.js.
but I think ril.data needs to be checked here, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, @alivedise is talking about logic of flight mode. You should keep the this.reservedSettings.bluetooth check.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's isolate the flight mode logic into another module and map it to ril.radio.disabled so both sleep menu and settings app can use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I supposed this.reservedSettings.* recorded the previous settings, and I set it back after turning off flight mode, no matter it's on/off, isn't it?
Regard to isolating flight mode logic, I will do it for #2404.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid..no :|
Should not turn off when airplane mode terminates if anything is turned on during airplane mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I got it. I didn't think of it will be changed individually by user in flight mode on, so this.reservedSettings.* may not sync with current state.
Thanks for review. :)

1. only set (previous) enabled item back when turn off flight mode.
2. remove unnecessary UI setting.
3. gjslint my code.
@alivedise
Copy link
Contributor

/botio lint

@ghost
Copy link

ghost commented Jul 17, 2012

From: Bot.io (Main)


Received

Command cmd_lint from @alivedise received. Current queue size: 0

Live output at: http://50.116.11.35:8000/18b40c5b4e39c37/output.txt

@ghost
Copy link

ghost commented Jul 17, 2012

From: Bot.io (Main)


Success

Full output at http://50.116.11.35:8000/18b40c5b4e39c37/output.txt

Total script time: 0.89 mins

  • Lint: Passed

settings.addObserver('bluetooth.enabled', function(event) {
if (event.settingValue) {
gBluetoothPowerStatus.textContent = 'Enabled';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else {

alivedise added a commit that referenced this pull request Jul 17, 2012
Use 'bluetooth.enabled' in mozSettings to represent bluetooth status.
@alivedise alivedise merged commit eb5c6da into mozilla-b2g:master Jul 17, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants