-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Use 'bluetooth.enabled' in mozSettings to represent bluetooth status. #2492
Conversation
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}); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
/botio lint |
From: Bot.io (Main)ReceivedCommand cmd_lint from @alivedise received. Current queue size: 0 Live output at: http://50.116.11.35:8000/18b40c5b4e39c37/output.txt |
From: Bot.io (Main)SuccessFull output at http://50.116.11.35:8000/18b40c5b4e39c37/output.txt Total script time: 0.89 mins
|
settings.addObserver('bluetooth.enabled', function(event) { | ||
if (event.settingValue) { | ||
gBluetoothPowerStatus.textContent = 'Enabled'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else {
Use 'bluetooth.enabled' in mozSettings to represent bluetooth status.
#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.