mvmike / min-cal-widget

Minimal calendar widget
BSD 3-Clause "New" or "Revised" License
89 stars 15 forks source link

Cannot add widget #51

Closed austinhuang0131 closed 4 years ago

austinhuang0131 commented 4 years ago

Per #32. Sony Xperia XA2 / H3123 / Android 9. v1.4.1 tried both GitHub release and F-droid.

07-05 15:25:28.714  1725  2182 I ActivityManager: START u0 {act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=cat.mvmike.minimalcalendarwidget/.application.activity.PermissionsActivity (has extras)} from uid 1000
07-05 15:25:28.784 26358 26358 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@5af63ef
07-05 15:25:28.802  1725 12228 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.google.android.packageinstaller cmp=com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity (has extras)} from uid 10365
07-05 15:25:28.899 26436 26436 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@6e60f03
07-05 15:25:28.974  1725  2182 I InputDispatcher: Focus entered window: Window{eef49e7 u0 cat.mvmike.minimalcalendarwidget/cat.mvmike.minimalcalendarwidget.application.activity.PermissionsActivity}
07-05 15:25:29.003  1725  1797 I Timeline: Timeline: Activity_windows_visible id: ActivityRecord{aae80ce u0 cat.mvmike.minimalcalendarwidget/.application.activity.PermissionsActivity t2} time:515619719 diff:29 start:warm|vis-activity batt:53|2 mw:off|0 mem:783100|0|51|3|13 cpu:[1,1,1,1,1,1,1,1],[1843,2208]
07-05 15:25:29.006  3207  3207 W StaticLayout: maxLineHeight should not be -1.  maxLines:1 lineCount:1
07-05 15:25:29.010  3207  3207 W StaticLayout: maxLineHeight should not be -1.  maxLines:1 lineCount:1
07-05 15:25:29.058  1725 12228 I InputDispatcher: Focus entered window: Window{16e79fc u0 com.sonymobile.home/com.sonymobile.home.HomeActivity}
07-05 15:25:29.074   840   840 D SurfaceFlinger: duplicate layer name: changing Surface(name=45b5b6d StatusBar)/@0xa03f822 - animation-leash to Surface(name=45b5b6d StatusBar)/@0xa03f822 - animation-leash#1
07-05 15:25:29.088  3207  3207 E HomeAppWidgetManager: : AppWidget failed to load:cat.mvmike.minimalcalendarwidget
07-05 15:25:29.089  7242  7242 E FullInputEventModel: onStartInput event aborted: gv2: could not obtain extracted text (class gv2)
07-05 15:25:29.169  1057  1193 E storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
07-05 15:25:29.214   840  1946 W SurfaceFlinger: Attempting to set client state on removed layer: cat.mvmike.minimalcalendarwidget/cat.mvmike.minimalcalendarwidget.application.activity.PermissionsActivity#0
07-05 15:25:29.214   840  1946 W SurfaceFlinger: Attempting to destroy on removed layer: cat.mvmike.minimalcalendarwidget/cat.mvmike.minimalcalendarwidget.application.activity.PermissionsActivity#0
07-05 15:25:29.477  3207  3207 W StaticLayout: maxLineHeight should not be -1.  maxLines:1 lineCount:1
07-05 15:25:29.484  3207  3207 W StaticLayout: maxLineHeight should not be -1.  maxLines:1 lineCount:1
kboss commented 4 years ago

Same behaviour here on Huawei P30 / ELE-L29 / with Android 10, EMUI 10.1

mvmike commented 4 years ago

Thanks a lot for the logcat, @austinhuang0131 !!!

As mentioned in #32, could not reproduce the issue, but after checking the log you provided it seems that it could be related with the permission management. May I suggest to reinstall the app, go to app settings, give calendar permissions and then try to place the widget? If that works, will try to find an alternative way of handling the permission that does not get stuck

austinhuang0131 commented 4 years ago

Gave Calendar perms right after installation. Same issue.

(App does ask for Calendar permission after I revoke it.)

mvmike commented 4 years ago

Thanks for trying out. Could you please do the same with a different launcher? I'm just trying to isolate the problem, if it's a launcher issue probably i can install and debug that on my phone

austinhuang0131 commented 4 years ago

Sorry for late reply... I use the system launcher (com.sonymobile.home). As we know, it affects EMUI launcher as well since @kboss uses a Huawei. So it shouldn't be a launcher issue. Nevertheless, I got OpenLauncher from F-Droid and the app would crash upon trying to add the widget.

Build version: 0.7.3 
Build date: 1979-11-29 19:00:00 
Current date: 2020-08-25 23:35:59 
Device: Sony H3123 

Stack trace:  
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=25717, result=-1, data=null} to activity {com.benny.openlauncher/com.benny.openlauncher.activity.HomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.content.Intent.getExtras()' on a null object reference
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4382)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4424)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1814)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:280)
    at android.app.ActivityThread.main(ActivityThread.java:6706)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.content.Intent.getExtras()' on a null object reference
    at com.benny.openlauncher.activity.homeparts.HpDesktopOption.createWidget(HpDesktopOption.java:86)
    at com.benny.openlauncher.activity.HomeActivity.onActivityResult(HomeActivity.java:489)
    at android.app.Activity.dispatchActivityResult(Activity.java:7463)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4375)
    ... 11 more

(their crash log)

mvmike commented 4 years ago

So finally got my hands on a Huawey and could reproduce the issue, but no traces in the logcat helped.

After playing a bit, it seems that some manufacturers implement differently the callback from the configuration of the widget provider, so reorganising how the read calendar permission is set will fix this issue.

Thanks for your patience, this took some time 😅

mvmike commented 4 years ago

Should be fixed in v1.5.0