Skip to content

Commit b0c5cbc

Browse files
committed
Move listener invocations back to the main thread while keeping disk write on background thread.
1 parent c25f0dc commit b0c5cbc

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

appcheck/firebase-appcheck/src/main/java/com/google/firebase/appcheck/internal/DefaultFirebaseAppCheck.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ Task<AppCheckToken> fetchTokenFromProvider() {
235235
return appCheckProvider
236236
.getToken()
237237
.continueWithTask(
238-
backgroundExecutor,
239238
new Continuation<AppCheckToken, Task<AppCheckToken>>() {
240239
@Override
241240
public Task<AppCheckToken> then(@NonNull Task<AppCheckToken> task) {
@@ -270,11 +269,9 @@ void setCachedToken(@NonNull AppCheckToken token) {
270269
/**
271270
* Updates the {@link AppCheckToken} persisted in {@link android.content.SharedPreferences} as
272271
* well as the in-memory cached {@link AppCheckToken}.
273-
*
274-
* <p>This method performs a disk write, and should therefore be called on a background thread.
275272
*/
276273
private void updateStoredToken(@NonNull AppCheckToken token) {
277-
storageHelper.saveAppCheckToken(token);
274+
backgroundExecutor.execute(() -> storageHelper.saveAppCheckToken(token));
278275
setCachedToken(token);
279276

280277
tokenRefreshManager.maybeScheduleTokenRefresh(token);

0 commit comments

Comments
 (0)