diff --git a/glance/src/main/kotlin/de/jeanlucmakiola/floret/glance/WidgetUpdates.kt b/glance/src/main/kotlin/de/jeanlucmakiola/floret/glance/WidgetUpdates.kt index fef030b..a709839 100644 --- a/glance/src/main/kotlin/de/jeanlucmakiola/floret/glance/WidgetUpdates.kt +++ b/glance/src/main/kotlin/de/jeanlucmakiola/floret/glance/WidgetUpdates.kt @@ -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()