LawnchairLauncher / lawnchair

No clever tagline needed.
https://lawnchair.app
Other
9.42k stars 1.23k forks source link

[BUG] Unable to add any widget #4320

Open saloniamatteo opened 6 months ago

saloniamatteo commented 6 months ago

Describe the bug

Any attemp to add any widget results in a LawnChair crash, and no widget added.

Steps to reproduce

Steps to reproduce the behavior:

  1. Open "widgets" tab
  2. Select any widget
  3. Drag and drop it to the home screen
  4. Try to add it

Expected behavior

No crash, obviously, and a working widget.

Screenshots

https://github.com/LawnchairLauncher/lawnchair/assets/28765699/c3f92576-6319-4b52-8a35-6d0a3efa5c74

Device information

Additional context

The main culprit seems to be com.android.launcher3.CellLayout.getUnusedHorizontalSpace()

Here is the log:

FATAL EXCEPTION: main
Process: app.lawnchair.debug, PID: 14419
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.launcher3.CellLayout.getUnusedHorizontalSpace()' on a null object reference
    at com.android.launcher3.Workspace.getFinalPositionForDropAnimation(Workspace.java:3137)
    at com.android.launcher3.Workspace.animateWidgetDrop(Workspace.java:3164)
    at com.android.launcher3.Launcher.completeTwoStageWidgetDrop(Launcher.java:1086)
    at com.android.launcher3.Launcher$3.run(Launcher.java:999)
    at com.android.launcher3.Workspace.removeExtraEmptyScreenDelayed(Workspace.java:952)
    at com.android.launcher3.Workspace.lambda$removeExtraEmptyScreenDelayed$3(Workspace.java:922)
    at com.android.launcher3.Workspace.$r8$lambda$qJmEWteEMIDxIhPN0xohUE9-Gbo(Unknown Source:0)
    at com.android.launcher3.Workspace$$ExternalSyntheticLambda13.run(D8$$SyntheticClass:0)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8893)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Serantek97 commented 6 months ago

Same issue.

dunxd commented 6 months ago

I am unable to add many widgets but not getting a crash with all of them.

Working

No crash, No Widget

Adding these brings up the preview then settings but no widget is added

The home assistant widgets are the ones that are most disappointing to not be able to add. I use these to turn lights on and off and other things. Show stopper for me.

Samsung Galaxy A53 5G Android 14/One UI 6.0 Lawnchair 14 beta 2

saloniamatteo commented 6 months ago

After trying several widgets, I can narrow the issue to be custom widgets, as in custom theme and/or custom size.

Widgets that have a fixed size (that do not open a customization menu) will work 99% of the time.

Widgets that can be resized, but do not offer styling (e.g. light/dark mode, transparency, etc.) will work as well, most of the time.

Widgets that can be styled and resized, will never work, at least for me.

dunxd commented 6 months ago

I had 6 Home Assistant widgets installed with Lawnchair 2, but adding any more was crashing Lawnchair.

I switched to Lawnchair 14 hoping things were better, but much worse.

saloniamatteo commented 6 months ago

Example 1: fixed size, non-styleable widget

Screenshot_20240427_191021_Lawnchair (Debug)

Added without any issue, works properly:

Screenshot_20240427_191029_Lawnchair (Debug)

Example 2: styleable widget

Screenshot_20240427_191115_Lawnchair (Debug)

Customisation menu. Pressing the "Save" button causes a Lawnchair crash.

Screenshot_20240427_191222_Clock

saloniamatteo commented 6 months ago

Another example: non-styleable widget, that can be resized:

Screenshot_20240427_191743_Lawnchair (Debug) Screenshot_20240427_191747_Lawnchair (Debug)

dunxd commented 5 months ago

Workaround is to set a different launcher as your default. After doing this, open Lawnchair and you can add the widget succesfully. Then set Lawnchair back as the default Launcher.