Added a new option in Private browsing menu to allow or prevent screenshots from being taken while in private mode by adding or removing the FLAG_SECURE flag from the home activity's window.
This method is called whenever the activity is initialized to account for the browsing mode being changed and whenever the setting from the Private browsing menu is changed.
The setting is by default set to true (screenshots are allowed to be taken)
This is how we can apply the new test runner to remove duplication.
This commit was generated programmatically with the following commands:
```
// Replace test runners with new one.
find app/src/test -type f -exec gsed -i "s/@RunWith(RobolectricTestRunner::class)/@RunWith(FenixRobolectricTestRunner::class)/" {} +
find app/src/test -type f -exec gsed -i "s/@RunWith(AndroidJUnit4::class)/@RunWith(FenixRobolectricTestRunner::class)/" {} +
// Replace imports of old test runners with new one
find app/src/test -type f -exec gsed -i "s/org.robolectric.RobolectricTestRunner/org.mozilla.fenix.helpers.FenixRobolectricTestRunner/" {} +
find app/src/test -type f -exec gsed -i "s/androidx.test.ext.junit.runners.AndroidJUnit4/org.mozilla.fenix.helpers.FenixRobolectricTestRunner/" {} +
// Remove unused imports
find app/src/test -type f -exec gsed -i "/@Config(application = TestApplication::class)/d" {} +
find app/src/test -type f -exec gsed -i "/import org.mozilla.fenix.TestApplication/d" {} +
find app/src/test -type f -exec gsed -i "/import org.robolectric.annotation.Config/d" {} +
```
Where gsed is the GNU version of sed installed via homebrew. After
running these commands, I need to manually clean up the following files:
- FenixRobolectricTestRunner
- LocaleManagerExtensionTest
robolectric increases the run time of tests so it's important to remove
them when they're unnecessary.
Between this change and the last one, the unit test runtime was reduced
by ~10s.
In unit tests, this annotation annotations defer to robolectric, non-trivially
increasing test runtime so it's important to remove them when they're
unnecessary.
We could consider renaming the Activity to make it clearer that it's the
main activity and doesn't just feature the homescreen but I'm concerned
that renaming it will break too many things (e.g. automation that starts
a specific activity). For quick fix, I added this comment.
AccountObserver listeners were being triggered correctly, however, during every time
we open HomeFragment, home menu gets re-created, which causes us to re-run the initialization
block. Before this patch, the init block would never touch the account manager.
After this patch, it will query it if account manager has already been initialized.
`init` blocks are executed before `val` initialization which is declared afterwards
in the class. In this case, we had `quitItem` and `reconnectToSyncItem` as lazy,
but declared after the `init` block which may need them. And so, while this compiles
just fine, in practice we run into an NPE as the `init` block tries to get the lazy's value.
Simply re-ordering initialization fixes the problem.
* For #8412: Passes error handling function to 'CustomTabWindowFeature'
Change required for showing error message when the app can't handle a specific
scheme. Implemented in AC:
https://github.com/mozilla-mobile/android-components/pull/6122
* Upgrade AC version
Co-authored-by: Sawyer Blatz <sdblatz@gmail.com>
In order to hide the time it takes for the account manager to be initialized
(which always involves disk IO, and often network IO), let's kick it off
after "visual completeness".
This makes sure that for most users, by the time they interact with the account
manager-related functionality (e.g. in Settings), it's ready to go.
Also, for signed-in users, this will establish background sync workers.
This refactor "reverses" relationship between these two classes, allowing
HomeMenu to inform its parent, HomeFragment, of any changes to the menu.
Once that's in place, we start observing account manager changes (once its ready)
for account problems.
This solves two problems:
- initialization of the account manager is no longer necessary to build a home menu
- home menu now starts observing changes to the account manager's state (before it was static)
Instead of always kicking off accountManager's init and telling it to sync right away in
'onResume', we move these tasks to some abstract point later on, whenever account manager
is available.
This replaces the StartupTaskManager we had with a more general class.
New implementation is a thread-safe "gated task executor", which either
runs the task right away if it's marked as 'ready', or queries it to be
executed later on.
This ability to either execute or queue a task will be useful later on in the
commit series.
AndroidAssetDispatcher class dispatcher was attempting to open a local asset with a query suffix from the request. If query suffix is found, remove it. Re-enable saveLoginFromPromptTest() and doNotSaveLoginFromPromptTest()
* let animation in top toolbar mode play nicely.
* remove duplicate methods, make code readable.
* migrate getToolbarNavOptions method to BrowserAnimator, one method to rule them all.
* Update linting
Co-authored-by: ahmedmamdouh13 <ahmedmamdouh13196@gmail.com>
- Increased atp switch size to be consistent with `dimen/tracking_protection_item_height`(48dp).
- Cut out redundant traversal of TextViews in SwitchWithTraversal as per https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md
- Reuse `QuickSettingsText.Icon` style on the switch component to be consistent with other items in the component_tracking_protection_panel.xml
- Added new string resources for textOff and textOn state to get appropriate screen reader description (unsure of the translation/localisation process here!)
FenixSnackbar, as the platform Snackbar can only be inflated in either a
`CoordinatorLayout` or a `FrameLayout`.
Ensure our HistoryFragment's layout uses one of these as it's root.
In the UX review of 8491 it was discovered that the proposed solution is not
optimal and we should actually better stick with the old implementation.
This ticket comes to help with that and revert the already merged patch for
8491 and so will add same gradient to the top toolbar as the bottom toolbar.