Closed Bug 1208655 (customtabs) Opened 9 years ago Closed 3 years ago

[meta] Make Fennec be an Android "custom tab" ecosystem participant

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(firefox44 affected)

RESOLVED INCOMPLETE
Tracking Status
firefox44 --- affected

People

(Reporter: nalexander, Unassigned)

References

Details

(Keywords: meta)

The Chrome team is pushing a series of APIs to allow Android Apps to
launch a mildly-customized web browser rather than embed a WebView.

The features are sketched at
http://blog.chromium.org/2015/09/chrome-custom-tabs-smooth-transition_2.html; 
and https://developer.chrome.com/multidevice/android/customtabs is a
good reference.

There are two broad parts: UI customizations and performance improvements.

The UI customizations add additional ACTION_VIEW parameters to configure
the browser:
* Custom colors for the toolbar
* Custom top-level action button
* Reduced menu with custom menu items

The performance improvements come from defining a Service that third
party Apps can bind to expose pre-fetching and cache warming.  This
service is exposed with a small Android AIDL.  The interface is
bi-directional; there's a provision to have the browser notify the
consuming App of page lifecycle events.

Supporting some or all of this series of features is a lot of work;
Fennec will need significant re-architecting to achieve the UI
customizations, and significant platform improvements to achieve the
backend customizations.  This ticket tracks that work.
A first cut at the UI customization looks like a little like Fennec's current WebApps implementation: a separate BrowserApp-based Activity, running in a separate process from Fennec proper.  That process will have its own Gecko and hence its own Gecko profile.

Fennec proper would inspect incoming load URI Intents for the custom ACTION_VIEW parameters and route them to the new Activity as appropriate.

Over time, we will try to allow multiple Activities to connect to different XUL windows in the same Gecko instance; as that happens, we can move the new Activity back into the main Fennec process.
No longer depends on: 1208195
No longer depends on: 1098544
It sounds like this will be a lot of work - in the meantime, could we add a custom tab provider that just opens up a tab in Firefox?
(In reply to Chris Lord [:cwiiis] from comment #4)
> It sounds like this will be a lot of work - in the meantime, could we add a
> custom tab provider that just opens up a tab in Firefox?

Yeah, this might be possible. However as long as it is the (third party) app developer's responsibility to pick the browser (or add custom code to let the user choose) it's unlikely that Firefox will receive any Intents from third party apps.

* Hardcoded package for chrome service: https://developer.chrome.com/multidevice/android/customtabs#implementationguide
* Also see "Preparing for other browsers": https://developer.chrome.com/multidevice/android/customtabs#bestpractices
After some hacking the situation seems to be much better than I thought:

At least the Google apps I tested (Google+, Google search) use helper code like this:
https://github.com/GoogleChrome/custom-tabs-client/blob/30e16577e696b635bfc5f66aafadc8a8033b8082/shared/src/main/java/org/chromium/customtabsclient/shared/CustomTabsHelper.java#L53-L107
This code will prefer the default browser over chrome if the default browser has support for custom tabs (= a service with the custom apps action exists in the package).
(In reply to Sebastian Kaspari (:sebastian) from comment #6)
> After some hacking the situation seems to be much better than I thought:
> 
> At least the Google apps I tested (Google+, Google search) use helper code
> like this:
> https://github.com/GoogleChrome/custom-tabs-client/blob/
> 30e16577e696b635bfc5f66aafadc8a8033b8082/shared/src/main/java/org/chromium/
> customtabsclient/shared/CustomTabsHelper.java#L53-L107
> This code will prefer the default browser over chrome if the default browser
> has support for custom tabs (= a service with the custom apps action exists
> in the package).

We can also work with the Google team to update this code. They really want to support multiple browsers, so they can help evangelize whatever patterns we think will help that.
(In reply to :Margaret Leibovic from comment #7)
> (In reply to Sebastian Kaspari (:sebastian) from comment #6)
> > After some hacking the situation seems to be much better than I thought:
> > 
> > At least the Google apps I tested (Google+, Google search) use helper code
> > like this:
> > https://github.com/GoogleChrome/custom-tabs-client/blob/
> > 30e16577e696b635bfc5f66aafadc8a8033b8082/shared/src/main/java/org/chromium/
> > customtabsclient/shared/CustomTabsHelper.java#L53-L107
> > This code will prefer the default browser over chrome if the default browser
> > has support for custom tabs (= a service with the custom apps action exists
> > in the package).
> 
> We can also work with the Google team to update this code. They really want
> to support multiple browsers, so they can help evangelize whatever patterns
> we think will help that.

The best practices (https://developer.chrome.com/multidevice/android/customtabs#bestpractices) on the official docs already recommend developers to prepare for other browsers. I've fil a bug on Chromium so we can track the best practices for multiple browsers implementation on the samples: https://bugs.chromium.org/p/chromium/issues/detail?id=612478. Please feel free to chime on the thread and help on the discussion on how to make it better.
I've a prototype implementation of this locally and I see a bunch of errors when switching between the browser and a custom tab ("white page of death"). I'm going to clean this up, attach the patches and hand this off to the platform team.
Assignee: nobody → s.kaspari
bug 1276696
Assignee: s.kaspari → nobody
Whiteboard: [platform-rel-Google][platform-rel-Chrome]
platform-rel: --- → ?
Alias: customtab → customtabs
platform-rel: ? → ---
Whiteboard: [platform-rel-Google][platform-rel-Chrome]
Depends on: 1293299
Depends on: 1294821
Depends on: 1299925
Depends on: 1300570
Depends on: 1300574
Depends on: 1303362
Depends on: 1303776
Depends on: 1305086
No longer depends on: 1294821
Depends on: 1305439
Depends on: 1319069
Depends on: 1325174
Depends on: 1329664
Depends on: 1336373
Depends on: 1346413
Depends on: 1346542
Depends on: 1346589
Depends on: 1348716
Depends on: 1348718
Depends on: 1347165
Depends on: 1352352
Depends on: 1351169
Depends on: 1354766
Depends on: 1355735
Depends on: 1356182
Depends on: 1359098
Depends on: 1366648
Depends on: 1369681
Depends on: 1398065
Depends on: 1398067
Depends on: 1400243
Depends on: 1406024
Depends on: 1411968
Depends on: 1412284
Depends on: 1415534
Depends on: 1432180
Keywords: meta
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.