Skip to content

Commit 4535883

Browse files
Add API Level check
1 parent a4ff139 commit 4535883

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/AbstractStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ private void close(State finalState, Status status) {
274274
if (Datastore.isSslHandshakeError(status)) {
275275
// The Android device is missing required SSL Ciphers. This error is non-recoverable and must
276276
// be addressed by the app developer (see https://bit.ly/2XFpdma).
277-
Util.crashMainThead(
277+
Util.crashMainThread(
278278
new IllegalStateException(SSL_DEPENDENCY_ERROR_MESSAGE, status.getCause()));
279279
}
280280

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/Datastore.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.google.firebase.firestore.remote;
1616

1717
import android.content.Context;
18+
import android.os.Build;
1819
import com.google.android.gms.tasks.Task;
1920
import com.google.firebase.firestore.FirebaseFirestoreException;
2021
import com.google.firebase.firestore.auth.CredentialsProvider;
@@ -230,7 +231,8 @@ public static boolean isSslHandshakeError(Status status) {
230231
Status.Code code = status.getCode();
231232
Throwable t = status.getCause();
232233

233-
return code.equals(Status.Code.UNAVAILABLE)
234+
return Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
235+
&& code.equals(Status.Code.UNAVAILABLE)
234236
&& (t instanceof SSLHandshakeException
235237
|| (t instanceof ConnectException && t.getMessage().contains("EHOSTUNREACH")));
236238
}

firebase-firestore/src/main/java/com/google/firebase/firestore/util/Util.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ public static String typeName(@Nullable Object obj) {
214214
return obj == null ? "null" : obj.getClass().getName();
215215
}
216216

217-
/** Raises an exception on Android's UI Thread. */
218-
public static void crashMainThead(RuntimeException exception) {
217+
/** Raises an exception on Android's UI Thread and crashes the end user's app. */
218+
public static void crashMainThread(RuntimeException exception) {
219219
new Handler(Looper.getMainLooper())
220220
.post(
221221
() -> {

0 commit comments

Comments
 (0)