Commit Graph
3386 Commits
Author SHA1 Message Date
James Willcox ff6825c688 Bug 1483329 - Hook Fennec up to new crash handling API r=jchen 2018-09-11 12:04:08 -05:00
James Willcox a9cfc15889 Bug 1483329 - Remove job id methods from GeckoRuntimeSettings r=jchen 2018-09-11 12:04:08 -05:00
James Willcox cefd1a2e44 Bug 1483329 - Remove existing crash-related methods in GeckoRuntimeSettings r=jchen 2018-09-11 12:04:07 -05:00
Jan Henning 9c706066c5 Bug 1489594 - Decouple application-background event from clearing of current activity. r=jchen
When the OS needs to display a permission prompt, our current activity is paused
and onSaveInstanceState gets called, however the activity isn't stopped yet.
When the permission handling then returns with the results to us, we display
the file picker using the current activity as retrieved from the GeckoActivity-
Monitor.

The problem is that in bug 1437382, our application-background handling was
changed such that it would already be triggered by the preparatory onSave-
InstanceState call. This had the side effect that the current activity would
be cleared from the GeckoActivityMonitor at that point already. Therefore, in
our case showing the file picker would fail because the GAM would have cleared
the current activity already after the runtime permission prompt caused our
previous activity to save its state.

To fix this, we change the behaviour of the GeckoActivityMonitor such that it
will continue to trigger our application-background handling during onSave-
InstanceState if possible, but will only clear the current activity when it is
stopping for real.

Differential Revision: https://phabricator.services.mozilla.com/D5304
2018-09-07 21:47:58 +00:00
Jan Henning 94d935ad31 Bug 1488174 - Use UpdateServiceHelper to decide on whether to add Updater notification channel. r=jchen
That way, we only add that notification channel if the updater really is active,
i.e. not if we've been installed from the Play Store.
Unfortunately, using the UpdateServiceHelper requires a Context, so adding/re-
moving the UPDATER_CHANNEL_TAG cannot be done during variable initialisation.

Differential Revision: https://phabricator.services.mozilla.com/D4890
2018-09-07 07:12:50 +00:00
Petru Lingurar 55b92ac908 Bug 1488691 - Prevent registering listeners if PIP failed; r=jchen
Also, if entering PIP fails will make sure that upon restarting the activity
it's orientation will match device's.

Differential Revision: https://phabricator.services.mozilla.com/D5035
2018-09-06 18:41:09 +00:00
Coroiu Cristina 851dcba80d Backed out changeset b9e56df24edc (bug 1488174) for fennec crashing at startup a=backout 2018-09-06 18:16:18 +03:00
Andreea Pavel bcca500c93 Merge mozilla-inbound to mozilla-central. a=merge 2018-09-06 07:37:40 +03:00
Jan Henning e7eac4c3ef Bug 1485151 - Part 2 - Switch our whitelisting of StrictMode violations to try-with-resources. r=jchen
In my opinion this is an altogether nicer way of setting and resetting temporary
StrictMode exceptions. The only fly in the ointment is that this causes a
warning about a technically unused variable that subsequently needs suppressing.

Differential Revision: https://phabricator.services.mozilla.com/D4889
2018-09-04 22:28:22 +02:00
Jan Henning f6ec342e50 Bug 1488174 - Use UpdateServiceHelper to decide on whether to add Updater notification channel. r=jchen
That way, we only add that notification channel if the updater really is active,
i.e. not if we've been installed from the Play Store.
Unfortunately, using the UpdateServiceHelper requires a Context, so adding/re-
moving the UPDATER_CHANNEL_TAG cannot be done during variable initialisation.

Differential Revision: https://phabricator.services.mozilla.com/D4890
2018-09-05 19:07:50 +00:00
Jan Henning d061efa762 Bug 1479532 - Part 2 - Use more sensible importance level for default notification channel. r=jchen
Previously, most of our notifications were silent, so we adopt a default
priority of IMPORTANCE_LOW instead of IMPORTANCE_DEFAULT.

Since we cannot change the priority setting for existing users on Nightly any
more, we technically have to retire the old default channel and replace it by
a new channel with a different ID. While in a way this is circumventing Google's
API design and destroys any existing customisation users have set for that
channel, we are only using this exceptionally to *lower* the initial priority of
our default notification channel, which we accidentally set too high. Besides,
it is unlikely that there are many users who really want to receive all kinds of
random Firefox notifications with a high priority.

Differential Revision: https://phabricator.services.mozilla.com/D4364
2018-09-05 18:47:04 +00:00
Petru Lingurar 121db1888d Bug 1480083 - After exiting PIP the restarted activity should have device's orientation; r=sdaswani
Differential Revision: https://phabricator.services.mozilla.com/D4939
2018-09-04 16:14:30 +00:00
Andrei Lazar 0f3e30c432 Bug 1486432 Leanplum push notifications are not received on devices with Android O or above r=JanH,flod
Added a default channel for Leanplum push notifications as fallback to cover the cases where we receive
push notifications from server with an invalid channel and the case where there are no channels configured
on server.

Provided a valid default icon for push notifications in Leanplum required for fallback strategy.

Differential Revision: https://phabricator.services.mozilla.com/D4704
2018-09-03 10:21:51 +00:00
Jan Henning ccbaad7e55 Bug 1479532 - Part 1 - Create notification channel for receiving synced tabs. r=jchen
Differential Revision: https://phabricator.services.mozilla.com/D4366
2018-09-02 20:09:09 +00:00
Vlad Baicu 623c2f8911 Bug 1479314 - Prevent media control notification flashing. r=jchen
Instead of stopping the foreground service whenever ACTION_PAUSE was triggered,
I created a new event where we notify the service to clear its foreground state.
Cleared usages of the NotificationManager and the onGoing attribute of the
MediaNotification because they are redundant. As of Android 4.3 a service in the
foreground state will always force the notification to be persistent and callling
stopForeground(false) will clear the onGoing flag while maintaining the notification.

Differential Revision: https://phabricator.services.mozilla.com/D4567
2018-08-30 17:47:51 +00:00
Petru Lingurar b37a2daa15 Bug 1480091 - Don't hide the status bar when exiting PIP mode; r=jchen
From the PIP window the user can either return to the fullscreen app or exit
it entirely.
Fullscreen and subsequently hiding the status bar should only be done if the
user is returning to the app.

Differential Revision: https://phabricator.services.mozilla.com/D4676
2018-08-30 17:49:29 +00:00
Jan Henning 6948d95af0 Bug 1482105 - Use dedicated notification channel for the built-in updater. r=jchen
To avoid cluttering our notification settings on builds not using the built-in
updater, we only add that channel when required.
Passing a null channelId to the system NotificationManager, which can then
happen if someone attempts to use the UPDATER channel anyway, even though
MOZ_UPDATER is false, is safe. It just means that the NotificationManager will
return the system's default channel, which will silently swallow any
notifications posted to it from apps targeting Android O or above.

Differential Revision: https://phabricator.services.mozilla.com/D4584
2018-08-30 18:59:52 +00:00
Jan Henning 99579dc834 Bug 1479532 - Part 0 - Cleanups. r=jchen
Differential Revision: https://phabricator.services.mozilla.com/D4367
2018-08-28 18:53:20 +00:00
alwu 7cbf9327d9 Bug 1479270 - part2 : remove HLS video player. r=snorp
Since we have native HLS support in 59 [1], we can remove those codes which is used to play HLS.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1345752

Differential Revision: https://phabricator.services.mozilla.com/D4166
2018-08-24 22:36:18 +00:00
Andreea Pavel 546d6fb079 Backed out 2 changesets (bug 1479270) for android lint on a CLOSED TREE
Backed out changeset 1676f895a710 (bug 1479270)
Backed out changeset 643ef11ea720 (bug 1479270)
2018-08-24 20:16:14 +03:00
alwu 9e058b69ab Bug 1479270 - part2 : remove HLS video player. r=snorp
Since we have native HLS support in 59 [1], we can remove those codes which is used to play HLS.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1345752

Differential Revision: https://phabricator.services.mozilla.com/D4166
2018-08-24 14:52:00 +00:00
Vlad Baicu e9abd573b0 Bug 1474633 - Check if pager navigation is null before calling it. r=jchen
Check if pager navigation is null before calling it.

Differential Revision: https://phabricator.services.mozilla.com/D4092
2018-08-23 20:56:01 +00:00
Jan Henning ed9d55e92f Bug 1484472 - Avoid FileUriExposedException in ExternalIntentDuringPrivateBrowsingPromptFragment. r=jchen
The fragment is also used to handle intents launched through GeckoAppShell.
openUriExternal(), such as e.g. when launching downloaded files from
about:downloads.

The synchronous code path when not in private browsing is already covered by the
code added in bug 1450449, but the async path through the fragment when in
private browsing needs to be handled separately.

Differential Revision: https://phabricator.services.mozilla.com/D3916
2018-08-22 16:50:04 +00:00
James Willcox 36d8bcc0f1 Bug 1480095 - Allow NavigationDelegate.onLoadError() to return URL for error page r=esawin,jchen
MozReview-Commit-ID: 4pgHD6oh4GY
2018-08-22 08:48:20 -05:00
Jim Chen 73be9e17e4 Bug 1330257 - 2. Separate out session focused state from active state; r=droeh
Make a distinction between a session being active (i.e. being visible)
and it being focused. More than one session may be active at a time, but
only one session is focused at a time. This means the focused session is
always active, but an active session may not be focused.

Also, manage setting of active/focused states in GeckoView itself, so
consumers don't generally have to worry about these states.

Differential Revision: https://phabricator.services.mozilla.com/D3251
2018-08-21 15:23:28 -04:00
Gurzau Raul d4882c2da1 Backed out 8 changesets (bug 1330257) for Geckoview failures at GeckoSessionTestRuleTest.waitForPageStop_throwOnChangedCallback on a CLOSED TREE
Backed out changeset c26970c767e1 (bug 1330257)
Backed out changeset 53ef69afca69 (bug 1330257)
Backed out changeset 62e53fa35d5b (bug 1330257)
Backed out changeset 7c589fc8621b (bug 1330257)
Backed out changeset 593f9a799d11 (bug 1330257)
Backed out changeset 9085b9fd557c (bug 1330257)
Backed out changeset aa0ef9b0e96a (bug 1330257)
Backed out changeset 7186e64192f7 (bug 1330257)
2018-08-21 06:51:29 +03:00
Jim Chen d16a866201 Bug 1330257 - 2. Separate out session focused state from active state; r=droeh
Make a distinction between a session being active (i.e. being visible)
and it being focused. More than one session may be active at a time, but
only one session is focused at a time. This means the focused session is
always active, but an active session may not be focused.

Also, manage setting of active/focused states in GeckoView itself, so
consumers don't generally have to worry about these states.

Differential Revision: https://phabricator.services.mozilla.com/D3251
2018-08-20 22:28:20 -04:00
Edouard Oger 12c9a546f1 Bug 1484090 - Flag the device for re-registration on push subscription not found r=lina
Differential Revision: https://phabricator.services.mozilla.com/D3567
2018-08-17 15:09:48 +00:00
Michael Comella aa71123c2f Bug 1373964 - On profile migrate, delete <dir>/res/fonts. r=vladbaicu
The previous implementation attempted to delete files from /res/fonts (i.e.
root). I don't believe this was intended either:
https://bugzilla.mozilla.org/show_bug.cgi?id=878674#c0 indicates the fonts
directory should be inside the data dir of the application. The crash occurs
when the /res/fonts directory exists (only some devices) but the user doesn't
have read access. If the user has write access, our code may actually delete
these system files: uh oh!

My fix is to change the deletion from /res/fonts to <dir>/res/fonts. I verified
this fix worked by creating a clean profile, adding dummy files to the
res/fonts dir, and making sure only the correct ones were deleted (in zsh):

export DIR=/data/data/org.mozilla.fennec_mcomella; \
    adb shell pm clear org.mozilla.fennec_mcomella && \
    adb shell mkdir -p $DIR/res/fonts && \
    for i in touch.ttf lol.rdf; do adb shell touch $DIR/res/fonts/$i; done && \
    adb shell ls $DIR/res/fonts

MozReview-Commit-ID: 8atpcjYjGu0
2018-08-14 18:43:42 -07:00
Jan Henning 208e35b70e Bug 1414084 - Part 17 - Fix setting of private browsing theme state. r=Grisha
Previously, this wasn't noticeable since adding/removing a PageAction would call
refreshPageActionIcons(), which would do the correct thing, but now a newly
created PageActionLayout can start with an already pre-populated mPageAction-
List, which means that the subsequently arriving call to setPrivateMode() will
erroneously activate the private mode tinting for all PageActions that support
it.

MozReview-Commit-ID: EvNx1Q9vwZ5
2018-03-02 18:01:28 +01:00
Jan Henning 700c57d0d8 Bug 1414084 - Part 15 - Correctly remove already resolved PageActions, too. r=Grisha
When a PageActions:Remove message arrives and we cannot simply forward it, we
need to remove not just pending PageActions:Add messages, but also any already
present PageActions objects that a former PageActionLayout had handed to us.

MozReview-Commit-ID: 3jnGsmMuVfa
2018-03-03 18:11:57 +01:00
Jan Henning 728a6d9248 Bug 1414084 - Part 14 - Rename isPwaAdded for more clarity. r=Grisha
Despite its name and the original purpose for which it was added, that function
generically checks for duplicates among all PageActions, not just the PWA badge.

MozReview-Commit-ID: Ae6FsLb9F3S
2018-03-18 20:39:00 +01:00
Jan Henning a0703fa158 Bug 1414084 - Part 13 - Cache PageActions. r=Grisha
Since converting a PageAction message into an actual PageAction object also en-
tails parsing the image data URL into a drawable, we leave that task to the
PageActionLayout.

This means that the PageAction cache needs to operate slightly differently than
the MenuItem cache. First, we store all PageAction BundleEvent messages that
arrive while no PageActionLayout is ready and then forward them en masse when
one becomes available. Secondly, if the PageActionLayout is going away again,
we then also take a list of already parsed PageAction objects for safekeeping.

MozReview-Commit-ID: AcPPONXqe46
2018-02-26 21:50:50 +01:00
Jan Henning 0e1e505c2c Bug 1414084 - Part 12 - Add some tests for the processing of Menu messages. r=Grisha
MozReview-Commit-ID: D8Aujo1PgIk
2018-03-19 20:06:32 +01:00
Jan Henning 00cb8b26f6 Bug 1414084 - Part 11 - Use a Map for the MenuItemInfo list. r=Grisha
Since all related EventDispatcher messages use UUIDs, it makes sense to store
our MenuItemInfos in a Map, so we can access them directly by UUID instead of
having to iterate over them until we've found the desired one.

Since we want to preserve the order in which MenuItemInfos were added, we use a
LinkedHashMap.

MozReview-Commit-ID: BEtJ59tX59m
2018-03-18 18:07:16 +01:00
Jan Henning 7151f058ff Bug 1414084 - Part 10 - Init MenuItemInfo list right from the start. r=Grisha
The small savings in initialising this on demand the first time a menu item is
added, are not worth the additional complexity in null checks and the like.

MozReview-Commit-ID: Lcz09Ds8NxJ
2018-03-18 17:47:33 +01:00
Jan Henning d213aaca38 Bug 1414084 - Part 9 - Move add-on menu item cache out of BrowserApp. r=Grisha
Bug 832990 solved the issue of us losing the menu item cache if BrowserApp was
destroyed, however the issue remains that we'll miss any Menu:... messages that
are sent while BrowserApp doesn't exist, e.g. if Gecko is initially loaded
through a GeckoView-based activity.

Therefore we now move the menu item cache and the listener for those messages
into a separate class, whose lifetime better matches that of Gecko.

Apart from any necessary changes, we move the existing code as is. The only
additional change is that we make addAddonMenuItemToMenu() static, because we
can.

MozReview-Commit-ID: BJleonLnjmo
2018-02-25 22:22:37 +01:00
Jan Henning 80061a1823 Bug 1414084 - Part 8 - Unify menu item EventDispatcher messages. r=Grisha
As a final step, these can be merged as well. The same reasoning as in the
previous patch applies with regards to additional functionality that isn't
(yet) used by webextensions.

MozReview-Commit-ID: Ezx2mQY0s85
2018-03-18 16:42:57 +01:00
Jan Henning 53c5b2d8df Bug 1414084 - Part 7 - Use one set of functions for managing MenuItems in the UI. r=Grisha
The original add-on functions have some additional capabilities regarding e.g.
checkboxes, disabling the menu, etc. that right now aren't required for
Webextensions (yet?), but in that case they will simply not be used - in any
case BrowserActions.jsm controls what functionality is actually exposed to
add-ons.

MozReview-Commit-ID: DPT8gV2gb6q
2018-03-18 14:17:03 +01:00
Jan Henning bd38a50a80 Bug 1414084 - Part 6 - Use only one list to store menu items added from Gecko. r=Grisha
Now that the UI code for handling both the old NativeWindow API and Web-
extensions is more or less the same and both are using the same MenuItemInfo
class, there's no longer any real need to keep items added through the two APIs
in separate lists - in fact doing so makes it harder to preserve the ordering
of menu items if the activity and its menu are destroyed and need to be re-
created later on from the stored lists of MenuItemInfos.

MozReview-Commit-ID: KlJdvO9WhhY
2018-03-23 19:58:18 +01:00
Jan Henning 718b8328c9 Bug 1414084 - Part 5 - Unify menu click event handling. r=Grisha
Now that both Webextensions and the NativeWindow API manage their onClick call-
back handling by UUID, we can start using the same EventDispatcher message for
both.

MozReview-Commit-ID: J3RRXrwPdTI
2018-03-18 14:24:15 +01:00
Jan Henning d9121962ca Bug 1414084 - Part 4 - Move menu item ID generation into the UI. r=Grisha
Since the NativeWindow API now only uses UUIDs as well when dealing with its
consumers, we can leave generation of the menu to the Android UI code of
Firefox.

MozReview-Commit-ID: 1qDLDnePfFE
2018-03-18 15:43:27 +01:00
Jan Henning c880075dc4 Bug 1414084 - Part 3 - Store NativeWindow menu callbacks by UUID. r=Grisha
MozReview-Commit-ID: 7nEhAUxOIsW
2018-03-18 13:33:42 +01:00
Jan Henning 845d362f1a Bug 1414084 - Part 2 - Use UUIDs for the NativeWindow menu API, too. r=Grisha
At the moment, the code for handling of JS-created main menu items is more or
less duplicated between the old NativeWindow API and Webextensions, with the
only real difference being that the former communicates directly via menu item
IDs, while the latter uses UUIDs for messaging between Gecko and the UI.

By switching the NativeWindow API to using UUIDs as well, we will be able to
start unifying this code again.
As for backward compatibility
- the return value of NativeWindow.menu.add is valid for the current session
  only, so no migration is necessary
- the return value of NativeWindow.menu add was already effectively only an
  opaque value which only had real meaning for subsequent calls to menu.add,
  menu.update and menu.remove, so it shouldn't really matter whether we return
  a plain numeric ID or an UUID in string form
- old-style add-ons are now unsupported for better or for worse and our one in-
  tree caller won't have any problems with this change

MozReview-Commit-ID: HdRNhrx1pu7
2018-03-18 13:26:16 +01:00
Jan Henning d628dbf255 Bug 1414084 - Part 1 - No longer track MenuItemInfo "added" data. r=Grisha
We no longer use that value anywhere, so we can just stop keeping track of it.

MozReview-Commit-ID: D1IgX1t8SKI
2018-03-18 13:49:31 +01:00
Jan Henning 3336e29ec3 Bug 1414084 - Part 0 - Cleanups. r=Grisha
MozReview-Commit-ID: B3ZGN2X8JXH
2018-02-25 20:53:01 +01:00
Jan Henning e728b16485 Bug 1476106 - Part 5 - Subscribe PromptService to OrientationChangeListener, too. r=snorp
Now that GeckoScreenOrientation generally offers notifications of screen
orientation changes, the PromptService no longer needs to do its own orientation
tracking and require to be fed orientation changes from each activity using it.

MozReview-Commit-ID: K7KbDsQip7b
2018-08-02 21:17:07 +02:00
Jan Henning e6691c643a Bug 1476106 - Part 3 - Move GeckoScreenOrientation updates into GeckoView. r=snorp
By moving the calls to GeckoScreenOrientation.update() into GeckoView, any app
using a GeckoView will automatically update the screen orientation in Gecko,
too, without any further action being required by the embedding app.

The synchronisation around GeckoScreenOrientation.update()/(un)lock() is
required for the following scenario:
If (un)locking of the screen orientation as requested by Gecko caused the
actual screen orientation of the app to change, there are two ways in which this
will cause our internal screen orientation to be updated:
1. Either the call to delegate.setRequestedOrientationForCurrentActivity
   (happening on the Gecko thread if the original request to (un)lock came from
   Gecko) returns first and update() is subsequently first called from the Gecko
   thread, too, meaning the onOrientationChange notification to Gecko can occur
   synchronously as well. In that case, as soon as (un)lock returns to Gecko,
   querying our internal screen orientation will return the correct value.
2. Or else the GeckoView.onConfigurationChanged() call resulting from the screen
   rotation manages to call GeckoScreenOrientation.update() first and does so
   from the Android UI thread. This means that the onOrientationChange
   notification will be redispatched asynchronously to the Gecko thread, while
   the Gecko thread's call to GeckoScreenOrientation.update() will return early
   without doing any work, as the screen orientation had already been previously
   updated by the UI thread.
   As a result,there will be a period of time between the Gecko thread returning
   from GeckoScreenOrientation.(un)lock() and the onOrientationChange
   notification finally executing where querying the internal screen
   orientation will not yet return the new orientation. This can cause problems
   for Gecko (test) code that expects to (un)lock the orientation and then be
   able to immediately query the new, changed orientation after the call to
   (un)lock returns.

Without additional measures in place, there are no guarantees at what point
the GeckoView will receive the onConfigurationChanged() call in relation to the
request to change the activity's orientation making its way back to (un)lock().
Therefore, we add synchronisation such that no other thread will be able to up-
date the screen orientation in GeckoScreenOrientation while another thread is
still busy (un)locking the screen orientation.

MozReview-Commit-ID: 5s5NEJcuS0p
2018-08-12 13:31:59 +02:00
Jan Henning c26f2878b5 Bug 1476106 - Part 1 - Make it possible to notify Java listeners from GeckoScreenOrientation, too. r=snorp
Once responsibility for notifying GeckoScreenOrientation of potentially changed
screen orientations moves from GeckoApp into GeckoView, the former will no
longer be able to benefit from the return value of calling GeckoScreen-
Orientation.update(), indicating whether the orientation actually changed or in
fact remained the same.

GeckoApp however requires that information in order to reset/refresh parts of
the UI when the orientation changes, and since GeckoScreenOrientation is already
doing all the work of tracking screen orientation changes, we don't want to have
to partially duplicate those efforts again in GeckoApp.

Instead, we introduce a mechanism for GeckoScreenOrientation to notify
interested parties on the Android app side as well.

The GeckoScreenOrientation.update() call in GeckoApp.onResume() is removed
completely (as opposed to merely removing the refreshChrome() bit) at this stage
already because it is unnecessary. If any screen rotation happened while the
activity was in background, it will receive an onConfigurationChanged() call
anyway before being resumed again.

MozReview-Commit-ID: Ila1evcj8Ud
2018-08-02 21:10:33 +02:00
Jan Henning b194b1e1b1 Bug 1476106 - Part 0 - Cleanup imports. r=JanH
MozReview-Commit-ID: UHUdrWSIks
2018-08-02 20:51:17 +02:00