Integrate activity for showing past crashes.
parent
b2b89bfab5
commit
d58c022619
|
@ -191,6 +191,10 @@
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".crashes.CrashListActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
<activity android:name=".widget.VoiceSearchActivity" />
|
<activity android:name=".widget.VoiceSearchActivity" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -68,6 +68,7 @@ class Analytics(
|
||||||
)
|
)
|
||||||
|
|
||||||
CrashReporter(
|
CrashReporter(
|
||||||
|
context = context,
|
||||||
services = services,
|
services = services,
|
||||||
telemetryServices = listOf(GleanCrashReporterService(context)),
|
telemetryServices = listOf(GleanCrashReporterService(context)),
|
||||||
shouldPrompt = CrashReporter.Prompt.ALWAYS,
|
shouldPrompt = CrashReporter.Prompt.ALWAYS,
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.fenix.crashes
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import mozilla.components.lib.crash.CrashReporter
|
||||||
|
import mozilla.components.lib.crash.ui.AbstractCrashListActivity
|
||||||
|
import org.mozilla.fenix.ext.components
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity showing the list of past crashes.
|
||||||
|
*/
|
||||||
|
class CrashListActivity : AbstractCrashListActivity() {
|
||||||
|
override val crashReporter: CrashReporter by lazy { components.analytics.crashReporter }
|
||||||
|
|
||||||
|
override fun onCrashServiceSelected(url: String) {
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW)
|
||||||
|
intent.data = Uri.parse(url)
|
||||||
|
intent.`package` = packageName
|
||||||
|
startActivity(intent)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
package org.mozilla.fenix.search
|
package org.mozilla.fenix.search
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
@ -22,6 +23,7 @@ import org.mozilla.fenix.components.metrics.Event.PerformedSearch.SearchAccessPo
|
||||||
import org.mozilla.fenix.components.metrics.Event.PerformedSearch.SearchAccessPoint.SUGGESTION
|
import org.mozilla.fenix.components.metrics.Event.PerformedSearch.SearchAccessPoint.SUGGESTION
|
||||||
import org.mozilla.fenix.components.metrics.MetricsUtils
|
import org.mozilla.fenix.components.metrics.MetricsUtils
|
||||||
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
|
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
|
||||||
|
import org.mozilla.fenix.crashes.CrashListActivity
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.metrics
|
import org.mozilla.fenix.ext.metrics
|
||||||
import org.mozilla.fenix.ext.navigateSafe
|
import org.mozilla.fenix.ext.navigateSafe
|
||||||
|
@ -52,6 +54,14 @@ class DefaultSearchController(
|
||||||
) : SearchController {
|
) : SearchController {
|
||||||
|
|
||||||
override fun handleUrlCommitted(url: String) {
|
override fun handleUrlCommitted(url: String) {
|
||||||
|
if (url == "about:crashes") {
|
||||||
|
// The list of past crashes can be accessed via "settings > about", but desktop and
|
||||||
|
// fennec users may be used to navigating to "about:crashes". So we intercept this here
|
||||||
|
// and open the crash list activity instead.
|
||||||
|
context.startActivity(Intent(context, CrashListActivity::class.java))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (url.isNotBlank()) {
|
if (url.isNotBlank()) {
|
||||||
(context as HomeActivity).openToBrowserAndLoad(
|
(context as HomeActivity).openToBrowserAndLoad(
|
||||||
searchTermOrURL = url,
|
searchTermOrURL = url,
|
||||||
|
|
|
@ -20,6 +20,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import org.mozilla.fenix.BuildConfig
|
import org.mozilla.fenix.BuildConfig
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.metrics.Event
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
|
import org.mozilla.fenix.crashes.CrashListActivity
|
||||||
import org.mozilla.fenix.ext.requireComponents
|
import org.mozilla.fenix.ext.requireComponents
|
||||||
import org.mozilla.fenix.ext.settings
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.utils.Do
|
import org.mozilla.fenix.utils.Do
|
||||||
|
@ -152,6 +153,10 @@ class AboutFragment : Fragment(), AboutPageListener {
|
||||||
SupportUtils.getSumoURLForTopic(context, SupportUtils.SumoTopic.HELP)
|
SupportUtils.getSumoURLForTopic(context, SupportUtils.SumoTopic.HELP)
|
||||||
), getString(R.string.about_support)
|
), getString(R.string.about_support)
|
||||||
),
|
),
|
||||||
|
AboutPageItem.Item(
|
||||||
|
AboutItem.Crashes,
|
||||||
|
getString(R.string.about_crashes)
|
||||||
|
),
|
||||||
AboutPageItem.Item(
|
AboutPageItem.Item(
|
||||||
AboutItem.ExternalLink(
|
AboutItem.ExternalLink(
|
||||||
PRIVACY_NOTICE,
|
PRIVACY_NOTICE,
|
||||||
|
@ -215,6 +220,9 @@ class AboutFragment : Fragment(), AboutPageListener {
|
||||||
requireComponents.analytics.metrics.track(Event.LibrariesThatWeUseTapped)
|
requireComponents.analytics.metrics.track(Event.LibrariesThatWeUseTapped)
|
||||||
openLibrariesPage()
|
openLibrariesPage()
|
||||||
}
|
}
|
||||||
|
is AboutItem.Crashes -> {
|
||||||
|
startActivity(Intent(requireContext(), CrashListActivity::class.java))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.mozilla.fenix.settings.about
|
||||||
sealed class AboutItem {
|
sealed class AboutItem {
|
||||||
data class ExternalLink(val type: AboutItemType, val url: String) : AboutItem()
|
data class ExternalLink(val type: AboutItemType, val url: String) : AboutItem()
|
||||||
object Libraries : AboutItem()
|
object Libraries : AboutItem()
|
||||||
|
object Crashes : AboutItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class AboutItemType {
|
enum class AboutItemType {
|
||||||
|
|
|
@ -1106,6 +1106,8 @@
|
||||||
|
|
||||||
<!-- About page link text to open support link -->
|
<!-- About page link text to open support link -->
|
||||||
<string name="about_support">Support</string>
|
<string name="about_support">Support</string>
|
||||||
|
<!-- About page link text to list of past crashes (like about:crashes on desktop) -->
|
||||||
|
<string name="about_crashes">Crashes</string>
|
||||||
<!-- About page link text to open privacy notice link -->
|
<!-- About page link text to open privacy notice link -->
|
||||||
<string name="about_privacy_notice">Privacy notice</string>
|
<string name="about_privacy_notice">Privacy notice</string>
|
||||||
<!-- About page link text to open know your rights link -->
|
<!-- About page link text to open know your rights link -->
|
||||||
|
|
|
@ -20,6 +20,9 @@ internal class BreadcrumbRecorderTest {
|
||||||
@Test
|
@Test
|
||||||
fun `ensure crash reporter recordCrashBreadcrumb is called`() {
|
fun `ensure crash reporter recordCrashBreadcrumb is called`() {
|
||||||
val service = object : CrashReporterService {
|
val service = object : CrashReporterService {
|
||||||
|
override val id: String = "test"
|
||||||
|
override val name: String = "Test"
|
||||||
|
override fun createCrashReportUrl(identifier: String): String? = null
|
||||||
override fun report(throwable: Throwable, breadcrumbs: ArrayList<Breadcrumb>): String? = ""
|
override fun report(throwable: Throwable, breadcrumbs: ArrayList<Breadcrumb>): String? = ""
|
||||||
override fun report(crash: Crash.NativeCodeCrash): String? = ""
|
override fun report(crash: Crash.NativeCodeCrash): String? = ""
|
||||||
override fun report(crash: Crash.UncaughtExceptionCrash): String? = ""
|
override fun report(crash: Crash.UncaughtExceptionCrash): String? = ""
|
||||||
|
@ -27,6 +30,7 @@ internal class BreadcrumbRecorderTest {
|
||||||
|
|
||||||
val reporter = spy(
|
val reporter = spy(
|
||||||
CrashReporter(
|
CrashReporter(
|
||||||
|
context = mock(),
|
||||||
services = listOf(service),
|
services = listOf(service),
|
||||||
shouldPrompt = CrashReporter.Prompt.NEVER
|
shouldPrompt = CrashReporter.Prompt.NEVER
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
object AndroidComponents {
|
object AndroidComponents {
|
||||||
const val VERSION = "41.0.20200510130109"
|
const val VERSION = "41.0.20200511120152"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue