Closed Bug 836517 Opened 7 years ago Closed 7 years ago

Lightweight theme support for distributions

Categories

(Firefox for Android :: General, defect)

ARM
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 21

People

(Reporter: Margaret, Assigned: Margaret)

References

Details

Attachments

(1 file, 1 obsolete file)

I thought that setting preferences would take care of this, but it's not.

Also, it seems like it would be bad if the theme is only applied after Gecko starts. I wonder if there's a way to do something in Java to get around that.
(In reply to :Margaret Leibovic from comment #0)

> Also, it seems like it would be bad if the theme is only applied after Gecko
> starts. I wonder if there's a way to do something in Java to get around that.

Well actually, testing with a regular lightweight theme, it also doesn't apply itself until Gecko starts. Sriram, do you know if there's a bug filed on improving this?
(In reply to :Margaret Leibovic from comment #1)
> Sriram, do you know if there's a bug filed
> on improving this?

No bug has been filed on this. Java has to wait for gecko to see if there is a theme or not.
The alternate approach is:
1. Java can directly look into the profile folder to see if there is an image.
2. But are personas enabled? -- This can be tracked through a SharedPreferences which stores a boolean and a path to the file whenever it receives LightweightTheme:Update message from Gecko.

But, reading SharedPreferences on startup is going to slow down startup -- and would get to a point where Gecko sending a message is slower only by 250ms. ;)
(In reply to Sriram Ramasubramanian [:sriram] from comment #2)

> No bug has been filed on this. Java has to wait for gecko to see if there is
> a theme or not.

I filed bug 836527 about this. We can discuss more in there.

In this bug I'll try to figure out why setting the prefs in my preferences.json file isn't working. I'm probably missing something.
Attached patch patch (obsolete) — Splinter Review
It turns out that LightweightThemeConsumer is initialized before we get to setting our distribution prefs, so we need to tell it to try again if we set a pref.

Unfortunately, this means that themes included in a distribution.json will be even slower to apply than user-set ones :/ But maybe we can find a way to improve this later.

To test, just add this in your preferences.json:

  "Preferences": {
    "lightweightThemes.isThemeSelected": true,
    "lightweightThemes.persisted.footerURL": false,
    "lightweightThemes.persisted.headerURL": false,
    "lightweightThemes.usedThemes": "[{\"id\":\"491717\",\"name\":\"colored trees\",\"headerURL\":\"http://getpersonas-cdn.mozilla.net/static/1/7/491717/trees.png?1358076678\",\"footerURL\":\"http://getpersonas-cdn.mozilla.net/static/1/7/491717/trees-base.png?1358076678\",\"textcolor\":\"#1d022b\",\"accentcolor\":\"#000000\",\"iconURL\":\"http://getpersonas-cdn.mozilla.net/static/1/7/491717/preview_small.jpg?1358076678\",\"previewURL\":\"http://getpersonas-cdn.mozilla.net/static/1/7/491717/preview.jpg?1358076678\",\"author\":\"birdyann\",\"description\":\"trees arbres colored colors couleurs\",\"updateURL\":\"https://www.getpersonas.com/en-US/update_check/491717\",\"version\":\"1358076678\",\"updateDate\":1359579038207,\"installDate\":1359579038207}]"
  },
Attachment #708388 - Flags: review?(mark.finkle)
Attached patch patchSplinter Review
Oops, forgot to remove observer.
Attachment #708388 - Attachment is obsolete: true
Attachment #708388 - Flags: review?(mark.finkle)
Attachment #708389 - Flags: review?(mark.finkle)
Comment on attachment 708389 [details] [diff] [review]
patch

nice
Attachment #708389 - Flags: review?(mark.finkle) → review+
Either this bug or bug 834681 was causing Android test hangs. Backed out.
https://hg.mozilla.org/integration/mozilla-inbound/rev/eefb9fb2af78
https://hg.mozilla.org/mozilla-central/rev/ccf2e70a3e52
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
You need to log in before you can comment on or make changes to this bug.