Commit graph

74 commits

Author SHA1 Message Date
Sebastian Kaspari
9afa3a75f7 [components] Revert Gradle, Android Gradle Plugin and Kotlin upgrade. (PR https://github.com/mozilla-mobile/android-components/pull/8360)
Revert "Address even more lint errors."

This reverts commit e98ee991b34d318e671c644d63daec53902e68ff.

Revert "Update to Gradle 6.6.1."

This reverts commit cdda701c8f2be6c0486ddf1494885accf78aab00.

Revert "Address lint errors."

This reverts commit 26cb5b27bc2be672c89e7e0c63eeeda9f64c0d08.

Revert "Move JNA configuration to root project."

This reverts commit 694ef37cc30e727f3ec5d275c0e9583385980a43.

Revert "Issue https://github.com/mozilla-mobile/android-components/issues/8319: Update to Kotlin 1.4, Coroutines 1.3.9 and Android lint 27.0.1."

This reverts commit ad675c35e794050dbf8514a2d2fe7506ce0c546c.

Revert "Update Glean to 33.0.4."

This reverts commit 4731c4e2fa52d40f4062a47f02078ca0c85de632.

Revert "Update Glean to 33.0.0."

This reverts commit 352cf88a4d4bad64330d0ec997814fd8b13928c2.

Revert "Update Gradle to 6.1.1."

This reverts commit 18e88aa1a2528b10f7d81ff9dbf1df094071b6ce.

Revert "Update Android Gradle Plugin to 4.0.1."

This reverts commit f915a3b47b0f5584889ff62a80c9642bccfa36ce.
2020-10-06 14:57:11 +02:00
Sebastian Kaspari
6429e13dea [components] Move JNA configuration to root project. 2020-10-02 18:44:27 +00:00
Sebastian Kaspari
7d533c0993 [components] Move CrashReporting/Breadcrumb from support-base to concept-base. 2020-09-08 17:50:14 +02:00
Grisha Kruglov
d19d368a12 [components] Introduce split read/write places scopes 2020-08-14 10:04:39 -07:00
Grisha Kruglov
43cbfa8346 [components] For https://github.com/mozilla-mobile/android-components/issues/8011: Switch PlacesStorage to a single-threaded executor 2020-08-14 10:04:39 -07:00
Grisha Kruglov
7b80ed5b0d [components] For https://github.com/mozilla-mobile/android-components/issues/8011: Handle non-fatal places exceptions 2020-08-14 10:04:39 -07:00
codrut.topliceanu
da059d1e2c [components] For https://github.com/mozilla-mobile/android-components/issues/7422 - Handles case where synced devices exist but have no open tabs
Also renames two methods to provide additional clarity, and fixes a DefaultController test.
2020-06-18 14:48:44 +03:00
Christian Sadilek
9d31efc5f8 [components] Closes https://github.com/mozilla-mobile/android-components/issues/7244: PlacesHistoryStorage crash in Sample Browser 2020-06-11 18:41:57 -04:00
Gabriel Luong
c4fa7dd109 [components] Issue https://github.com/mozilla-mobile/android-components/issues/7094: Add getTopFrecentSiteInfos history API 2020-06-03 17:58:02 -04:00
Grisha Kruglov
c131f42a57 [components] Don't modify dependencies after task graph was completed 2020-05-20 18:04:40 -07:00
Jonathan Almeida
2d1417d83b [components] Close https://github.com/mozilla-mobile/android-components/issues/6837: Update class name to SyncedTabsStorage
We also introduce a `SyncedDeviceTabs` data class to make the result API
easier to work with for consumers.
2020-05-04 15:35:44 -04:00
Jonathan Almeida
b86fa6dfb5 [components] Close https://github.com/mozilla-mobile/android-components/issues/6601: Update targetSdkVersion to 29 2020-04-28 03:16:54 -04:00
Grisha Kruglov
03d5572144 [components] Closes https://github.com/mozilla-mobile/android-components/issues/6637: Support for v34 fennec database migrations migrations 2020-04-24 14:54:58 -07:00
Grisha Kruglov
a34a6ac9a7 [components] Closes https://github.com/mozilla-mobile/android-components/issues/6394 - Add warm-up API to places and logins storage layers
This allows consumers to ensure that underlying database connections are fully established.
After `warmUp` is called, there should be no additional overhead upon first access to the storage.
2020-03-25 21:09:03 -07:00
Edouard Oger
bc3a9abfca [components] Closes https://github.com/mozilla-mobile/android-components/issues/6253: Update application-services to v0.55.0 2020-03-16 15:48:16 -04:00
Grisha Kruglov
0932d55ed9 [components] Part 1: Add 'read pinned sites' support to browser-storage-sync 2020-02-09 11:36:32 -08:00
Vlad Filippov
6d2516abd4 [components] Bump a-s dependency to 0.48.3 2020-01-29 14:27:31 +01:00
Grisha Kruglov
c8ce05109e [components] Pre: bump a-s dependency to 0.48.1, expose migration metrics 2020-01-09 16:32:52 -08:00
Edouard Oger
edb7e4f504 [components] Closes https://github.com/mozilla-mobile/android-components/issues/5006: Add RemoteTabsStorage to storage-sync
The tabs engine `sync` method signature needs to be different than
the one currently defined in `SyncableStore.sync`.
`StorageSync` is the only user of the interface method and is deprecated
already.
This patch removes the `StorageSync` class and makes the store `sync`
methods not inherited from any interface.
2019-12-02 10:19:55 -05:00
Grisha Kruglov
548ffcb6a0 [components] Fix broken link in browser-storage-sync README 2019-10-31 16:20:59 -07:00
Grisha Kruglov
bd6e481776 [components] Basics of the Fennec data migration API 2019-10-21 13:18:11 -07:00
Grisha Kruglov
222b8a82f5 [components] Pre: convert bookmark tests to exercise native lib 2019-10-16 18:22:40 -07:00
Lina Cambridge
c64f248f76 [components] Pass redirect source and target flags to history tracking delegates.
There's some confusion in `GeckoEngineSession` about redirect flags.
The `VISIT_REDIRECT_SOURCE` and `VISIT_REDIRECT_SOURCE_PERMANENT` flags
that we get from GeckoView's history delegate are for the redirect
_source_, not the visit type. They indicate if the URL passed to
`onVisited` is redirecting _to_ another URL, most likely because the
server returned an HTTP 3xy status code with a `Location` header.
Rust Places decides whether to mark the URL as hidden based on
these flags.

`VISIT_REDIRECT_{PERMANENT, TEMPORARY}`, however, indicate if the
URL passed to `onVisited` is the _target_ of a redirect (in other
words, the page that's _in_ the `Location` header). These get
translated into `VisitType` flags, which Rust Places stores as the
visit transition type. These two flags don't affect whether a URL
is hidden.

Note that, in a redirect chain, the middle links are both sources and
targets. For example, in "mozilla.org" -> "www.mozilla.org" ->
"www.mozilla.org/en-US", "www.mozilla.org" is both a redirect target
(since "mozilla.org" redirected to it), and a source (it redirected
to "www.mozilla.org/en-US").

See https://github.com/mozilla-mobile/fenix/issues/3526.
2019-10-11 21:41:40 -07:00
Grisha Kruglov
b1a7c46ea4 [components] Part 3: Rust SyncManager integration
Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
2019-09-27 12:39:48 -07:00
Grisha Kruglov
75cb27e62f [components] Part 2: Move SyncTelemetry into a common support-telemetry component
This allows us to use the same Glean definitions and processing logic
from multiple components. In our case, it'll be browser-storage-sync
(for non-AccountManager syncing) and services-firefox-accounts (SyncManager integration)
2019-09-27 12:39:17 -07:00
Grisha Kruglov
f9a56032fd [components] Part 1: Introduce re-usable SyncTelemetry
We will need to record sync telemetry from the sync manager. We already
have telemetry related code, but at the DB Connection level.

This patch refactors this code into a singleton object that may be
used from within any context in which there's a ping object available that
needs to be processed.
2019-09-27 12:39:17 -07:00
Denys M
b95c932f81 [components] For https://github.com/mozilla-mobile/android-components/issues/4460. Fix detekt warning about license in project files. 2019-09-24 01:01:03 +04:00
Alessio Placitelli
cb8f7dc12d [components] Allow generating docs for Glean metrics
The docs are written, at build-time, to
'$project/docs/metrics.md'. This additionally
enables automatic doc generation for the following
components: lib-crash, storage-sync.
2019-09-03 14:21:51 +02:00
Thom Chiovoloni
81cbc8ce02 [components] Support new a-s megazord build configuration
This includes exposing a new component for configuring the HTTP stack,
as to avoid forcing dependents who have no custom megazord to keep a-s
and a-c versions in sync.

This is required for the CWTS work, and has been coming for a while.
It's a breaking change for users of FxA/Sync/Push who don't megazord
(they must to init HTTP now, and should init rustlog as well). It's also
a breaking change for megazord users, but I'll file PRs for them
individually.

This includes other changes required to update a-s, in logins and fxa
specifically.
2019-07-31 16:47:50 -07:00
Alessio Placitelli
4342c14263 [components] Use the GleanTestRule in bookmark-sync tests using the Glean SDK 2019-07-31 11:10:34 +02:00
Grisha Kruglov
34cd5f6fa3 [components] Move sync scope ownership into account manager; API simplification
I've started pulling on one little thread, and ended up with a few more changes than initially anticipated.

Raison d'être for this PR - introducing access token caching for Sync.
- Some background on the issue: Rust FirefoxAccount object maintains an in-memory cache of access tokens, keyed by 'scope'. During every sync, we "rehydrate" an instance of FirefoxAccount, starting with a fresh cache. We then obtain an access token from it to sync; this performs a network request (since the internal cache is empty), which is quite costly at scale for our services. This creates a situation when we may overwhelm our own servers with a large enough, actively syncing user base.
- This PR adds a caching layer for sync authInfo objects. Sync workers no longer interact with the account directly, and instead look into the cache to obtain authentication info necessary for syncing. No more "talk to the FxA server before every sync".
Account manager is responsible for keeping the cache up-to-date, and resetting it when necessary. Cache is currently updated: on startup (but only if access token has expired), on authentication, and when we recover from auth problems.

And this is where the "thread pulling" begins! In order to "own" the access token for sync, account manager needs to be aware of the "sync scope".
Before, we just relied on the application to specify that scope. Instead, I've changed account manager's constructor to take a SyncConfig object which allows consuming application to configure how sync should behave (enabled at all?, periodic syncing enabled? how often to sync? which stores should be synced?).
Ownership of the "sync manager" moved down the stack, from the application layer into the account manager.

Application is now expected to interact with sync only via AccountManager's `sync` method, which exposes an internal SyncManager instance (if sync is enabled).

Above changes were a good reason to move support classes from feature-sync and into services-firefox-account. Note that since "sync" is part of our "storage" modules, this change doesn't mean that you need to take an extra native dependency on your classpath simply if you need to use FxA. Thanks to concept-sync, actual "Firefox Sync" machinery (within libplaces) is still fully decoupled from FxA. `feature-sync` has been removed entirely.

Since we're churning the public API anyway, I took the chance to introduce a few more simplifications at the API layer:
- 'SyncManager' interface was removed, since we're not expecting to have multiple implementations of it
- 'Config' was renamed to 'ServerConfig'
- 'DeviceTuple' was renamed to 'DeviceConfig'
- account manager grew a new public API, 'setSyncConfig', which allows application to re-configure how it wants sync to behave
- 'AuthInfo' was renamed to 'SyncAuthInfo', and a bunch of cleanup happened in that area
- 'AccountObservable'@'onError' method was removed. The only error that could have been passed into it (unable to restore account) wasn't actionable by the application anyway, and none of the integrations did anything with that call

Documentation of public APIs and classes was improved.
2019-07-10 16:09:59 -07:00
Thom Chiovoloni
7e1fc2bccb [components] Bump version of application-services libraries to 0.34.0 2019-07-10 15:34:42 -07:00
Denys M
9f1bb888c7 [components] For https://github.com/mozilla-mobile/android-components/issues/2740. Update detekt to 1.0.0-RC16. 2019-07-02 06:10:14 -07:00
Denys M
1f8fc3fa5b [components] For https://github.com/mozilla-mobile/android-components/issues/1481. Enable unit test binary resources globally.
Excluded few modules.
2019-06-13 09:29:52 +02:00
Denys M
f9ec3e04ad [components] For https://github.com/mozilla-mobile/android-components/issues/1481. Use androidx runner in browser-storage-sync. 2019-06-11 17:45:56 +02:00
Lina Cambridge
8796c29449 [components] Record Sync engine telemetry in Glean.
This commit adds two Glean pings to the Storage-Sync browser component:
one for history, and one for bookmarks. Both pings record the same set
of base metrics, including incoming and outgoing counts, sync duration,
the hashed FxA UID, and, most importantly, the failure reason if the
store fails to sync. The bookmarks ping records additional validation
data.

The Glean schema is a flattened version of the Sync ping that's
currently sent on Firefox Desktop and Firefox for iOS. Instead of
sending a single ping with multiple syncs, each having multiple
engines, we send one Glean ping per engine per sync.

The pings are recorded directly in the component, so any app that
consumes it should get pings for free.
2019-06-11 09:05:51 +02:00
Tiger Oakes
e7fdd7b70d [components] Turn on ComplexMethod ignore when expression lint 2019-06-07 10:18:31 +02:00
Grisha Kruglov
b0408c038a [components] Make sure to re-throw places panics during sync 2019-06-05 14:10:03 -07:00
Grisha Kruglov
98b1b7a94a [components] Closes https://github.com/mozilla-mobile/android-components/issues/3195: Ignore UrlParseFailed exceptions coming out of places 2019-06-03 16:26:57 -07:00
Grisha Kruglov
77014b2ed4 [components] Pre: enable previously disabled test; underlying problem was fixed 2019-06-03 16:26:57 -07:00
Denys M
fbb63b9257 [components] For https://github.com/mozilla-mobile/android-components/issues/2346. Enable kotlin warningsAsErrors for browser-storage-sync module. 2019-06-03 16:57:52 +02:00
Grisha Kruglov
4d9df95f05 [components] End-to-end places history unit tests
This is the first time we're exercising the Rust appservices stack
from our unit tests.

New tests are a combination of old browser-storage-sync tests, and tests
from browser-storage-memory, adjusted for the slightly different
implementation.
2019-05-09 13:36:54 -07:00
Grisha Kruglov
9fb56e9d59 [components] Pre: null-out 'api' after closing RustPlacesConnection
If we didn't, we'll never be able to re-initialize RustPlacesConnection.
Caught thanks to the new tests!
2019-05-09 13:36:54 -07:00
Sebastian Kaspari
5c54ec453d [components] Closes https://github.com/mozilla-mobile/android-components/issues/842: Migrate from support libraries to AndroidX. 2019-05-02 16:08:55 +02:00
Colin Lee
04e4ef9498 [components] Fix https://github.com/mozilla-mobile/android-components/issues/2839: Expose methods to find a bookmark by its URL or guid 2019-04-24 16:32:34 -07:00
Grisha Kruglov
cb58d6bef0 [components] Closes https://github.com/mozilla-mobile/android-components/issues/2778 - Bump application-services to 0.27.0 2019-04-23 14:48:03 -07:00
Sebastian Kaspari
42556c9465 [components] Update to Kotlin 1.3.30 and Coroutines 1.2.0. 2019-04-22 15:29:45 -04:00
Grisha Kruglov
421d5929ec [components] Closes https://github.com/mozilla-mobile/android-components/issues/1373: Add deleteVisit API to HistoryStorage 2019-03-28 13:00:17 -07:00
Colin Lee
15687fe3a5 [components] Fixes https://github.com/mozilla-mobile/android-components/issues/2469: Bookmarks component for storage and management 2019-03-27 11:20:25 -05:00
Grisha Kruglov
ff26ff28de [components] Closes https://github.com/mozilla-mobile/android-components/issues/1373: HistoryStorage delete APIs
- add Delete APIs to the HistoryStorage concept
- expose them in browser-storage-sync and browser-storage-memory
2019-03-22 13:17:01 -07:00