Closed Bug 1035807 Opened 9 years ago Closed 8 years ago

[b2g] unable to override app.update.url in settings developer menu

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox34 wontfix, firefox35 wontfix, firefox36 fixed, b2g-v2.1 fixed, b2g-v2.2 fixed)

RESOLVED FIXED
2.1 S7 (24Oct)
Tracking Status
firefox34 --- wontfix
firefox35 --- wontfix
firefox36 --- fixed
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: bkelly, Assigned: janx)

References

Details

Attachments

(1 file, 4 obsolete files)

Currently the b2g developer panel in settings provides an "Update URL" text box.  Setting this value creates an entry like this in the user profile prefs.js:

  user_pref("app.update.url", "https://aus4.mozilla.org/update/3/B2G/%VERSION%/20140704000201/flame/%LOCALE%/%CHANNEL%/%OS_VERSION%/default/default/update.xml");

Note that I have overridden the PRODUCT_VERSION here to be flame.  I want to use flame OTA updates on my open c device which does not have its own update channel.

In logcat, however, I see that the original URL is actually used:

I/Gecko   (  301): *** AUS:SVC Checker:getUpdateURL - update URL: https://aus4.mozilla.org/update/3/B2G/32.0a2/20140703000248/ZTE_P821A10/en-US/aurora/Boot2Gecko%202.0.0.0-prerelease/default/default/update.xml?force=1

As you can see it still uses ZTE_P821A10 for the PRODUCT_VERSION.

I tried rebooting in case the pref was cached, but that had no effect.

This code suggests that maybe gaia should set app.update.url.override instead of app.update.url:

http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/update/nsUpdateService.js#3595
Janx, this is a bug I already talked about :)
Assignee: nobody → janx
`app.update.url.override` is used more than I imagined, so it needs to be controllable from the settings:

- Either instead of `app.update.url`,
- Or as an additional `Override` field.
Ben, "app.update.url.override" should only be used for tests[1]. Do you have a way to find out if/where that pref is being set?

I'm not sure we want to expose it in the Settings, because it should really only be used for tests, and not make the "app.update.url" pref obsolete. However, if the override really is being used badly and we can't fix it, I guess we won't have a choice.

[1] http://dxr.mozilla.org/mozilla-central/source/browser/app/profile/firefox.js#140
Flags: needinfo?(bkelly)
Jan, I'm not really sure the right way to fix this.  I just want to be able to change my update URL so I can have my Open C pull flame OTA updates.
Flags: needinfo?(bkelly)
Might have to expose the override field then. Self-needinfo so I don't forget about this.
Flags: needinfo?(janx)
Attached patch Allow overriding app.update.url. (obsolete) — Splinter Review
So Fabrice ran into this as well. If you have any information that could help me debug this, please share.

- Supposedly, the app.update.url and app.update.channel prefs are successfully controlled by the UI in Gaia's Developer menu.
- However, sometimes update requests as seen in logcat seem to ignore these prefs.
- This could be due to someone using the app.update.url.override pref[1] (my attached patches allow to control it, but it's a test-only[2] pref so I don't like people changing it for no reason).
- This could be due to something else designed to illegitimately bypass our update process.

[1] http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/update/nsUpdateService.js#3613
[2] http://dxr.mozilla.org/mozilla-central/source/browser/app/profile/firefox.js#140
Flags: needinfo?(janx)
What I did is:
- flash a v184 image.
- upgrade to current 2.2 using a pvt build.
 At the point the DEVICE is set to flame-kk by v184 which is bogus.
- I updated the url in the setting app, replacing %DEVICE% by 'flame'
- doing a forced update check, flame-kk is still used in the AUS url.
I'm not sure how to debug this. On my Keon, when I use Settings > Device Information > Check Now, for some reason I see [1] being logged but never [2] or [3], and nothing else ever happens.

I'd be very interested to see what happens to `url` in getUpdateURL[4], and what code paths it goes through. If someone can please add some logging there to watch the construction of the update url, that'd be great.

[1] http://dxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#723
[2] http://dxr.mozilla.org/mozilla-central/source/b2g/components/UpdatePrompt.js#416
[3] http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/update/nsUpdateService.js#3654
[4] http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/update/nsUpdateService.js#3609
Flags: needinfo?(lissyx+mozillians)
Flags: needinfo?(fabrice)
Flags: needinfo?(bkelly)
Are you sure you have builds that are good ?

e.g., VARIANT=userdebug and B2G_UPDATER=1 ?
Flags: needinfo?(lissyx+mozillians)
fwiw, adding *another* field for the override url will be a usability nightmare. There should be just an update channel and url fields, and do whatever magic it takes to get things working.
Flags: needinfo?(fabrice)
I agree about the usability problems of another field, and forgot about userdebug and B2G_UPDATER. I'll follow up, thanks!
Flags: needinfo?(bkelly)
Hmm, it turns out that the update service uses default pref values for app.update.url[1] and app.update.channel[2], ignoring any user changes to prefs.

[1] http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/update/nsUpdateService.js#3618
[2] http://dxr.mozilla.org/mozilla-central/source/toolkit/modules/UpdateChannel.jsm#26

This is by design, as explained in bug 302721 comment 43 (from 9 years ago), and MozillaZine[3] says app.update.channel's caveat is that you can only change it by editing channel-prefs.js in the application directory.

[3] http://kb.mozillazine.org/App.update.channel

For the feature to work, B2G's settings should somehow be able to modify the default values of the app.update.channel and app.update.url prefs.
This fixes the feature for me. Fabrice, please let me know what you think.
Attachment #8502186 - Attachment is obsolete: true
Attachment #8502187 - Attachment is obsolete: true
Attachment #8509109 - Flags: review?(fabrice)
(typo)
Attachment #8509109 - Attachment is obsolete: true
Attachment #8509109 - Flags: review?(fabrice)
Attachment #8509110 - Flags: review?(fabrice)
Comment on attachment 8509110 [details] [diff] [review]
Actually allow overriding app.update.url from FxOS developer menu.

Review of attachment 8509110 [details] [diff] [review]:
-----------------------------------------------------------------

I guess you tested on device?
Attachment #8509110 - Flags: review?(fabrice) → review+
Thanks! Yes, with VARIANT=userdebug and B2G_UPDATER=1, and it works on my keon.

Rebased, carried over. https://tbpl.mozilla.org/?tree=Try&rev=fd48080fac7e
Attachment #8509110 - Attachment is obsolete: true
Attachment #8509874 - Flags: review+
Random breakages look unrelated.
Keywords: checkin-needed
Should we ask for uplift to 2.1?
Flags: needinfo?(fabrice)
[Blocking Requested - why for this release]: Update channel and url are presented as editable in 2.1's developer menu, but the feature is non-functional without this patch.
blocking-b2g: --- → 2.1?
Flags: needinfo?(fabrice)
I would not ask for blocking, just for b2g-34 approval on the patch.
Ok thanks for the advice, I'll do that.
blocking-b2g: 2.1? → ---
Comment on attachment 8509874 [details] [diff] [review]
Actually allow overriding app.update.url from FxOS developer menu.

NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]

Bug caused by (feature/regressing bug #): Feature from bug 984962 doesn't work without this fix.

User impact if declined: There are input fields at the bottom of the developer menu letting users think they can modify update url and channel, but it won't work.

Testing completed: Verified that it worked on device.

Risk to taking this patch (and alternatives if risky): Moderate. It lets the user modify update prefs, but clearing the input fields restores them to default. Alternative would be to remove the feature entirely.

String or UUID changes made by this patch: none.
Attachment #8509874 - Flags: approval-mozilla-b2g34?
https://hg.mozilla.org/mozilla-central/rev/b73f421fd64f
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.1 S7 (24Oct)
Attachment #8509874 - Flags: approval-mozilla-b2g34? → approval-mozilla-b2g34+
Depends on: 984962
Blocks: 984962
No longer depends on: 984962
You need to log in before you can comment on or make changes to this bug.