glance: mark the state-restore helper's restricted GlanceState use as deliberate

This commit is contained in:
2026-10-23 15:48:43 +02:00
parent 513c135ec2
commit 76e07fe8cb
@@ -1,5 +1,6 @@
package de.jeanlucmakiola.floret.glance
import android.annotation.SuppressLint
import android.appwidget.AppWidgetManager
import android.content.ComponentName
import android.content.Context
@@ -83,7 +84,12 @@ suspend fun GlanceAppWidget.updateWithRefresh(
* A receiver's `onRestored`: moves each restored instance's Glance state from
* its old id to the one the host gave it, which Glance doesn't do itself, so
* per-instance settings survive a backup restore or device transfer.
*
* Reads the stores through Glance's restricted [GlanceState]: the public state
* calls need a GlanceId, which Glance only gives out for ids still bound, and
* opening the files directly would race Glance's own DataStore on them.
*/
@SuppressLint("RestrictedApi")
fun GlanceAppWidgetReceiver.restoreState(context: Context, oldIds: IntArray, newIds: IntArray) {
val appContext = context.applicationContext
val pending = goAsync()