Skip to content

[Bug]: The app widget is unusable #5395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sivaraam opened this issue Nov 28, 2023 · 6 comments · Fixed by #5402
Closed

[Bug]: The app widget is unusable #5395

sivaraam opened this issue Nov 28, 2023 · 6 comments · Fixed by #5402

Comments

@sivaraam
Copy link
Member

Summary

The app widget is not usable at least on newer Android devices like those running Android 13. The widget doesn't show the image and the app crashes when opening after the widget is added.

Steps to reproduce

  1. Add the "Picture of day" widget from the app to your homescreen.
  2. Open the app.

Expected behaviour

The widget should show the oicture of the day properly on all supprted devices.

Actual behaviour

The wudget shows a blank screen. Further, the app crashes when opening after adding the widget.

Device name

Samsung SM-S918U

Android version

Android 13

Commons app version

4.2.1

Device logs

Full crash report

USER_COMMENT=just opened the app, and saw this message
APP_VERSION_CODE=1036
APP_VERSION_NAME=4.2.1
ANDROID_VERSION=13
PHONE_MODEL=SM-S918U
STACK_TRACE=java.lang.RuntimeException: Unable to start receiver fr.free.nrw.commons.widget.PicOfDayAppWidget: java.lang.IllegalArgumentException: fr.free.nrw.commons: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4903)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2420)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.IllegalArgumentException: fr.free.nrw.commons: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:408)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:491)
at android.app.PendingIntent.getActivity(PendingIntent.java:477)
at android.app.PendingIntent.getActivity(PendingIntent.java:441)
at fr.free.nrw.commons.widget.PicOfDayAppWidget.updateAppWidget(PicOfDayAppWidget.java:54)
at fr.free.nrw.commons.widget.PicOfDayAppWidget.onUpdate(PicOfDayAppWidget.java:140)
at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java:66)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4894)
... 9 more

IS_SILENT=false
REPORT_ID=c8ec07ca-39ef-43f2-bd2d-7d1c21ea36e9
USER_CRASH_DATE=2023-11-19T19:16:45.378-05:00
USER_EMAIL= 

Screen-shots

No response

Would you like to work on the issue?

None

@sivaraam sivaraam changed the title [Bug]: Make the app widget usable [Bug]: The app widget is unusable Nov 28, 2023
@nicolas-raoul
Copy link
Member

Just tried once now, I don't get the crash so far, but the widget stays black and does not show any picture.

@sivaraam
Copy link
Member Author

sivaraam commented Nov 28, 2023

Interesting. I consistently get the crash when I open the app for the first time immediately after adding the widget. I tried this on a OnePlus Nord running Android 12.

Could you share what steps you were following?

@nicolas-raoul
Copy link
Member

I am actually getting a crash after using the app for a while, caused by the widget:

USER_COMMENT=
APP_VERSION_CODE=1036
APP_VERSION_NAME=4.2.1-debug-issue5372_osmdroid
ANDROID_VERSION=14
PHONE_MODEL=Pixel 7 Pro
STACK_TRACE=java.lang.RuntimeException: Unable to start receiver fr.free.nrw.commons.widget.PicOfDayAppWidget: java.lang.IllegalArgumentException: fr.free.nrw.commons: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4478)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2261)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8194)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.IllegalArgumentException: fr.free.nrw.commons: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:450)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:566)
at android.app.PendingIntent.getActivity(PendingIntent.java:552)
at android.app.PendingIntent.getActivity(PendingIntent.java:516)
at fr.free.nrw.commons.widget.PicOfDayAppWidget.updateAppWidget(PicOfDayAppWidget.java:54)
at fr.free.nrw.commons.widget.PicOfDayAppWidget.onUpdate(PicOfDayAppWidget.java:140)
at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java:71)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4469)
... 9 more

IS_SILENT=false
REPORT_ID=34f851fc-0013-4dfd-adbe-e95d654c48a3
USER_CRASH_DATE=2023-11-29T13:36:30.186+09:00
USER_EMAIL= 

@nicolas-raoul
Copy link
Member

I just got this despite removing the widget from my screens yesterday:

USER_COMMENT=
APP_VERSION_CODE=1036
APP_VERSION_NAME=4.2.1-debug-issue5372_osmdroid
ANDROID_VERSION=14
PHONE_MODEL=Pixel 7 Pro
STACK_TRACE=java.lang.RuntimeException: Unable to start receiver fr.free.nrw.commons.widget.PicOfDayAppWidget: java.lang.IllegalArgumentException: fr.free.nrw.commons: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4478)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2261)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8194)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.IllegalArgumentException: fr.free.nrw.commons: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:450)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:566)
at android.app.PendingIntent.getActivity(PendingIntent.java:552)
at android.app.PendingIntent.getActivity(PendingIntent.java:516)
at fr.free.nrw.commons.widget.PicOfDayAppWidget.updateAppWidget(PicOfDayAppWidget.java:54)
at fr.free.nrw.commons.widget.PicOfDayAppWidget.onUpdate(PicOfDayAppWidget.java:140)
at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java:71)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4469)
... 9 more

IS_SILENT=false
REPORT_ID=029a3523-3ac2-495c-9a07-db9a697ae966
USER_CRASH_DATE=2023-11-29T13:35:18.772+09:00
USER_EMAIL= 

@sivaraam
Copy link
Member Author

sivaraam commented Dec 6, 2023

That's strange indeed. I wonder if there's any relation between the number of crashes and the amount of widget that we add. 🤔

I hope you've stopped seeing the crashes now.

@nicolas-raoul
Copy link
Member

Yes, not getting crashes anymore after resetting the app's storage (and not adding the widget obviously).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants