TylerWilliamson / BatteryNotification

Creates a persistent notification to see battery information at a glance!
https://play.google.com/store/apps/details?id=com.ominous.batterynotification
GNU General Public License v3.0
33 stars 4 forks source link

Fix crash when opening notification settings on Android 8+ #11

Open unbiaseduser opened 2 years ago

unbiaseduser commented 2 years ago

Hello! I discovered your app on F-Droid and I must say I love it. Unfortunately, after starting the notification, the app crashes when I open the notification settings from it. After some time, I have discovered that the cause is an Intent with incorrect extras put in. (the Settings.ACTION_APP_NOTIFICATION_SETTINGS action takes only one input (Settings.EXTRA_APP_PACKAGE) but you also put another one (Settings.EXTRA_CHANNEL_ID)) Thus, I have edited the intent to use the correct one (Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS), which I believe you intended to use with those two inputs.

TylerWilliamson commented 2 years ago

This feature works fine on every device I have tested on. This is likely an specific device/OS issue rather than a global fix. Could you provide more information about the device(s) that you tested on?

unbiaseduser commented 2 years ago

(Sorry, I forgot to clarify that it's the system Settings app that crashes.) I tested on a phone running android 11 and an emulator running android 13. The crash can be reproduced reliably. I triggered the crash by doing this:

TylerWilliamson commented 2 years ago

I tested on a phone running android 11

What is the model of phone? Is it running its stock OS or a custom ROM?

unbiaseduser commented 2 years ago

It's a Xiaomi Mi Mix 3 5G running a custom ROM.

TylerWilliamson commented 2 years ago

It's a Xiaomi Mi Mix 3 5G running a custom ROM.

What ROM is it? LineageOS? I need this information to help with testing.

unbiaseduser commented 2 years ago

It's crDroid (7.9), based on LineageOS. Oh, and what devices have you tested on?

unbiaseduser commented 2 years ago

If this is taking too long, you can just test on an emulator like I did. Any emulator works, as long as it's running Android 9 or later. (Strangely, on Android 8.0 the Settings app just says "The app wasn't found in the list of installed apps" regardless of my change, and on Android 8.1 everything surprisingly works fine (!!!))

KiralyCraft commented 1 year ago

I also have this issue on LineageOS 20/19, on a Galaxy S9 (starlte) and Xiaomi Mi A1 (tissot) respectively.