Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prominent google play errors. #842

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.openobservatory.ooniprobe.common.OONIDescriptor
import org.openobservatory.ooniprobe.common.OONITests
import org.openobservatory.ooniprobe.common.PreferenceManager
import org.openobservatory.ooniprobe.common.ResubmitTask
import org.openobservatory.ooniprobe.common.ThirdPartyServices
import org.openobservatory.ooniprobe.databinding.ActivityResultDetailBinding
import org.openobservatory.ooniprobe.domain.GetResults
import org.openobservatory.ooniprobe.domain.GetTestSuite
Expand Down Expand Up @@ -85,7 +86,14 @@ class ResultDetailActivity : AbstractActivity(), View.OnClickListener, OnConfirm

else -> {
result = iResult
result.getTestSuite(this@ResultDetailActivity).get()?.themeLight?.let { setTheme(it) }
val optionalSuite = result.getTestSuite(this@ResultDetailActivity)
if (optionalSuite.isPresent){
try {
setTheme(optionalSuite.get().themeLight)
} catch (e: Exception) {
ThirdPartyServices.logException(e)
}
}
binding = ActivityResultDetailBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ public int onStartCommand(Intent intent, int flags, int startId) {
.setProgress(100, 0, false)
.build();

task = (TestAsyncTask) new TestAsyncTask(app, testSuites, store_db, unattended).execute();
//This intent is used to manage the stop test button in the notification
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(RunTestService.ACTION_INTERRUPT);
PendingIntent pIntent = pendingIntentGetBroadcast(this, 1, broadcastIntent);
builder.addAction(0, getApplicationContext().getString(R.string.Notification_StopTest), pIntent);
startForeground(NOTIFICATION_ID, builder.build());

task = (TestAsyncTask) new TestAsyncTask(app, testSuites, store_db, unattended).execute();
/*
START_NOT_STICKY says that, after returning from onStartCreated(),
if the process is killed with no remaining start commands to deliver,
Expand Down Expand Up @@ -202,7 +203,12 @@ public void stopTest() {
public synchronized void interrupt() {
task.interrupt();
if (task.isInterrupted()) {
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE);
try {
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE);
stopSelf();
} catch (Exception e) {
ThirdPartyServices.logException(e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ProgressFragment : Fragment() {
}

private fun updateUI(service: RunTestService?) {
if ((requireActivity().application as Application).isTestRunning) {
if (isAdded && (requireActivity().application as Application).isTestRunning) {
val progressLevel = testProgressRepository.progress.value
when {
progressLevel != null -> {
Expand Down
Loading