From 01b85e6dbe3281d6a2b234e32d93dde99db1678a Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 4 May 2026 11:46:08 -0300 Subject: [PATCH] Log when we updated ourselves so we can test if it is feasible to auto-restart the app --- app/src/main/AndroidManifest.xml | 8 +++++++ .../org/fdroid/install/AppUpdateReceiver.kt | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dd96e6967..f898a8c63 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -161,6 +161,14 @@ + + + + + + diff --git a/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt b/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt new file mode 100644 index 000000000..12c638acd --- /dev/null +++ b/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt @@ -0,0 +1,22 @@ +package org.fdroid.install + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.Intent.ACTION_MY_PACKAGE_REPLACED +import androidx.annotation.RequiresApi +import mu.KotlinLogging + +class AppUpdateReceiver : BroadcastReceiver() { + + private val log = KotlinLogging.logger {} + + @RequiresApi(35) + override fun onReceive(context: Context, intent: Intent) { + if (intent.action != ACTION_MY_PACKAGE_REPLACED) { + log.warn { "Unknown action: ${intent.action}" } + return + } + log.info { "Intent received, we just updated ourselves!" } + } +}