Closed Bug 1160346 Opened 9 years ago Closed 9 years ago

Allow distributions to customize the initial panel config

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox41 fixed, fennec40+)

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed
fennec 40+ ---

People

(Reporter: Margaret, Assigned: Margaret)

References

Details

Attachments

(1 file)

The home panel config is stored in SharedPreferences, so if we want distributions to be able to customize the initial set of panels, they'll need a way to set Java-based preferences.

Since we wouldn't want distributions poking around directly in the JSON we store for these panels, we should probably just provide some sort of API to do this, perhaps another JSON file in the distribution to specify a set of home panels. Then Distribution.java can do the dirty work of actually setting the right prefs for HomeConfigPrefsBackend to do its thing.
Assignee: nobody → margaret.leibovic
(Remind me why we don't have a Distributions component yet?)

Concur that making this a narrowly scoped JSON file makes sense, but bear in mind that each additional file we stat impacts our first-run perf. We might consider sacrificing a little modularity here, or processing a stream of JarEntries instead of individual files.
Status: NEW → ASSIGNED
OS: Unspecified → Android
Hardware: Unspecified → All
Version: Firefox 35 → Trunk
We could also make a new section of preferences.json. I was worried that we would accidentally slurp up everything in there into gecko preferences, but there's already some structure to help prevent that.

Maybe something like:

{
  "Global": {
     ...
  },
  "Preferences": {
     ...
  },
  "LocalizablePreferences": {
     ...
  },
  "HomeConfig": {
    "default": "our.panel@distribution.org",
    "order": [
      "bookmarks",
      "history",
      "our.panel@distribution.org",
      "recent_tabs",
      "remote_tabs
    ]
  }
}
(In reply to :Margaret Leibovic from comment #2)

>   "HomeConfig": {
>     "default": "our.panel@distribution.org",
>     "order": [
>       "bookmarks",
>       "history",
>       "our.panel@distribution.org",
>       "recent_tabs",
>       "remote_tabs
>     ]
>   }

Actually, supporting this fine level of granularity would be quite a pain. Maybe we should just allow distributions to replace the top sites panel with their own default panel.

The main challenge with this is that if the panel is bundled as an add-on (which is the way to add a new panel), we would need to wait for that panel to be installed before we would know how to deal with it in the HomeConfig code.

Maybe a better solution here would be to allow home panel add-ons to specify that they are designed to replace the top sites panel, and we can take care of all this customization from within the add-on.

The down side to this is that any add-on developer could create add-ons that would replace the default top sites panel, but maybe this is something users would like.
Here's a pretty simple patch that allows home panel add-ons to make themselves the default and specify their order. This wouldn't give distributions the ability to disable any of our built-in panels, but this does solve the issue of creating a new default "speed dial" panel without needing to muck around in distribution land.

https://github.com/leibovic/speed-dial/commit/3ea7a905d4165bad7a9e3c40dc866272e0cedf97
Attachment #8602429 - Flags: feedback?(mark.finkle)
Comment on attachment 8602429 [details] [diff] [review]
Allow home panel add-ons to specify order and make themselves default

Looks pretty sane
Attachment #8602429 - Flags: feedback?(mark.finkle) → feedback+
tracking-fennec: ? → 40+
Comment on attachment 8602429 [details] [diff] [review]
Allow home panel add-ons to specify order and make themselves default

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

This has been doing what I want locally, let's land it.
Attachment #8602429 - Flags: review?(mark.finkle)
Attachment #8602429 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/integration/fx-team/rev/43512d4631b7

I tested locally to verify this wouldn't cause any problems with previously customized configurations.
https://hg.mozilla.org/mozilla-central/rev/43512d4631b7
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
Depends on: 1192788
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.