mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-10-14 19:27:09 -04:00
Rebuilt open drivers reach phones: re-downloaded when their digest changes, release list hourly on non-Adreno
The non-Adreno driver releases replace their assets in place (the PanVK kbase sync-file fd leak fix). A download is now remembered with its GitHub sha256, and an asset whose digest changed counts as not installed, so Auto fetches it again and the bundle replaces the old one; the release list is re-read after an hour instead of a day on a GPU that is not an Adreno.
This commit is contained in:
1 parent
92e4eecb58
commit
6c7242aa64
2 files changed
+16
-4
No files matched your search
@@ -208,7 +208,9 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
autoStatus = activity.getString(R.string.drivers_checking_latest)
|
||||
Thread({
|
||||
val cached = TurnipReleases.cached(activity)
|
||||
val stale = cached == null || System.currentTimeMillis() - cached.checkedAt > 24 * 3_600_000L ||
|
||||
// The open non-Adreno drivers are rebuilt in place while they are tested: an hour.
|
||||
val maxAge = if (DeviceSupport.adreno()) 24 * 3_600_000L else 3_600_000L
|
||||
val stale = cached == null || System.currentTimeMillis() - cached.checkedAt > maxAge ||
|
||||
cached.assets.none { it.pair.isNotEmpty() } ||
|
||||
// A list checked before this device's open drivers were offered has none of them.
|
||||
(!DeviceSupport.adreno() && cached.assets.none { DriverPairs.isNonAdreno(it.pair) })
|
||||
|
||||
@@ -187,8 +187,16 @@ object TurnipReleases {
|
||||
}
|
||||
|
||||
/** The id an asset was installed as, when it was downloaded before and is still installed. */
|
||||
fun installedId(context: Context, asset: Asset, isInstalled: (String) -> Boolean): String? =
|
||||
downloads(context).optString(asset.name, "").takeIf { it.isNotEmpty() && isInstalled(it) }
|
||||
fun installedId(context: Context, asset: Asset, isInstalled: (String) -> Boolean): String? {
|
||||
val d = downloads(context)
|
||||
// The open non-Adreno drivers are rebuilt in place under the same asset name: one whose
|
||||
// digest changed since it was downloaded counts as not installed, so it is fetched again.
|
||||
if (DriverPairs.isNonAdreno(asset.pair) && asset.sha256.isNotEmpty() &&
|
||||
!asset.sha256.equals(d.optString(SHA_PREFIX + asset.name, asset.sha256), ignoreCase = true)) return null
|
||||
return d.optString(asset.name, "").takeIf { it.isNotEmpty() && isInstalled(it) }
|
||||
}
|
||||
|
||||
private const val SHA_PREFIX = "sha256:"
|
||||
|
||||
/** True when [id] came from a release download rather than a zip picked by hand. */
|
||||
fun isDownloaded(context: Context, id: String): Boolean {
|
||||
@@ -197,7 +205,9 @@ object TurnipReleases {
|
||||
}
|
||||
|
||||
fun recordDownload(context: Context, asset: Asset, id: String) {
|
||||
prefs(context).edit().putString(KEY_DOWNLOADS, downloads(context).put(asset.name, id).toString()).apply()
|
||||
val d = downloads(context).put(asset.name, id)
|
||||
if (DriverPairs.isNonAdreno(asset.pair) && asset.sha256.isNotEmpty()) d.put(SHA_PREFIX + asset.name, asset.sha256)
|
||||
prefs(context).edit().putString(KEY_DOWNLOADS, d.toString()).apply()
|
||||
}
|
||||
|
||||
/** Forget a deleted driver, so its release offers the download again. */
|
||||
|
||||
Reference in new issue
Block a user