From c362f08ec329fb69824d00f73ed4ffe3637b14d4 Mon Sep 17 00:00:00 2001 From: andrekir Date: Wed, 2 Feb 2022 23:28:23 -0300 Subject: [PATCH 1/2] disassociate old CompanionDeviceManager address --- .../mesh/service/RadioInterfaceService.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt b/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt index 52f6b57c..c5f1deab 100644 --- a/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt @@ -2,6 +2,7 @@ package com.geeksville.mesh.service import android.annotation.SuppressLint import android.app.Service +import android.companion.CompanionDeviceManager import android.content.Context import android.content.Intent import android.content.SharedPreferences @@ -285,6 +286,22 @@ class RadioInterfaceService : Service(), Logging { debug("Setting bonded device to ${address.anonymize}") + // We only keep an association to one device at a time... (move to BluetoothInterface?) + if (BluetoothInterface.hasCompanionDeviceApi(this)) { + if (address != null) { + val deviceManager = getSystemService(CompanionDeviceManager::class.java) + val c = address[0] + val rest = address.substring(1) + + deviceManager.associations.forEach { old -> + if (rest != old) { + debug("Forgetting old BLE association ${old.anonymize}") + deviceManager.disassociate(old) + } + } + } + } + getPrefs(this).edit(commit = true) { if (address == null) this.remove(DEVADDR_KEY) From 2bed56809bfb9ce4377897e5ff8bd6572bb6563e Mon Sep 17 00:00:00 2001 From: andrekir Date: Thu, 3 Feb 2022 10:29:17 -0300 Subject: [PATCH 2/2] 1.2.56 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a9cccafc..8afea98a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,8 +42,8 @@ android { applicationId "com.geeksville.mesh" minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works) targetSdkVersion 30 // 30 can't work until an explicit location permissions dialog is added - versionCode 20255 // format is Mmmss (where M is 1+the numeric major number - versionName "1.2.55" + versionCode 20256 // format is Mmmss (where M is 1+the numeric major number + versionName "1.2.56" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // per https://developer.android.com/studio/write/vector-asset-studio