OpenLauncherTeam / openlauncher

Customizable and Open Source Launcher for Android
Apache License 2.0
1.43k stars 414 forks source link

Crash when adding Weather Radar Smart Widget #100

Closed urbanomad64 closed 7 years ago

urbanomad64 commented 7 years ago

Build version: 0.4.0 Build date: 1980-01-01 00:00:00 Current date: 2017-05-13 06:20:49 Device: UMI SUPER

Stack trace:
java.lang.ArrayIndexOutOfBoundsException: length=4; index=-1 at com.benny.openlauncher.widget.CellContainer.onLayout(CellContainer.java:543) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at com.benny.openlauncher.widget.SmoothViewPager.onLayout(SmoothViewPager.java:1663) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.support.constraint.ConstraintLayout.onLayout(ConstraintLayout.java:1197) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:383) at android.widget.FrameLayout.onLayout(FrameLayout.java:321) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:383) at android.widget.FrameLayout.onLayout(FrameLayout.java:321) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1982) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1826) at android.widget.LinearLayout.onLayout(LinearLayout.java:1735) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:383) at android.widget.FrameLayout.onLayout(FrameLayout.java:321) at com.android.internal.policy.DecorView.onLayout(DecorView.java:803) at android.view.View.layout(View.java:17838) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2711) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2384) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1462) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6965) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:907) at android.view.Choreographer.doCallbacks(Choreographer.java:709) at android.view.Choreographer.doFrame(Choreographer.java:644) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893) at android.os.Handler.handleCallback(Handler.java:836) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6247) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

mueller-ma commented 7 years ago

Does it only carsh when adding a specific widget? I have installed 0.4.0 and I tested five widgets. All of them cause a crash

sidhenidon commented 7 years ago

Yes, it's only crash with specific widget. I try with Dashclock, cLock, Reuters, WhatsApp, Good Weather, Calendar, etc. and I have no problem. But when I try to add DuckDuckGo widget, K9 widget and others, it's crash. And always crash with the same widgets. I also have installed 0.4.0.

urbanomad64 commented 7 years ago

I hadn't tried any other widgets but just now tried some...

dkanada commented 7 years ago

Are the widgets causing the crashes all large or is there no connection to size?

aabaker commented 7 years ago

I've observed the same crash attempting to use the LunaSolCal 2x1 compact details widget with 0.4.0 on a physical device. I don't get the problem running git HEAD on an emulator with the same widget.

Unfortunately the database I've got on the emulator triggers a different crash in 0.4.0 so I can't easily test if I get this crash with 0.4.0 on the emulator.

aabaker commented 7 years ago

Now 0.5.0 is published on F-Droid I no longer get the crash on a physical device either so I believe this bug is fixed some time between 0.4.0 and 0.5.0. Can any of the others who have had the issue confirm if it is fixed for them in 0.5.0

urbanomad64 commented 7 years ago

Well, the crashing isn't happening on 0.5.0 for me but the widget will not take up the full width of the screen now. I have one column-width extra.

aabaker commented 7 years ago

There is some code in ItemViewFactory that constrains min / max widget size

private static void scaleWidget(View view, Item item) {
        item.spanX = Math.min(item.spanX, 4);
        item.spanX = Math.max(item.spanX, 1);
        item.spanY = Math.min(item.spanY, 4);
        item.spanY = Math.max(item.spanY, 1);

I'm not sure if there is a specific reason to constrain the max size to 4 however if it isn't constrained then I'd expect the number of bugs regarding changing grid size to increase.

urbanomad64 commented 7 years ago

That wasn't a problem on earlier builds/launchers. They spread out all the way and gave me four days of weather forecasts but on 0.5.0, I only get three (see screenshot) screenshot_20170520-135113

urbanomad64 commented 7 years ago

I just got 0.5.1 which seems to have fixed this problem. Thanks.