How can I set a static lock screen wallpaper without resetting the OEM lock screen style (clock style, widgets, depth effect)?
I'm building an Android app that sets the currently playing track's album art as the lock screen wallpaper (minSdk 26, targetSdk 36). Each time the track changes, it sets a new static bitmap on the lock screen only.
On HyperOS and ColorOS devices, the lock screen customisation (clock style, lock screen widgets, depth effect) resets to the phone maker's default whenever my app changes the wallpaper. Setting the same image by hand through the system wallpaper picker keeps the customisation.
Device(s) where this happens:
25080RABDG), Android 15 (API 35), HyperOS 2.0 (OS2.0.202.0.VPPMIXM)It happens on every HyperOS (Xiaomi/Redmi/POCO) and ColorOS (OPPO) device I've tested.
Steps to reproduce:
setBitmap(..., FLAG_LOCK) with the album art.private fun setLock(context: Context, bitmap: Bitmap) {
val wm = WallpaperManager.getInstance(context)
check(wm.isWallpaperSupported && wm.isSetWallpaperAllowed)
// Lock screen only; home screen is never touched
wm.setBitmap(bitmap, /* visibleCropHint = */ null, /* allowBackup = */ true, WallpaperManager.FLAG_LOCK)
}
When playback stops, I restore a user-chosen default image with the same call, or if none is set:
WallpaperManager.getInstance(context).clear(WallpaperManager.FLAG_LOCK)
The bitmap is rendered at screen size (WindowMetrics bounds) in portrait.
setBitmap(..., FLAG_LOCK) only. I never pass FLAG_SYSTEM, so the home screen is never changed. The style still resets on the affected devices.WallpaperService) instead of static images, to avoid changing the wallpaper on every track. This is worse: the OEM can't theme a live wallpaper, so the lock screen goes back to its default style as soon as the live wallpaper is applied.WallpaperManage API, flag or call order that stops OEM SystemUI from resetting lock screen customisation when a third-party app sets a static lock wallpaper?clear(FLAG_LOCK) be what triggers the reset, more than setBitmap? Is there a better way to "restore" the lock screen without clearing it?ACTION_WALLPAPER_CHANGED or a WallpaperColors change) that makes it reset the style?