Background missing for Android shortcuts
The current shortcuts in the android app work really fine, but there are some UI flaws
The icons does not follow the Google design guidelines (not positioned in a circle live area) and they float freely
https://developer.android.com/develop/ui/views/launch/shortcuts/best-practices
This also impacts to the pinned shortcuts, that are inconsistent with the android layouts (we can't even change the color)
Could be possible to wrap them in a circle to improve the UI? And maybe allow to select the color?
What device is this? My shortcuts look like this. Are you using a custom launcher?
It's a Samsung Galaxy S23+ with OneUI 7 and the stock samsung launcher
I just tried removing the custom icons, and I have the same behavior as you, really weird
Curious why the other apps shortcuts have the proper format, but the home assistant don't 🤔
The icon pack was generated with icon pack studio
This really looks like some weird manufacturer specific issue. What do you mean by remove custom icons? Is that a launcher setting on that device?
All samsung phones has an app called theme park, there you can set icon packs to the samsung oneui launcher, or set them to the default icons of the apps.
If I set a custom icon pack from there (I have tested like 4 different), there is the issue. If I leave the default icons without icon packs, works fine
I have not tested other launchers tbh, but this one is the samsung default, so has a really big user pool
I am not really sure what we need to provide for the icon packs as the icons look fine without them and we are not doing anything different there, this may be difficult for us developers to look into as none of us have samsung devices.
Can you check other third party apps (not from Samsung and Google) to see if their shortcut backgrounds look correct when changing the icon pack?
I have tested with other third party launchers and works fine. Also with the oneui launcher, some apps have the background, and other not. So looks that is some device specific and a small issue. If you want I can make more tests, but would be fine if you just simply mark this as "won't do"
Out of curiosity I've asked ChatGPT, and it said that we should use AdaptiveIcons with a clear distinction between background and foreground so that the system knows how to manipulate them.
https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmap(android.graphics.Bitmap)
If you provide a debug apk I can test it if you want
I've been playing a bit more with the API and I managed to reproduce the issue on my Pixel too when I set the Icon theming, the icon are not themed like with the one from the application. The bad news at least on Pixel is that it is also the case for all the other apps (the Play Store for instance or Google Photos).
The good news is that on static shortcut I managed partially to make it work (like with the DevPlayground)
It doesn't work in the shortcut menu but it does once it is on the home screen.
I've tried to use IconCompat.createWithAdaptiveBitmap with an icon that respect the specification in terms of size like (108dp) but it doesn't work on the Pixel... What worked was IconCompat.createWithResource (you can see it in the screenshot). But it is not suitable for us unfortunately since we don't have all the icons already in resources in an adaptive form.
I suspect that based on how the API is made we cannot really fix this issue, because createWithAdaptiveBitmap only creates a Bitmap with a Flag saying it's adaptive where the other one seems to directly gives the xml of the system.
I'll make a PR so that you can test my changes it might work on Samsung or make it a bit better but I don't have a lot of hope to be honest.
@vlaraort once the build is done in Github Action could you test the APK on your Samsung?
Sure!
Can you provide link to the pipeline or apk?
Can you provide link to the pipeline or apk?
download and extract the artifact from: https://github.com/home-assistant/android/actions/runs/15781339843
you can use either full or minimal version of the app
Working fantastic! Also, the color in the default shortcuts look sick! Would be a cool improvement foe the future, instead of the stock blueScreenshot_20250620_195739_One UI Home.jpg
So Samsung implemented correctly versus google partially 😂
Could you try to drag and drop a shortcut to see how it behaves in your launcher? @vlaraort
Top ones the debug apk Bottom the Google play app
I'm closing the issue since the PR is merged. For anyone finding this issue, we've done our best to at least replicate what Google is doing on their own app. We won't be able to do more until Google offer a way to properly exposes Adaptive Icons without relying on XML resources.