GNOME Bugzilla – Bug 789110
bluetooth: inconsistent state sometimes when coming back from suspend
Last modified: 2020-01-17 03:47:59 UTC
Created attachment 361759 [details] Inconsistency in the bluetooth menu In Endless's fork of GNOME Shell 3.24, we sometimes get an inconsistent state in the system menu for the Bluetooth, that leads to weird situations where you see the menu item as "Off" even if bluetooth is active (and we know that because we can use the BT mouse), with a submenu item showing "Turn Off". See the attached picture for a better visual description of the problem. As far as I can see, this is a problem in master too, patch will be coming soon..
Created attachment 361760 [details] [review] 1. bluetooth: Add missing 'BluetoothHardwareAirplaneMode' to D-Bus interface
Created attachment 361761 [details] [review] 2. bluetooth: Be consistent when determining whether Bluetooth is off
Review of attachment 361760 [details] [review]: Whoops
Review of attachment 361761 [details] [review]: > otherwise we risk showing inconsistent states in each place if. I'd be interested in how that sentence continues :-p Joking aside, I don't think this is correct. As far as I can see, "nConnectedDevices == -1" means there is no Bluetooth adapter that is powered on - we can toggle the AirplaneMode property as much as we want (that's what "Turn On/Off" does after all), that's not going to change. So a better option may be to do this._toggleItem.actor.visible = nConnectedDevices > -1; instead ... ::: js/ui/status/bluetooth.js @@ +134,3 @@ + // Bluetooth will be considered 'Off' if either the adapter + // is not available or it's set in irplane mode. *airplane
Comment on attachment 361760 [details] [review] 1. bluetooth: Add missing 'BluetoothHardwareAirplaneMode' to D-Bus interface (In reply to Florian Müllner from comment #3) > Review of attachment 361760 [details] [review] [review]: > > Whoops Thanks for the review. Commmitted: https://git.gnome.org/browse/gnome-shell/commit/?id=fb3070981c549ad9812d62f8ab868c323ed2ccf5
(In reply to Florian Müllner from comment #4) > Review of attachment 361761 [details] [review] [review]: > > > otherwise we risk showing inconsistent states in each place if. > > I'd be interested in how that sentence continues :-p I'd be too, but I can't remember what I had in there :). I suppose it' was something along the lines of "...if the adapter is available but it's set in airplane mode". > Joking aside, I don't think this is correct. As far as I can see, > "nConnectedDevices == -1" means there is no Bluetooth adapter that is > powered on - we can toggle the AirplaneMode property as much as we want > (that's what "Turn On/Off" does after all), that's not going to change. So a > better option may be to do > > this._toggleItem.actor.visible = nConnectedDevices > -1; > > instead ... > > ::: js/ui/status/bluetooth.js > @@ +134,3 @@ > > + // Bluetooth will be considered 'Off' if either the adapter > + // is not available or it's set in irplane mode. > > *airplane I thought the same thing, but I'm not 100% sure on whether it's possible to have a BT adapter that would be "powered on"/"available" and would still report to be in airplane mode (either soft or hard), so I thought the sane thing to do was to check both things, just in case. What looks more clear to me, is that the same condition should be used in both places, since what you want to show in both labels depend on exactly the same thing. I'm adding Bastien to CC, since he added the original code and might have extra info to decide what's best to do here.
Was moved to https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/118, closing.
Please reopen this bug. The above link is not a bug.