Merge lp:~seb128/ubuntu-system-settings/bluetooth-device-visibility-tweak into lp:ubuntu-system-settings

Proposed by Sebastien Bacher on 2015-02-18
Status: Merged
Approved by: Ricardo Salveti on 2015-03-06
Approved revision: 1316
Merged at revision: 1344
Proposed branch: lp:~seb128/ubuntu-system-settings/bluetooth-device-visibility-tweak
Merge into: lp:ubuntu-system-settings
Diff against target: 75 lines (+25/-1)
4 files modified
plugins/bluetooth/PageComponent.qml (+18/-0)
plugins/bluetooth/bluetooth.cpp (+5/-0)
plugins/bluetooth/bluetooth.h (+1/-0)
plugins/bluetooth/devicemodel.h (+1/-1)
To merge this branch: bzr merge lp:~seb128/ubuntu-system-settings/bluetooth-device-visibility-tweak
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve on 2015-03-06
PS Jenkins bot continuous-integration Needs Fixing on 2015-02-25
Ken VanDine 2015-02-18 Needs Information on 2015-02-20
Review via email: mp+250105@code.launchpad.net

Commit Message

bluetooth: disable device visiblity when switching out, that way it's not
staying on if the settings are closed from the switcher or if the user switch
to another software

Description of the Change

bluetooth: disable device visiblity when switching out, that way it's not
staying on if the settings are closed from the switcher or if the user switch
to another software

To post a comment you must log in.
Ken VanDine (ken-vandine) wrote :

Do we really want to make it discoverable regardless of the previous state?

review: Needs Information
1314. By Sebastien Bacher on 2015-02-25

rebase on trunk

1315. By Sebastien Bacher on 2015-02-25

delay the start by a second as described on the spec

Sebastien Bacher (seb128) wrote :

> Do we really want to make it discoverable regardless of the previous state?

The specification states it should be made discoverable when the view is open, so yes? I've pushed a small update to delay the start by 1s since that's what the spec describes

1316. By Sebastien Bacher on 2015-02-25

revert buggy rebase change

Ricardo Salveti (rsalveti) wrote :

This is still not going to fix the case when the app gets closed before getting suspended.

Same happens if you kill the app.

I think the proper implementation here would be to set a timeout when making the device visible, and only trigger it again (after the timeout) if the bt screen is opened.

review: Needs Fixing
Ricardo Mendoza (ricmm) wrote :

For this, you could use the DiscoverableTimeout property of bluez, just set it to something reasonable and have a way for the user to make it discoverable again.

Short of this, I don't know how much we can do about the app being closed / crashing case. It's always safer to have the timeout, even if you'd like to make it a 5 minutes one.

Ricardo Mendoza (ricmm) wrote :

Of course, the timeout being in addition to whats already provided by this MR. The timeout is only to safeguard against the closing/crashing case if it happens while the app is in focus.

Ricardo Salveti (rsalveti) wrote :

Yeah, after talking over IRC and looking to understand why the default timeout in bluez was 0, it's clear that it should be fixed there instead (which was fixed already in upstream).

So pushed a new bluez in the same silo to change the default timeout value.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/bluetooth/PageComponent.qml'
2--- plugins/bluetooth/PageComponent.qml 2015-02-10 11:19:53 +0000
3+++ plugins/bluetooth/PageComponent.qml 2015-02-25 10:34:54 +0000
4@@ -36,6 +36,24 @@
5
6 UbuntuBluetoothPanel { id: backend }
7
8+ Timer {
9+ id: discoverableTimer
10+ onTriggered: backend.trySetDiscoverable(true)
11+ }
12+
13+ /* Disable bt visiblity when switching out */
14+ Connections {
15+ target: Qt.application
16+ onActiveChanged: {
17+ if (Qt.application.state === Qt.ApplicationSuspended) {
18+ backend.trySetDiscoverable(false)
19+ }
20+ else {
21+ discoverableTimer.start()
22+ }
23+ }
24+ }
25+
26 Component {
27 id: confirmPasskeyDialog
28 ConfirmPasskeyDialog { }
29
30=== modified file 'plugins/bluetooth/bluetooth.cpp'
31--- plugins/bluetooth/bluetooth.cpp 2015-02-10 11:19:53 +0000
32+++ plugins/bluetooth/bluetooth.cpp 2015-02-25 10:34:54 +0000
33@@ -88,6 +88,11 @@
34 m_devices.stopDiscovery();
35 }
36
37+void Bluetooth::trySetDiscoverable(bool discoverable)
38+{
39+ m_devices.trySetDiscoverable(discoverable);
40+}
41+
42 bool Bluetooth::isSupportedType(const int type)
43 {
44 switch((Device::Type)type) {
45
46=== modified file 'plugins/bluetooth/bluetooth.h'
47--- plugins/bluetooth/bluetooth.h 2015-02-10 11:19:53 +0000
48+++ plugins/bluetooth/bluetooth.h 2015-02-25 10:34:54 +0000
49@@ -83,6 +83,7 @@
50 Q_INVOKABLE void startDiscovery();
51 Q_INVOKABLE void stopDiscovery();
52 Q_INVOKABLE static bool isSupportedType(const int type);
53+ Q_INVOKABLE void trySetDiscoverable(bool discoverable);
54
55 public:
56 Agent * getAgent();
57
58=== modified file 'plugins/bluetooth/devicemodel.h'
59--- plugins/bluetooth/devicemodel.h 2014-08-11 09:18:12 +0000
60+++ plugins/bluetooth/devicemodel.h 2015-02-25 10:34:54 +0000
61@@ -74,6 +74,7 @@
62 void stopDiscovery();
63 void startDiscovery();
64 void toggleDiscovery();
65+ void trySetDiscoverable(bool discoverable);
66
67 Q_SIGNALS:
68 void poweredChanged(bool powered);
69@@ -96,7 +97,6 @@
70 QTimer m_timer;
71 QTimer m_discoverableTimer;
72 void restartTimer();
73- void trySetDiscoverable(bool discoverable);
74 void setDiscoverable(bool discoverable);
75 void setPowered(bool powered);
76

Subscribers

People subscribed via source and target branches