[maemo-developers] Browser Switchboard, MicroB, and application prestart in Fremantle

From: Steven Luo steven+maemo-developers at steven676.net
Date: Fri Jan 8 20:22:01 EET 2010
I'm the maintainer of Browser Switchboard [1], which is a program
that's supposed to make it possible for the user to choose the
default browser on his/her Maemo device.  Packages are available in
extras for Diablo and extras-devel for Fremantle.

In order to control the default browser, Browser Switchboard takes
over handling of the com.nokia.osso_browser D-Bus methods.  Since
launching MicroB from the menus invokes
com.nokia.osso_browser.top_application, it has to be able to launch

For Diablo, we do this by exec() of /usr/bin/browser(*), but this
doesn't seem to bring up a browser window in Fremantle (see the
discussion on talk.maemo.org [2]).

Also, at least in testing with my half-broken SDK, the Fremantle
browser process remains in memory even after the last browser window
closes.  This poses a problem for Browser Switchboard, which releases
com.nokia.osso_browser before starting MicroB (so that MicroB handles
the methods while it's open, giving users an easy way to temporarily
open links in MicroB no matter what their default browser is set to),
and needs to be able to reclaim the name when the last browser window

I can only assume this behavior is related to the prestarting of the
browser process in Fremantle, but I'm unclear on how Browser
Switchboard interacts with prestarting in the first place (is a
browser process prestarted on boot when Browser Switchboard is
installed?), and I don't have a Fremantle device to test any of this

That leaves me with the following questions:

* How does one open a new browser window from an application,
  preferably without using the D-Bus interface?  (If there is no
  other way to bring up a new window except D-Bus, I assume I'd have
  to try something like launching the browser process, waiting for it
  to acquire the com.nokia.osso_browser name, then making the method
  call, which wouldn't be pretty, and also precludes the possibility
  of working with a prestarted browser process).
* Is there a way to ensure the browser process quits when the last
  browser window closes?  If not, is there a way to receive a signal
  when the last browser window closes?  (It's probably possible to
  poll for the existence of a browser window, but I can't think of a
  way of doing it that doesn't impact battery life and doesn't
  introduce a potential race condition.)

-Steven Luo

(*) Well, not quite, since the package replaces /usr/bin/browser with
a shell script.  We exec() /usr/bin/maemo-invoker with argv[0] set to
"browser", which is equivalent to invoking a symlink to maemo-invoker
named "browser".

[1] http://browser-switch.garage.maemo.org/
[2] http://talk.maemo.org/showthread.php?p=444134#post444134 and
following posts
More information about the maemo-developers mailing list