Previous we were reporting the permission id which can be overwritten
throughout the app.
The class name will allow to easily identify and differentiate permissions.
This patch will also ensure that we won't be reporting the same permission
multiple times like it can happen on devices with multiple cameras and the
permission to access all cameras.
Adds support for Save to PDF from the GeckoSession by plugging the
API into `onExternalResponse` to provide the same flow as a typical
file download experience would be.
Co-authored-by: Olivia Hall <ohall@mozilla.com>
A change in AS v93.6.0 made it so the underlying function
`LoginsStore.import_multiple` no longer returns the metrics as a JSON
string string. Instead it just encodes the unit struct. This was a
breaking change, but it's not listed properly in the CHANGELOG.
The fix is pretty simple: just assume that no logins failed to import.
- Added new component that hooks into the new app-services error
reporter and listens for events. When it sees an event it submits it
to the crash reporter.
- Added support for customizing crash reports for these errors.
Used `runTestOnMain` where `MainCoroutineRule` was used or needed to be used,
`runTest` elsewhere.
Extra effort for removing all `runBlocking` occurrences in unit tests.
`kotlinx.coroutines.test.runTest` is a test specific API that seems like a more
appropriate way for running tests in a coroutine than the general
`kotlinx.coroutines.runBlocking` api.
- Introduces `CreditCardValidationDelegate` and a default implementation in `DefaultCreditCardValidationDelegate`
- Implements `onCreditCardSave` in `GeckoCreditCardsAddressesStorageDelegate`
- Refactors `CreditCard` from concept-engine to `CreditCardEntry` in concept-storage so that it can validated with the `CreditCardValidationDelegate`
Gecko's WebNotification will be persisted in the native Android notification
that is posted like before to target a specific activity in the app.
When the user clicks the notification the target activity can delegate a new
WebNotificationIntentProcessor component to actually process notification's
contentIntent and trigger `click` on the WebNotification.
A new ScreenOrientationFeature which can be set in any integrator's Activity or
Fragment will register itself as an Engine delegate for GeckoRuntime callbacks
for setting a specific screen orientation or resetting such set orientation.
All preconditions for setting/resetting the orientation are checked on
GeckoView's side before the callbacks would fire so the feature will
automatically set the requested orientations without any other work.
This change splits out tab-specific data from RecoverableTab data class
into a separate TabState (so, it doesn't have the EngineSessionState).
Then, once we have the simplified TabState, everything that touches RecentlyClosedTabs
is converted to use that instead of its more expensive sibling.
This way we avoid having to eagerly process EngineSessionState simply to populate BrowserState.closedTabs.
This saves us from having to hit disk (where the EngineSessionState is persisted) on initializing BrowserState (so, startup in most cases).
It also saves us from having to parse/rehydrate that persisted state.
At the point we actually need the EngineSessionState for a tab we'd like to restore, we can read/process it.
* fixup the VisitObservation, HistoryVisitInfo APIs based on changes in a-s
* Uniffi top frecent site info (https://github.com/mozilla-mobile/android-components/issues/3)
* uses VisitTransition in HistoryVisitInfo (https://github.com/mozilla-mobile/android-components/issues/4)
* fixup the VisitObservation, HistoryVisitInfo APIs based on changes in a-s
* updated based on bookmarks being uniffied
* fix issues with how we are rethrowing places exceptions
* bump appservices version
* fix ktlint lexiographic and ununsed import errors
* updated fennec migration code
Co-authored-by: Tarik Eshaq <tarikeshaq@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This adds an abstract KeyManager class to our storage component, which
establishes a pattern of managing keys as used by our storage classes
that require encryption.
AutofillCrypto and LoginsCrypto become implementors of this basis class,
allowing them to explicitly share structure and some core functionality.
- remove KeyRecoveryHandler indirection, I don't think it was adding
any value
- AutofillCrypto and LoginsCrypto are now taking shape of a 'key
manager' type objects - they know how to get, validate and store keys,
as well as recover corresponding storage classes from key loss.
- AutofillCrypto now scrubs credit cards - removes encrypted CC numbers
and resets the sync engine - in case of key loss.
Add a new method(removeNavigationAction) in Toolbar interface to be able to remove a navigation action
as we have at this moment for browser/page actions(removeBrowserAction, removePageAction)
In feature-session we had some logic to filter out certain URIs. This
patch moves this logic into the storage layer, so that it has a broader
coverage - whenever we attempt to write some URL into the storage, we'll
now go through this filter.
Before, we'd only go through this filter for writes that were routed via
the HistoryDelegate.
After this change, direct writes (such as for metadata) are also
covered.
This shouldn't change all that much - the storage implementation is
likely to have rejected these URIs. Now, instead of letting it through
exceptions at us (which we catch and report via sentry), we simply don't
even call into the storage if we don't expect these calls to succeed.
This should reduce volume of "url without base" type of 'info' events we
see in Sentry.
Most of the time redirectSource isn't set, so this makes that field
optional, and switches away from a special enum (NOT_A_SOURCE) to just a
simple nullable.
* deleted module and related files along with occurrences
* lint fixes
* used PlacesHistoryStorage for storage and readmeFix
* test fixes 1
* Update feature-awesomebar tests to use mocked HistoryStorage
* Linter fixes for feature-awesomebar
* toolbar fix 1
* toolbar fix
* final code cleanup
Co-authored-by: Grisha Kruglov <gkruglov@mozilla.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Copied the crypto code from autofill and adapted it for logins. At some
point it would be nice to combine the common parts here, but I figure
that can be a later issue.
Added code to migrate from a SQLCipher database to the new plaintext
ones. Choose the unimaginative "logins2.db" filename, feel free to pick
a different one.
Fixed some linter errors.
Switched the login saving interfaces to using `LoginEntry`, which
matches the change in `LoginValidationDelegate`.
The select login code still uses `Login`, but I changed how the
conversion from `GeckoView.LoginEntry` works. Now it checks if the guid
is set, and ignores the login if not. This is needed because a) guid is
no longer nullable and b) `areItemsTheSame()` in `BasicLoginAdapter.kt`
uses the guid to compare rows in the select list. I'm pretty sure the
guid should always be set because those login entries ultimately come
from a `List<Login>`.
Removed the `GeckoView.LoginEntry` -> `Login` conversion from
`ext/Login.kt`. It's now more dangerous to call, since it will throw if
guid is null. I think it's better to force the calling code to write
the `!!` themselves to make this clear.
Updated `GeckoLoginStorageDelegate` to use the new `addOrUpdate()`
function.
Updated `LoginValidationDelegate` to use the new `findLoginToUpdate()`
function. Removed the Result.Error class. It was only returned from
`ensureValidAsync`, which we don't call anymore because `addOrUpdate()`
now does the validation. This means that we will now throw an error
instead of doing a no-op, hopefully that's okay. Removed the not
threadsafe warnings. I think this the login storage code should be
threadsafe in general because we use Arc/Mutex on the rust side
A key difference is that `shouldUpdateOrCreateAsync()` now inputs
`LoginEntry` rather than a `Login`. The old code had some confusing
bits with how it handled the `guid` field. For example, we could pass a
`Login` with a `guid` set to the `SaveLoginPrompt`, but depending on
what the final username was and how the dupe-checking turned out, we
could end up updating a login with a different `guid` or creating a new
login altogether. Using `LoginEntry` hopefully makes the story clearer.
There are a few edge cases where the behavior may change now that we no
longer use a GUID in the dupe-calculation. I'm pretty sure that it
shouldn't really change things from a user's point of view, but I need
to double-check the use cases here.
`Login.guid` is now non-nullable. `LoginEntry` should be used for login
data to be saved.
Replaced the field-level documentation in the `service:sync-logins`
README with a note to check out docs from `cconcept-storage`. The
README was just a copy of the documentation from `LoginsStorage.kt` and
it seems better refer people there rather than duplicate it.
Removed the unit tests. The main thing they were testing was
the `LoginValidationDelegate` dupe-handling but now that code is very
simple and and there are tests for `findLoginToUpdate()` in a-s
(components/logins/src/login.rs).
See code comments for reasoning.
There were already tests for the core functionality. Unfortunately, I
couldn't figure out how to write a test for the allocation change but I
tested it manually using an allocation tracker.
The previous implementation was affected by the fact that the class has 3
integer properties, all with values [0..4] (-1 was added recently) and it
would just add those value to compute the hashcode.
Collisions were a given.
By using decimal places for each property the new implementation should avoid
collisions while allowing for all the other expected guarantees.
We need to wait until having a response from GeckoView on how it handled the
touch only after which we'll know whether to animate the toolbar or not.
The edgecase scenario of having pull to refresh enabled even before having a
response from GeckoView will still work because "canOverscrollTop()" only
checks for the touch to not be handled by the browser to pan the page.
* Add Places calls for recently added bookmarks.
Changelog addition for bookmarks places api additions.
* Test for fetching list of recently added bookmarks
* Reword kdoc and changelog
Following crash reports it was seen that it is possible for multiple prompts to
be shown at the same time with an edgecase being that one prompt request comes
after the user interacted with a previous prompt but before the consume call
completing in AC / GV time at which this code will try to use the new prompt,
not the one the user interacted with.
Having support for multiple prompt requests in ContentState and tightly
coupling a PromptDialogFragment with it's PromptRequest ensures any action
consuming a PromptDialogFragment will always consume the PromptRequest for
which that dialog was shown irrespective of the number of prompts or which is
currently shown on top.
- To get around the intermittent, we call `getCreditCard(creditCard.guid)` and make sure it's gone instead of calling `getAllCreditCards()`
- Change `getCreditCard` and `getAddress` to be able to return null when no record can be found
- Implements an override function of `onCreditCardSelect` in `GeckoPromptDelegate`
- Adds a new `CreditCard` data class in `concept-engine`. This is a parallel of GV's
`Autocomplete.CreditCard`. We can't using the existing `CreditCard` from `concept-storage`
since that has encryption dependencies whereas the card number is already decrypted
when it reaches GV.
- Adds a new `SelectCreditCard` in `PromptRequest`
- Uses the new GeckoView's `Autocomplete.StorageDelegate` interface in GeckoStorageDelegate
- Implements GeckoView's `Autocomplete.StorageDelegate.onCreditCardFetch`
On newer AndroidX versions of lifecycle library, interactions with a lifecycle registry,
by default, must happen on the main thread. While in this code we don't control how lifecycle
registries are created, and so we can't be sure if this default behaviour is present, it's likely
safe to assume that our consumers won't create custom lifecycle registries with non-main thread interactions
allowed.
Both NestedGeckoView and NestedWebView will now return an InputResultDetail
wrapping many new details about how a touch event will be handled.
NestedGeckoView's InputResultDetail will be used to more accurately decide when
to animate the toolbar or start the pull to refresh feature.
NestedWebView's InputResultDetail will only have details about if it will
handle the touch or not. With all the other being unknown the dynamic toolbar
or pull to refresh features will not work.
This will serve the following purposes:
- wrapper for all the new data from GeckoView's onTouchEventForDetailResult
- filters out values not in range (eg: GV's INPUT_RESULT_IGNORED)
- controls how the data can be updated and offers clear APIs for querying this
data without needing to know about the implementation specifics.
When presenting the tray, embedders want to be able to style or react
differently to private tabs. Instead of them querying this value for
each tab, we can just provide it in the `Tab` abstraction of the tray.
Toolbar will not be animated while the tab is loading irrespective of the
intrinsic checks made in the BrowserToolbarBehavior - whether the touch is a
vertical scroll and it was handled by GeckoView.
* For `PurgeHistoryUseCase` I decided to not introduce a "tab ID" parameter and instead have
it purge the history of all tabs. It seems like this is what we need and individual tab
history removal is not needed for now.
* Some tabs may not have an `EngineSession` assigned. Creating one just to call purgeHistory()
seems excessive. Instead I am dropping an attached `EngineSessionState` which will cause
those tabs to just reload the URL with not back/forward history when they get restored.
Clients interested in this should:
- use partial bindings with PAYLOAD_(DONT_)HIGHLIGHT_SELECTED_ITEM
- override TabsAdapter#isTabSelected for new item bindings
- override TabViewHolder#updateSelectedTabIndicator
Running ./gradlew ktlint locally reports a lot of stuff like:
/home/emilio/src/moz/android-components/components/support/migration/src/test/java/mozilla/components/support/migration/MigrationIntentProcessorTest.kt:1:1: File must end with a newline (\n)
This fixes it with:
for f in $(cat files | cut -d : -f 1); do echo "" >> $f; done
Making ./gradlew ktlint pass.
The prompt for a repost request was previously an instance of Confirm, type
used for many other requests.
We'll now use a new Repost type that allows easily identifying the particular
scenario for a repost request, prompt that will now show a slightly different
text and will notify engine observers of "onRepostPromptCancelled" when users
asked to refresh the page but then cancelled that operation in the repost
prompt, callback used to hide the pull to refresh throbber.
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.
make lint and detekt happy
add changelog
forgotten space from another pr's in changelog
make requested changes
add flag to synced tabs suggestions too and add test
make detekt happy
add test for indicatorIcons too
make requested changes
8176: For https://github.com/mozilla-mobile/android-components/issues/8175: Allow SuggestionProviders to specify a edit suggestion r=pocmo a=miDeb
The edit suggestion arrow will only be shown if the suggestion is not null or empty. Tapping it autocompletes the suggestion, which can now be specified by the `SuggestionProvider`.
Co-authored-by: Michael Debertol <michael.debertol@gmail.com>
* Instead of keeping the EngineSessionState inside EngineSession, we now always attach it to EngineState and also do not
clear it anymore.
* If the content process gets killed we now just suspend affected EngineSession instances. They will automatically and
lazily get restored from the last EngineSessionState once needed.
* On a content process crash we now mark the EngineState as crashed and suspend the EngineSession. We will not restore
the EngineSession until explicitly restored by the application.