Builder instance is returned so subsequent calls can be chained.
*/
public Builder setHttpTransport(HttpTransport httpTransport) {
- this.httpTransport = httpTransport;
+ this.httpTransport = checkNotNull(httpTransport,
+ "FirebaseOptions must be initialized with a non-null HttpTransport.");
return this;
}
@@ -433,7 +447,8 @@ public Builder setHttpTransport(HttpTransport httpTransport) {
* @return This Builder instance is returned so subsequent calls can be chained.
*/
public Builder setJsonFactory(JsonFactory jsonFactory) {
- this.jsonFactory = jsonFactory;
+ this.jsonFactory = checkNotNull(jsonFactory,
+ "FirebaseOptions must be initialized with a non-null JsonFactory.");
return this;
}
@@ -445,7 +460,8 @@ public Builder setJsonFactory(JsonFactory jsonFactory) {
* @return This Builder instance is returned so subsequent calls can be chained.
*/
public Builder setThreadManager(ThreadManager threadManager) {
- this.threadManager = threadManager;
+ this.threadManager = checkNotNull(threadManager,
+ "FirebaseOptions must be initialized with a non-null ThreadManager.");
return this;
}
@@ -492,6 +508,19 @@ public Builder setReadTimeout(int readTimeout) {
return this;
}
+ /**
+ * Sets the write timeout for outgoing HTTP (REST) calls made by the SDK. This does not affect
+ * the {@link com.google.firebase.database.FirebaseDatabase} and
+ * {@link com.google.firebase.cloud.FirestoreClient} APIs.
+ *
+ * @param writeTimeout Write timeout in milliseconds. Must not be negative.
+ * @return This Builder instance is returned so subsequent calls can be chained.
+ */
+ public Builder setWriteTimeout(int writeTimeout) {
+ this.writeTimeout = writeTimeout;
+ return this;
+ }
+
/**
* Builds the {@link FirebaseOptions} instance from the previously set options.
*
diff --git a/src/main/java/com/google/firebase/ImplFirebaseTrampolines.java b/src/main/java/com/google/firebase/ImplFirebaseTrampolines.java
index 3a7f6499a..3dff2764c 100644
--- a/src/main/java/com/google/firebase/ImplFirebaseTrampolines.java
+++ b/src/main/java/com/google/firebase/ImplFirebaseTrampolines.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
import com.google.api.core.ApiFutures;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.FirestoreOptions;
+import com.google.firebase.auth.internal.Utils;
+import com.google.firebase.internal.EmulatorCredentials;
import com.google.firebase.internal.FirebaseService;
import com.google.firebase.internal.NonNull;
@@ -41,6 +43,9 @@ public final class ImplFirebaseTrampolines {
private ImplFirebaseTrampolines() {}
public static GoogleCredentials getCredentials(@NonNull FirebaseApp app) {
+ if (Utils.isEmulatorMode()) {
+ return new EmulatorCredentials();
+ }
return app.getOptions().getCredentials();
}
diff --git a/src/main/java/com/google/firebase/IncomingHttpResponse.java b/src/main/java/com/google/firebase/IncomingHttpResponse.java
index cfeac5e70..794479040 100644
--- a/src/main/java/com/google/firebase/IncomingHttpResponse.java
+++ b/src/main/java/com/google/firebase/IncomingHttpResponse.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 Google Inc.
+ * Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/OutgoingHttpRequest.java b/src/main/java/com/google/firebase/OutgoingHttpRequest.java
index 44af4bff0..fdaee7458 100644
--- a/src/main/java/com/google/firebase/OutgoingHttpRequest.java
+++ b/src/main/java/com/google/firebase/OutgoingHttpRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 Google Inc.
+ * Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/ThreadManager.java b/src/main/java/com/google/firebase/ThreadManager.java
index 8903101f6..29e7b42d0 100644
--- a/src/main/java/com/google/firebase/ThreadManager.java
+++ b/src/main/java/com/google/firebase/ThreadManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/auth/AbstractFirebaseAuth.java b/src/main/java/com/google/firebase/auth/AbstractFirebaseAuth.java
index e9f1a4320..44fe9b7d2 100644
--- a/src/main/java/com/google/firebase/auth/AbstractFirebaseAuth.java
+++ b/src/main/java/com/google/firebase/auth/AbstractFirebaseAuth.java
@@ -256,11 +256,13 @@ public FirebaseToken verifyIdToken(@NonNull String idToken) throws FirebaseAuthE
* API call.
*
* @param idToken A Firebase ID token string to parse and verify.
- * @param checkRevoked A boolean denoting whether to check if the tokens were revoked.
+ * @param checkRevoked A boolean denoting whether to check if the tokens were revoked or if
+ * the user is disabled.
* @return A {@link FirebaseToken} representing the verified and decoded token.
* @throws IllegalArgumentException If the token is null, empty, or if the {@link FirebaseApp}
* instance does not have a project ID associated with it.
- * @throws FirebaseAuthException If an error occurs while parsing or validating the token.
+ * @throws FirebaseAuthException If an error occurs while parsing or validating the token, or if
+ * the user is disabled.
*/
public FirebaseToken verifyIdToken(@NonNull String idToken, boolean checkRevoked)
throws FirebaseAuthException {
@@ -343,8 +345,11 @@ public FirebaseToken verifySessionCookie(String cookie) throws FirebaseAuthExcep
* checkRevoked} is true, throws a {@link FirebaseAuthException}.
*
* @param cookie A Firebase session cookie string to verify and parse.
- * @param checkRevoked A boolean indicating whether to check if the cookie was explicitly revoked.
+ * @param checkRevoked A boolean indicating whether to check if the cookie was explicitly revoked
+ * or if the user is disabled.
* @return A {@link FirebaseToken} representing the verified and decoded cookie.
+ * @throws FirebaseAuthException If an error occurs while parsing or validating the token, or if
+ * the user is disabled.
*/
public FirebaseToken verifySessionCookie(String cookie, boolean checkRevoked)
throws FirebaseAuthException {
@@ -595,9 +600,10 @@ private CallableOperationA Google Cloud project ID is required to access Firestore. FirestoreClient determines the
@@ -32,7 +35,7 @@ public class FirestoreClient {
private final Firestore firestore;
- private FirestoreClient(FirebaseApp app) {
+ private FirestoreClient(FirebaseApp app, String databaseId) {
checkNotNull(app, "FirebaseApp must not be null");
String projectId = ImplFirebaseTrampolines.getProjectId(app);
checkArgument(!Strings.isNullOrEmpty(projectId),
@@ -47,16 +50,17 @@ private FirestoreClient(FirebaseApp app) {
.setCredentialsProvider(
FixedCredentialsProvider.create(ImplFirebaseTrampolines.getCredentials(app)))
.setProjectId(projectId)
+ .setDatabaseId(databaseId)
.build()
.getService();
}
/**
- * Returns the Firestore instance associated with the default Firebase app. Returns the same
- * instance for all invocations. The Firestore instance and all references obtained from it
+ * Returns the default Firestore instance associated with the default Firebase app. Returns the
+ * same instance for all invocations. The Firestore instance and all references obtained from it
* becomes unusable, once the default app is deleted.
*
- * @return A non-null {@code Firestore}
+ * @return A non-null {@code Firestore}
* instance.
*/
@NonNull
@@ -65,42 +69,97 @@ public static Firestore getFirestore() {
}
/**
- * Returns the Firestore instance associated with the specified Firebase app. For a given app,
- * always returns the same instance. The Firestore instance and all references obtained from it
- * becomes unusable, once the specified app is deleted.
+ * Returns the default Firestore instance associated with the specified Firebase app. For a given
+ * app, invocation always returns the same instance. The Firestore instance and all references
+ * obtained from it becomes unusable, once the specified app is deleted.
*
* @param app A non-null {@link FirebaseApp}.
- * @return A non-null {@code Firestore}
+ * @return A non-null {@code Firestore}
* instance.
*/
@NonNull
public static Firestore getFirestore(FirebaseApp app) {
- return getInstance(app).firestore;
+ final FirestoreOptions firestoreOptions = ImplFirebaseTrampolines.getFirestoreOptions(app);
+ return getFirestore(app, firestoreOptions == null ? null : firestoreOptions.getDatabaseId());
+ }
+
+ /**
+ * Returns the Firestore instance associated with the specified Firebase app. Returns the same
+ * instance for all invocations given the same app and database parameter. The Firestore instance
+ * and all references obtained from it becomes unusable, once the specified app is deleted.
+ *
+ * @param app A non-null {@link FirebaseApp}.
+ * @param database - The name of database.
+ * @return A non-null {@code Firestore}
+ * instance.
+ */
+ @NonNull
+ public static Firestore getFirestore(FirebaseApp app, String database) {
+ return getInstance(app, database).firestore;
+ }
+
+ /**
+ * Returns the Firestore instance associated with the default Firebase app. Returns the same
+ * instance for all invocations given the same database parameter. The Firestore instance and all
+ * references obtained from it becomes unusable, once the default app is deleted.
+ *
+ * @param database - The name of database.
+ * @return A non-null {@code Firestore}
+ * instance.
+ */
+ @NonNull
+ public static Firestore getFirestore(String database) {
+ return getFirestore(FirebaseApp.getInstance(), database);
}
- private static synchronized FirestoreClient getInstance(FirebaseApp app) {
+ private static synchronized FirestoreClient getInstance(FirebaseApp app, String database) {
FirestoreClientService service = ImplFirebaseTrampolines.getService(app,
SERVICE_ID, FirestoreClientService.class);
if (service == null) {
service = ImplFirebaseTrampolines.addService(app, new FirestoreClientService(app));
}
- return service.getInstance();
+ return service.getInstance().get(database);
}
private static final String SERVICE_ID = FirestoreClient.class.getName();
- private static class FirestoreClientService extends FirebaseService If the {@code dryRun} option is set to true, the message will not be actually sent. Instead
* FCM performs all the necessary validations and emulates the send operation. The {@code dryRun}
- * option is useful for determining whether an FCM registration has been deleted. However, it
+ * option is useful for determining whether an FCM registration has been deleted. However, it
* cannot be used to validate APNs tokens.
*
* @param message A non-null {@link Message} to be sent.
@@ -139,6 +144,204 @@ protected String execute() throws FirebaseMessagingException {
};
}
+ /**
+ * Sends each message in the given list via Firebase Cloud Messaging.
+ * Unlike {@link #sendAll(List)}, this method makes an HTTP call for each message in the
+ * given array.
+ *
+ * The list of responses obtained by calling {@link BatchResponse#getResponses()} on the return
+ * value is in the same order as the input list.
+ *
+ * @param messages A non-null, non-empty list containing up to 500 messages.
+ * @return A {@link BatchResponse} indicating the result of the operation.
+ * @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
+ * delivery. An exception here or a {@link BatchResponse} with all failures indicates a total
+ * failure, meaning that none of the messages in the list could be sent. Partial failures or
+ * no failures are only indicated by a {@link BatchResponse}.
+ */
+ public BatchResponse sendEach(@NonNull List If the {@code dryRun} option is set to true, the message will not be actually sent. Instead
+ * FCM performs all the necessary validations, and emulates the send operation. The {@code dryRun}
+ * option is useful for determining whether an FCM registration has been deleted. But it cannot be
+ * used to validate APNs tokens.
+ *
+ * The list of responses obtained by calling {@link BatchResponse#getResponses()} on the return
+ * value is in the same order as the input list.
+ *
+ * @param messages A non-null, non-empty list containing up to 500 messages.
+ * @param dryRun A boolean indicating whether to perform a dry run (validation only) of the send.
+ * @return A {@link BatchResponse} indicating the result of the operation.
+ * @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
+ * delivery. An exception here or a {@link BatchResponse} with all failures indicates a total
+ * failure, meaning that none of the messages in the list could be sent. Partial failures or
+ * no failures are only indicated by a {@link BatchResponse}.
+ */
+ public BatchResponse sendEach(
+ @NonNull List This method uses the {@link #sendEach(List)} API under the hood to send the given
+ * message to all the target recipients. The list of responses obtained by calling
+ * {@link BatchResponse#getResponses()} on the return value is in the same order as the
+ * tokens and/or FIDs in the {@link MulticastMessage}. If both tokens and FIDs are
+ * provided, tokens are processed first, followed by FIDs.
+ *
+ * @param message A non-null {@link MulticastMessage}
+ * @return A {@link BatchResponse} indicating the result of the operation.
+ * @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
+ * delivery. An exception here or a {@link BatchResponse} with all failures indicates a total
+ * failure, meaning that none of the messages in the list could be sent. Partial failures or
+ * no failures are only indicated by a {@link BatchResponse}.
+ */
+ public BatchResponse sendEachForMulticast(
+ @NonNull MulticastMessage message) throws FirebaseMessagingException {
+ return sendEachForMulticast(message, false);
+ }
+
+ /**
+ * Sends the given multicast message to all the FCM registration tokens and/or FIDs
+ * specified in it.
+ *
+ * If the {@code dryRun} option is set to true, the message will not be actually sent.
+ * Instead FCM performs all the necessary validations, and emulates the send operation.
+ * The {@code dryRun} option is useful for determining whether an FCM registration has
+ * been deleted. But it cannot be used to validate APNs tokens.
+ *
+ * This method uses the {@link #sendEach(List)} API under the hood to send the given
+ * message to all the target recipients. The list of responses obtained by calling
+ * {@link BatchResponse#getResponses()} on the return value is in the same order as the
+ * tokens and/or FIDs in the {@link MulticastMessage}. If both tokens and FIDs are
+ * provided, tokens are processed first, followed by FIDs.
+ *
+ * @param message A non-null {@link MulticastMessage}.
+ * @param dryRun A boolean indicating whether to perform a dry run (validation only) of the send.
+ * @return A {@link BatchResponse} indicating the result of the operation.
+ * @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
+ * delivery. An exception here or a {@link BatchResponse} with all failures indicates a total
+ * failure, meaning that none of the messages in the list could be sent. Partial failures or
+ * no failures are only indicated by a {@link BatchResponse}.
+ */
+ public BatchResponse sendEachForMulticast(@NonNull MulticastMessage message, boolean dryRun)
+ throws FirebaseMessagingException {
+ checkNotNull(message, "multicast message must not be null");
+ return sendEach(message.getMessageList(), dryRun);
+ }
+
+ /**
+ * Similar to {@link #sendEachForMulticast(MulticastMessage)} but performs the operation
+ * asynchronously.
+ *
+ * @param message A non-null {@link MulticastMessage}.
+ * @return An {@code ApiFuture} that will complete with a {@link BatchResponse} when
+ * the messages have been sent.
+ */
+ public ApiFuture This method uses the {@link #sendAll(List)} API under the hood to send the given
* message to all the target recipients. The responses list obtained by calling
- * {@link BatchResponse#getResponses()} on the return value corresponds to the order of tokens
- * in the {@link MulticastMessage}.
+ * {@link BatchResponse#getResponses()} on the return value corresponds to the order of
+ * tokens and/or FIDs in the {@link MulticastMessage}. If both tokens and FIDs are
+ * provided, tokens are processed first, followed by FIDs.
*
* @param message A non-null {@link MulticastMessage}
* @return A {@link BatchResponse} indicating the result of the operation.
* @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
- * delivery. An exception here indicates a total failure -- i.e. the messages could not be
- * delivered to any recipient. Partial failures are indicated by a {@link BatchResponse}
+ * delivery. An exception here indicates a total failure, meaning that the messages could not
+ * be delivered to any recipient. Partial failures are indicated by a {@link BatchResponse}
* return value.
+ * @deprecated Use {@link #sendEachForMulticast(MulticastMessage)} instead.
*/
+ @Deprecated
public BatchResponse sendMulticast(
@NonNull MulticastMessage message) throws FirebaseMessagingException {
return sendMulticast(message, false);
}
/**
- * Sends the given multicast message to all the FCM registration tokens specified in it.
+ * Sends the given multicast message to all the FCM registration tokens and/or FIDs
+ * specified in it.
*
- * If the {@code dryRun} option is set to true, the message will not be actually sent. Instead
- * FCM performs all the necessary validations, and emulates the send operation. The {@code dryRun}
- * option is useful for determining whether an FCM registration has been deleted. But it cannot be
- * used to validate APNs tokens.
+ * If the {@code dryRun} option is set to true, the message will not be actually sent.
+ * Instead FCM performs all the necessary validations, and emulates the send operation.
+ * The {@code dryRun} option is useful for determining whether an FCM registration has
+ * been deleted. But it cannot be used to validate APNs tokens.
*
* This method uses the {@link #sendAll(List)} API under the hood to send the given
* message to all the target recipients. The responses list obtained by calling
- * {@link BatchResponse#getResponses()} on the return value corresponds to the order of tokens
- * in the {@link MulticastMessage}.
+ * {@link BatchResponse#getResponses()} on the return value corresponds to the order of
+ * tokens and/or FIDs in the {@link MulticastMessage}. If both tokens and FIDs are
+ * provided, tokens are processed first, followed by FIDs.
*
* @param message A non-null {@link MulticastMessage}.
* @param dryRun A boolean indicating whether to perform a dry run (validation only) of the send.
* @return A {@link BatchResponse} indicating the result of the operation.
* @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
- * delivery. An exception here indicates a total failure -- i.e. the messages could not be
- * delivered to any recipient. Partial failures are indicated by a {@link BatchResponse}
+ * delivery. An exception here indicates a total failure, meaning that the messages could not
+ * be delivered to any recipient. Partial failures are indicated by a {@link BatchResponse}
* return value.
+ * @deprecated Use {@link #sendEachForMulticast(MulticastMessage, boolean)} instead.
*/
+ @Deprecated
public BatchResponse sendMulticast(
@NonNull MulticastMessage message, boolean dryRun) throws FirebaseMessagingException {
checkNotNull(message, "multicast message must not be null");
@@ -261,7 +482,9 @@ public BatchResponse sendMulticast(
* @param message A non-null {@link MulticastMessage}.
* @return An {@code ApiFuture} that will complete with a {@link BatchResponse} when
* the messages have been sent.
+ * @deprecated Use {@link #sendEachForMulticastAsync(MulticastMessage)} instead.
*/
+ @Deprecated
public ApiFuture Instances of this class are thread-safe and immutable. Use {@link MulticastMessage.Builder}
* to create new instances. See {@link FirebaseMessaging#sendMulticast(MulticastMessage)} for
* details on how to send the message to FCM for multicast delivery.
*
- * This class and the associated Builder retain the order of tokens. Therefore the order of
- * the responses list obtained by calling {@link BatchResponse#getResponses()} on the return value
- * of {@link FirebaseMessaging#sendMulticast(MulticastMessage)} corresponds to the order in which
- * tokens were added to the {@link MulticastMessage.Builder}.
+ * This class and the associated Builder retain the order of tokens and FIDs. Therefore
+ * the order of the responses list obtained by calling {@link BatchResponse#getResponses()}
+ * on the return value of {@link FirebaseMessaging#sendMulticast(MulticastMessage)}
+ * corresponds to the order in which targets were added to the
+ * {@link MulticastMessage.Builder}. If both tokens and FIDs are provided, tokens are
+ * processed first, followed by FIDs.
*/
public class MulticastMessage {
+ @Deprecated
private final List You can get an instance of {@link FirebasePhoneNumberVerification} via {@link #getInstance()},
+ * or {@link #getInstance(FirebaseApp)}.
+ */
+public final class FirebasePhoneNumberVerification {
+ private static final String SERVICE_ID = FirebasePhoneNumberVerification.class.getName();
+ private final FirebasePhoneNumberVerificationTokenVerifier tokenVerifier;
+
+ private FirebasePhoneNumberVerification(FirebaseApp app) {
+ this.tokenVerifier = new FirebasePhoneNumberVerificationTokenVerifier(app);
+ }
+
+ /**
+ * Gets the {@link FirebasePhoneNumberVerification} instance for the default {@link FirebaseApp}.
+ *
+ * @return The {@link FirebasePhoneNumberVerification} instance for the default
+ * {@link FirebaseApp}.
+ */
+ public static FirebasePhoneNumberVerification getInstance() {
+ return getInstance(FirebaseApp.getInstance());
+ }
+
+ /**
+ * Gets the {@link FirebasePhoneNumberVerification} instance for the specified
+ * {@link FirebaseApp}.
+ *
+ * @return The {@link FirebasePhoneNumberVerification} instance for the specified
+ * {@link FirebaseApp}.
+ */
+ public static synchronized FirebasePhoneNumberVerification getInstance(FirebaseApp app) {
+ FirebasePhoneNumberVerificationService service =
+ ImplFirebaseTrampolines.getService(app, SERVICE_ID,
+ FirebasePhoneNumberVerificationService.class);
+ if (service == null) {
+ service = ImplFirebaseTrampolines.addService(
+ app, new FirebasePhoneNumberVerificationService(app));
+ }
+ return service.getInstance();
+ }
+
+ /**
+ * Verifies a Firebase Phone Number Verification token (JWT).
+ *
+ * @param phoneNumberVerificationJwt The JWT string to verify.
+ * @return A verified {@link FirebasePhoneNumberVerificationToken}.
+ * @throws FirebasePhoneNumberVerificationException If verification fails.
+ */
+ public FirebasePhoneNumberVerificationToken verifyToken(String phoneNumberVerificationJwt)
+ throws FirebasePhoneNumberVerificationException {
+ return this.tokenVerifier.verifyToken(phoneNumberVerificationJwt);
+ }
+
+ private static class FirebasePhoneNumberVerificationService
+ extends FirebaseServiceFirebaseOptions,
* or if the bucket does not exist.
@@ -84,7 +84,7 @@ public Bucket bucket() {
* Returns a cloud storage Bucket instance for the specified bucket name.
*
* @param name a non-null, non-empty bucket name.
- * @return a cloud storage {@code Bucket}
+ * @return a cloud storage {@code Bucket}
* instance.
* @throws IllegalArgumentException If the bucket name is null, empty, or if the specified
* bucket does not exist.
diff --git a/src/main/java/com/google/firebase/database/ChildEventListener.java b/src/main/java/com/google/firebase/database/ChildEventListener.java
index 65bcdfdce..21f74db54 100644
--- a/src/main/java/com/google/firebase/database/ChildEventListener.java
+++ b/src/main/java/com/google/firebase/database/ChildEventListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/database/DataSnapshot.java b/src/main/java/com/google/firebase/database/DataSnapshot.java
index f1f470505..64fa7f7b7 100644
--- a/src/main/java/com/google/firebase/database/DataSnapshot.java
+++ b/src/main/java/com/google/firebase/database/DataSnapshot.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/database/DatabaseError.java b/src/main/java/com/google/firebase/database/DatabaseError.java
index 456eb99e6..1b0deb059 100644
--- a/src/main/java/com/google/firebase/database/DatabaseError.java
+++ b/src/main/java/com/google/firebase/database/DatabaseError.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/database/DatabaseException.java b/src/main/java/com/google/firebase/database/DatabaseException.java
index c85e93878..a5aff67b8 100644
--- a/src/main/java/com/google/firebase/database/DatabaseException.java
+++ b/src/main/java/com/google/firebase/database/DatabaseException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/database/DatabaseReference.java b/src/main/java/com/google/firebase/database/DatabaseReference.java
index 10dfe40ba..7a1bebac1 100644
--- a/src/main/java/com/google/firebase/database/DatabaseReference.java
+++ b/src/main/java/com/google/firebase/database/DatabaseReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/database/Exclude.java b/src/main/java/com/google/firebase/database/Exclude.java
index e4d90c7da..4eb65dc46 100644
--- a/src/main/java/com/google/firebase/database/Exclude.java
+++ b/src/main/java/com/google/firebase/database/Exclude.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/google/firebase/database/FirebaseDatabase.java b/src/main/java/com/google/firebase/database/FirebaseDatabase.java
index 306ce9274..9dea16566 100644
--- a/src/main/java/com/google/firebase/database/FirebaseDatabase.java
+++ b/src/main/java/com/google/firebase/database/FirebaseDatabase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Google Inc.
+ * Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@
import com.google.firebase.database.utilities.ParsedUrl;
import com.google.firebase.database.utilities.Utilities;
import com.google.firebase.database.utilities.Validation;
+import com.google.firebase.internal.EmulatorCredentials;
import com.google.firebase.internal.FirebaseService;
import com.google.firebase.internal.SdkUtils;
@@ -406,26 +407,4 @@ public void destroy() {
instance.destroy();
}
}
-
- private static class EmulatorCredentials extends GoogleCredentials {
-
- EmulatorCredentials() {
- super(newToken());
- }
-
- private static AccessToken newToken() {
- return new AccessToken("owner",
- new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1)));
- }
-
- @Override
- public AccessToken refreshAccessToken() {
- return newToken();
- }
-
- @Override
- public Map> responsesFuture = ApiFutures.allAsList(list);
+
+ // Chain this future to wrap the eventual responses in a BatchResponse without blocking
+ // the main thread. This uses the current thread to execute, but since the transformation
+ // function is non-blocking the transformation itself is also non-blocking.
+ return ApiFutures.transform(
+ responsesFuture,
+ (responses) -> {
+ return new BatchResponseImpl(responses);
+ },
+ MoreExecutors.directExecutor());
+ }
+
+ private CallableOperation