From: Matt Ranostay Date: Wed, 3 Apr 2019 03:05:26 +0000 (-0700) Subject: settings: bluetooth: qml: cleanup onPoweredChanged slot X-Git-Tag: 7.0.1^0 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F14%2F20914%2F1;p=apps%2Fsettings.git settings: bluetooth: qml: cleanup onPoweredChanged slot Move enabling of discovery + discoverablity to the respective slot to avoid race conditions from the adapter powering on Bug-AGL: SPEC-2295 SPEC-2290 Change-Id: I16c04d7bcd880ef5dcc5352d0da52ce2fe8b2447 Signed-off-by: Matt Ranostay --- diff --git a/app/bluetooth/Bluetooth.qml b/app/bluetooth/Bluetooth.qml index efc2374..b2b3308 100644 --- a/app/bluetooth/Bluetooth.qml +++ b/app/bluetooth/Bluetooth.qml @@ -33,7 +33,14 @@ SettingPage { bluetooth.send_confirmation(data.pincode) } - onPowerChanged: if (!root.checked) root.checked = state + onPowerChanged: { + if (state) { + bluetooth.start_discovery() + bluetooth.discoverable = true; + } + root.checked = state + } + } Text { @@ -46,12 +53,7 @@ SettingPage { onCheckedChanged: { console.log("Bluetooth set to", checked) - - bluetooth.power = checked; - bluetooth.discoverable = checked; - - if (checked == true) - bluetooth.start_discovery() + bluetooth.power = checked } Rectangle {