title: Strange behaviour in Android 12+ with WallpaperManager
body: <p>Is this a bug with WallpaperManager in the latest versions of Android?</p>
  <p>When setting the wallpaper, it will automatically destroy and reload the current activity.</p>
  <p>This behaviour only seems to affect Android 12 and onwards.
  It's quite easy to replicate, code in Kotlin:</p>
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      val randomResourceList = arrayListOf(R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4, R.drawable.image5)
      val randomValue = (0 until randomResourceList.size).random()
      val wallpaper = randomResourceList[randomValue]
  
      val bmp = BitmapFactory.decodeResource(resources, wallpaper)
      val wallpaperManager = WallpaperManager.getInstance(this)
      wallpaperManager.setBitmap(bmp, null, true)
  }
  
  override fun onDestroy() {
      super.onDestroy()
      Log.d(&quot;tag&quot;, &quot;Destroyed.&quot;)
  }
  </code></pre>
  <p>Add a few images (include several because the wallpaper will not be set if the wallpaper image is the same as the last, hence the randomization)</p>
  <p>You should then see the activity being destroyed and reloaded in a cycle. No errors are thrown and the wallpaper is actually changed each time.</p>
  <p>In my particular case, this is causing havoc when setting the wallpaper on a timer in a foreground service. If the user happens to have an activity on the screen when the wallpaper is changed, it will get destroyed.</p>