Merge lp:~diegosarmentero/ubuntu-system-settings/update-battery into lp:ubuntu-system-settings

Proposed by Diego Sarmentero
Status: Work in progress
Proposed branch: lp:~diegosarmentero/ubuntu-system-settings/update-battery
Merge into: lp:ubuntu-system-settings
Diff against target: 97 lines (+46/-4)
1 file modified
plugins/system-update/PageComponent.qml (+46/-4)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntu-system-settings/update-battery
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Needs Fixing
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+225964@code.launchpad.net

Commit message

- Notify the user if the phone needs to be plug to power for update

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks you for your work, some issues

- you use "label.text" there, but there is no such object (you get a runtime warning about it being undefined btw)

- I just tried on my laptop (using the "sudo system-image-dbus --testing=update-manual-success" mock) which is plugged and 100% charged, it gave me the error case/not now interface

My case on that one is th at "onRemainingCapacityChanged" is never called on my fully charged scenario, so the batterySafeForUpdate is never set

- the 50% charge seems a bit much, but the spec doesn't define what would be a reasonable level, I guess 30% should be enough ... I'm not going to be picky about that though

- clicking on "not now" brought me back to the updates list, clicking on the "install" button again made the install happen despite the incorrect charge/without asking

(that one is not a new bug I think though)

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

(you can add that line
" onRemainingCapacityChanged(0, chargingState(0))"
to Component.onCompleted, to workaround the first issue)

747. By Diego Sarmentero

removing unused code

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

the issue with the batterySafeForUpdate was due to the invalid variable, not to the missing call ... I can confirm that r747 fixes that

748. By Diego Sarmentero

fixing bug on install button for system update

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

thanks, r748 has an issue though, if you click "not now" it sends you back to the main list with the system image item having a install bar at 0% and stating "installing in progress"

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

PASSED: Continuous integration, rev:746
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/941/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1695
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1433
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/133
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/133
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/133/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/133
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1961
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2737
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2737/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9466
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1191
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1602
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1602/artifact/work/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:748
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/942/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1703
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1441
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/134
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/134
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/134/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/134
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1970
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2746
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2746/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9478
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1199
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1610
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1610/artifact/work/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
749. By Diego Sarmentero

fixing issue with image progress after finish

750. By Diego Sarmentero

hide progress bar on image download complete

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> thanks, r748 has an issue though, if you click "not now" it sends you back to
> the main list with the system image item having a install bar at 0% and
> stating "installing in progress"

Fixed

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

PASSED: Continuous integration, rev:749
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/946/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1720
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1455
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/138
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/138
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/138/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/138
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1983
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2765
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2765/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9494
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1213
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1624
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1624/artifact/work/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:750
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/947/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1722/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1457
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/139
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/139
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/139/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/139
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1985/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2768
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2768/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9496
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1215
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1626
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1626/artifact/work/output/*zip*/output.zip

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

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

Thanks, I did a new round and testing, and remainingCapacity() seems wrong on the n4, which gives a > 90% charged info when the device is actually 10% charged :/

You might better import the battery plugin and get the charge info from there I think (sorry about that, I think we had issues with the qtsystems binding as well before but I don't remember the details)

Other small question, why don't use the visble = true/false to show/hide widgets?

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

Did you look at that issue yet? Do you need help with the changes?

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

Setting to "work in progress" to get it out of the review queue until the issues are sorted out

review: Needs Fixing

Unmerged revisions

750. By Diego Sarmentero

hide progress bar on image download complete

749. By Diego Sarmentero

fixing issue with image progress after finish

748. By Diego Sarmentero

fixing bug on install button for system update

747. By Diego Sarmentero

removing unused code

746. By Diego Sarmentero

adding battery support to updates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/system-update/PageComponent.qml'
2--- plugins/system-update/PageComponent.qml 2014-07-03 15:24:46 +0000
3+++ plugins/system-update/PageComponent.qml 2014-07-08 20:22:14 +0000
4@@ -37,23 +37,63 @@
5 property bool installAll: false
6 property bool includeSystemUpdate: false
7 property int updatesAvailable: 0
8-
9 property var notificationAction;
10+ property bool batterySafeForUpdate: false
11
12 DeviceInfo {
13 id: deviceInfo
14 }
15
16+ BatteryInfo {
17+ id: batteryInfo
18+
19+ monitorChargingState: true
20+ monitorBatteryStatus: true
21+ monitorRemainingCapacity: true
22+
23+ onRemainingCapacityChanged: {
24+ capacity = batteryInfo.remainingCapacity(0) * 100 / batteryInfo.maximumCapacity(0)
25+ if (capacity < 50) {
26+ root.batterySafeForUpdate = false;
27+ } else {
28+ root.batterySafeForUpdate = true;
29+ }
30+ }
31+
32+ onChargingStateChanged: {
33+ if (state === BatteryInfo.Charging) {
34+ root.batterySafeForUpdate = true;
35+ }
36+ else if (state === BatteryInfo.Discharging &&
37+ batteryInfo.batteryStatus(0) !== BatteryInfo.BatteryFull) {
38+ capacity = batteryInfo.remainingCapacity(0) * 100 / batteryInfo.maximumCapacity(0)
39+ if (capacity < 50) {
40+ root.batterySafeForUpdate = false;
41+ } else {
42+ root.batterySafeForUpdate = true;
43+ }
44+ }
45+ else if (batteryInfo.batteryStatus(0) === BatteryInfo.BatteryFull ||
46+ state === BatteryInfo.NotCharging) {
47+ root.batterySafeForUpdate = true;
48+ }
49+ }
50+ Component.onCompleted: {
51+ onChargingStateChanged(0, chargingState(0));
52+ }
53+ }
54+
55 Component {
56 id: dialogInstallComponent
57 Dialog {
58 id: dialogueInstall
59 title: i18n.tr("Update System")
60- text: i18n.tr("The phone needs to restart to install the system update.")
61+ text: root.batterySafeForUpdate ? i18n.tr("The phone needs to restart to install the system update.") : i18n.tr("Connect the phone to power before installing the system update.")
62
63 Button {
64 text: i18n.tr("Install & Restart")
65 color: UbuntuColors.orange
66+ visible: root.batterySafeForUpdate ? true : false
67 onClicked: {
68 installingImageUpdate.visible = true;
69 updateManager.applySystemUpdate();
70@@ -68,7 +108,9 @@
71 var item = updateList.currentItem;
72 var modelItem = updateManager.model[0];
73 item.actionButton.text = i18n.tr("Install");
74+ item.progressBar.opacity = 0;
75 modelItem.updateReady = true;
76+ modelItem.selected = false;
77 PopupUtils.close(dialogueInstall);
78 }
79 }
80@@ -270,6 +312,7 @@
81 showDivider: false
82
83 property alias actionButton: buttonAppUpdate
84+ property alias progressBar: progress
85
86 Rectangle {
87 id: textArea
88@@ -311,8 +354,7 @@
89 textArea.retry = false;
90 updateManager.retryDownload(modelData.packageName);
91 } else if (modelData.updateReady) {
92- updateManager.applySystemUpdate();
93- installingImageUpdate.visible = true;
94+ PopupUtils.open(dialogInstallComponent);
95 } else if (modelData.updateState) {
96 if (modelData.systemUpdate) {
97 updateManager.pauseDownload(modelData.packageName);

Subscribers

People subscribed via source and target branches