title: "Theming Icons" functionality crashes live wallpapers on Android 12
body: <p>I recently noticed that my live wallpaper apps are crashing when users try to set the newly introduced &quot;Theming Icons&quot; 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 &quot;Material You&quot; design). But for some reason when it operates on a <strong>live wallpaper</strong> it crashes the app with the following log:</p>
  <pre><code>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)
  </code></pre>
  <p>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.</p>
  <p>Currently, I cannot reproduce this crash because I don't own a Galaxy S21 and the Android Studio emulator still misses the &quot;Theming Icons&quot; option (maybe because this functionality is currently still in beta).</p>
  <p>Does anybody have any clue on how to solve this catastrophic problem? Any help is greatly appreciated!</p>
  <p><strong>Update November 18:</strong> I was able to test the new &quot;Themed icon&quot; feature on the Android Studio Emulator (on the newly introduced &quot;SV2&quot; 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.</p>
  <p>I tried to test some Galaxy S21 devices from the publicly available phones at the &quot;Galaxy Mobile - Remote Test Lab&quot; site, but they implement a beta version of Android 12 where the Themed Icon feature is not available.</p>
  <p>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!</p>