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

Proposed by Sebastien Bacher
Status: Merged
Approved by: Ricardo Salveti
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
PS Jenkins bot continuous-integration Needs Fixing
Ken VanDine Needs Information
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.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

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

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1314. By Sebastien Bacher

rebase on trunk

1315. By Sebastien Bacher

delay the start by a second as described on the spec

Revision history for this message
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

revert buggy rebase change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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
Revision history for this message
Ricardo Salveti (rsalveti) wrote :
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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