From b150556f1ef86a2f210bae51257408a55d6ba37e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 24 May 2026 23:10:37 +0000 Subject: [PATCH] =?UTF-8?q?refactor(amethyst):=20drop=20PlayAmethyst=20?= =?UTF-8?q?=E2=80=94=20appfunctions=20doesn't=20need=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous wiring forced Amethyst to be `open`, added a 30-line PlayAmethyst subclass that only implemented AppFunctionConfiguration .Provider, and used tools:replace="android:name" in the play manifest to swap classes. The justification was that the appfunctions runtime discovers @AppFunction host classes via Application.appFunctionConfiguration. Reading the KSP-generated dispatcher ($AmethystAppFunctions_AppFunctionInvoker.kt) shows that's only half true. The invoker passes a default-construction fallback lambda when instantiating the host class, and ConfigurableAppFunctionFactory takes that fallback as a constructor argument. Provider is only consulted to *override* construction — required for classes with non-default constructors, optional otherwise. AmethystAppFunctions has a no-arg constructor, so: * PlayAmethyst is deleted entirely * Amethyst goes back to `class Amethyst : Application()` (no `open`) * Play manifest reverts to plain `android:name=".Amethyst"`, no tools:replace gymnastics Verified by assemblePlayDebug (APK builds clean) and the merged play manifest still pinning the appfunctions service. If we ever add a host class with constructor parameters (an Account-injected one, say), we'll need to add Provider back — kdoc on AmethystAppFunctions documents that. --- .../com/vitorpamplona/amethyst/Amethyst.kt | 2 +- amethyst/src/play/AndroidManifest.xml | 7 +-- .../vitorpamplona/amethyst/PlayAmethyst.kt | 52 ------------------- .../appfunctions/AmethystAppFunctions.kt | 10 +++- 4 files changed, 10 insertions(+), 61 deletions(-) delete mode 100644 amethyst/src/play/java/com/vitorpamplona/amethyst/PlayAmethyst.kt diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt index 3ae80f681f..4ac9fefc0e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.service.nests.AppForegroundRecycleHook import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.LogLevel -open class Amethyst : Application() { +class Amethyst : Application() { init { Log.minLevel = if (BuildConfig.DEBUG) LogLevel.DEBUG else LogLevel.ERROR Log.d("AmethystApp") { "Creating App $this" } diff --git a/amethyst/src/play/AndroidManifest.xml b/amethyst/src/play/AndroidManifest.xml index 23fc8df4b3..044e757915 100644 --- a/amethyst/src/play/AndroidManifest.xml +++ b/amethyst/src/play/AndroidManifest.xml @@ -2,13 +2,8 @@ - + android:name=".Amethyst">