ABausG / home_widget

Flutter Package for Easier Creation of Home Screen Widgets
786 stars 218 forks source link

java.lang.RuntimeException: Unable to start receiver com.example.home_widget.HomeWidgetExampleProvider: java.lang.IllegalArgumentException: pendingIntentBackgroundActivityStartMode must not be set when creating a PendingIntent #303

Open ZhangXingXingo opened 1 month ago

ZhangXingXingo commented 1 month ago

What happened?

When I run app on Android SDK 35 Device and add HomeWidget to Device's Home Screen I get this exception and app exit then I can't run app no more unless remove HomeWidget from Device's Home Screen

What do you expect?

get it!

Relevant log output

E/AndroidRuntime(28483): java.lang.RuntimeException: Unable to start receiver cn.schoolheart.destiny.HomeWidgetExampleProvider: java.lang.IllegalArgumentException: pendingIntentBackgroundActivityStartMode must not be set when creating a PendingIntent
E/AndroidRuntime(28483):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:5164)
E/AndroidRuntime(28483):    at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
E/AndroidRuntime(28483):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2660)
E/AndroidRuntime(28483):    at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(28483):    at android.os.Looper.loopOnce(Looper.java:249)
E/AndroidRuntime(28483):    at android.os.Looper.loop(Looper.java:337)
E/AndroidRuntime(28483):    at android.app.ActivityThread.main(ActivityThread.java:9571)
E/AndroidRuntime(28483):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(28483):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
E/AndroidRuntime(28483):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
E/AndroidRuntime(28483): Caused by: java.lang.IllegalArgumentException: pendingIntentBackgroundActivityStartMode must not be set when creating a PendingIntent
E/AndroidRuntime(28483):    at android.os.Parcel.createExceptionOrNull(Parcel.java:3260)
E/AndroidRuntime(28483):    at android.os.Parcel.createException(Parcel.java:3240)
E/AndroidRuntime(28483):    at android.os.Parcel.readException(Parcel.java:3223)
E/AndroidRuntime(28483):    at android.os.Parcel.readException(Parcel.java:3165)
E/AndroidRuntime(28483):    at android.app.IActivityManager$Stub$Proxy.getIntentSenderWithFeature(IActivityManager.java:7380)
E/AndroidRuntime(28483):    at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:581)
E/AndroidRuntime(28483):    at android.app.PendingIntent.getActivity(PendingIntent.java:562)
E/AndroidRuntime(28483):    at es.antonborri.home_widget.HomeWidgetLaunchIntent.getActivity(HomeWidgetIntent.kt:39)
E/AndroidRuntime(28483):    at es.antonborri.home_widget.HomeWidgetLaunchIntent.getActivity$default(HomeWidgetIntent.kt:17)
E/AndroidRuntime(28483):    at cn.schoolheart.destiny.HomeWidgetExampleProvider.onUpdate(HomeWidgetExampleProvider.kt:27)
E/AndroidRuntime(28483):    at es.antonborri.home_widget.HomeWidgetProvider.onUpdate(HomeWidgetProvider.kt:16)
E/AndroidRuntime(28483):    at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java:71)
E/AndroidRuntime(28483):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:5152)
E/AndroidRuntime(28483):    ... 9 more
E/AndroidRuntime(28483): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime(28483):    at com.android.server.am.PendingIntentController.getIntentSender(PendingIntentController.java:145)
E/AndroidRuntime(28483):    at com.android.server.am.ActivityManagerService.getIntentSenderWithFeatureAsApp(ActivityManagerService.java:6181)
E/AndroidRuntime(28483):    at com.android.server.am.ActivityManagerService.getIntentSenderWithFeature(ActivityManagerService.java:6074)
E/AndroidRuntime(28483):    at android.app.IActivityManager$Stub.onTransact$getIntentSenderWithFeature$(IActivityManager.java:13508)
E/AndroidRuntime(28483):    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3647)
E/AndroidRuntime(28483): 
I/olheart.destiny(28483): This is non sticky GC, maxfree is 33554432 minfree is 8388608
I/olheart.destiny(28483): Background concurrent mark compact GC freed 13MB AllocSpace bytes, 69(1892KB) LOS objects, 84% free, 4506KB/28MB, paused 364us,9.233ms total 44.562ms
W/FinalizerDaemon(28483): type=1400 audit(0.0:26592): avc:  denied  { getopt } for  path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c121,c257,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 app=cn.schoolheart.destiny
W/olheart.destiny(28483): ApkAssets: Deleting an ApkAssets object '<empty> and /product/app/ContentCatcherOS2/ContentCatcherOS2.apk' with 1 weak references
W/olheart.destiny(28483): ApkAssets: Deleting an ApkAssets object '<empty> and /system_ext/priv-app/RtMiCloudSDK/RtMiCloudSDK.apk' with 1 weak references
W/olheart.destiny(28483): ApkAssets: Deleting an ApkAssets object '<empty> and /system_ext/app/miuisystem/miuisystem.apk' with 1 weak references
W/olheart.destiny(28483): ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~QMT0fX7o8G_iJY7F6zH00Q==/com.google.android.marvin.talkback-QXTMo0UnwzYvu9rEisbmlA==/base.apk' with 1 weak references
W/olheart.destiny(28483): ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~QMT0fX7o8G_iJY7F6zH00Q==/com.google.android.marvin.talkback-QXTMo0UnwzYvu9rEisbmlA==/split_config.arm64_v8a.apk' with 1 weak references
D/TrafficStats(28483): tagSocket(3) with statsTag=0xffffffff, statsUid=-1
W/olheart.destiny(28483): type=1400 audit(0.0:26596): avc:  denied  { search } for  name="miuilog" dev="dm-54" ino=963 scontext=u:r:untrusted_app:s0:c121,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=cn.schoolheart.destiny
W/olheart.destiny(28483): type=1400 audit(0.0:26597): avc:  denied  { search } for  name="miuilog" dev="dm-54" ino=963 scontext=u:r:untrusted_app:s0:c121,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=cn.schoolheart.destiny
W/olheart.destiny(28483): type=1400 audit(0.0:26598): avc:  denied  { search } for  name="miuilog" dev="dm-54" ino=963 scontext=u:r:untrusted_app:s0:c121,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=cn.schoolheart.destiny
W/olheart.destiny(28483): type=1400 audit(0.0:26599): avc:  denied  { search } for  name="miuilog" dev="dm-54" ino=963 scontext=u:r:untrusted_app:s0:c121,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=cn.schoolheart.destiny
W/olheart.destiny(28483): type=1400 audit(0.0:26600): avc:  denied  { search } for  name="miuilog" dev="dm-54" ino=963 scontext=u:r:untrusted_app:s0:c121,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=cn.schoolheart.destiny
D/CompatChangeReporter(28483): Compat change id reported: 312399441; UID 10377; state: ENABLED
W/ScoutUtils(28483): Failed to mkdir /data/miuilog/stability/memleak/heapdump/
I/Process (28483): Process is going to kill itself!
I/Process (28483): java.lang.Exception
I/Process (28483):  at android.os.Process.killProcess(Process.java:1513)
I/Process (28483):  at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:193)
I/Process (28483):  at cn.jiguang.b.a.uncaughtException(Unknown Source:69)
I/Process (28483):  at cn.jiguang.cf.h.uncaughtException(Unknown Source:25)
I/Process (28483):  at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1071)
I/Process (28483):  at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1066)
I/Process (28483):  at java.lang.Thread.dispatchUncaughtException(Thread.java:2306)
I/Process (28483): Sending signal. PID: 28483 SIG: 9
Lost connection to device.
the Dart compiler exited unexpectedly.

Execute in a terminal and put output into the code block below

Output of: flutter doctor -v

On which Platform do you experience this issue?

Android

Other information

No response

Are you interested in working on a PR for this?

daniele-sforza commented 1 month ago

I have the same problem. Did you solve it?

ItzBubschki commented 1 week ago

I also have the same issue. Seems like this line: options.pendingIntentBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED in HomeWidgetIntent.kt ln: 32 causes this.