|
|
|
@ -517,7 +517,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
components.core.store.dispatch(SearchAction.RefreshSearchEnginesAction)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onStart() {
|
|
|
|
|
final override fun onStart() {
|
|
|
|
|
// DO NOT MOVE ANYTHING ABOVE THIS getProfilerTime CALL.
|
|
|
|
|
val startProfilerTime = components.core.engine.profiler?.getProfilerTime()
|
|
|
|
|
|
|
|
|
@ -537,7 +537,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
) // DO NOT MOVE ANYTHING BELOW THIS addMarker CALL.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onStop() {
|
|
|
|
|
final override fun onStop() {
|
|
|
|
|
super.onStop()
|
|
|
|
|
|
|
|
|
|
// Diagnostic breadcrumb for "Display already aquired" crash:
|
|
|
|
@ -593,6 +593,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
outContent?.webUri = currentTabUrl?.let { Uri.parse(it) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@CallSuper
|
|
|
|
|
override fun onDestroy() {
|
|
|
|
|
super.onDestroy()
|
|
|
|
|
|
|
|
|
@ -616,7 +617,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
|
|
|
final override fun onConfigurationChanged(newConfig: Configuration) {
|
|
|
|
|
super.onConfigurationChanged(newConfig)
|
|
|
|
|
|
|
|
|
|
// Diagnostic breadcrumb for "Display already aquired" crash:
|
|
|
|
@ -626,7 +627,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun recreate() {
|
|
|
|
|
final override fun recreate() {
|
|
|
|
|
// Diagnostic breadcrumb for "Display already aquired" crash:
|
|
|
|
|
// https://github.com/mozilla-mobile/android-components/issues/7960
|
|
|
|
|
breadcrumb(
|
|
|
|
@ -711,12 +712,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
else -> super.onCreateView(parent, name, context, attrs)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onActionModeStarted(mode: ActionMode?) {
|
|
|
|
|
final override fun onActionModeStarted(mode: ActionMode?) {
|
|
|
|
|
actionMode = mode
|
|
|
|
|
super.onActionModeStarted(mode)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onActionModeFinished(mode: ActionMode?) {
|
|
|
|
|
final override fun onActionModeFinished(mode: ActionMode?) {
|
|
|
|
|
actionMode = null
|
|
|
|
|
super.onActionModeFinished(mode)
|
|
|
|
|
}
|
|
|
|
@ -783,7 +784,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
|
|
|
|
|
final override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
|
|
|
|
|
ProfilerMarkers.addForDispatchTouchEvent(components.core.engine.profiler, ev)
|
|
|
|
|
return super.dispatchTouchEvent(ev)
|
|
|
|
|
}
|
|
|
|
@ -844,6 +845,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
* private mode directly before the content view is created. Returns the mode set by the intent
|
|
|
|
|
* otherwise falls back to the last known mode.
|
|
|
|
|
*/
|
|
|
|
|
@VisibleForTesting
|
|
|
|
|
internal fun getModeFromIntentOrLastKnown(intent: Intent?): BrowsingMode {
|
|
|
|
|
intent?.toSafeIntent()?.let {
|
|
|
|
|
if (it.hasExtra(PRIVATE_BROWSING_MODE)) {
|
|
|
|
@ -896,7 +898,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
* Returns the [supportActionBar], inflating it if necessary.
|
|
|
|
|
* Everyone should call this instead of supportActionBar.
|
|
|
|
|
*/
|
|
|
|
|
override fun getSupportActionBarAndInflateIfNecessary(): ActionBar {
|
|
|
|
|
final override fun getSupportActionBarAndInflateIfNecessary(): ActionBar {
|
|
|
|
|
if (!isToolbarInflated) {
|
|
|
|
|
navigationToolbar = binding.navigationToolbarStub.inflate() as Toolbar
|
|
|
|
|
|
|
|
|
@ -911,7 +913,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Suppress("SpreadOperator")
|
|
|
|
|
fun setupNavigationToolbar(vararg topLevelDestinationIds: Int) {
|
|
|
|
|
private fun setupNavigationToolbar(vararg topLevelDestinationIds: Int) {
|
|
|
|
|
NavigationUI.setupWithNavController(
|
|
|
|
|
navigationToolbar,
|
|
|
|
|
navHost.navController,
|
|
|
|
@ -1094,13 +1096,13 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
navController.navigate(NavGraphDirections.actionStartupHome())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun attachBaseContext(base: Context) {
|
|
|
|
|
final override fun attachBaseContext(base: Context) {
|
|
|
|
|
base.components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
|
|
|
|
|
super.attachBaseContext(base)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun getSystemService(name: String): Any? {
|
|
|
|
|
final override fun getSystemService(name: String): Any? {
|
|
|
|
|
// Issue #17759 had a crash with the PerformanceInflater.kt on Android 5.0 and 5.1
|
|
|
|
|
// when using the TimePicker. Since the inflater was created for performance monitoring
|
|
|
|
|
// purposes and that we test on new android versions, this means that any difference in
|
|
|
|
@ -1114,7 +1116,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
return super.getSystemService(name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected open fun createBrowsingModeManager(initialMode: BrowsingMode): BrowsingModeManager {
|
|
|
|
|
private fun createBrowsingModeManager(initialMode: BrowsingMode): BrowsingModeManager {
|
|
|
|
|
return DefaultBrowsingModeManager(initialMode, components.settings) { newMode ->
|
|
|
|
|
updateSecureWindowFlags(newMode)
|
|
|
|
|
themeManager.currentTheme = newMode
|
|
|
|
@ -1131,7 +1133,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected open fun createThemeManager(): ThemeManager {
|
|
|
|
|
private fun createThemeManager(): ThemeManager {
|
|
|
|
|
return DefaultThemeManager(browsingModeManager.mode, this)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1182,7 +1184,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
* Indicates if the user should be redirected to the [BrowserFragment] or to the [HomeFragment],
|
|
|
|
|
* links from an external apps should always opened in the [BrowserFragment].
|
|
|
|
|
*/
|
|
|
|
|
fun shouldStartOnHome(intent: Intent? = this.intent): Boolean {
|
|
|
|
|
@VisibleForTesting
|
|
|
|
|
internal fun shouldStartOnHome(intent: Intent? = this.intent): Boolean {
|
|
|
|
|
return components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
|
|
|
|
|
// We only want to open on home when users tap the app,
|
|
|
|
|
// we want to ignore other cases when the app gets open by users clicking on links.
|
|
|
|
@ -1262,6 +1265,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
|
|
|
|
|
// PWA must have been used within last 30 days to be considered "recently used" for the
|
|
|
|
|
// telemetry purposes.
|
|
|
|
|
const val PWA_RECENTLY_USED_THRESHOLD = DateUtils.DAY_IN_MILLIS * 30L
|
|
|
|
|
private const val PWA_RECENTLY_USED_THRESHOLD = DateUtils.DAY_IN_MILLIS * 30L
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|