Closed Bug 1182514 Opened 9 years ago Closed 9 years ago

Light-weight kidfox theme

Categories

(Firefox for Android Graveyard :: Profile Handling, defect)

defect
Not set
normal

Tracking

(firefox42 fixed, firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox42 --- fixed
firefox43 --- fixed

People

(Reporter: sfang, Assigned: sebastian)

References

Details

Attachments

(1 file, 3 obsolete files)

Kid style themes, colors, gender-neutral

Possibility bundle add-on?
Take a look at AMO to see if any existing themes are "kid style" enough to bundle somehow.
A lightweight theme is really just an image, so we could see if we can "bundle" one and find a way to apply it when launching with a kidfox profile.
I just want to point out there are still some lwt changes (meta: bug 1079416) to be made to improve the experience, specifically bug 1082928 and bug 1082542.
Assignee: nobody → randersen
Status: NEW → ASSIGNED
Blocks: 1186027
Assignee: randersen → nobody
No longer blocks: 1186027
Status: ASSIGNED → NEW
Cloned to 1186027 to move the UX work over to that bug.
Assignee: nobody → ally
Margaret once played around with using Lightweight Themes from add-ons. Might be useful for this too:
https://github.com/leibovic/privacy-coach/commit/39612a31df29b2da68096b5177919d8d7cb48a45
(In reply to Mark Finkle (:mfinkle) from comment #5)
> Margaret once played around with using Lightweight Themes from add-ons.
> Might be useful for this too:
> https://github.com/leibovic/privacy-coach/commit/
> 39612a31df29b2da68096b5177919d8d7cb48a45

Thanks, Mark!
Attached patch 1182514-kidfox-theme.patch (obsolete) — Splinter Review
This is a quite hacky first patch. It installs the Kinderfox Cyan theme (bug 1191208) from the web for a restricted profile on app start.
Comment on attachment 8644912 [details] [diff] [review]
1182514-kidfox-theme.patch

installKidFoxTheme -> _installRestrictedTheme or _installParentalControlsTheme

(I'm not a fan of putting codenames in the code)
Assignee: ally → s.kaspari
(In reply to Sebastian Kaspari (:sebastian) from comment #7)
> Created attachment 8644912 [details] [diff] [review]
> 1182514-kidfox-theme.patch
> 
> This is a quite hacky first patch. It installs the Kinderfox Cyan theme (bug
> 1191208) from the web for a restricted profile on app start.

Just to confirm, the light-weight theme is Green, not Cyan :)
(In reply to Mark Finkle (:mfinkle) from comment #8)
> Comment on attachment 8644912 [details] [diff] [review]
> 1182514-kidfox-theme.patch
> 
> installKidFoxTheme -> _installRestrictedTheme or
> _installParentalControlsTheme
> 
> (I'm not a fan of putting codenames in the code)

I agree here, but otherwise this patch seems pretty simple. My main concern would be whether or not this affects startup performance, but I assume it won't affect performance any more than a regular theme would.
Status: NEW → ASSIGNED
Attached patch 1182514-kidfox-theme-v2.patch (obsolete) — Splinter Review
This is the updated and simplified patch for web installation of the theme.

I dug into LightweightThemeManager.jsm to see whether I could load the theme from a local file. It seems like it supports resource:// uris but I couldn't find a way how I could use this to load a shipped file.
Attachment #8644912 - Attachment is obsolete: true
Attachment #8650478 - Flags: feedback?(margaret.leibovic)
Comment on attachment 8650478 [details] [diff] [review]
1182514-kidfox-theme-v2.patch

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

::: mobile/android/chrome/content/browser.js
@@ +3131,5 @@
>    },
>  
> +  _installParentalControlsTheme: function() {
> +    this._install({
> +      "headerURL": "https://addons.cdn.mozilla.net/user-media/addons/636224/header.png",

I don't like that we'll require a network request to install this theme on first run. I think we should look into how desktop Firefox implements its recommended themes and do that instead. I see code here for that:
http://mxr.mozilla.org/mozilla-central/source/browser/app/profile/firefox.js#198
http://mxr.mozilla.org/mozilla-central/source/browser/components/customizableui/CustomizeMode.jsm#1365
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/defaultthemes/

You're right, we should use a resource: URI. I would look into how desktop Firefox does this and copy that. I'd hope that it would work the same way for Fennec.
Attachment #8650478 - Flags: feedback?(margaret.leibovic) → feedback-
After reading a lot of code about themes, jars, manifest and the help of MDN I can:

* Package a theme header into the omni.ja
* Create an alias to obtain a resource:// uri to that header
* Install a theme with the resource URI at runtime
* Load the theme's header in Java if I know the complete(!) path inside the JAR(!)

The missing piece is translating a resource URI to the path inside the JAR so that I can pass that to GeckoJarReader. It seems like we do not have anything for that yet.

Right now LightweightThemeManager can handle http/https/file/resource URIs but our LightweightTheme class only knows how to handle http(s) URIs. For extending the functionality with the help of GeckoJarReader I'd need to translate the resource URI to the actual path. But I guess this will require to parse the manifests to lookup the actual path in the JAR?
nalexander gave me the hint to use resource://android/assets/. This seems to work pretty well. I'll finalize the patch based on that.
Attached patch 1182514-kidfox-theme-v3.patch (obsolete) — Splinter Review
This patch now adds and installs a built-in theme served from the assets directory.
Attachment #8650478 - Attachment is obsolete: true
Attachment #8651684 - Flags: review?(margaret.leibovic)
Comment on attachment 8651684 [details] [diff] [review]
1182514-kidfox-theme-v3.patch

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

Nice. I wonder if we could use a similar approach to fix bug 1004517.

::: mobile/android/base/lwt/LightweightTheme.java
@@ +132,5 @@
> +        }
> +
> +        private Bitmap loadFromAssets(String url) {
> +            try {
> +                InputStream stream = mApplication.getAssets().open(url.substring(ASSETS_PREFIX.length()));

Do you need to close this stream after you're done with it?

::: mobile/android/chrome/content/browser.js
@@ +3133,5 @@
> +  _installParentalControlsTheme: function() {
> +    let mgr = this._manager;
> +    let parentalControlsTheme = {
> +      "headerURL": "resource://android/assets/parental_controls_theme.png",
> +      "name": "Parental Controls Theme",

Might be worth noting that we don't localize this because the add-on manager is disabled when parental controls are enabled, so users will never see this.

Although... is it possible for the restricted profile admin to enable add-on installs separately? Maybe we should file a follow-up to localize this for Fx43 (and uplift the non-localized patch).
Attachment #8651684 - Flags: review?(margaret.leibovic) → review+
(In reply to :Margaret Leibovic from comment #16)
> ::: mobile/android/base/lwt/LightweightTheme.java
> @@ +132,5 @@
> > +        }
> > +
> > +        private Bitmap loadFromAssets(String url) {
> > +            try {
> > +                InputStream stream = mApplication.getAssets().open(url.substring(ASSETS_PREFIX.length()));
> 
> Do you need to close this stream after you're done with it?

Oh wow, yeah, definitely. Not sure how this slipped through.. :)


(In reply to :Margaret Leibovic from comment #16)
> Although... is it possible for the restricted profile admin to enable add-on
> installs separately? Maybe we should file a follow-up to localize this for
> Fx43 (and uplift the non-localized patch).

Yeah, the default is to hide it but the admin can enable it. I'll file a follow-up.
url:        https://hg.mozilla.org/integration/fx-team/rev/c4cd293d7edd80740c9eae1368821307a7699c45
changeset:  c4cd293d7edd80740c9eae1368821307a7699c45
user:       Sebastian Kaspari <s.kaspari@gmail.com>
date:       Fri Aug 07 13:23:18 2015 +0200
description:
Bug 1182514 - Add Lightweight theme for restricted profiles. r=margaret
See Also: → 1198158
https://hg.mozilla.org/mozilla-central/rev/c4cd293d7edd
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Updating patch to version that landed (for uplift request).

Approval Request Comment
[Feature/regressing bug #]: Bug 1125984
[User impact if declined]: This is the last missing feature for KidFox v1 (Support for restricted profiles) (Bug 1125984). Requesting uplift because KidFox is targeting Fx42.
[Describe test coverage new/current, TreeHerder]: Local testing. Restricted profiles are not covered by UI tests yet.
[Risks and why]: Patch installs and applies a built-in theme at runtime. I verified that the theme is not installed for normal profiles and guest profiles. So I estimate the risk to be low.
[String/UUID change made/needed]: -
Attachment #8651684 - Attachment is obsolete: true
Attachment #8652354 - Flags: review+
Attachment #8652354 - Flags: approval-mozilla-aurora?
Comment on attachment 8652354 [details] [diff] [review]
1182514-kidfox-theme-v4.patch

Approved for uplift to aurora. We want this for 42 and it looks like many of the kinks have been worked out now.
Attachment #8652354 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
QA Contact: ioana.chiorean
Depends on: 1199596
Depends on: 1205274
Hello,

Taking into consideration the long period of time since the qe-verify+ flag has been set, I will remove it.

Thank you!
Flags: qe-verify+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: