ACRA / acra

Application Crash Reports for Android
https://www.acra.ch
Apache License 2.0
6.3k stars 1.13k forks source link

Toast shows permanently after Reboot on DeadSystemException #746

Closed aloz77 closed 4 years ago

aloz77 commented 5 years ago

Thank you for this nice library. I use it in my project as follow:

    implementation 'ch.acra:acra-http:5.3.0'
    implementation 'ch.acra:acra-toast:5.3.0'
    implementation 'ch.acra:acra-limiter:5.3.0'
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);

        try {
            final ReportField fields[] = {ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT};

            CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
            builder.setBuildConfigClass(BuildConfig.class).setReportFormat(StringFormat.KEY_VALUE_LIST);
            builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class).setResText(R.string.crash_toast_text);
            builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class).setEnabled(true);

            builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setPeriodUnit(TimeUnit.DAYS);
            if (BuildConfig.DEBUG) {
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setPeriod(1);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setOverallLimit(250);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setExceptionClassLimit(100);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setStacktraceLimit(50);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setFailedReportLimit(50);
            }
            else {
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setPeriod(7);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setOverallLimit(25);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setExceptionClassLimit(10);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setStacktraceLimit(5);
                builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setFailedReportLimit(5);
            }
            builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setResIgnoredCrashToast(R.string.crash_again_toast_text);
            builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setEnabled(true);

            builder.setReportContent(fields);

            ACRA.init(this, builder);

            if (BuildConfig.DEBUG)
                Log.d(TAG,"Crash ACRA registered");

        } catch (Exception e) {
            e.printStackTrace();
        }
}

Users reported that some devices seem to show the toast crash_toast_text permanently. I could also reproduce this behavior when my device rebooted (probably due to some hardware issues) and DeadSystemException was thrown. After reboot I could find in the app_ACRA-unapproved folder on the device the file _2019-05-06T16_36_55.069+0200.stacktrace which remains there while the toast message was shown permanently as soon as app was started. However no reports are sent with https for this exception at all. Seems that only the app uninstall can help to stop the toast message.

{"REPORT_ID":"826b0049-de7f-4d12-b225-bed21a73f91f","IS_SILENT":false,"APP_VERSION_NAME":"N\/A","LOGCAT":"05-06 16:36:46.893 D\/InputTransport( 5129): Input channel destroyed: fd=206\n05-06 16:36:46.897 V\/CloudService( 5129): Ping got response: 0:20000:8000\n05-06 16:36:46.945 D\/DullyActivity( 5129): Bringing my task ID 49194 to foreground\n05-06 16:36:46.952 D\/PinInputDialog( 5129): onDetach\n05-06 16:36:46.953 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): MSG_WINDOW_FOCUS_CHANGED 1\n05-06 16:36:46.953 D\/DullyActivity( 5129): onWindowFocusChanged to true\n05-06 16:36:46.960 V\/InputMethodManager( 5129): Starting input: tba=android.view.inputmethod.EditorInfo@10c5076 nm : io.dispot.kiosk ic=null\n05-06 16:36:46.961 I\/InputMethodManager( 5129): [IMM] startInputInner - mService.startInputOrWindowGainedFocus\n05-06 16:36:46.983 E\/ViewRootImpl( 5129): sendUserActionEvent() mView == null\n05-06 16:36:46.985 I\/DullyActivity( 5129): onNewIntent TaskID=49194 intent=Intent { act=io.dispot.kiosk.action.put_pin flg=0x10000000 cmp=io.dispot.kiosk\/de.ozzi.Dully.DullyActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } (has extras) }\n05-06 16:36:46.985 D\/KioskManager( 5129): pinActivityCallback result:0\n05-06 16:36:46.986 D\/DullyActivity( 5129): onResume\n05-06 16:36:46.986 D\/MyApplication( 5129): Last activity: DullyActivity\n05-06 16:36:46.990 D\/DullyActivity( 5129): onPostResume action = io.dispot.kiosk.action.put_pin\n05-06 16:36:46.990 D\/DullyActivity( 5129): setWhiteListSingleApp null\n05-06 16:36:47.019 V\/DeviceManager( 5129): Usage Stats Size: 41\n05-06 16:36:47.021 D\/RuntimePermissionManager( 5129): Missing permissions: 0\n05-06 16:36:47.032 V\/MyWebViewClient( 5129): shouldInterceptRequest url=https:\/\/www8.afsanalytics.com\/cgi-bin\/event.cgi webview #75896258\n05-06 16:36:47.043 D\/KioskManager( 5129): Current launcher: io.dispot.kiosk\n05-06 16:36:47.043 D\/DullyActivity( 5129): setKioskMode true\n05-06 16:36:47.044 D\/SystemBarManager( 5129): setStatusBar: isKioskLocked true isKioskMode true getDisableStatusBar true bootCompleted false\n05-06 16:36:47.053 V\/DeviceManager( 5129): isScreenLocked inKeyguardRestrictedInputMode:false isKeyguardLocked:false isDeviceLocked:true isInteractive:true isScreenOn:true\n05-06 16:36:47.053 D\/SystemBarManager( 5129): recheckLockedStatus newHasLock:false\n05-06 16:36:47.053 D\/LicenseManager( 5129): setPlusAnnounce isLicensed:true\n05-06 16:36:47.077 D\/KeyboardHelper( 5129): uiVisibility = 2818 rawHeight = 1008\n05-06 16:36:47.122 D\/ViewRootImpl@65586a2[PinInputActivity]( 5129): dispatchDetachedFromWindow\n05-06 16:36:47.129 D\/InputTransport( 5129): Input channel destroyed: fd=207\n05-06 16:36:47.390 V\/DullyActivity( 5129): MediaPlayer is stopped, no unsuspend\n05-06 16:36:48.116 V\/DullyActivity( 5129): internetWatchdog: Internet is reachable\n05-06 16:36:48.982 V\/MyWebViewClient( 5129): shouldInterceptRequest url=https:\/\/play.google.com\/log?format=json&hasfast=true webview #75896258\n05-06 16:36:48.987 V\/MyWebViewClient( 5129): shouldInterceptRequest url=https:\/\/docs.google.com\/presentation\/d\/e\/2PACX-1vSVLvNu8KqoTqHh4sramBEFu6CpEec55Hvcvrgjbid6fCVJOnLmH71Ynk-RrfcxFLkRZOOpFeIlW6Kg\/logImpressions?id=e%2F2PACX-1vSVLvNu8KqoTqHh4sramBEFu6CpEec55Hvcvrgjbid6fCVJOnLmH71Ynk-RrfcxFLkRZOOpFeIlW6Kg&includes_info_params=1 webview #75896258\n05-06 16:36:51.347 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:51.838 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:51.895 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:51.941 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:51.990 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.041 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.093 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.139 I\/art ( 5129): Starting a blocking GC Explicit\n05-06 16:36:52.144 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.193 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.225 I\/art ( 5129): Explicit concurrent mark sweep GC freed 18365(1216KB) AllocSpace objects, 8(300KB) LOS objects, 40% free, 12MB\/20MB, paused 1.196ms total 85.687ms\n05-06 16:36:52.242 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.293 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.298 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:52.305 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 1\n05-06 16:36:52.305 D\/KioskManager( 5129): setKioskLocked 3 currentKioskLockMode 3\n05-06 16:36:52.305 D\/SystemBarManager( 5129): setStatusBar: isKioskLocked true isKioskMode true getDisableStatusBar true bootCompleted false\n05-06 16:36:52.344 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 1\n05-06 16:36:52.776 V\/CustomViewBehind( 5129): behind INVISIBLE\n05-06 16:36:52.926 D\/KioskManager( 5129): setKioskLocked 2 currentKioskLockMode 3\n05-06 16:36:52.927 D\/MenuSlider( 5129): Drawer Closed\n05-06 16:36:53.444 D\/ViewRootImpl@8367f79[DullyActivity]( 5129): ViewPostImeInputStage processKey 0\n05-06 16:36:53.744 W\/Sensors ( 5129): sensorservice died [0x72756f9e00]\n05-06 16:36:54.984 V\/MyWebViewClient( 5129): shouldInterceptRequest url=https:\/\/play.google.com\/log?format=json&hasfast=true webview #75896258\n05-06 16:36:54.989 V\/MyWebViewClient( 5129): shouldInterceptRequest url=https:\/\/docs.google.com\/presentation\/d\/e\/2PACX-1vSVLvNu8KqoTqHh4sramBEFu6CpEec55Hvcvrgjbid6fCVJOnLmH71Ynk-RrfcxFLkRZOOpFeIlW6Kg\/logImpressions?id=e%2F2PACX-1vSVLvNu8KqoTqHh4sramBEFu6CpEec55Hvcvrgjbid6fCVJOnLmH71Ynk-RrfcxFLkRZOOpFeIlW6Kg&includes_info_params=1 webview #75896258\n05-06 16:36:55.044 E\/MyApplication( 5129): Crash uncaughtException\n05-06 16:36:55.046 E\/MyApplication( 5129): Uncaught exception - Restarting dispot\n05-06 16:36:55.047 W\/System.err( 5129): java.lang.RuntimeException: android.os.DeadSystemException\n05-06 16:36:55.049 W\/System.err( 5129): \tat android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1352)\n05-06 16:36:55.049 W\/System.err( 5129): \tat android.app.ContextImpl.registerReceiver(ContextImpl.java:1311)\n05-06 16:36:55.049 W\/System.err( 5129): \tat android.app.ContextImpl.registerReceiver(ContextImpl.java:1305)\n05-06 16:36:55.049 W\/System.err( 5129): \tat android.content.ContextWrapper.registerReceiver(ContextWrapper.java:617)\n05-06 16:36:55.050 W\/System.err( 5129): \tat android.content.ContextWrapper.registerReceiver(ContextWrapper.java:617)\n05-06 16:36:55.050 W\/System.err( 5129): \tat Fe.a(PG:21)\n05-06 16:36:55.050 W\/System.err( 5129): \tat GK.a(PG:317)\n05-06 16:36:55.050 W\/System.err( 5129): \tat Gw.a(PG:38)\n05-06 16:36:55.050 W\/System.err( 5129): \tat GQ.a(PG:68)\n05-06 16:36:55.050 W\/System.err( 5129): \tat HE.a(PG:9)\n05-06 16:36:55.050 W\/System.err( 5129): \tat HY.handleMessage(PG:40)\n05-06 16:36:55.050 W\/System.err( 5129): \tat android.os.Handler.dispatchMessage(Handler.java:102)\n05-06 16:36:55.050 W\/System.err( 5129): \tat android.os.Looper.loop(Looper.java:154)\n05-06 16:36:55.050 W\/System.err( 5129): \tat android.os.HandlerThread.run(HandlerThread.java:61)\n05-06 16:36:55.051 W\/System.err( 5129): Caused by: android.os.DeadSystemException\n05-06 16:36:55.051 W\/System.err( 5129): \t... 14 more\n05-06 16:36:55.053 E\/MyApplication( 5129): Error setting up restarting intent\n05-06 16:36:55.053 W\/System.err( 5129): java.lang.RuntimeException: android.os.DeadSystemException\n05-06 16:36:55.054 W\/System.err( 5129): \tat android.app.AlarmManager.setImpl(AlarmManager.java:737)\n05-06 16:36:55.054 W\/System.err( 5129): \tat android.app.AlarmManager.set(AlarmManager.java:390)\n05-06 16:36:55.054 W\/System.err( 5129): \tat de.ozzi.Dully.MyApplication$1.uncaughtException(MyApplication.java:74)\n05-06 16:36:55.054 W\/System.err( 5129): \tat java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)\n05-06 16:36:55.054 W\/System.err( 5129): \tat java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)\n05-06 16:36:55.054 W\/System.err( 5129): Caused by: android.os.DeadSystemException\n05-06 16:36:55.054 W\/System.err( 5129): \t... 5 more\n05-06 16:36:55.055 E\/ACRA ( 5129): ACRA caught a RuntimeException for io.dispot.kiosk\n05-06 16:36:55.055 E\/ACRA ( 5129): DeadSystemException: The system died; earlier logs will point to the root cause\n05-06 16:36:55.072 W\/ACRA ( 5129): \n05-06 16:36:55.072 W\/ACRA ( 5129): org.acra.collector.CollectorException: Error while retrieving APP_VERSION_NAME data:Failed to get package info\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat org.acra.collector.BaseReportFieldCollector.collect(BaseReportFieldCollector.java:77)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat org.acra.data.CrashReportDataFactory.lambda$createCrashData$1$CrashReportDataFactory(CrashReportDataFactory.java:88)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat org.acra.data.-$$Lambda$CrashReportDataFactory$JhNXduZFyp6NfMtDKKl8MZ9kTPI.run(lambda)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat java.util.concurrent.FutureTask.run(FutureTask.java:237)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat java.lang.Thread.run(Thread.java:762)\n05-06 16:36:55.072 W\/ACRA ( 5129): Caused by: org.acra.collector.CollectorException: Failed to get package info\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat org.acra.collector.PackageManagerCollector.collect(PackageManagerCollector.java:47)\n05-06 16:36:55.072 W\/ACRA ( 5129): \tat org.acra.collector.BaseReportFieldCollector.collect(BaseReportFieldCollector.java:73)\n05-06 16:36:55.072 W\/ACRA ( 5129): \t... 7 more","USER_CRASH_DATE":"2019-05-06T16:36:55.069+02:00","CUSTOM_DATA":{"ROM":"NRD90M.G930FXXU1DQD3","packageName":"io.dispot.kiosk","motionDetection":"false","kioskMode":"true"},"STACK_TRACE":"java.lang.RuntimeException: android.os.DeadSystemException\n\tat android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1352)\n\tat android.app.ContextImpl.registerReceiver(ContextImpl.java:1311)\n\tat android.app.ContextImpl.registerReceiver(ContextImpl.java:1305)\n\tat android.content.ContextWrapper.registerReceiver(ContextWrapper.java:617)\n\tat android.content.ContextWrapper.registerReceiver(ContextWrapper.java:617)\n\tat Fe.a(PG:21)\n\tat GK.a(PG:317)\n\tat Gw.a(PG:38)\n\tat GQ.a(PG:68)\n\tat HE.a(PG:9)\n\tat HY.handleMessage(PG:40)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loop(Looper.java:154)\n\tat android.os.HandlerThread.run(HandlerThread.java:61)\nCaused by: android.os.DeadSystemException\n\t... 14 more\n","ANDROID_VERSION":"7.0","PHONE_MODEL":"SM-G930F"}

F43nd1r commented 5 years ago

I was unable to reproduce this. Could you outline the exact steps you took to cause this issue?

aloz77 commented 5 years ago

No, unfrotunately can't really reproduce the DeadSystemException. But this seems to be what happens at least sometimes. Now I'm trying to remove these files in attachBaseContext() before starting ACRA.init()

emptyFolder(new File(getFilesDir().getParent(), "app_ACRA-unapproved"));

I'm not sure if this is a good idea or not, but a permanent error toast is not acceptable at all.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.