Skip to content

Commit c2b3bfd

Browse files
author
Rachel Prince
committed
Fix formatting
1 parent c709d54 commit c2b3bfd

File tree

11 files changed

+92
-35
lines changed

11 files changed

+92
-35
lines changed

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/AabUpdater.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import androidx.annotation.GuardedBy;
2626
import androidx.annotation.NonNull;
2727
import androidx.annotation.VisibleForTesting;
28-
2928
import com.google.firebase.appdistribution.internal.InstallActivity;
3029
import com.google.firebase.appdistribution.internal.LogWrapper;
3130
import com.google.firebase.appdistribution.internal.SignInResultActivity;

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/ApkUpdater.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ private void installApk(File file, boolean showDownloadNotificationManager) {
130130
UpdateStatus.INSTALL_FAILED,
131131
showDownloadNotificationManager);
132132
setUpdateTaskCompletionErrorWithDefault(
133-
e, FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED, Status.INSTALLATION_FAILURE);
133+
e,
134+
FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED,
135+
Status.INSTALLATION_FAILURE);
134136
});
135137
}
136138

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/FirebaseAppDistribution.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,15 @@ private Task<Void> showSignInConfirmationDialog(Activity hostActivity) {
232232
(dialogInterface, i) ->
233233
showSignInDialogTask.setException(
234234
new FirebaseAppDistributionException(
235-
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, AUTHENTICATION_CANCELED)));
235+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED,
236+
AUTHENTICATION_CANCELED)));
236237

237238
signInConfirmationDialog.setOnCancelListener(
238239
dialogInterface ->
239240
showSignInDialogTask.setException(
240241
new FirebaseAppDistributionException(
241-
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, AUTHENTICATION_CANCELED)));
242+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED,
243+
AUTHENTICATION_CANCELED)));
242244

243245
signInConfirmationDialog.show();
244246

@@ -322,7 +324,8 @@ private UpdateTask updateApp(boolean showDownloadInNotificationManager) {
322324
LogWrapper.getInstance().v("New release not found.");
323325
return getErrorUpdateTask(
324326
new FirebaseAppDistributionException(
325-
FirebaseAppDistributionException.ErrorMessages.NOT_FOUND_ERROR, UPDATE_NOT_AVAILABLE));
327+
FirebaseAppDistributionException.ErrorMessages.NOT_FOUND_ERROR,
328+
UPDATE_NOT_AVAILABLE));
326329
}
327330
if (cachedNewRelease.getDownloadUrl() == null) {
328331
LogWrapper.getInstance().v("Download failed to execute.");
@@ -357,7 +360,8 @@ void onActivityResumed(Activity activity) {
357360
if (dialogHostActivity != null && dialogHostActivity != activity) {
358361
showSignInDialogTask.setException(
359362
new FirebaseAppDistributionException(
360-
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED, HOST_ACTIVITY_INTERRUPTED));
363+
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED,
364+
HOST_ACTIVITY_INTERRUPTED));
361365
} else {
362366
showSignInConfirmationDialog(activity);
363367
}
@@ -367,7 +371,8 @@ void onActivityResumed(Activity activity) {
367371
if (dialogHostActivity != null && dialogHostActivity != activity) {
368372
showUpdateDialogTask.setException(
369373
new FirebaseAppDistributionException(
370-
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED, HOST_ACTIVITY_INTERRUPTED));
374+
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED,
375+
HOST_ACTIVITY_INTERRUPTED));
371376
} else {
372377
synchronized (cachedNewReleaseLock) {
373378
showUpdateConfirmationDialog(
@@ -446,13 +451,15 @@ private Task<Void> showUpdateConfirmationDialog(
446451
(dialogInterface, i) ->
447452
showUpdateDialogTask.setException(
448453
new FirebaseAppDistributionException(
449-
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED, Status.INSTALLATION_CANCELED)));
454+
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED,
455+
Status.INSTALLATION_CANCELED)));
450456

451457
updateConfirmationDialog.setOnCancelListener(
452458
dialogInterface ->
453459
showUpdateDialogTask.setException(
454460
new FirebaseAppDistributionException(
455-
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED, Status.INSTALLATION_CANCELED)));
461+
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED,
462+
Status.INSTALLATION_CANCELED)));
456463

457464
updateConfirmationDialog.show();
458465

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/FirebaseAppDistributionException.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,53 @@ public enum Status {
2525
/** Unknown error or an error from a different error domain. */
2626
UNKNOWN,
2727

28-
/** The authentication process failed. The tester was either not signed in, or something went wrong. Try signing in again by calling {@link FirebaseAppDistribution#signInTester}. */
28+
/**
29+
* The authentication process failed. The tester was either not signed in, or something went
30+
* wrong. Try signing in again by calling {@link FirebaseAppDistribution#signInTester}.
31+
*/
2932
AUTHENTICATION_FAILURE,
3033

3134
/** The authentication process was canceled (typically by the user). */
3235
AUTHENTICATION_CANCELED,
3336

34-
/** No network is available to make requests, or the request timed out. Check your internet connection and try again. */
37+
/**
38+
* No network is available to make requests, or the request timed out. Check your internet
39+
* connection and try again.
40+
*/
3541
NETWORK_FAILURE,
3642

37-
/** The new release failed to download. This is a most likely due to a transient condition and
38-
* may be corrected by retrying. */
43+
/**
44+
* The new release failed to download. This is a most likely due to a transient condition and
45+
* may be corrected by retrying.
46+
*/
3947
DOWNLOAD_FAILURE,
4048

41-
/** The new release failed to install. Verify that the new release has the same signing key as the version running on device. */
49+
/**
50+
* The new release failed to install. Verify that the new release has the same signing key as
51+
* the version running on device.
52+
*/
4253
INSTALLATION_FAILURE,
4354

4455
/** The installation was canceled (typically by the user). */
4556
INSTALLATION_CANCELED,
4657

47-
/** An update is not available for the current tester and app. Make sure that {@link FirebaseAppDistribution#checkForNewRelease()} returns with a non-null {@link AppDistributionRelease} before calling {@link FirebaseAppDistribution#updateApp()} */
58+
/**
59+
* An update is not available for the current tester and app. Make sure that {@link
60+
* FirebaseAppDistribution#checkForNewRelease()} returns with a non-null {@link
61+
* AppDistributionRelease} before calling {@link FirebaseAppDistribution#updateApp()}
62+
*/
4863
UPDATE_NOT_AVAILABLE,
4964

50-
/** The app is running in production. The App Distribution SDK is intended for beta testing usage only. Do not include the App Distribution SDK in production builds. */
65+
/**
66+
* The app is running in production. The App Distribution SDK is intended for beta testing usage
67+
* only. Do not include the App Distribution SDK in production builds.
68+
*/
5169
APP_RUNNING_IN_PRODUCTION,
5270

53-
/** The host activity for a confirmation dialog was destroyed or pushed to the backstack. Try calling {@link FirebaseAppDistribution#updateIfNewReleaseAvailable()} again */
71+
/**
72+
* The host activity for a confirmation dialog was destroyed or pushed to the backstack. Try
73+
* calling {@link FirebaseAppDistribution#updateIfNewReleaseAvailable()} again
74+
*/
5475
HOST_ACTIVITY_INTERRUPTED,
5576
}
5677

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/FirebaseAppDistributionTesterApiClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,12 @@ private FirebaseAppDistributionException getExceptionForHttpResponse(int respons
172172
"Bad request when fetching new release", Status.UNKNOWN);
173173
case 401:
174174
return new FirebaseAppDistributionException(
175-
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR, Status.AUTHENTICATION_FAILURE);
175+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR,
176+
Status.AUTHENTICATION_FAILURE);
176177
case 403:
177178
return new FirebaseAppDistributionException(
178-
FirebaseAppDistributionException.ErrorMessages.AUTHORIZATION_ERROR, Status.AUTHENTICATION_FAILURE);
179+
FirebaseAppDistributionException.ErrorMessages.AUTHORIZATION_ERROR,
180+
Status.AUTHENTICATION_FAILURE);
179181
case 404:
180182
return new FirebaseAppDistributionException(
181183
"App or tester not found when fetching new release", Status.AUTHENTICATION_FAILURE);

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/TesterSignInManager.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ void onActivityStarted(Activity activity) {
110110
LogWrapper.getInstance().e("App Resumed without sign in flow completing.");
111111
setSignInTaskCompletionError(
112112
new FirebaseAppDistributionException(
113-
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, AUTHENTICATION_CANCELED));
113+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED,
114+
AUTHENTICATION_CANCELED));
114115
}
115116
}
116117
}
@@ -138,10 +139,14 @@ public Task<Void> signInTester() {
138139
.get()
139140
.getId()
140141
.addOnFailureListener(
141-
handleTaskFailure(FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR, Status.AUTHENTICATION_FAILURE))
142+
handleTaskFailure(
143+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR,
144+
Status.AUTHENTICATION_FAILURE))
142145
.onSuccessTask(this::getForegroundActivityAndOpenSignInFlow)
143146
// Catch any unexpected failures to be safe.
144-
.addOnFailureListener(handleTaskFailure(FirebaseAppDistributionException.ErrorMessages.UNKNOWN_ERROR, Status.UNKNOWN));
147+
.addOnFailureListener(
148+
handleTaskFailure(
149+
FirebaseAppDistributionException.ErrorMessages.UNKNOWN_ERROR, Status.UNKNOWN));
145150

146151
return signInTaskCompletionSource.getTask();
147152
}

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/AabUpdaterTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ public void updateAppTask_onAppResume_setsUpdateCancelled() throws InterruptedEx
165165
aabUpdater.onActivityStarted(activity);
166166

167167
FirebaseAppDistributionException exception =
168-
assertTaskFailure(updateTask, Status.INSTALLATION_CANCELED, FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED);
168+
assertTaskFailure(
169+
updateTask,
170+
Status.INSTALLATION_CANCELED,
171+
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED);
169172
assertEquals(
170173
ReleaseUtils.convertToAppDistributionRelease(TEST_RELEASE_NEWER_AAB_INTERNAL),
171174
exception.getRelease());

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/ApkUpdaterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ public void updateApk_showNotificationFalse_doesNotUpdateNotificationManager() {
213213

214214
installTaskCompletionSource.setException(
215215
new FirebaseAppDistributionException(
216-
FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED, Status.INSTALLATION_FAILURE));
216+
FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED,
217+
Status.INSTALLATION_FAILURE));
217218

218219
FirebaseAppDistributionException e =
219220
assertThrows(FirebaseAppDistributionException.class, () -> onCompleteListener.await());

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/FirebaseAppDistributionTest.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ public void checkForNewRelease_whenCheckForNewReleaseFails_throwsError() {
180180
.thenReturn(
181181
Tasks.forException(
182182
new FirebaseAppDistributionException(
183-
FirebaseAppDistributionException.ErrorMessages.JSON_PARSING_ERROR, Status.NETWORK_FAILURE)));
183+
FirebaseAppDistributionException.ErrorMessages.JSON_PARSING_ERROR,
184+
Status.NETWORK_FAILURE)));
184185

185186
Task<AppDistributionRelease> task = firebaseAppDistribution.checkForNewRelease();
186187
assertTaskFailure(task, NETWORK_FAILURE, JSON_PARSING_ERROR);
@@ -296,7 +297,8 @@ public void updateToNewRelease_whenSignInCancelled_checkForUpdateNotCalled() {
296297
.thenReturn(
297298
Tasks.forException(
298299
new FirebaseAppDistributionException(
299-
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, AUTHENTICATION_CANCELED)));
300+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED,
301+
AUTHENTICATION_CANCELED)));
300302

301303
UpdateTask updateTask = firebaseAppDistribution.updateIfNewReleaseAvailable();
302304

@@ -305,7 +307,10 @@ public void updateToNewRelease_whenSignInCancelled_checkForUpdateNotCalled() {
305307

306308
verify(mockTesterSignInManager, times(1)).signInTester();
307309
verify(mockNewReleaseFetcher, never()).checkForNewRelease();
308-
assertTaskFailure(updateTask, AUTHENTICATION_CANCELED, FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED);
310+
assertTaskFailure(
311+
updateTask,
312+
AUTHENTICATION_CANCELED,
313+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED);
309314
}
310315

311316
@Test
@@ -315,7 +320,8 @@ public void updateToNewRelease_whenSignInFailed_checkForUpdateNotCalled() {
315320
.thenReturn(
316321
Tasks.forException(
317322
new FirebaseAppDistributionException(
318-
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR, AUTHENTICATION_FAILURE)));
323+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR,
324+
AUTHENTICATION_FAILURE)));
319325

320326
UpdateTask updateTask = firebaseAppDistribution.updateIfNewReleaseAvailable();
321327

@@ -395,7 +401,8 @@ public void signInTester_whenDialogDismissed_taskFails() {
395401
Exception e = updateTask.getException();
396402
assertTrue(e instanceof FirebaseAppDistributionException);
397403
assertEquals(AUTHENTICATION_CANCELED, ((FirebaseAppDistributionException) e).getErrorCode());
398-
assertEquals(FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, e.getMessage());
404+
assertEquals(
405+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, e.getMessage());
399406
}
400407

401408
@Test
@@ -410,7 +417,8 @@ public void updateToNewRelease_whenSignInDialogCanceled_taskFails() {
410417
Exception e = signInTask.getException();
411418
assertTrue(e instanceof FirebaseAppDistributionException);
412419
assertEquals(AUTHENTICATION_CANCELED, ((FirebaseAppDistributionException) e).getErrorCode());
413-
assertEquals(FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, e.getMessage());
420+
assertEquals(
421+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, e.getMessage());
414422
}
415423

416424
private AlertDialog assertAlertDialogShown() {
@@ -498,7 +506,9 @@ public void updateIfNewReleaseAvailable_whenScreenRotates_updateDialogReappears(
498506
firebaseAppDistribution.onActivityResumed(testActivity2);
499507

500508
assertTaskFailure(
501-
updateTask, HOST_ACTIVITY_INTERRUPTED, FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED);
509+
updateTask,
510+
HOST_ACTIVITY_INTERRUPTED,
511+
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED);
502512
}
503513

504514
@Test
@@ -515,7 +525,9 @@ public void updateIfNewReleaseAvailable_whenScreenRotates_updateDialogReappears(
515525
firebaseAppDistribution.onActivityResumed(testActivity2);
516526

517527
assertTaskFailure(
518-
updateTask, HOST_ACTIVITY_INTERRUPTED, FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED);
528+
updateTask,
529+
HOST_ACTIVITY_INTERRUPTED,
530+
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED);
519531
}
520532

521533
@Test

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/NewReleaseFetcherTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ public void checkForNewRelease_fisFailure() throws Exception {
182182
FirebaseAppDistributionException actualException =
183183
assertThrows(FirebaseAppDistributionException.class, onCompleteListener::await);
184184

185-
assertThat(actualException).hasMessageThat().contains(FirebaseAppDistributionException.ErrorMessages.UNKNOWN_ERROR);
185+
assertThat(actualException)
186+
.hasMessageThat()
187+
.contains(FirebaseAppDistributionException.ErrorMessages.UNKNOWN_ERROR);
186188
assertThat(actualException).hasMessageThat().contains("test ex");
187189
assertThat(actualException.getErrorCode()).isEqualTo(Status.UNKNOWN);
188190
assertThat(actualException).hasCauseThat().isEqualTo(expectedException);
@@ -203,7 +205,9 @@ public void checkForNewRelease_uncaughtExceptionFailure() throws Exception {
203205
FirebaseAppDistributionException actualException =
204206
assertThrows(FirebaseAppDistributionException.class, onCompleteListener::await);
205207

206-
assertThat(actualException).hasMessageThat().contains(FirebaseAppDistributionException.ErrorMessages.UNKNOWN_ERROR);
208+
assertThat(actualException)
209+
.hasMessageThat()
210+
.contains(FirebaseAppDistributionException.ErrorMessages.UNKNOWN_ERROR);
207211
assertThat(actualException).hasMessageThat().contains("test ex");
208212
assertThat(actualException.getErrorCode()).isEqualTo(Status.UNKNOWN);
209213
assertThat(actualException).hasCauseThat().isEqualTo(expectedException);

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/TesterSignInManagerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public void signInTester_whenAppReenteredDuringSignIn_taskFails() {
222222
Exception e = signInTask.getException();
223223
assertTrue(e instanceof FirebaseAppDistributionException);
224224
assertEquals(AUTHENTICATION_CANCELED, ((FirebaseAppDistributionException) e).getErrorCode());
225-
assertEquals(FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, e.getMessage());
225+
assertEquals(
226+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED, e.getMessage());
226227
}
227228
}

0 commit comments

Comments
 (0)