mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-13 22:45:06 +00:00
ENF: Fix average RSSI calculation
Correctly discard new measurements when the reported timestamp is older than the timestamp in the database. Fixes https://github.com/microg/GmsCore/issues/1655.
This commit is contained in:
parent
61957c33cd
commit
75aaeb1fc6
1 changed files with 1 additions and 1 deletions
|
@ -181,7 +181,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit
|
|||
}
|
||||
|
||||
fun noteAdvertisement(rpi: ByteArray, aem: ByteArray, rssi: Int, timestamp: Long = Date().time) = writableDatabase.run {
|
||||
val update = compileStatement("UPDATE $TABLE_ADVERTISEMENTS SET rssi = IFNULL(((rssi * duration) + (? * MIN(0, ? - timestamp - duration))) / MAX(duration, ? - timestamp), -100), duration = MAX(duration, ? - timestamp) WHERE rpi = ? AND timestamp > ? AND timestamp < ?").run {
|
||||
val update = compileStatement("UPDATE $TABLE_ADVERTISEMENTS SET rssi = IFNULL(((rssi * duration) + (? * MAX(0, ? - timestamp - duration))) / MAX(duration, ? - timestamp), -100), duration = MAX(duration, ? - timestamp) WHERE rpi = ? AND timestamp > ? AND timestamp < ?").run {
|
||||
bindLong(1, rssi.toLong())
|
||||
bindLong(2, timestamp)
|
||||
bindLong(3, timestamp)
|
||||
|
|
Loading…
Reference in a new issue