Closed Bug 594238 Opened 10 years ago Closed 10 years ago

Implement UI for Fennec updater on Android

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set

Tracking

(fennec2.0b1+)

VERIFIED FIXED
Tracking Status
fennec 2.0b1+ ---

People

(Reporter: alexp, Assigned: alexp)

References

Details

Attachments

(1 file, 4 obsolete files)

Update service requires UI to notify the user about available updates.

Draft steps are:
1. Detect the update and show a status bar notification "New version available"
2. When user clicks on the notification, display a confirmation "Do you want to download a new version?"
3. Download the update in background. Display the progress in the status bar.
4. When download is finished, show a status bar notification "Install the new version"
5. When clicked, launch the downloaded APK to install the update.
The following page contains the screenshots of the existing Update Wizard UI (nsIUpdatePrompt implementation), as well as a status bar notification and APK installation implemented by the WIP patch in the bug 587384:
http://people.mozilla.com/~alexp/594238-updater-ui/update.html
Assignee: nobody → alexp
Blocks: 587384
Status: NEW → ASSIGNED
I assume we are using the standard Mozilla mechanism to check for updates, using nsIApplicationUpdateService and nsIUpdateManager, like here:

http://mxr.mozilla.org/mozilla-central/source/browser/base/content/utilityOverlay.js#507

Actually, I don't think we'll let the user manually look for an update. We'll use the automated timer service.

Actually, the whole update system is a UI mess. We'll likely need to override some components.

Anyway...

If we find an update, we'll make an nsIAlertService notification, which will appear as an Android notification. The Android bridge will need to handle the "update" notification correctly, likely by showing the app icon. We'll use a callback for the notification that, when fired, will start the update.

We might need some extra code for a progressbar and a "finished" alert to clear the Android notification. Those can be followups, as I want to get the update mess itself figured out first.

Sound ok to everyone? Good.
(In reply to comment #2)
> I assume we are using the standard Mozilla mechanism to check for updates,
> using nsIApplicationUpdateService and nsIUpdateManager

This is correct. We will be using the standard mechanism: http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/update/nsUpdateService.js

> Actually, I don't think we'll let the user manually look for an update. We'll
> use the automated timer service.

Correct again.
The automatic background update checker is supposed to be used. We don't need that wizard UI shown on the screenshots at the link above. That is for reference only.

As discussed with Madhava, we would like to use some less obtrusive UI, status bar notifications (nsIAlertService), and a Fennec-style prompt to start update download.

> Actually, the whole update system is a UI mess. We'll likely need to override
> some components.

The current plan is to override nsIUpdatePrompt. The interface seems to be specifically designed to be overridden to provide a custom UI.
Attached patch wip (obsolete) — Splinter Review
Just the basics. Simple override of nsIUpdatePrompt that uses notifications for everything.
Assignee: alexp → mark.finkle
Attached patch wip 2 (obsolete) — Splinter Review
Using a mock update.xml file on people.mozilla.com, I am able to get Fennec to look for updates, find an update and display the notification popups.

Now I need a real MAR file so I can test the download and actual update.
Attachment #473413 - Attachment is obsolete: true
(In reply to comment #5)
> Using a mock update.xml file on people.mozilla.com, I am able to get Fennec to
> look for updates, find an update and display the notification popups.
> 
> Now I need a real MAR file so I can test the download and actual update.

Mark, thank you for handling this so quickly!
I tried your patch and it works as expected. We probably just want to add confirmations before starting the download and restarting Fennec when update is downloaded and ready, but even without those it's already usable.

You can try your work on Android using this pref:
pref("app.update.url.override", "http://people.mozilla.com/~alexp/android/update/fennec-update.xml");
At the moment you won't be able to install the APK (I'll provide the patch for that later today), but the update check and download will work with your change.
Comment on attachment 473546 [details] [diff] [review]
wip 2

>+  _showNotification: function UP__showNotif(aUpdate, aTitle, aText, aImageUrl, aMode) {
...
>+    let notifier = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
>+    notifier.showAlertNotification(aImageUrl, aTitle, aText, true, "", observer);

A small note: please provide some sensible notification name (the last parameter in this function) - it is hashed and used as a notification ID, otherwise another no-name notification will replace this one.
tracking-fennec: --- → ?
Flags: in-testsuite?
Flags: in-litmus?
Attached patch Fix (obsolete) — Splinter Review
- Implemented showUpdateError
- Show a confirmation before starting to download the update
Assignee: mark.finkle → alexp
Attachment #473546 - Attachment is obsolete: true
Attachment #475185 - Flags: review?(mark.finkle)
Comment on attachment 475185 [details] [diff] [review]
Fix


>+  _showNotification: function UP__showNotif(aUpdate, aTitle, aText, aImageUrl, aMode) {

>+    let notifier = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
>+    notifier.showAlertNotification(aImageUrl, aTitle, aText, true, "", observer, "update");

Let's use "update-app" for the extra string here

Also, remove all dump and debugger code from UpdatePrompt.js

r+ with nits fixed
Attachment #475185 - Flags: review?(mark.finkle) → review+
Attached patch Fix v2 (obsolete) — Splinter Review
r=mfinkle
Attachment #475185 - Attachment is obsolete: true
Attachment #475342 - Flags: review+
Attached patch Fix v2.1Splinter Review
Removed the last dump().
r=mfinkle
Attachment #475342 - Attachment is obsolete: true
Attachment #475351 - Flags: review?
Attachment #475351 - Flags: review? → review+
tracking-fennec: ? → 2.0b1+
pushed:
http://hg.mozilla.org/mobile-browser/rev/5860ea9d73d5
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Flags: in-litmus? → in-litmus?(mozaakash)
Flags: in-litmus?(mozaakash) → in-litmus?(nhirata.bugzilla)
Waverly is having issues with the update.
We need to follow up with them and have them use app.update.log = true to see the reason why they cannot update.

There are still some questions that remain to be resolved:
* does an update occur even though fennec is closed?
* does app.update.auto = true implemented on fennec?

AFAIK, the profile seems to be intact after updating.  Each channel is different for each platform.
Maemo also has different update channels (4: OVA, Nightly, Beta, Repo)
Android has 2 (Nightly, Beta)
(In reply to comment #14)
> Waverly is having issues with the update.
> We need to follow up with them and have them use app.update.log = true to see
> the reason why they cannot update.

Yes, just "update is not working" doesn't give us any info.

> There are still some questions that remain to be resolved:
> * does an update occur even though fennec is closed?

When Fennec is completely closed, no services are running.
I'm not sure if our timers still run when Fennec is in background. I remember there were some issues with that.

> * does app.update.auto = true implemented on fennec?

app.update.auto = false by default in Fennec. It means "don't do it silently, show the confirmation".
I believe the "true" value is handled as well - in this case the update will be downloaded without asking the user, and will notify only when it's ready to be installed.

> AFAIK, the profile seems to be intact after updating.

Yes, the profile is supposed to stay intact. If the same signature is used for the APK, Android reinstalls the new version over the old one keeping the data.

PS. I don't think this is the right bug to discuss these issues.
Setting this bug to verified.

Mozilla/5.0 (Maemo;Linux armv71; rv:2.0b8pre) Gecko/20101015 Firefox/4.0b8pre Fennec/4.0b2pre
Mozilla/5.0 (Android; Linux armv71; rv2.0b8pre) Gecko/20101015 Firefox/4.0b8pre Fennec/4.0b2pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.