Modern Apps git

← Modern-Apps.git

library: make :sdk:openassistant dependency-free (#884)

Commit
42f03c0cac4953bb2098426432aeab651822a42b
Author
Vayun Mathur <[email protected]>
When
2026-10-31 19:35 UTC (1 month ago)
Parents
33bbd34
Part of #884. :sdk:openassistant is the client SDK third-party and
first-party apps embed to call the assistant; it depended on the whole
:library base module for one 14-line ResultReceiver wrapper
(SecureResultReceiver). Per the owner's rule that libraries should not
depend on other libraries, the SDK now owns its own copy in
com.vayunmathur.sdk.openassistant and has no project dependencies.

:library keeps its copy because the openassistant app and email use it
directly; duplicating a trivial forwarding class was preferred over
keeping a library-to-library edge.

No behaviour change. Verified: :sdk:openassistant:compileDebugKotlin,
:openassistant:compileDevKotlin and :email:compileDevKotlin green.

Diff

sdk/openassistant/AGENTS.md
diff --git a/sdk/openassistant/AGENTS.md b/sdk/openassistant/AGENTS.mdindex f911f9740a..9de17a77ea 100644--- a/sdk/openassistant/AGENTS.md+++ b/sdk/openassistant/AGENTS.md@@ -6,7 +6,7 @@ - Gradle: :sdk:openassistant / dir: sdk/openassistant/ - Package roots present: (public assistant SDK — one package) - Entry files: OpenAssistant.kt (no MainActivity/Route — SDK)-- Deps: :library+- Deps: (none — SecureResultReceiver is owned by this module, #884) - Metadata: metadata_data/sdk-openassistant.md (absent — SDKs have none by design) - Rust: no / screenshotTest: no 
sdk/openassistant/build.gradle.kts
diff --git a/sdk/openassistant/build.gradle.kts b/sdk/openassistant/build.gradle.ktsindex b300abd4fc..57320b33ca 100644--- a/sdk/openassistant/build.gradle.kts+++ b/sdk/openassistant/build.gradle.kts@@ -2,6 +2,7 @@ plugins {     id("common-conventions-library") } +// No project dependencies by design: SecureResultReceiver is owned by this+// module so the SDK stays free of the base :library edge (#884). dependencies {-    implementation(project(":library")) }
sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/OpenAssistant.kt
diff --git a/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/OpenAssistant.kt b/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/OpenAssistant.ktindex c09a9905b9..bdc79e9f19 100644--- a/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/OpenAssistant.kt+++ b/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/OpenAssistant.kt@@ -7,7 +7,6 @@ import android.content.pm.PackageManager import android.os.Handler import android.os.Looper import android.os.ResultReceiver-import com.vayunmathur.library.util.SecureResultReceiver import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withTimeout import kotlin.coroutines.resume
sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/SecureResultReceiver.kt
diff --git a/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/SecureResultReceiver.kt b/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/SecureResultReceiver.ktnew file mode 100644index 0000000000..c30c16d058--- /dev/null+++ b/sdk/openassistant/src/main/java/com/vayunmathur/sdk/openassistant/SecureResultReceiver.kt@@ -0,0 +1,20 @@+package com.vayunmathur.sdk.openassistant++import android.os.Bundle+import android.os.Handler+import android.os.ResultReceiver++/**+ * Thin [ResultReceiver] that forwards results to a lambda.+ *+ * Lives in this SDK (rather than `:library`) so the SDK does not depend on+ * the whole base library for one 14-line class (#884).+ */+class SecureResultReceiver(+    handler: Handler?,+    private val onResult: (resultCode: Int, resultData: Bundle?) -> Unit+) : ResultReceiver(handler) {+    override fun onReceiveResult(resultCode: Int, resultData: Bundle?) {+        onResult(resultCode, resultData)+    }+}