GeckoThread.waitOnGecko blocks the current thread and waits for previous
events on the Gecko thread to finish executing before continuing. This
is implemented by synchronously running a dummy event on the Gecko
thread. This patch also lets us get rid of sendEventToGeckoSync in
GeckoAppShell.
Add GeckoThread.initWithProfile that make it easy to target a particular
profile. The method succeeds when GeckoThread has not been initialized
or is already using the specified profile. It fails when the current
profile does not match the specified profile.
Make sure we treat profiles under a custom directory differently. To
simplify things, custom profiles must already exist, and we don't
attempt to cache instances of GeckoProfile containing custom profiles.
Custom profiles are an edge use case (must be passed in via Intent
arguments) so I think it's reasonable to have this behavior change.
Only determine GeckoThread arguments when GeckoThread has not been
started in GeckoApp. Otherwise, if GeckoThread has already started, we
don't need those arguments.
GeckoProfile.get() was reaching into GeckoApp to get and set the current
profile. I think now that GeckoThread is managing the profile, we don't
need that anymore. Also move the GuestSession check to getFromArgs, and
get rid of GeckoApp.getDefaultProfileName and
GeckoProfile.sIsUsingCustomProfile, which are redundant now.
Because Gecko itself can only handle one profile per process, we should
let the GeckoThread singleton manage our GeckoProfile instance on the
Java side, instead of using GeckoApp.
Android's Settings.canDrawOverlays() returns true/false for one of the packages with the same
sharedUserId. There's no guarantee that this is actually the current package.
Instead of relying on Settings.canDrawOverlays() we just try to add and remove an invisible
view through WindowManger. If this succeeds then we obviously can draw overlays and if this
fails then we seem to not have the permission.
MozReview-Commit-ID: 1jdrQ7iV3ek
The probes in this patch are annotated with the extra "dom-push-api"
to distinguish from future Fennec-specific push messages. These
probes allow to determine for each user the difference:
{# sites subscribed to} - {# sites unsubscribed from}.
If we assume the same site is not subscribed to multiple times, this
is a good approximation to the total number of sites the user receives
push messages from.
To test manually:
0) Install Fennec and execute |adb shell setprop log.tag.Telemetry DEBUG|.
1) Subscribe to notifications on a site like serviceworke.rs.
Observe a UI Telemetry SAVE event, like:
D/Telemetry( 7109): SendUIEvent: event = save.1 method = service timestamp = 277456 extras = dom-push-api
2) Send a push notification using the sites' interface.
Observe a UI Telemetry PUSH_RECEIVED_MESSAGE event, like:
D/Telemetry( 7109): SendUIEvent: event = action.1 method = service timestamp = 361795 extras = dom-push-api
3) Unsubscribe to notifications by revoking permission using Site
Settings from the URL bar.
Observe a UI Telemetry PUSH_UNSUBSCRIBED_FROM_SITE event, like:
D/Telemetry( 7109): SendUIEvent: event = unsave.1 method = service timestamp = 393600 extras = dom-push-api
MozReview-Commit-ID: IOCwfXFnowA
The existing code assumes an Activity, not just a Context, but doesn't
statically guarantee it. This patch is safe because it dynamically
type-checks, but it would be better to declare the member to be an
Activity.
MozReview-Commit-ID: 9AigV055I5j
GlobalHistory is Fennec-specific: it accesses the Fennec history data
store, and collects Telemetry. This allows other consumers to
implement their own store as appropriate.
MozReview-Commit-ID: 75Uxc5k8V0O
This moves some Fennec-specific home-screen icon manipulations out of
GeckoAppShell. A GeckoView interface can follow.
MozReview-Commit-ID: 7OhRAT9Agdh