Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit a3d6f1ae authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

EN: Don't adjust tx power by TX_POWER_LOW (-15)

The exposure-notifications-internal suggests that this is the thing to do,
but the actual implementaton doesn't.
parent 128ca58b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -117,13 +117,13 @@ class AdvertiserService : LifecycleService() {
            val aemBytes = when (version) {
                VERSION_1_0 -> byteArrayOf(
                        version, // Version and flags
                        (currentDeviceInfo.txPowerCorrection + TX_POWER_LOW).toByte(), // TX power
                        currentDeviceInfo.txPowerCorrection, // TX power
                        0x00, // Reserved
                        0x00  // Reserved
                )
                VERSION_1_1 -> byteArrayOf(
                        (version + currentDeviceInfo.confidence.toByte() * 4).toByte(), // Version and flags
                        (currentDeviceInfo.txPowerCorrection + TX_POWER_LOW).toByte(), // TX power
                        currentDeviceInfo.txPowerCorrection, // TX power
                        0x00, // Reserved
                        0x00  // Reserved
                )
@@ -175,7 +175,7 @@ class AdvertiserService : LifecycleService() {
                    Since: ${Date(startTime)}
                    RPI: $uuid
                    Version: 0x${version.toString(16)}
                    TX Power: ${currentDeviceInfo.txPowerCorrection + TX_POWER_LOW}
                    TX Power: ${currentDeviceInfo.txPowerCorrection}
                    AEM: 0x${aem.toLong().let { if (it < 0) 0x100000000L + it else it }.toString(16)}
                """.trimIndent())
        } catch (e: Exception) {
+1 −1
Original line number Diff line number Diff line
@@ -490,7 +490,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit
        }.mapNotNull {
            val decrypted = key.cryptAem(it.rpi, it.aem)
            val version = (decrypted[0] and 0xf0.toByte())
            val txPower = if (decrypted.size >= 4 && version >= VERSION_1_0) decrypted[1].toInt() else (averageDeviceInfo.txPowerCorrection + TX_POWER_LOW)
            val txPower = if (decrypted.size >= 4 && version >= VERSION_1_0) decrypted[1].toInt() else averageDeviceInfo.txPowerCorrection.toInt()
            val confidence = if (decrypted.size >= 4 && version >= VERSION_1_1) ((decrypted[0] and 0xc) / 4) else (averageDeviceInfo.confidence)
            if (version > VERSION_1_1) {
                Log.w(TAG, "Unknown AEM version: 0x${version.toString(16)}")