Commit Graph

282 Commits (5d500a1d660c2070dc0f3f39ffd826a6231c27cc)

Author SHA1 Message Date
Sebastian Kaspari 5d500a1d66 Issue #19040: Remove Leanplum (Beta) 3 years ago
mcarare f94f8531f6 For #18496: Set activity theme in onCreate before call to super. 3 years ago
Michael Comella cbc5df3c63 For #18836: address onCreate method length detekt issue. 3 years ago
Michael Comella d6999234b0 For #18836: add & integrate StartupTypeTelemetry. 3 years ago
Michael Comella a64540bd06 For #18836: add StartupPathProvider + tests. 3 years ago
MarcLeclair 990bfa7e6d
16900 make navgraph inflation asynchronous (#18889)
* For #16900: implement async navgraph inflation

For #16900: removed nav graph from xml

For #16900: inflate navGraph programatically

For #16900: Made NavGraph inflation asynchronous

For #16900: Changed to block with runBlocking

For #16900: Refactored blocking call into a function

For 16900: NavGraph inflation is now async

We now attach the nav graph (or check if its attached) on every nav call ( an extension function for NavController).
This is done by checking the value of the job stored in PerfNavController.map which keeps track of the job with the NavController as a Key.
If the job hasn't been completed, it will block the main thread until the job is done. The job itself is responsible for attaching the navgraph
to the navcontroller (and the inflation of the latter too)

For 16900: rebased upstream master

For 16900: Rebase on master

For #16900: Fixed Async Navgraph navigation per review comments.

1)The Asynchronous method is now found in NavGraphProvider.kt. It creates a job on the IO dispatcher
2)The Job is tracked through a WeakHashMap from Controller --> NavGraph
3)The Coroutine scope doesn't use MainScope() anymore
4)The Coroutine is cancelled if the Activity is destroyed
5)The tests mockk the blockForNavGraphInflation method through the FenixReoboelectricTestApplication instead of calling the mock every setup()

For #16900: inflateNavGraphAsync now takes navController

For #16900: Pass lifecycleScope to NavGraphProvider

For #16900: removed unused mock

For #16900: Added linter rules for navigate calls

We need linting rules to make sure no one calls the NavController.navigate() methods

For #16900: Added TestRule to help abstract the mocks in the code

For 16900: Fix linting problems

For #16900: Cleaned duplicated code in tests

For #16900: cleaned up NavGraphTestRule for finished test

For #16900: had to revert an accidentally edited file

For #16900: rebased master

* For #16900: Review nits for async navgraph

This is composed of squash commits, the original messages can be found below:

-> DisableNavGraphProviderAssertionRule + kdoc.

Use test rule in RobolectricApplication.

Fix failing CrashReporterControllerTest

Fix blame by -> navigate in tests.

This commit was generated by the following commands only:
```
find app/src/test -type f -exec sed -i '' "/import org.mozilla.fenix.ext.navigateBlockingForAsyncNavGraph/d" {} \;
find app/src/test -type f -exec sed -i "" "s/navigateBlockingForAsyncNavGraph/navigate/g" {} \;
git checkout app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
```

Fix various blame

This is expected to be squashed into the first commit so, if so, it'd
fix the blame.

Move test rule to helpers pkg.

add missing license header

Add import change I missed

fix unused imports

Replace robolectricTestrunner with test rule.

Improve navGraphProvider docs

Remove unnecessary rule as defined by robolectric.

add clarifying comment to robolectric

remove unnecessary space

* For #16900: nit fixes for MozillaNavigateCheck and lint fixes

3 squash commits:
 *Changed violation message and fixed the lint rule for MozillaNavigateCheck
 *Added suppression to NavController.kt
 *Fixed detekt violations

* For 16900: Fixed failing tests

Co-authored-by: Michael Comella <michael.l.comella@gmail.com>
3 years ago
Michael Comella 000bef020a For #18836: replace StartupActivityStateProvider with StartupStateProvider.
The StartupActivityStateProvider uses an imperative implementation,
driven by callbacks, to set the state of the application. This is hard
to follow as you need to understand which callbacks will be called in
which order. For example, to make sense of an implementation like this,
COLD, WARM, AND HOT would likely need to be implemented in separate
ActivityLifecycleCallbacks.

I feel the StartupStateProvider is an improvement because it leverages
the StartupActivityLog to query a linear state for a more understandable
implementation. Furthermore, it seems accessible to write COLD, WARM,
and HOT in the same class because they can all be approached the same
way.
3 years ago
MarcLeclair 9d728ec168
For #17759: Added min SDK 23 to avoid crashes on android 5.0 and 5.1 (#18832)
* For #17759: Added min SDK 23 to avoid crashes on android 5.0 and 5.1

* For #17759: fixed Android code from INT to actual version name
3 years ago
Mihai Adrian Carare ccfb275b03
For #17800 - Request desktop site from home screen. (#18653) 3 years ago
Michael Comella ade38246be For #18426: record cold start duration telemetry. 3 years ago
Vitaly V. Pinchuk 43c54b7006
For #18395: Dismiss contextual menu when entering/exiting Reader Mode 3 years ago
Arturo Mejia 54db8f3fde Revert "For #17805 - Fix adjustResize deprecation (#18252)"
This reverts commit 38f906a6
3 years ago
Michael Comella 62e2fb1aa6 For #18426: add measurement probes for long-running lifecycle methods.
In addition to the existing probes for onCreate, this should cover all
lifecycle methods that take a long time in our profiles.
3 years ago
Michael Comella 9024eca01e For #18426: add telemetry for app.onCreate subsections.
Hopefully this will help us understand behavior of the
`application_on_create` probe, specifically that it seems to take longer
in telemetry than in does locally compared to `home_activity_on_create`
(comparing the medians to local runs)..
3 years ago
Roger Yang d2ffaa85f9
Closes #17531: Use shared preference to store top sites count for telemetry (#18557) 3 years ago
Codrut Topliceanu 38f906a685
For #17805 - Fix adjustResize deprecation (#18252)
* For #17805 - Fix adjustResize deprecation

To handle the deprecation of `adjustResize` I've moved it from `styles.xml` and `AndroidManifest.xml` to `Activity.kt` as a fallback for devices with Android < 11. For Android 11 and up `setDecorFitsSystemWindows(false)` and `OnApplyWindowInsetsListener` will be used to handle app insets. Normal use activities should call `enableSystemInsetsHandling` in `onCreate` as to properly display system bars and for proper keyboard handling.
3 years ago
Michael Comella 993428cd0f For #17969: add duration probes for App.onCreate and HomeActivity.onCreate. 3 years ago
Michael Comella b3ef8a11e8 For #17816: add profiler marker for onPreDraw via HomeActivity.onStart.
This may be useful for MAIN start up to determine when the user begins
seeing content.
3 years ago
Michael Comella 4de49c7585 For #17816: add profiler marker for 2x Activity.onCreate.
The IntentReceiverActivity one is particularly useful to quickly determine
when we can begin executing code in the WARM VIEW case (i.e. "Set selection
begin here").

The HomeActivity one is useful for COLD start up analysis in similar
ways and to see the Activity transitions in WARM VIEW.
3 years ago
ekager f5b068a453 For #17785 - Use screenshots setting when adding secure flag 3 years ago
Jonathan Almeida 824f3fd821 Issue #1340: Forward Activity results to the fragment 3 years ago
MarcLeclair 24bce64e0b
16373 Count the # of inflations done on startup (#16778)
* 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
3 years ago
Gabriel Luong 846d618c06
For #16941 - [Telemetry] Bookmark Counts (#16942) 3 years ago
Christian Sadilek 3722033a5c For #16032: Support installing recommended add-ons from AMO 4 years ago
Sebastian Kaspari 2b759e9d6f Integrate new search code from Android Components into Fenix. 4 years ago
ekager f520586dcd
For #12062 - Remove feature flag for return to browser (#16622) 4 years ago
Christian Sadilek fbbc25b54e Closes #16053: Fix crash when closing private tabs via notification 4 years ago
Christian Sadilek 0fbc8410a4 Closes #16430: ExternalAppBrowserActivity should not handle incoming intents 4 years ago
ekager aae43b84eb
For #12062 - Feature Flag return to browser (#16099) 4 years ago
Christian Sadilek c852301c93 Closes #11286: Add TelemetryMiddleware to remove Session[Manager] observers 4 years ago
ekager e56043c485 For #15265 - Save cached top sites for metrics ping 4 years ago
ekager cbe293d3e4 For #12062 - Launch back to browser if we previoulsy had tabs 4 years ago
sraturi 8f16f9cb37 for #10069 added AppLaunchTimeMeasurement.kt to handle logic of startup time for cold, warm, and hot startup types. 4 years ago
ekager ec3595d4fc For #15600 - Move removal of timed out sessions to immediately after restoration 4 years ago
Michael Comella d767cd199e For #13959: fix startup crash by using arg Context.
The `context` member function returns null in attachBaseContext so we
need to use the Context that's being attached instead.
4 years ago
Michael Comella f19c9920f9 For #13959: move resetAfter into StrictModeManager.
In a followup PR, we need to add state to strictModeManager (the
number of suppressions). This is much simpler to do when this is defined
as a class rather than an object. However, when this is defined as a
class, `resetAfter` needs access to the strictModeManager. Instead of
passing it in as an argument, it made sense to move this function onto
the strictModeManager instead.

Since folks are used to calling:
```
StrictMode.ThreadPolicy.allowThreadDiskReads().resetAfter
```

We're going to have to add a lint check to prevent them from doing that.
4 years ago
Michael Comella 6abeb2d9e7 For #13959: change StrictModeManager to class from object.
I originally tried to create this PR leaving this as an object to keep
the change simple but it wasn't worth it - once the object started to
keep state, we'd need to manually reset the state between runs. Also,
the tests were already getting hacky with static mocking so it was
easier to address some of those issues this way too.
4 years ago
Michael Comella 2c1befaa25 For #13959: rename to attachListenerToDisablePenaltyDeath for clarity. 4 years ago
Grisha Kruglov 24985d54fa Closes #15436: Auto-close tabs during startup on the main thread 4 years ago
Elise Richards 1adf467248
For #14280, #14743: Remove old search fragment (#15169)
* Remove search fragment

* Use new folder to search dialog

* Rebase and lint

* Update tests with search dialog nav directions

* Rename interactor to match naming convention. Remove old controller and point everything to the dialog controller.
4 years ago
Grisha Kruglov 71b51146cb Update breaking changes in the FxA/Sync integration 4 years ago
ekager 09fbb43f80 For #2486 - Adds Recently Closed Tabs 4 years ago
ekager de7e6663ce Closes #14895 - Adds paste to context menu ordering preference 4 years ago
ekager 2d67e4b748 For #4118 - Creates setting for auto closing tabs 4 years ago
Kainalu Hagiwara d668a82f14
For #13498 - Use custom long press back handling for Huawei devices. (#14387) 4 years ago
Sachin 316b70940f
for #12573, added startup type and hasSavedInstance keys to app_startup_type telemetry (#13494) 4 years ago
Jeff Boek c73870b794 For #13507 - Performance fixes for the ReviewPromptController 4 years ago
Jeff Boek 56b730f0e8 For #13507 - Extracts review prompt behavior into ReviewPromptController 4 years ago
Tiger Oakes 0b333fe48a For #9056: Search from custom tab 4 years ago
Sebastian Kaspari 4782705af9 Add diagnostic breadcrumbs for debugging "Display already aquired" crashes.
For:
https://github.com/mozilla-mobile/android-components/issues/7960
4 years ago