From bccb23616181051974edc2a803567526f921a38d Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Wed, 18 Oct 2023 11:47:34 +0100 Subject: [PATCH 1/2] Revert target sdk to `33` and update countly to latest version (#621) Fixes `java.lang.SecurityException: org.openobservatory.ooniprobe: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts` https://github.com/Countly/countly-sdk-android/issues/191 ## Proposed Changes - Downgrade `compileSdk` and `targetSdk` to versions `ly.count.android:sdk:+` can support --- app/src/main/AndroidManifest.xml | 4 ++-- gradle/libs.versions.toml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 78c0d0b76..1b717a3e5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ - + Date: Wed, 18 Oct 2023 17:26:58 +0100 Subject: [PATCH 2/2] Fix: Update rules for displaying an error message when test starts (#614) Fixes https://github.com/ooni/probe/issues/2468 ## Proposed Changes - Only display an error message if the `start_time` of the test is more than 5 minutes ago. ![Screenshot_20230904_090258](https://github.com/ooni/probe-android/assets/17911892/57af92a1-464c-4a89-8fc4-c899ee11a62c) --- .../ooniprobe/item/FailedItem.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java b/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java index 43171a5f4..4566b4341 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java @@ -12,7 +12,9 @@ import org.openobservatory.ooniprobe.databinding.ItemFailedBinding; import org.openobservatory.ooniprobe.model.database.Result; +import java.util.Date; import java.util.Locale; +import static java.util.concurrent.TimeUnit.*; import localhost.toolkit.widget.recyclerview.HeterogeneousRecyclerItem; @@ -39,8 +41,19 @@ public FailedItem(Result extra, View.OnClickListener onClickListener, View.OnLon viewHolder.binding.icon.setImageResource(extra.getTestSuite().getIcon()); viewHolder.binding.testName.setText(extra.getTestSuite().getTitle()); String failure_msg = viewHolder.itemView.getContext().getString(R.string.TestResults_Overview_Error); - if (extra.failure_msg != null) + if (extra.failure_msg != null) { failure_msg += " - " + extra.failure_msg; + } else { + // NOTE: If the test is running for more than 5 minutes, we assume it's stuck or failed, + // and we show the default error message. + long MAX_DURATION = MILLISECONDS.convert(5, MINUTES); + long duration = new Date().getTime() - extra.start_time.getTime(); + if (duration < MAX_DURATION) { + failure_msg = viewHolder.itemView.getContext() + .getString(R.string.Dashboard_Running_Running) + .replace(":",""); + } + } viewHolder.binding.subtitle.setText(failure_msg); viewHolder.binding.startTime.setText(DateFormat.format(DateFormat.getBestDateTimePattern(Locale.getDefault(), "yMdHm"), extra.start_time)); }