@@ -21,10 +21,10 @@ import androidx.annotation.StringRes
2121import androidx.core.content.edit
2222import androidx.test.annotation.UiThreadTest
2323import androidx.test.ext.junit.runners.AndroidJUnit4
24+ import com.ichi2.anki.AcraCrashReporter
25+ import com.ichi2.anki.AcraCrashReporter.FEEDBACK_REPORT_ALWAYS
26+ import com.ichi2.anki.AcraCrashReporter.FEEDBACK_REPORT_ASK
2427import com.ichi2.anki.AnkiDroidApp
25- import com.ichi2.anki.CrashReportService
26- import com.ichi2.anki.CrashReportService.FEEDBACK_REPORT_ALWAYS
27- import com.ichi2.anki.CrashReportService.FEEDBACK_REPORT_ASK
2828import com.ichi2.anki.R
2929import com.ichi2.anki.analytics.UsageAnalytics
3030import com.ichi2.anki.logging.ProductionCrashReportingTree
@@ -70,10 +70,10 @@ class ACRATest : InstrumentedTest() {
7070 @Throws(Exception ::class )
7171 fun testDebugConfiguration () {
7272 // Debug mode overrides all saved state so no setup needed
73- CrashReportService .setDebugACRAConfig(sharedPrefs)
73+ AcraCrashReporter .setDebugACRAConfig(sharedPrefs)
7474 assertArrayEquals(
7575 " Debug logcat arguments not set correctly" ,
76- CrashReportService .acraCoreConfigBuilder
76+ AcraCrashReporter .acraCoreConfigBuilder
7777 .build()
7878 .logcatArguments
7979 .toTypedArray(),
@@ -90,21 +90,21 @@ class ACRATest : InstrumentedTest() {
9090 )
9191 assertEquals(
9292 " ACRA feedback was not turned off correctly" ,
93- CrashReportService .FEEDBACK_REPORT_NEVER ,
93+ AcraCrashReporter .FEEDBACK_REPORT_NEVER ,
9494 sharedPrefs
95- .getString(CrashReportService .FEEDBACK_REPORT_KEY , " undefined" ),
95+ .getString(AcraCrashReporter .FEEDBACK_REPORT_KEY , " undefined" ),
9696 )
9797 }
9898
9999 @Test
100100 @Throws(Exception ::class )
101101 fun testProductionConfigurationUserDisabled () {
102102 // set up as if the user had prefs saved to disable completely
103- setReportConfig(CrashReportService .FEEDBACK_REPORT_NEVER )
103+ setReportConfig(AcraCrashReporter .FEEDBACK_REPORT_NEVER )
104104
105105 // ACRA initializes production logcat via annotation and we can't mock Build.DEBUG
106106 // That means we are restricted from verifying production logcat args and this is the debug case again
107- CrashReportService .setProductionACRAConfig(sharedPrefs)
107+ AcraCrashReporter .setProductionACRAConfig(sharedPrefs)
108108 verifyDebugACRAPreferences()
109109 }
110110
@@ -115,7 +115,7 @@ class ACRATest : InstrumentedTest() {
115115 setReportConfig(FEEDBACK_REPORT_ASK )
116116
117117 // If the user is set to ask, then it's production, with interaction mode dialog
118- CrashReportService .setProductionACRAConfig(sharedPrefs)
118+ AcraCrashReporter .setProductionACRAConfig(sharedPrefs)
119119 verifyACRANotDisabled()
120120
121121 assertToastMessage(R .string.feedback_for_manual_toast_text)
@@ -134,7 +134,7 @@ class ACRATest : InstrumentedTest() {
134134
135135 // If the user is set to always, then it's production, with interaction mode toast
136136 // will be useful with ACRA 5.2.0
137- CrashReportService .setProductionACRAConfig(sharedPrefs)
137+ AcraCrashReporter .setProductionACRAConfig(sharedPrefs)
138138
139139 // The same class/method combo is only sent once, so we face a new method each time (should test that system later)
140140 val crash = Exception (" testCrashReportSend at " + System .currentTimeMillis())
@@ -153,12 +153,12 @@ class ACRATest : InstrumentedTest() {
153153 val crashData =
154154 CrashReportDataFactory (
155155 testContext,
156- CrashReportService .acraCoreConfigBuilder.build(),
156+ AcraCrashReporter .acraCoreConfigBuilder.build(),
157157 ).createCrashData(ReportBuilder ().exception(crash))
158158 assertTrue(
159159 LimitingReportAdministrator ().shouldSendReport(
160160 testContext,
161- CrashReportService .acraCoreConfigBuilder.build(),
161+ AcraCrashReporter .acraCoreConfigBuilder.build(),
162162 crashData,
163163 ),
164164 )
@@ -167,19 +167,19 @@ class ACRATest : InstrumentedTest() {
167167 assertFalse(
168168 LimitingReportAdministrator ().shouldSendReport(
169169 testContext,
170- CrashReportService .acraCoreConfigBuilder.build(),
170+ AcraCrashReporter .acraCoreConfigBuilder.build(),
171171 crashData,
172172 ),
173173 )
174174
175175 // Now let's clear data
176- CrashReportService .deleteACRALimiterData(testContext)
176+ AcraCrashReporter .deleteACRALimiterData(testContext)
177177
178178 // A third send should work again
179179 assertTrue(
180180 LimitingReportAdministrator ().shouldSendReport(
181181 testContext,
182- CrashReportService .acraCoreConfigBuilder.build(),
182+ AcraCrashReporter .acraCoreConfigBuilder.build(),
183183 crashData,
184184 ),
185185 )
@@ -192,7 +192,7 @@ class ACRATest : InstrumentedTest() {
192192 setReportConfig(FEEDBACK_REPORT_ALWAYS )
193193
194194 // If the user is set to always, then it's production, with interaction mode toast
195- CrashReportService .setProductionACRAConfig(sharedPrefs)
195+ AcraCrashReporter .setProductionACRAConfig(sharedPrefs)
196196 verifyACRANotDisabled()
197197
198198 assertToastMessage(R .string.feedback_auto_toast_text)
@@ -207,7 +207,7 @@ class ACRATest : InstrumentedTest() {
207207 setReportConfig(FEEDBACK_REPORT_ALWAYS )
208208
209209 // If the user is set to ask, then it's production, with interaction mode dialog
210- CrashReportService .setProductionACRAConfig(sharedPrefs)
210+ AcraCrashReporter .setProductionACRAConfig(sharedPrefs)
211211 verifyACRANotDisabled()
212212
213213 assertDialogEnabledStatus(" dialog should be disabled when status is ALWAYS" , false )
@@ -226,7 +226,7 @@ class ACRATest : InstrumentedTest() {
226226 setReportConfig(FEEDBACK_REPORT_ASK )
227227
228228 // If the user is set to ask, then it's production, with interaction mode dialog
229- CrashReportService .setProductionACRAConfig(sharedPrefs)
229+ AcraCrashReporter .setProductionACRAConfig(sharedPrefs)
230230 verifyACRANotDisabled()
231231
232232 assertToastMessage(R .string.feedback_for_manual_toast_text)
@@ -262,7 +262,7 @@ class ACRATest : InstrumentedTest() {
262262 ThrowableFilterService .installDefaultExceptionHandler()
263263
264264 // reinitialize things and make sure they came through correctly again
265- CrashReportService .onPreferenceChanged(app!! .applicationContext, FEEDBACK_REPORT_ASK )
265+ AcraCrashReporter .onPreferenceChanged(app!! .applicationContext, FEEDBACK_REPORT_ASK )
266266 firstExceptionHandler = Thread .getDefaultUncaughtExceptionHandler()
267267 assertThat(" First handler is ThrowableFilterService" , firstExceptionHandler is ThrowableFilterService .FilteringExceptionHandler )
268268 ThrowableFilterService .unInstallDefaultExceptionHandler()
@@ -282,15 +282,15 @@ class ACRATest : InstrumentedTest() {
282282 }
283283
284284 private fun setAcraReportingMode (feedbackReportAlways : String ) {
285- CrashReportService .setAcraReportingMode(feedbackReportAlways)
285+ AcraCrashReporter .setAcraReportingMode(feedbackReportAlways)
286286 }
287287
288288 @Throws(ACRAConfigurationException ::class )
289289 private fun assertDialogEnabledStatus (
290290 message : String ,
291291 isEnabled : Boolean ,
292292 ) {
293- val config = CrashReportService .acraCoreConfigBuilder.build()
293+ val config = AcraCrashReporter .acraCoreConfigBuilder.build()
294294 for (configuration in config.pluginConfigurations) {
295295 // Make sure the dialog is set to pop up
296296 if (configuration.javaClass.toString().contains(" Dialog" )) {
@@ -301,7 +301,7 @@ class ACRATest : InstrumentedTest() {
301301
302302 @Throws(ACRAConfigurationException ::class )
303303 private fun assertToastIsEnabled () {
304- val config = CrashReportService .acraCoreConfigBuilder.build()
304+ val config = AcraCrashReporter .acraCoreConfigBuilder.build()
305305 for (configuration in config.pluginConfigurations) {
306306 if (configuration.javaClass.toString().contains(" Toast" )) {
307307 assertThat(" Toast should be enabled" , configuration.enabled(), equalTo(true ))
@@ -313,7 +313,7 @@ class ACRATest : InstrumentedTest() {
313313 private fun assertToastMessage (
314314 @StringRes res : Int ,
315315 ) {
316- val config = CrashReportService .acraCoreConfigBuilder.build()
316+ val config = AcraCrashReporter .acraCoreConfigBuilder.build()
317317 for (configuration in config.pluginConfigurations) {
318318 if (configuration.javaClass.toString().contains(" Toast" )) {
319319 assertEquals(
@@ -333,7 +333,7 @@ class ACRATest : InstrumentedTest() {
333333 }
334334
335335 private fun setReportConfig (feedbackReportAsk : String ) {
336- sharedPrefs.edit { putString(CrashReportService .FEEDBACK_REPORT_KEY , feedbackReportAsk) }
336+ sharedPrefs.edit { putString(AcraCrashReporter .FEEDBACK_REPORT_KEY , feedbackReportAsk) }
337337 }
338338
339339 private val sharedPrefs: SharedPreferences
0 commit comments