Right now Bluetooth is unconditionally enabled after turning off airplane mode
regardless of whether or not it was on before. This patch fixes that.
BUG: 413967
FIXED-IN: 5.18.0
Right now Bluetooth is unconditionally enabled after turning off airplane mode
regardless of whether or not it was on before. This patch fixes that.
BUG: 413967
FIXED-IN: 5.18.0
Bluetooth stays off (the bug is fixed)
Bluetooth stays on (no regression)
No Linters Available |
No Unit Test Coverage |
Buildable 18796 | |
Build 18814: arc lint + arc unit |
libs/handler.cpp | ||
---|---|---|
366–369 | You're asynchronously querying the bluetooth state with multiple calls. DBus will maintain order of individual calls, but N async things vs N async things is less determined |
Nothing checks the previous BT status, so by the time we get to the function to enable BT, it can't know whether it was on before.
...Unless I'm misunderstanding you?
You are right, I didn't properly read what you do. I still think we should modify the already existing function to additionaly save the previous state, because most of the code is same. The only difference is "Set" vs "Get" method on DBus.
We were actually saving already the value of current BT state, it was just not used. Your code assumes there is just one BT adapter, while in theory there might be more of them. What I would just is just simply not add property like m_tmpBluetoothEnabled and use m_bluetoothAdapters to check if the specific BT adapter was enabled before, that's why we save the object path together with the value. This should be done in the else if (enable && m_bluetoothAdapters.value(objPath)) branch. Just check whether it was enabled before and enable it in that case.
Sorry for not looking into this properly before, I'm attending the LAS conference and didn't have that much time.
Hmm, reading the code more closely, it looks like it should already work. In fact, when I remove all my changes... it does work! I could have sworn that it didn't work before though.
Does this make any sense? Could it have been fixed by 7dd740aa963057c255fbbe83366504bbe48a240e?
Not sure whether the change mentioned above, but it should indeed work just fine. The "else if" branch checks whether an adapter was enabled before so it does what it's supposed to do.