Merge lp:~dbarth/ubuntu-system-settings/location-apps into lp:ubuntu-system-settings

Proposed by David Barth
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 952
Merged at revision: 1001
Proposed branch: lp:~dbarth/ubuntu-system-settings/location-apps
Merge into: lp:ubuntu-system-settings
Diff against target: 142 lines (+63/-15)
3 files modified
plugins/security-privacy/Location.qml (+17/-6)
plugins/security-privacy/PageComponent.qml (+14/-4)
plugins/security-privacy/trust-store-model.cpp (+32/-5)
To merge this branch: bzr merge lp:~dbarth/ubuntu-system-settings/location-apps
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Sebastien Bacher (community) Approve
Alberto Mardegan Approve
Alexandre Abreu (community) Approve
Review via email: mp+232575@code.launchpad.net

Commit message

Enable location panel, display contols for authorized applications.

Description of the change

Enable location panel, display contols for authorized applications.

Note: icon files and application names are not always working; there is a bug in the trust-store-model access code.

To post a comment you must log in.
947. By David Barth

comment

Revision history for this message
Alberto Mardegan (mardy) wrote :

I didn't test it, but looks good!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:947
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~dbarth/ubuntu-system-settings/location-apps/+merge/232575/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1328/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/4200
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/3181
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/520
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/4016
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5452
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5452/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/12302
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2599
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3468
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3468/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1328/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, I've one comment inline, also is there a bug about the icons issue? It seems like something to fix before enabling the feature, the dialog looks quite buggy without those

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

(the titles are also missing, which gives 3 empty lines and 1 for camera, it's not really usable)

Revision history for this message
Sebastien Bacher (seb128) wrote :

could you also look at enabling/displaying th caption described in the design?

948. By David Barth

display all text in debug mode

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
949. By David Barth

filter out unconfined apps; lookup desktop file for apps without version numbers

950. By David Barth

improve rendering of the location entry

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

A few inline comments, nothing major.

review: Needs Fixing
951. By David Barth

cleanups

Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve
Revision history for this message
Alberto Mardegan (mardy) wrote :

Looks good to me!

review: Approve
Revision history for this message
Sebastien Bacher (seb128) wrote :

David, testing the debs from the C.I run from earlier today, on a krillin device, I still get camera and 3 rows without a title nor an icon... what informations do you need to debug those empty row issues?

review: Needs Fixing
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: Approve (continuous-integration)
Revision history for this message
David Barth (dbarth) wrote :

You should try the packages from the silo, ie https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-017 and that package version number: 0.3+14.10.20140904.2-0ubuntu1

If the problem persists, please email me the trustdb in:
~/.local/share/UbuntuLocationService/
and all desktop files in ~/.local/share/applications

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

tested the debs in the silo

Approved location access for camera and it showed up in the list as the only entry
Approved access for the browser and it does not show up in the list
Approved access for openstreetmap and it showed in the list
I ran clock and weather but they did not prompt for access and they do not show up in the list. I even scanned for location in weather.

When I disabled the camera access I saw this message on the terminal output
2014-09-04 18:03:40,782 - WARNING - file:///usr/share/ubuntu/settings/system/qml-plugins/security-privacy/Location.qml:106: TypeError: Property 'setEnabled' of object QQmlDMAbstractItemModelData(0x91c990) is not a function

Restarted settings and camera was still enabled

Revision history for this message
David Barth (dbarth) wrote :

The applications which do not appear on the list are 'unconfined'
applications. They can't be controled as they have all privileges
potentially. If we want to control the browser, we need to fix apparmor,
trust-store and then update webbrowser-app.

The function issue is a bug, re-factoring: thanks for spotting that one.
It's fixed in the new rev.

But in geneal, the main problem is going to be that apps have the logic to
request authorizations, but may not have the right logic to react whn the
authorization is removed.

I think this is independent of the settings, as technically the trust store
db is updated to reflect the authorization status.

On Fri, Sep 5, 2014 at 12:11 AM, Pat McGowan <email address hidden>
wrote:

> tested the debs in the silo
>
> Approved location access for camera and it showed up in the list as the
> only entry
> Approved access for the browser and it does not show up in the list
> Approved access for openstreetmap and it showed in the list
> I ran clock and weather but they did not prompt for access and they do not
> show up in the list. I even scanned for location in weather.
>
> When I disabled the camera access I saw this message on the terminal output
> 2014-09-04 18:03:40,782 - WARNING -
> file:///usr/share/ubuntu/settings/system/qml-plugins/security-privacy/Location.qml:106:
> TypeError: Property 'setEnabled' of object
> QQmlDMAbstractItemModelData(0x91c990) is not a function
>
> Restarted settings and camera was still enabled
>
>
> --
>
> https://code.launchpad.net/~dbarth/ubuntu-system-settings/location-apps/+merge/232575
> You are the owner of lp:~dbarth/ubuntu-system-settings/location-apps.
>

952. By David Barth

call the right model to toggle the setting

Revision history for this message
Sebastien Bacher (seb128) wrote :

Ok, looks fine to me after clearing out ~/.local/share/UbuntuLocationService, I guess I had an old configuration from previous tests there.

review: Approve
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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/security-privacy/Location.qml'
2--- plugins/security-privacy/Location.qml 2013-09-24 12:33:58 +0000
3+++ plugins/security-privacy/Location.qml 2014-09-05 08:59:08 +0000
4@@ -23,6 +23,7 @@
5 import QtQuick 2.0
6 import Ubuntu.Components 0.1
7 import Ubuntu.Components.ListItems 0.1 as ListItem
8+import Ubuntu.SystemSettings.SecurityPrivacy 1.0
9 import SystemSettings 1.0
10
11 ItemPage {
12@@ -82,21 +83,31 @@
13 return i18n.tr("Uses wi-fi (currently off), cell tower locations (no current cellular connection), and GPS to detect your rough location. Turning off location detection saves battery.")
14 }
15
16- visible: showAllUI
17+ visible: showAllUI /* hide until the information is real */
18 }
19
20 ListItem.Standard {
21 text: i18n.tr("Allow access to location:")
22- visible: showAllUI && locationOn.checked
23+ visible: locationOn.checked
24+ }
25+
26+ TrustStoreModel {
27+ id: trustStoreModel
28+ serviceName: "UbuntuLocationService"
29 }
30
31 Repeater {
32- model: ["Browser", "Camera", "Clock", "Weather"]
33+ model: trustStoreModel
34 ListItem.Standard {
35- text: modelData
36- control: Switch { checked: true; enabled: false}
37- visible: showAllUI && locationOn.checked
38+ text: model.applicationName
39+ iconSource: model.iconName
40+ control: Switch {
41+ checked: model.granted
42+ onClicked: trustStoreModel.setEnabled(index, !model.granted)
43+ }
44+ visible: locationOn.checked
45 }
46 }
47+
48 }
49 }
50
51=== modified file 'plugins/security-privacy/PageComponent.qml'
52--- plugins/security-privacy/PageComponent.qml 2014-08-28 18:11:36 +0000
53+++ plugins/security-privacy/PageComponent.qml 2014-09-05 08:59:08 +0000
54@@ -231,13 +231,23 @@
55 Component.onCompleted: start()
56 }
57 ListItem.SingleValue {
58+ id: locationItem
59 text: i18n.tr("Location access")
60- value: locationActionGroup.enabled.state ?
61- i18n.tr("On") : i18n.tr("Off")
62+ value: ""
63 progression: true
64 onClicked: pageStack.push(Qt.resolvedUrl("Location.qml"))
65- visible: showAllUI && // Hidden until the indicator works
66- locationActionGroup.enabled.state !== undefined
67+ visible: true
68+ enabled: true
69+ property variant locationEnabled
70+ onLocationEnabledChanged: {
71+ value = locationEnabled ?
72+ i18n.tr("On") : i18n.tr("Off")
73+ }
74+ }
75+ Binding {
76+ target: locationItem
77+ property: "locationEnabled"
78+ value: locationActionGroup.enabled.state
79 }
80 ListItem.SingleValue {
81 text: i18n.tr("Other app access")
82
83=== modified file 'plugins/security-privacy/trust-store-model.cpp'
84--- plugins/security-privacy/trust-store-model.cpp 2014-08-20 12:50:09 +0000
85+++ plugins/security-privacy/trust-store-model.cpp 2014-09-05 08:59:08 +0000
86@@ -39,17 +39,38 @@
87 void setId(const QString &id) {
88 this->id = id;
89
90- QString localShare =
91- QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
92- QSettings desktopFile(QString("%1/applications/%2.desktop").
93- arg(localShare).arg(id),
94- QSettings::IniFormat);
95+ QString desktopFilename = resolveDesktopFilename(id);
96+ QSettings desktopFile(desktopFilename, QSettings::IniFormat);
97 desktopFile.beginGroup("Desktop Entry");
98 displayName = desktopFile.value("Name").toString();
99 iconName = resolveIcon(desktopFile.value("Icon").toString(),
100 desktopFile.value("Path").toString());
101 }
102
103+ QString resolveDesktopFilename(const QString &id) {
104+ QString localShare =
105+ QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
106+ QString desktopFilename(QString("%1/applications/%2.desktop").
107+ arg(localShare).arg(id));
108+ if (QFile(desktopFilename).exists())
109+ return desktopFilename;
110+
111+ /* search the directory for a matching filename */
112+ QDir dir(QString("%1/applications").arg(localShare));
113+ dir.setFilter(QDir::Files);
114+ QStringList fileList = dir.entryList();
115+ QString pattern = QString("%1*.desktop").arg(id);
116+ for (int i = 0; i < fileList.count(); i++) {
117+ /* stop at the first match */
118+ if (QDir::match(pattern, fileList[i])) {
119+ return QString("%1/applications/%2").arg(localShare).arg(fileList[i]);
120+ }
121+ }
122+
123+ qWarning() << "No desktop file found for app id: " << id;
124+ return QString();
125+ }
126+
127 QString resolveIcon(const QString &iconName, const QString &basePath) {
128 /* If iconName points to a valid file, use it */
129 if (QFile::exists(iconName)) {
130@@ -160,6 +181,12 @@
131
132 QString applicationId = QString::fromStdString(r.from);
133
134+ /* filter out unconfined apps, they can access everything anyway */
135+ if (applicationId == "unconfined") {
136+ query->next();
137+ continue;
138+ }
139+
140 Application &app = appMap[applicationId];
141 app.setId(applicationId);
142 app.addRequest(r);

Subscribers

People subscribed via source and target branches