Skip to content

Commit

Permalink
Merge pull request #255 from DP-3T/develop
Browse files Browse the repository at this point in the history
Version 2.3.1
  • Loading branch information
simonroesch authored Jul 7, 2021
2 parents cd0dbc1 + 22b9bef commit 2ae3022
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog for DP3T-SDK Android

## version 2.3.1 (07.07.2021)
- fixed CANCEL notifications that appeared directly when SyncWorker was cancelled. These notifications will now only show, if the SyncWorker keeps failing for more than syncErrorGracePeriod

## version 2.3.0 (21.06.2021)
- Added DP3T.showShareTEKsPopup(...) and DP3T.uploadTEKs(...). This splits the functionality of DP3T.sendIAmInfected(...) into two functions. The functionality of DP3T.sendIAmInfected(...) remains unchanged
- Log all generated Notifications if devHistory is enabled
Expand Down
4 changes: 2 additions & 2 deletions dp3t-sdk/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ SNAPSHOT_REPOSITORY_URL=https://s01.oss.sonatype.org/content/repositories/snapsh

GROUP=org.dpppt
POM_ARTIFACT_ID=dp3t-sdk-android
VERSION_CODE=230
VERSION_NAME=2.3.0
VERSION_CODE=231
VERSION_NAME=2.3.1
PUBLISH_VARIANT=productionRelease

POM_NAME=dp3t-sdk-android
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2021 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
package org.dpppt.android.sdk.internal

class DelayableCancellationException : Exception() {

}

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.dpppt.android.sdk.internal.nearby.GoogleExposureClient.Companion.getI
import java.io.File
import java.security.PublicKey
import java.util.*
import java.util.concurrent.CancellationException
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean

Expand Down Expand Up @@ -121,11 +122,16 @@ class SyncWorker(context: Context, workerParams: WorkerParameters) : CoroutineWo
SyncErrorState.getInstance().setSyncError(context, null)
BroadcastHelper.sendUpdateAndErrorBroadcast(context)
} catch (e: Exception) {
Logger.e(TAG, "sync", e)
val syncError = ErrorHelper.getSyncErrorFromException(e, true)
SyncErrorState.getInstance().setSyncError(context, syncError)
BroadcastHelper.sendUpdateAndErrorBroadcast(context)
throw e
if (e is DelayableCancellationException) {
//ignore delayable cancellation exception
Logger.e(TAG, "ignoring DelayableCancellationException", e)
} else {
Logger.e(TAG, "sync", e)
val syncError = ErrorHelper.getSyncErrorFromException(e, true)
SyncErrorState.getInstance().setSyncError(context, syncError)
BroadcastHelper.sendUpdateAndErrorBroadcast(context)
throw e
}
}
} finally {
isSyncInProgress.set(false)
Expand Down Expand Up @@ -170,6 +176,10 @@ class SyncWorker(context: Context, workerParams: WorkerParameters) : CoroutineWo
lastSuccessfulSyncTime > currentTime - SyncErrorState.getInstance().syncErrorGracePeriod
if (isDelayWithinGracePeriod && ErrorHelper.isDelayableSyncError(e)) {
addHistoryEntry(false, true)
if (e is CancellationException) {
Logger.e(TAG, "throwing DelayableCancellationException")
throw DelayableCancellationException()
}
} else {
addHistoryEntry(true, false)
throw e
Expand Down

0 comments on commit 2ae3022

Please sign in to comment.