Search code examples
androidandroid-manifestandroid-permissions

What is the difference between the permissions SET_WALLPAPER and SET_WALLPAPER_HINTS on Android?


I'm looking at Android's permissions for setting a wallpaper.

I found the following two permissions:

<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />

To understand these permissions, I read this link but I still couldn't understand the explanation.

What's the difference between SET_WALLPAPER and SET_WALLPAPER_HINTS?

I want to ask, where are hints for setting a wallpaper?


Solution

  • It's not explained well but if you browse the WallpaperManager API, you'll get the answer.

    setDisplayPadding added in API level 28

    public void setDisplayPadding (Rect padding)

    Specify extra padding that the wallpaper should have outside of the display. That is, the given padding supplies additional pixels the wallpaper should extend outside of the display itself.

    This method requires the caller to hold the permission Manifest.permission.SET_WALLPAPER_HINTS.

    Requires the SET_WALLPAPER_HINTS permission.

    [Emphasis added]

    There's also suggestDesiredDimensions that requires this permission but that's only if you're implementing a launcher app.

    Basically if you want to be able to set a wallpaper that extends beyond the boundaries of the current view (e.g. wallpaper parallax scrolling), you need this permission to enable that functionality.