Skip to content

Commit 4b31fa4

Browse files
committed
Fix errors after rebase on fad/next (#4477)
* Fix unit test after rebase on fad/next * Guard reference to previousActivity with lock * Supress lint error about explicit executor in continuation
1 parent abdcfae commit 4b31fa4

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/FeedbackActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import static android.view.View.GONE;
1818
import static android.view.View.VISIBLE;
1919

20+
import android.annotation.SuppressLint;
2021
import android.graphics.Bitmap;
2122
import android.net.Uri;
2223
import android.os.Bundle;
@@ -144,6 +145,8 @@ private Bitmap readScreenshot() {
144145
return bitmap;
145146
}
146147

148+
// TODO(b/261014422): Use an explicit executor in continuations.
149+
@SuppressLint("TaskMainThread")
147150
public void submitFeedback(View view) {
148151
setSubmittingStateEnabled(true);
149152
if (releaseName == null) {

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/FeedbackSender.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
package com.google.firebase.appdistribution.impl;
1616

17+
import android.annotation.SuppressLint;
1718
import android.net.Uri;
1819
import androidx.annotation.Nullable;
1920
import com.google.android.gms.tasks.Task;
@@ -37,6 +38,8 @@ static FeedbackSender getInstance() {
3738
return FirebaseApp.getInstance().get(FeedbackSender.class);
3839
}
3940

41+
// TODO(b/261014422): Use an explicit executor in continuations.
42+
@SuppressLint("TaskMainThread")
4043
/** Send feedback text and optionally a screenshot to the Tester API for the given release. */
4144
Task<Void> sendFeedback(String releaseName, String feedbackText, @Nullable Uri screenshotUri) {
4245
return testerApiClient

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/FirebaseAppDistributionImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ public void cancelFeedbackNotification() {
372372
notificationsManager.cancelFeedbackNotification();
373373
}
374374

375+
// TODO(b/261014422): Use an explicit executor in continuations.
376+
@SuppressLint("TaskMainThread")
375377
private void doStartFeedback(CharSequence infoText, @Nullable Uri screenshotUri) {
376378
testerSignInManager
377379
.signInTester()

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/FirebaseAppDistributionLifecycleNotifier.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@ <A extends Activity> Task<Activity> getForegroundActivity(@Nullable Class<A> cla
242242
new OnActivityResumedListener() {
243243
@Override
244244
public void onResumed(Activity activity) {
245-
task.setResult(
246-
getActivityWithIgnoredClass(activity, previousActivity, classToIgnore));
245+
synchronized (lock) {
246+
task.setResult(
247+
getActivityWithIgnoredClass(activity, previousActivity, classToIgnore));
248+
}
247249
removeOnActivityResumedListener(this);
248250
}
249251
});

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/ScreenshotTaker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class ScreenshotTaker {
7272
* @return a {@link Task} that will complete with the file URI in app-level storage where the
7373
* screenshot was written, or null if no activity could be found to screenshot.
7474
*/
75+
// TODO(b/261014422): Use an explicit executor in continuations.
76+
@SuppressLint("TaskMainThread")
7577
Task<Uri> takeScreenshot() {
7678
return deleteScreenshot()
7779
.onSuccessTask(unused -> captureScreenshot())

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/impl/FirebaseAppDistributionNotificationsManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void showAppUpdateNotification_withSuccess() {
9595
Notification notification =
9696
shadowOf(notificationManager).getNotification(APP_UPDATE.tag, APP_UPDATE.id);
9797
assertThat(shadowOf(notification).getProgress()).isEqualTo(100);
98-
assertThat(shadowOf(notification).getContentTitle().toString()).contains("Download completed");
98+
assertThat(shadowOf(notification).getContentTitle().toString()).contains("Download complete");
9999
}
100100

101101
@Test

0 commit comments

Comments
 (0)