mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
fix: Pre-release cleanup of manifest, resource leaks, and dependencies
- Fix BleScanResultReceiver package name in manifest (.bluetooth → .common.bluetooth) - Fix HandlerThread leak in BluetoothManager2 when registerReceiver() throws - Cache battery values in MonitorNotifications to match hardening pattern - Remove duplicate fragment-ktx dependency and align fragment-testing version - Remove deprecated lifecycle-extensions dependency
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".bluetooth.BleScanResultReceiver"
|
||||
android:name=".common.bluetooth.BleScanResultReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="eu.darken.capod.bluetooth.DELIVER_SCAN_RESULTS" />
|
||||
|
||||
@@ -212,6 +212,7 @@ class BluetoothManager2 @Inject constructor(
|
||||
context.registerReceiver(receiver, filter, null, handler)
|
||||
} catch (e: Exception) {
|
||||
log(TAG, ERROR) { "monitorProfile(): Failed to register receiver: $e" }
|
||||
handlerThread.quitSafely()
|
||||
close(e)
|
||||
return@callbackFlow
|
||||
}
|
||||
|
||||
@@ -105,11 +105,14 @@ class MonitorNotifications @Inject constructor(
|
||||
|
||||
val batteryText = when (device) {
|
||||
is DualPodDevice -> {
|
||||
val left = formatBatteryPercent(context, device.batteryLeftPodPercent)
|
||||
val right = formatBatteryPercent(context, device.batteryRightPodPercent)
|
||||
val leftPercent = device.batteryLeftPodPercent
|
||||
val rightPercent = device.batteryRightPodPercent
|
||||
val left = formatBatteryPercent(context, leftPercent)
|
||||
val right = formatBatteryPercent(context, rightPercent)
|
||||
when {
|
||||
device is HasCase -> {
|
||||
val case = formatBatteryPercent(context, device.batteryCasePercent)
|
||||
val casePercent = device.batteryCasePercent
|
||||
val case = formatBatteryPercent(context, casePercent)
|
||||
"$left $case $right"
|
||||
}
|
||||
|
||||
@@ -118,10 +121,12 @@ class MonitorNotifications @Inject constructor(
|
||||
}
|
||||
|
||||
is SinglePodDevice -> {
|
||||
val headset = formatBatteryPercent(context, device.batteryHeadsetPercent)
|
||||
val headsetPercent = device.batteryHeadsetPercent
|
||||
val headset = formatBatteryPercent(context, headsetPercent)
|
||||
when {
|
||||
device is HasCase -> {
|
||||
val case = formatBatteryPercent(context, device.batteryCasePercent)
|
||||
val casePercent = device.batteryCasePercent
|
||||
val case = formatBatteryPercent(context, casePercent)
|
||||
"$headset $case"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user