Commit Graph
464 Commits
Author SHA1 Message Date
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
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
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
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
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
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
Petru Lingurar 2fa6389321 Bug 1349523 - Add support for playing videos in Picture-in-picture mode; r=jchen
MozReview-Commit-ID: DKlBFRo9q8t
2018-06-22 12:57:02 +03:00
Andrei Lazar baef92682c Bug 1450447 - Start using notification channels. r=jchen
Made all the notifications within the app to use notification channel for devices with API26 and higher.

MozReview-Commit-ID: CVmpitNsS66
2018-07-06 17:57:22 +03:00
Petru Lingurar f70bcdebf1 Bug 1465323 - Update PackageAddedReceiver. r=JanH
This Receiver was used for implicit broadcasts and registered statically.
Refactored MmaDelegate() to register it dynamically in the init() method,
called in activity's onCreate and unregister it in activity's onDestroy.
This way we will still get notified immediately if the user installs any of
the apps we are interested in, even though he might not return to Fennec
immediately after. This will help to better asses the impact of suggestions to
install recommended packages.

For the cases in which the user installs the packages without us suggesting to
or if he kills our app before completing the new install, we will trigger a
check for the install status of the packages in MmaDelegate().init().

Also cleaned the code a little.

MozReview-Commit-ID: I00mLS2snzj
2018-07-16 21:15:32 +03:00
Petru Lingurar 00f9e9cc86 Bug 1407046 - Migrate DownloadContentService to JobIntentService. r=snorp
Broke the big IntentService into four small JobIntentServices because
the same JobIntentService class cannot be used with multiple JobIds
(https://github.com/aosp-mirror/platform_frameworks_support/blob/b6838fd2d2e834fdd38aab34511d385cb7108f63/compat/src/main/java/android/support/v4/app/JobIntentService.java#L121)
Also:
    - will make the code easier to be migrated to WorkManager in the future
    - more in line with SRP. It was initially doing too much.

Cleaned the code a little, removed the superfluous creation of new Threads for
DownloadContentCatalog().persistChanges() / .startLoadFromDisk()
as those methods are always called from the background threads
of the new JobIntentServices.
The new DlcHelper helps reducing duplicated code.

MozReview-Commit-ID: G3fsWYOGEbR
2018-06-26 17:31:19 +03:00
Petru Lingurar c3646527ee Bug 1385464 - Start using support library v. 26; r=nalexander
This patch also:
Resolves missing resources and api changes
- LeanplumActionBarActivity was removed because Support Library 26 deprecated
ActionBarActivity. Class was already not in use.
- CustomTabsService added two new methods which we need to override.
Tested to make sure that previous functionality was maintained but with the
addition of the two new methods maybe that feature could be improved.
- For checking layout direction we'll use our own new method from ViewUtil
which mimics what the now restricted method from the support library would do.
- Upgraded to use AppCompatResources#getDrawable(..) in place
of the now restricted AppCompatDrawableManager.get().getDrawable(..).

Resolves obscure leaks and crashes after the upgrade
- LoaderManager.destroyLoader(..) was added before the existing call to
LoaderManager.restartLoader(..) to prevent potential Cursor leaks
- Disable website suggestions depending on the address bar inputs when running
in automation to avoid Robocop tests failing (they were entering serially maybe
100 characters in <5 ms which created around that many new Threads,
operation that could cause the Executor to throw a RejectedExecutionException)
At the moment this functionality is not covered by tests anyway and it was the
only fix I could find that would not involve changing the whole implemenation
for address bar suggestions, implementation which in the real world works ok.

MozReview-Commit-ID: 2fX1SBHiSh0
2018-07-13 17:16:37 +03:00
Rob Wu dc75f4427d Bug 1448305 - Avoid disk cache for icons of private tab's session history. r=JanH 2018-07-16 12:19:18 +02:00
Petru Lingurar 5580ddb70b Bug 1386192 - Test Leanplum Custom Message for Onboarding; r=cnevinchen+582291
Created LeanPlumVariables to allow LeanPlum overwriting the values used for
populating the OnBoarding screens. By simply adding the @Variable annotation
to it's fields, on the first run of the app, they will appear in "LeanPlum
dashboard - Variables" and will allow overwriting for future runs.

The OnBoarding process will now try to use LeanPlum values if possible.
Because connecting to LeanPlum and downloading the Variables might take
a few seconds we use a delay of up to 3 seconds until starting to show
the Onboarding screens.
The default values will still be used if:
- if the LP experiment is not available
- if no internet connection
- if more than 3 seconds have passed and LP didn't finish it's download

Added two new events that could be tracked to Leanplum
MmaDelegate.ONBOARDING_DEFAULT_VALUES and MmaDelegate.ONBOARDING_REMOTE_VALUES
to inform if showing the Onboarding with server values was possible or not.

Because of the 3 seconds delay until showing the Onboarding panels leaking the
could be possible. Used WeakReferences for both the Activity in
OnboardingHelper and the OnboardingHelper in MmaLeanplumImp to avoid it.

MozReview-Commit-ID: H30e9Ng7jrM
2018-07-04 12:56:20 +03:00
Petru Lingurar 9388bf17de Bug 1454686 - Respond to changes in the new preference state state; r=mcomella
Because Mma cannot work if Health Report is disabled by the user (Settings - Privacy)
we will treat toggling Health Report on/off the same as we treat toggling the new preference from Settings - Notifications.
Toggling Health Report on will inform about the need to start LeanPlum (useful if the user did not explicitly stopped LP notifications but only Health Report which in turn disabled LeanPlum also) but there are other checks made afterwards (BrowserAp() is informed about this which calls GeckoPreferences.isMmaAvailable(..)) to decide if LP can and should be enabled.

Toggling any of these preferences will trigger an event caught by BrowserApp which can either
    - immediately initialize LeanPlum (if the toggle was off LP is not running) as it would normally do when the app first starts
    - stop LeanPlum reporting to servers, flush the per-session available messages
      and resets the LP started status so that it can be restarted in the same app session (like if the user toggles the feature again)

MozReview-Commit-ID: 1SmhN0NucWW
***
2018-05-16 15:54:13 +03:00
Petru Lingurar f4fda68d95 Bug 1454686 - Small refactoring of Mma related methods; r=mcomella
With the adding of the new preference that Mma depends on we need to have only one place where all the conditions for considering if Mma is available are checked - GeckoPreferences.isMmaAvailableAndEnabled()
Added only one place from where the availability of the LP experiments should be checked as that currently involves two checks - MmaDelegate.isMmaExperimentEnabled(..)
Also renamed isMmaEnabled() from MmaDelegate() and initSwitchboard from BrowserApp() to better express what those methods do.

MozReview-Commit-ID: BCJqM9b5JbW
***
2018-05-17 18:55:38 +03:00
Jim Chen f2f3a492bf Bug 1457255 - 2. Fix Java warnings; r=me
Fix all Java warnings in the Android codebase except deprecation and
serial warnings, and warnings in third-party code.

There is one required change to exoplayer2 code under thirdparty,
because that code is included directly in the geckoview project, instead
of the thirdparty project. I think I'll just make a pull-request to
upstream the change, instead of separating exoplayer2 into a
gv-thirdparty project.
2018-05-01 00:22:54 -04:00
Noemi Erli 3c14ea8f31 Backed out 4 changesets (bug 1457255) for kotlin warnings/errors are not being parsed by Treeherder a=backout
Backed out changeset 9c42ce50a911 (bug 1457255)
Backed out changeset 524a0f9fb978 (bug 1457255)
Backed out changeset a49833bfd519 (bug 1457255)
Backed out changeset 4eccde5dfbef (bug 1457255)
2018-05-02 01:16:57 +03:00
Jim Chen 1133dd50cb Bug 1457255 - 2. Fix Java warnings; r=me
Fix all Java warnings in the Android codebase except deprecation and
serial warnings, and warnings in third-party code.

There is one required change to exoplayer2 code under thirdparty,
because that code is included directly in the geckoview project, instead
of the thirdparty project. I think I'll just make a pull-request to
upstream the change, instead of separating exoplayer2 into a
gv-thirdparty project.
2018-05-01 00:22:54 -04:00
Petru Lingurar 09e3c80f37 Bug 1423045 - Drop an event when User changes default browser to Firefox; r=mcomella
Use SharedPreference to ensure we won't loose previous state if Fennec is killed, set as default, restarted.
The default browser status will only be set once, when the app is resumed, as it cannot change while the app is in foreground.
We will track "E_Changed_Default_To_Fennec" only if Fennec wasn't previously the default browser.
The method to track the event is safe to be called even before the mma init process is finished as LeanPlum postpones the track operation until it has actually been started.

Refactored MmaDelegate to not use a WeakReference for application context anymore as that should exist for the entire time the app is open, and only in that timeframe the MmaDelegate methods that use that context can be called.

MozReview-Commit-ID: JMJJclWj9fq
2018-04-18 15:21:12 +03:00
Eitan Isaacson 392de1f884 Bug 1449364 - Create SessionAccessibility for GeckoSession. r=jchen r=yzen 2018-04-12 13:46:47 -07:00
Margareta Eliza Balazs dacc6fec21 Backed out 2 changesets (bug 1449364, bug 1453278) for rc4 and 42 perma failures in layout/base/tests/test_bug332655-2.html and testInputConnection on a CLOSED TREE
Backed out changeset 7149139c60d9 (bug 1449364)
Backed out changeset bcfee006ebaa (bug 1453278)
2018-04-12 15:30:20 +03:00
Eitan Isaacson 2302d1e7dd Bug 1449364 - Create SessionAccessibility for GeckoSession. r=jchen r=yzen 2018-04-11 15:21:00 +03:00
Petru 134eaf3874 Bug 1423046 - Drop an event when User opens the Firefox app (from Leanplum contextual hints); r=mcomella
The app already sends "E_Launch_Browser" for when it is first launched.

MozReview-Commit-ID: 9BU6b3D58vY
2018-04-05 13:34:32 +03:00
Jan Henning 6c9b6523fc Bug 1450076 - Add more keyboard shortcuts for opening new tabs. r=jchen
We cannot open completely new windows on mobile, but we sort of mimic desktop
by having Ctrl + N/Ctrl + Shift + P always open a new normal/private tab,
whereas for Ctrl + T the kind of tab opened will now depend on the currently
selected tab.

MozReview-Commit-ID: KmPCcnn79OH
2018-03-29 21:05:47 +02:00
Jan Henning 05ab192225 Bug 1179698 - Part 1 - Put input focus on the URL bar when opening a new tab via keyboard. r=jchen
MozReview-Commit-ID: 2iZkO8FDB3R
2018-03-29 20:55:11 +02:00
Jan Henning 92ddd90a02 Bug 1179698 - Part 0 - Remove superfluous true/false ternary operator. r=jchen
Somehow I must have overlooked that during review, but if I'm touching something
in the neighbourhood I might just as well clean this up.

MozReview-Commit-ID: 95gnzSebGyf
2018-03-29 20:51:07 +02:00
Jan Henning e242a601be Bug 1278581 - Part 2 - Ensure a stray key-up event doesn't end up in Gecko after committing the URL bar input. r=jchen
When editing the URL bar, we're committing the input and starting a page load in
response to a key-down event for the Enter key.
We end up hiding the ToolbarEditLayout from within the key event handler, which
means that by the time we get the corresponding key-up event, input focus has
moved on and the key event ends up being dispatched to the GeckoView and
consequently to Gecko.

This means that loading an URL from the URL bar by pressing Enter will reset
millisSinceLastUserInput, which defeats our logic to distinguish URLs loaded via
the Android UI from those loaded by clicking on links within the content.

MozReview-Commit-ID: 3Wbnk3bnqVS
2018-03-21 20:44:31 +01:00
Dylan Roeh 2617ae421a Bug 1432487 - Rename all *Listeners to *Delegates and corresponding minor changes. r=snorp,jchen 2018-03-01 08:49:52 -05:00
Cosmin Sabou 1ba0cb7655 Backed out changeset 2b86e947b043 (bug 1432487) for Android build bustages on several files that were renamed. CLOSED TREE 2018-03-01 00:29:12 +02:00
Dylan Roeh b66e3d995c Bug 1432487 - Rename all *Listeners to *Delegates and corresponding minor changes. r=snorp,jchen 2018-02-28 16:36:36 -05:00
Eugen Sawin 0478424983 Bug 1432235 - [1.2] Move GeckoView API classes to org.mozilla.geckoview. r=snorp,jchen 2018-02-22 00:46:26 +01:00
Grigory Kruglov cf3a32e48c Bug 1429735 - Pre: cleanup some unused helper methods r=nalexander
MozReview-Commit-ID: vpnFdFYf4V
2018-01-23 16:05:11 -05:00
Andreea Pavel 6ce9ddd168 Merge mozilla-central to autoland. on a CLOSED TREE 2018-02-15 12:34:12 +02:00
Snowrries c80e9069a9 Bug 1435060 - Allow keyword bookmark as search query; r=JanH
Function queryExists added to StringUtils to check
if a given URL allows for arguments.
Tests for said function added to TestStringUtils.
Function loadUrlOrKeywordSearch in BrowserApp.java updated to also pass
the entire entered string along regardless of whether or not the first
words are keyword bookmarks iff there is additional text after the
keyword bookmark, and the keyword bookmark does not accept any input arguments

MozReview-Commit-ID: 2eyi5Botd3F
2018-02-14 03:07:13 -05:00
Jim Chen 197a96e299 Bug 1391268 - 4. Display message when APK is corrupt; r=snorp
Display a message on startup when the APK is corrupt. Right now the
"wrong SDK" message is displayed. I think we can potentially reuse that
message for Beta, but we need a different message for Nightly.

MozReview-Commit-ID: 9NEw252Ytkc
2018-02-14 16:56:54 -05:00
Suhail Alkowaileet 3e0fd416ac Bug 1432854 - Fix Tab counter doesn't show native numbers for non-arabic numeral languages r=JanH
MozReview-Commit-ID: 3STmgEGAbJG
2018-02-08 18:26:00 +03:00
Jan Henning b6817d461e Bug 832990 - Part 2 - Save and restore menu item caches via savedInstanceState. r=Grisha
MozReview-Commit-ID: 6x5BDqhwabS
2018-01-25 20:47:16 +01:00
Jan Henning 5658e2faf0 Bug 832990 - Part 1 - Make MenuItemInfo classes parcelable. r=Grisha
Longer term, the MenuItemInfo handling needs to be moved out of BrowserApp in
order to solve bug 1414084 [1], but the easier short term solution is to just
save the cached menu data via the savedInstanceState. This means that
MenuItemInfo and friends have to be made parcelable.


[1] Because of GeckoView, add-ons may load (and attempt to add menu items) while
BrowserApp isn't even alive.

MozReview-Commit-ID: HzPe7ZKbJOj
2018-01-25 20:20:35 +01:00
Jan Henning ea60d23038 Bug 1432619 - Remove DawnHelper. r=nechen
It was only used in the 55 Nightly and never meant to stay around.

MozReview-Commit-ID: JDJr9WC4V5M
2018-01-23 22:37:51 +01:00