When testing out WebAuthn support with the privileged API,
we need our app to be signed by an allowed signing key.
We're seeing our tests fail with this error when testing locally:
```
[FidoApiImpl] updateTransaction is called for stop
[FidoApiImpl] finishSecurityKeyRequestController should not be called when SecurityKeyRequestController is null.
```
Our theory is that if we try this code on our signed APK, we should see
it work.
I validated:
- that the log statement appeared in Nightly but not in Beta.
- that the local runtimes of our perftest increased (the median diff is 124ms)
* For #16373: Added performance Inflater to counter # of inflations
This class is quite straight forward. The only thing that I have to point out is the onCreateView method. It usually
calls its super if you don't override it. The problem with that is that the super.onCreateView actually uses
android.view. as a prefix for the XML element it tries to inflate. So if we have an element that isn't part
of that package, it'll crash. As I said in the code, a good example is ImageButton. Calling android.view.ImageButton
will make the app crash. The method is implemented the same way that PhoneLayoutInflater does (Another example
is the AsyncLayoutInflater)
* For #16373: Added test for PerformanceInflater
This test got quite awkward / complicated fast. I wanted to test the to make sure we don't break *any* of our layouts
and to do so, I decided to just retrieve all our XML in our /res/layout folder. However, this gets quite a bit outside of a unit test scope.
The point was to get every layouts and get their LayoutID through the resources using the testContext we have. It gets even weirder, since some
of the XML tags have special implementation in android. One of them is the <fragment> tag. That tag actually is inflated by the OS using the Factory2
that the Activity.java implements. In order to get around the fragment issue, we just return a basic FrameLayout since the system LayoutInflater doesn't deal
won't ever get a <fragment> tag to inflate. Another issue was the <merge> tag. In order to inflate those, you need 1) a root view and 2) attach your view to it.
In order to be able to test those layouts file, I had to create an empty FrameLayout and use it as the root view for testing. Again, I know this is beyond the spirit of a unit test but if we use this inflater, I think it should make sure that no layouts are broken by it.
* For #16373: Overrode getSystemService to return PerformanceInflater
This allows PerformanceInflater to be called in every inflation to keep track of the number of inflations we do.
* For #16373: Added UI test for # of inflations
* For #16373: Lint fix
* For #167373: Changed the LayoutInflater cloneInContext to take this instead of inflater
The inflater parameter is set on the first call from the OS from the Window object. However, the activity itself sets multiple factories on the inflater
during its creation (usually through AppCompatDelegateImpl.java). This means that, once we initially set the inflater with a null check, we pass an inflater
that has no factory initially. However, since we keep a reference to it, when cloneInContext was called, it cloned the inflater with the original inflater
which didn't have any factories set up. This meant that the app would crash on either browserFragment creation or any thing that required appCompat (such as
ImageView and ImageButton). Now, passing itself with a cloneInContext means we keep all the factories initially set by the activity or the fragment.
* For #16373: Fixed code issues for PR. No behavior change
* For #16373: fixed some code nits
* For #11580 - Tracks text selection context menu usage
Tracks Copy, Search, Select All and Share items from the text selection context menu. Uses AC's DefaultSelectionActionDelegate to achieve this.
Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com>
Adds a counter for how many times the user does the following action:
- opens the Downloads section inside the app
- tap to open an item from inside Downloads / from the download dialog
- tap to delete one or more downloads at once
With accessibility enabled, when adding a site to a collection and tapping "View" on the snackbar, we send a request for focus and an `AccessibilityEvent.TYPE_VIEW_FOCUSED` to the specified collection.
Selecting a tab while in Multiselect would add a different decoration to the one
already set for the last tab opened and this would confuse users.
Let's avoid this.
Removed now obsolete feature flag and tests.
Removed obsolete swipe refresh state from BookmarkFragmentState
Also adapted tests and remove obsolete ones.
Upgrades to A-C 69.0.20201203202830 and addresses breaking changes:
- Upgrades androidx workmanager to 2.4.0 in line with A-C.
- RecordingDevicesNotificationFeature was removed
- SearchUseCases accept parent session ID instead of session itself
This PR builds on [AC##9024][1], and implements setting the Nimbus endpoints from [a secret set at build time][2].
For production use, this requires a secret named `nimbus_url` to be put into CI.
Note: Nimbus is currently behind a feature flag.
If developers wish to use a Nimbus server for local development, you can set the url by adding an entry into local.properties, e.g.:
```
nimbus.remote-settings.url=https://settings.stage.moz4ws.net
```
Without setting server, Nimbus will be able to function, except no experimental definitions will be fetched, and features under experiment will be configured as if not enrolled in the experiment.
[1]: https://github.com/mozilla-mobile/android-components/pull/9024
[2]: https://groups.google.com/a/mozilla.com/g/android-components-team/c/lAGVKQy8aiA/m/rY3uGAwhBAAJ
This doesn't fix the underlying issue of #16435, but a symptom we have seen quite often in different
situations: When the ExternalAppBrowserActivity is not linked to a tab anymore then it falls back
to displaying a (partially broken) browser UI. With multiple browser activities at the same time
sooner or later we crash with a "display already acquired" error because both activities try to
render the same tab.
Items should follow the following ordering:
- current session open tabs
- collections options - currently the "Select tabs" button
- synced tabs items
This order should also be kept after returning from Multiselect mode.
Instead of simply fixing the memory leak for this issue by directly
removing references, it makes more sense to move the whole
BiometricPrompt out of the fragment and into it's own feature to be
re-usable.
While StrictMode is not exclusively used for performance purposes, it's
primarily used for perf purposes so let's move it to the perf package
and code owner it.
* For #15761 - Part 1: Turn ON the showGridViewInTabsSettings feature flag
* For #15761 - Part 2: Remove the showGridViewInTabsSettings feature flag and show the Tab view preference category
To get the index of the current selected browser tab when using reverse layout
we should also account for items placed below of the browser tabs.
The patch here unifies the logic already used for some calls but not all.
They're currently lazy { lazy { value } }. Accessing `lazy.value`
directly allows us to make it lazy { value }. This should be more
performant and prevents us from double-counting these components.
By having LazyMonitored implement Lazy, we can continue to pass these
values directly into the ac APIs that require Lazy references. For some
reason, implementing `Lazy.value` can replace `operator fun getValue`
required for delegates.
By component groups, I mean I applied this to any class with the
class kdoc, "Component group for...".
There are a few instances of lazy we had to keep using the old API to
avoid having to update constructor arguments.
With the Fennec -> Fenix migration complete there is no other Mozilla
application that would serve as a custom account provider hence the automatic
signin would not be possible.
Make this more obvious by commenting out the code that would trigger an
onboarding banner for it but keep the code in the app for when #15694 would add
to Fenix the ability to serve as a custom account provider.
STATE_HALF_EXPANDED cannot be disabled while also keeping fitToContents = true
based on which the tabs tray layout is currently set.
To work around this we'll set a a minuscule height for the tab tray when in
this state and then immediately advance to STATE_HIDDEN so to make it
imperceptible to the users.
Since I couldn't write unit tests because of InflateExceptions in Robolectric
I've written UI tests to protect against regressions.
This patch introduces a build flag that can be used on demand on the command line (`./gradlew -PmozillaOnline [..}`) or
permanently when added to local.properties (`mozillaOnline`).
At runtime `Config.channel.isMozillaOnline` will return `true` if the flag was set at build time.
* For #15278: added CoroutineManager to count runBlocking calls
* For #15278: Added actual detekt rule for runblocking and its config to the yaml
* For #15278: Added unit test for RunblockingCounter
* For #15278: renamed StrictModeStartupSuppressionCountTest.kt to PerformanceStartupTest.kt and added runBlockingCount test
* Lint fix
* For #15278: made runblocking a Long to prevent overflow
* For #15278: fixed MozRunblocking name, description and moved RunBlockingCounter to perf package
* For #15278:Renamed MozillaRunblockingCheck to MozillaRunBlockingCheck
* For #15278: Added setup for unit test, since it failed without restting counter
* For #15278: Fixed naming for RunBlocking lint check
* For #15278: removed changes made to test to use runBlockingIncrement
* For #15728: added test exclusion for runBlocking check
* For #15278: changed null check and added Synchronized to count setter
* For #15278: fix for nits
* For #15278: added StartupExcessiveResourceUseTest to CODEOWNERS
* For #15278: fixed for nits
* For #15278: Moved increment function to extension function and fixed indentation
* For #15278: Added tests for Atomic Integer extension and nit fix
Items should have a 16dp all around padding.
Have them have a 8dp padding that will add to 16 when placed together.
Have the parent have another 8dp that will add to 16 for when items are placed
to the edge of the available screen.
* Ability to rename top sites, closes#9548
* Highlight the "Remove" top site action as destructive
With more menu items in the top site contextual menu, it makes sense to differentiate
* Added test for the top site renaming action
* Fixed lint check (wildcard imports, blank spaces)
* Applied suggestions from code review
* Apply suggestions from code review
Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com>
* Implemented dialog click listener with manual dismiss/cancel
Co-authored-by: Lorenzo Stanco <lorenzo.stanco@gmail.com>
* For #14637 - Compatibility patch for AC - 8554
* Update Android Components version to 65.0.20201029143039
Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
* For #15929: Remove SearchWidgetCFR telemetry.
* For #15929: Remove SearchWidgetCFR and search widget experiment.
* For #15929: Remove unit tests references to search widget experiment.
* Closes#13262: Update AGP to 4
* Update to Mozilla Android Components 63.0.20201019090011.
* Update Kotlin to 1.4.10 and Coroutines to 1.3.9.
* Fix new compiler warnings.
* Fix compilation of lint rules module.
* Pin JNA version.
* Fix new lint errors.
Co-authored-by: Tiger Oakes <toakes@mozilla.com>
* For #15937 - Remove the topFrecentSite feature flag
* For #15937 - Hide the "Pull to refresh" preference since its visibility is managed by a feature flag
While the callback receiver is identical in these two methods, they're
semantically different: apply is for initializing the receiver while with
is anything else benefiting from a new `this` receiver.
I didn't change the usage of apply that has a return statement because I
was afraid my change might change behavior.
The new robolectric version changed the behavior such that the app ID
that was returned for our app was `org.mozilla.fenix.debug` instead of
(I guess) `org.mozilla.fenix`. In general, relying on robolectric can be
fragile, such as this case, so it's better to mock. Also, this test
behavior should theoretically have varied between build flavors so
mocking prevents the tests from breaking across flavors.