"Theming Icons" functionality crashes live wallpapers on Android 12

1.9k Views Asked by At

I recently noticed that my live wallpaper apps are crashing when users try to set the newly introduced "Theming Icons" functionality on Android 12. This new functionality calculates a palette of colors from the user's current static wallpaper and uses this palette to color some of the other apps icons (a feature of the new "Material You" design). But for some reason when it operates on a live wallpaper it crashes the app with the following log:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2443)
       at android.os.Parcel.createException(Parcel.java:2421)
       at android.os.Parcel.readException(Parcel.java:2404)
       at android.os.Parcel.readException(Parcel.java:2346)
       at android.service.wallpaper.IWallpaperConnection$Stub$Proxy.onWallpaperColorsChanged(IWallpaperConnection.java:298)
       at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:2586)
       at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:44)
       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:8582)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:563)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)


Caused by android.os.RemoteException: Remote stack trace:
    at com.samsung.server.wallpaper.LegibilityColor.convertColors(LegibilityColor.java:418)
    at com.android.server.wallpaper.WallpaperManagerService$WallpaperConnection.onWallpaperColorsChanged(WallpaperManagerService.java:2169)
    at android.service.wallpaper.IWallpaperConnection$Stub.onTransact(IWallpaperConnection.java:158)
    at android.os.Binder.execTransactInternal(Binder.java:1215)
    at android.os.Binder.execTransact(Binder.java:1179)

At this moment I can observe this crash only on Samsung Galaxy S21 / S21 Ultra phones but it will be present on many more phones as users update their system to Android 12.

Currently, I cannot reproduce this crash because I don't own a Galaxy S21 and the Android Studio emulator still misses the "Theming Icons" option (maybe because this functionality is currently still in beta).

Does anybody have any clue on how to solve this catastrophic problem? Any help is greatly appreciated!

Update November 18: I was able to test the new "Themed icon" feature on the Android Studio Emulator (on the newly introduced "SV2" release). This release is really buggy but I was not able to reproduce a similar crash. It makes me think that this crash is exclusive to Samsung phones.

I tried to test some Galaxy S21 devices from the publicly available phones at the "Galaxy Mobile - Remote Test Lab" site, but they implement a beta version of Android 12 where the Themed Icon feature is not available.

I want to generate a complete crash report (log + video) to send to Samsung but I still can't find a Galaxy S21 with Android 12 installed (the Android 12 system update started on November 15 for Galaxy S21 phones). In the meantime, the crash reports are exploding as many more users are updating their phones to Android 12...Such a shame!

3

There are 3 best solutions below

15
Aleksey On BEST ANSWER

Solution found.

File name: wallpaper.xml

Was:

<wallpaper bla bla bla 
android:thumbnail="@mipmap/ic_launcher" 
/>

Changed to:

<wallpaper bla bla bla 
android:thumbnail="@drawable/thumbnail" 
/>

Copied the app icon to: drawable/thumbnail.png

Update from @Redwarp: you should use a bitmap not a vector image.

After app update:

enter image description here

4
Aleksey On

For a while I was looking for a similar problem in reviews of popular live wallpapers. I found similar reviews only for one application. I updated my phone today. All my live wallpapers stopped working as expected. Then I installed "Earth & Moon" and this app works fine. It means that we are doing something wrong or, on the contrary, we are not doing something :) In the near future I will begin to investigate this problem.

0
iangilman On

One of the users of my app who is on a Samsung S21 tells me that a new Samsung OS update (SP1A.210812.016.G991BXXU3BUKG) fixed the issue for them even before I implemented @Aleksey's fix. Good to see Samsung is taking care of things.

That said, I'm still in favor of implementing the fix ourselves as well, in case there are other places where it's needed.