Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ composeCompiler {
}

dependencies {
implementation(fileTree("libs") { include("*.aar") })
implementation(fileTree("libs") { include("*.aar", "*.jar") })
implementation(libs.jna) { artifact { type = "aar" } }
implementation(platform(libs.kotlin.bom))
implementation(libs.core.ktx)
Expand Down
Binary file added app/libs/btleplug.aar
Binary file not shown.
Binary file added app/libs/jni-utils.jar
Binary file not shown.
9 changes: 8 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

# btleplug (droidplug) Android Bluetooth support
# These classes are loaded via JNI from Rust code
-keep class com.nonpolynomial.btleplug.** { *; }

# jni-utils support library for btleplug
-keep class io.github.gedgygedgy.rust.** { *; }
26 changes: 26 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@
android:name="android.permission.FOREGROUND_SERVICE"
tools:ignore="ForegroundServicePermission,ForegroundServicesPolicy" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<!-- USB Host support for Trezor hardware wallet -->
<uses-feature
android:name="android.hardware.usb.host"
android:required="false" />

<!-- Bluetooth permissions for Trezor Safe 7 (Android 12+) -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />

<!-- Bluetooth permissions (legacy, Android 11 and below) -->
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Required for E2E tests connecting to local Electrum server (Android 16+) -->
<uses-permission
android:name="android.permission.NEARBY_WIFI_DEVICES"
Expand Down Expand Up @@ -125,6 +143,14 @@
<data android:scheme="lnurlp" />
</intent-filter>

<!-- USB device attached — auto-grants permission when Trezor is plugged in -->
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/usb_device_filter" />

<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/to/bitkit/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import to.bitkit.env.Env
import to.bitkit.services.BluetoothInit
import javax.inject.Inject

@HiltAndroidApp
Expand All @@ -25,6 +26,8 @@ internal open class App : Application(), Configuration.Provider {
super.onCreate()
currentActivity = CurrentActivity().also { registerActivityLifecycleCallbacks(it) }
Env.initAppStoragePath(filesDir.absolutePath)
// Initialize btleplug for Bluetooth support (required before any BLE usage)
BluetoothInit.ensureInitialized()
}

companion object {
Expand Down
Loading
Loading