Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out if different home- and lockscreen wallpapers are set

I have a running live wallpaper and react to SCREEN_ON event to display changes on the canvas. However on some phones the user can set a different lockscreen and homescreen wallpaper (Touchwiz, some Xperia devices). When the user has set a different wallpaper on the lockscreen my live wallpaper is not shown.

On the Galaxy S3 I used WallpaperService.Engine.isVisible() and it correctly returns false when the user has set a different lockscreen wallpaper. On the Galaxy S3 Mini, however, this does not work, because isVisible() returns true whether or not my live wallpaper is the active lockscreen wallpaper.

WallpaperManager.getWallpaperInfo() or WallpaperManager.peekDrawable() don't work either, because getWallpaperInfo() returns my live wallpaper regardless of the current lockscreen wallpaper, and peekDrawable() returns a valid drawable even if my live wallpaper is set for both screens. I tried listening to WallpaperService.Engine.onTouchEvent(..), but the touch events from the lockscreen don't get through to my live wallpaper, because they are consumed by the unlock slider.

Is there any other way to detect if my live wallpaper is the current lockscreen wallpaper? I'm fine with reflection-hacks, workarounds, everything that will let me do this.

EDIT: it also works on the Galaxy Note 2, bot not on the Xperia T LT30p

like image 594
Thrakbad Avatar asked Jan 23 '13 16:01

Thrakbad


1 Answers

Lockscreen wallpaper is not supported by AOSP version of Android. The feature is entirely made by OEMs (Samsung, Sony, LG, etc.) and thus APIs for dealing with the lockscreen wallpaper are totally different among OEMs. Furthermore, some OEMs only do not support live wallpapers on loockscreens while others do.

Since they are OEM added APIS, you should use reflections to access them. However, it will work on one OEM devices, but the same code will not work on other OEMs' devices.

like image 169
Jiyong Park Avatar answered Oct 25 '22 14:10

Jiyong Park