title: Accessing WallpaperManager in Android 8.1
body: <p>I'm building a launcher and need to access the user's current background wallpaper but every time I launch the app I get the warning <code>W/WallpaperManager: No permission to access wallpaper, suppressing exception to avoid crashing legacy app.</code> in the logs.</p>
  
  <p>Here is the code I'm using:</p>
  
  <pre><code>WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
  Drawable wallpaperDrawable = wallpaperManager.getDrawable();
  
  ImageView imageView = findViewById(R.id.background);
  imageView.setImageDrawable(wallpaperDrawable);
  </code></pre>
  
  <p>This code returns the default stock background image rather than my actual background image. I've noticed this problem on a few other mainstream launchers (Evie, Launchair, etc) but it only seems to happen on my recently-updated Andorid 8.1 device.</p>
  
  <p>Digging further into the actual Android Source code, I've found this: </p>
  
  <pre><code>if (context.getApplicationInfo().targetSdkVersion &lt;= Build.VERSION_CODES.O) {
      Log.w(TAG, "No permission to access wallpaper, suppressing"
      + " exception to avoid crashing legacy app.");
  } else {
      // Post-O apps really most sincerely need the permission.
      throw e;
  }
  </code></pre>
  
  <p>But I can't seem to find a reference to the actual permission required.</p>
  
  <p>Any help is appreciated!</p>