[Bug] Smartspacer crashes when Shizuku is unavailable/enhanced mode is off and 'Tap to turn off' (Torch) is clicked
25huizengek1 opened this issue · comments
Description
This is a small inconvenience for when Shizuku is not available for some reason. This theoretically can be seen as a plugin issue, so if I should've reported this in KieronQuinn/SmartspacerPlugins, please let me know. The issue lies in this codebase though, so I think I should be good 😅
Steps to reproduce
- Add a torch (reminder) target
- Turn on the torch
- Navigate to the torch target in Smartspace
- Click 'Tap to turn off' in the target
- The entire app crashes and the widget restarts
Logs
Possible fix
Normally we wouldn't want this, but it's probably enough if the 'fallback' (workaround?) FlashlightToggleActivity just gets launched (FlashlightReceiver) using the FLAG_ACTIVITY_NEW_TASK Intent flag. That would look something like this:
}.unwrap() ?: run {
context.startActivity(Intent(context, FlashlightToggleActivity::class.java).apply {
setFlags(Context.FLAG_ACTIVITY_NEW_TASK)
})
}
But since I'm not able to test this myself (I can't seem to build without Firebase credentials, for example) I'll leave this to you.
Thank you so much for building such an incredible app, I really appreciate all of your hard work that goes into making this widget.
I mistakenly put ‘complication’ instead of ‘target’, I meant the Torch target, of course.
Fixed in 1.6.4
Excellent bug deduction btw, you were correct in that it needed that flag. I only tested the 'happy path' where the app was already open in the background.