From 8b49b0558514b60a2e4b896f35d85c4d8a4c5c6e Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 20 Dec 2020 12:43:38 +0100 Subject: [PATCH] EN: Do not log isEnabled calls Some apps make excessive use of this method, so better not log it --- .../gms/nearby/exposurenotification/ExposureDatabase.kt | 6 +++++- .../exposurenotification/ExposureNotificationServiceImpl.kt | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureDatabase.kt b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureDatabase.kt index b0670c5a..01647987 100644 --- a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureDatabase.kt +++ b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureDatabase.kt @@ -122,6 +122,10 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit } } } + if (oldVersion == 9) { + Log.d(TAG, "Get rid of isEnabled log entries") + db.delete(TABLE_APP_LOG, "method = ?", arrayOf("isEnabled")); + } Log.d(TAG, "Finished database upgrade") } @@ -830,7 +834,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit companion object { private const val DB_NAME = "exposure.db" - private const val DB_VERSION = 9 + private const val DB_VERSION = 10 private const val DB_SIZE_TOO_LARGE = 256L * 1024 * 1024 private const val MAX_DELETE_TIME = 5000L private const val TABLE_ADVERTISEMENTS = "advertisements" diff --git a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt index 674a6797..902bc2dc 100644 --- a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt +++ b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt @@ -151,9 +151,7 @@ class ExposureNotificationServiceImpl(private val context: Context, private val override fun isEnabled(params: IsEnabledParams) { lifecycleScope.launchWhenStarted { val isAuthorized = ExposureDatabase.with(context) { database -> - database.isAppAuthorized(packageName).also { - if (it) database.noteAppAction(packageName, "isEnabled") - } + database.isAppAuthorized(packageName) } try { params.callback.onResult(Status.SUCCESS, isAuthorized && ExposurePreferences(context).enabled)