thunderbird / thunderbird-android

K-9 Mail – Open Source Email App for Android
https://k9mail.app/
Apache License 2.0
9.92k stars 2.46k forks source link

ANR when using custom tabs in OAuth flow #7845

Open LingEmberMaple opened 3 months ago

LingEmberMaple commented 3 months ago

Checklist

App version

6.900

Where did you get the app from?

F-Droid

Android version

14

Device model

Redmi K40S

Steps to reproduce

  1. First open K-9 Mail
  2. Click “Start”
  3. Enter email and click “Next”
  4. Click “Next” or “Sign in”

Expected behavior

APP continue running

Actual behavior

ANR

Logs

15_05-23-41-18_676.zip crash-com-fsck-k9-15_05-23-40-50_459.zip

LingEmberMaple commented 3 months ago

6.901 still ANR 16_05-07-36-02_394.zip crash-com-fsck-k9-16_05-07-34-17_429.zip

LingEmberMaple commented 3 months ago

ANR when:

  1. First open K-9 Mail
  2. Click “Start”
  3. Click “Back”
  4. Repeat 2 and 3 several times

16_05-08-24-51_813.zip crash-com-fsck-k9-16_05-08-24-37_980.zip

cketti commented 3 months ago

This seems to be related to custom tabs that are used for the OAuth sign-in flow. It looks like communication with the custom tabs service takes longer than 5 seconds. Are you doing anything to deliberately slow down such communication?

The OAuth library seems to be using the recommended way of doing this.

This issue does occasionally show up in ANRs reported via Google Play. But it's not very common (9 affected users in the last 60 days). Given that, we can't really justify spending more time on this.

Of course, pull requests to fix the problem are welcome (although this probably needs to be fixed in AppAuth-Android).

LingEmberMaple commented 3 months ago

Thank you for the response.

I am not doing anything to deliberately slow down such communication.

It is strange that it started to have issues after I updated to HyperOS based on Android 14, but there were no problems on MIUI based on Android 13 before the update.

I will try again after the next system update.

LingEmberMaple commented 3 months ago

Found a temporary solution: Set the battery saver setting for the browser that K-9 Mail use the custom tab feature to “No restrictions”.

When you have installed a browser that supports the custom tab feature, whether or not this browser is set as the default browser, K-9 Mail will use the custom tab feature of this browser when adding an email account. However, due to unknown system reasons, setting the battery saver setting of this type of browser to “Battery saver” can cause K-9 Mail to ANR.