Loading play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/Crypto.kt +3 −3 Original line number Diff line number Diff line Loading @@ -41,13 +41,13 @@ val currentIntervalNumber: Int val currentDayRollingStartNumber: Int get() = getDayRollingStartNumber(currentIntervalNumber) fun getDayRollingStartNumber(intervalNumber: Int) = (floor(currentIntervalNumber.toDouble() / ROLLING_PERIOD).toLong() * ROLLING_PERIOD).toInt() fun getDayRollingStartNumber(intervalNumber: Int) = (floor(intervalNumber.toDouble() / ROLLING_PERIOD).toLong() * ROLLING_PERIOD).toInt() fun getPeriodInDay(intervalNumber: Int) = intervalNumber - getDayRollingStartNumber(intervalNumber) val nextKeyMillis: Long get() { val currentWindowStart = currentIntervalNumber.toLong() * ROLLING_WINDOW_LENGTH * 1000 val currentWindowEnd = currentWindowStart + ROLLING_WINDOW_LENGTH * 1000 val currentWindowStart = currentIntervalNumber.toLong() * ROLLING_WINDOW_LENGTH_MS val currentWindowEnd = currentWindowStart + ROLLING_WINDOW_LENGTH_MS return (currentWindowEnd - System.currentTimeMillis()).coerceAtLeast(0) } Loading play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureDatabase.kt +1 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit fun dailyCleanup(): Boolean = writableDatabase.run { val start = System.currentTimeMillis() val rollingStartTime = currentDayRollingStartNumber * ROLLING_WINDOW_LENGTH * 1000 - TimeUnit.DAYS.toMillis(KEEP_DAYS.toLong()) val rollingStartTime = currentDayRollingStartNumber.toLong() * ROLLING_WINDOW_LENGTH_MS - TimeUnit.DAYS.toMillis(KEEP_DAYS.toLong()) val advertisements = delete(TABLE_ADVERTISEMENTS, "timestamp < ?", longArrayOf(rollingStartTime)) Log.d(TAG, "Deleted on daily cleanup: $advertisements adv") if (start + MAX_DELETE_TIME < System.currentTimeMillis()) return@run false Loading Loading
play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/Crypto.kt +3 −3 Original line number Diff line number Diff line Loading @@ -41,13 +41,13 @@ val currentIntervalNumber: Int val currentDayRollingStartNumber: Int get() = getDayRollingStartNumber(currentIntervalNumber) fun getDayRollingStartNumber(intervalNumber: Int) = (floor(currentIntervalNumber.toDouble() / ROLLING_PERIOD).toLong() * ROLLING_PERIOD).toInt() fun getDayRollingStartNumber(intervalNumber: Int) = (floor(intervalNumber.toDouble() / ROLLING_PERIOD).toLong() * ROLLING_PERIOD).toInt() fun getPeriodInDay(intervalNumber: Int) = intervalNumber - getDayRollingStartNumber(intervalNumber) val nextKeyMillis: Long get() { val currentWindowStart = currentIntervalNumber.toLong() * ROLLING_WINDOW_LENGTH * 1000 val currentWindowEnd = currentWindowStart + ROLLING_WINDOW_LENGTH * 1000 val currentWindowStart = currentIntervalNumber.toLong() * ROLLING_WINDOW_LENGTH_MS val currentWindowEnd = currentWindowStart + ROLLING_WINDOW_LENGTH_MS return (currentWindowEnd - System.currentTimeMillis()).coerceAtLeast(0) } Loading
play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureDatabase.kt +1 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit fun dailyCleanup(): Boolean = writableDatabase.run { val start = System.currentTimeMillis() val rollingStartTime = currentDayRollingStartNumber * ROLLING_WINDOW_LENGTH * 1000 - TimeUnit.DAYS.toMillis(KEEP_DAYS.toLong()) val rollingStartTime = currentDayRollingStartNumber.toLong() * ROLLING_WINDOW_LENGTH_MS - TimeUnit.DAYS.toMillis(KEEP_DAYS.toLong()) val advertisements = delete(TABLE_ADVERTISEMENTS, "timestamp < ?", longArrayOf(rollingStartTime)) Log.d(TAG, "Deleted on daily cleanup: $advertisements adv") if (start + MAX_DELETE_TIME < System.currentTimeMillis()) return@run false Loading