mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 11:28:22 +00:00
Route every android.util.Log call through a new AmberLog wrapper that only emits when BuildConfig.DEBUG is true. Release builds now produce no logcat output, keeping potentially sensitive data (npubs, relay URLs, event payloads) out of device logs. The debug gate lives in a single place (AmberLog), replacing the scattered inline `if (BuildConfig.DEBUG)` guards in NostrClientLoggerListener. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B4FaZsFdswYa1F2jTy4HLN
60 lines
1.6 KiB
Kotlin
60 lines
1.6 KiB
Kotlin
package com.greenart7c3.nostrsigner
|
|
|
|
import android.content.ContentProvider
|
|
import android.content.ContentValues
|
|
import android.database.Cursor
|
|
import android.net.Uri
|
|
|
|
class SignerProvider : ContentProvider() {
|
|
override fun delete(
|
|
uri: Uri,
|
|
selection: String?,
|
|
selectionArgs: Array<String>?,
|
|
): Int = 0
|
|
|
|
override fun getType(uri: Uri): String? = null
|
|
|
|
override fun insert(
|
|
uri: Uri,
|
|
values: ContentValues?,
|
|
): Uri? = null
|
|
|
|
override fun onCreate(): Boolean = true
|
|
|
|
override fun query(
|
|
uri: Uri,
|
|
projection: Array<String>?,
|
|
selection: String?,
|
|
selectionArgs: Array<String>?,
|
|
sortOrder: String?,
|
|
): Cursor? {
|
|
val ctx = context
|
|
if (ctx == null) {
|
|
AmberLog.d(Amber.TAG, "No context")
|
|
return null
|
|
}
|
|
// External apps are always attributed to their own Android package. The
|
|
// requester identity is taken from the binder's calling package, never from
|
|
// caller-supplied query arguments, so an app cannot impersonate another one.
|
|
val caller = callingPackage
|
|
if (caller == null) {
|
|
AmberLog.d(Amber.TAG, "No calling package")
|
|
return null
|
|
}
|
|
return SignerProviderQuery.query(
|
|
context = ctx,
|
|
requesterId = caller,
|
|
callerPackageName = caller,
|
|
operationUri = uri,
|
|
arguments = projection,
|
|
)
|
|
}
|
|
|
|
override fun update(
|
|
uri: Uri,
|
|
values: ContentValues?,
|
|
selection: String?,
|
|
selectionArgs: Array<String>?,
|
|
): Int = 0
|
|
}
|