15
15
package com .google .firebase .firestore .remote ;
16
16
17
17
import android .content .Context ;
18
- import androidx .annotation .VisibleForTesting ;
19
18
import com .google .android .gms .common .GooglePlayServicesNotAvailableException ;
20
19
import com .google .android .gms .common .GooglePlayServicesRepairableException ;
21
20
import com .google .android .gms .security .ProviderInstaller ;
25
24
import com .google .firebase .firestore .util .AsyncQueue ;
26
25
import com .google .firebase .firestore .util .Executors ;
27
26
import com .google .firebase .firestore .util .Logger ;
28
- import com .google .firebase .firestore .util .Supplier ;
29
27
import com .google .firestore .v1 .FirestoreGrpc ;
30
28
import io .grpc .CallCredentials ;
31
29
import io .grpc .CallOptions ;
@@ -43,26 +41,11 @@ public class GrpcCallProvider {
43
41
44
42
private static final String LOG_TAG = "GrpcCallProvider" ;
45
43
46
- private static Supplier <ManagedChannelBuilder <?>> overrideChannelBuilderSupplier ;
47
-
48
44
private final Task <ManagedChannel > channelTask ;
49
45
private final AsyncQueue asyncQueue ;
50
46
51
47
private CallOptions callOptions ;
52
48
53
- /**
54
- * Helper function to globally override the channel that RPCs use. Useful for testing when you
55
- * want to bypass SSL certificate checking.
56
- *
57
- * @param channelBuilderSupplier The supplier for a channel builder that is used to create gRPC
58
- * channels.
59
- */
60
- @ VisibleForTesting
61
- public static void overrideChannelBuilder (
62
- Supplier <ManagedChannelBuilder <?>> channelBuilderSupplier ) {
63
- overrideChannelBuilderSupplier = channelBuilderSupplier ;
64
- }
65
-
66
49
GrpcCallProvider (
67
50
AsyncQueue asyncQueue ,
68
51
Context context ,
@@ -105,16 +88,12 @@ private ManagedChannel initChannel(Context context, DatabaseInfo databaseInfo) {
105
88
Logger .warn (LOG_TAG , "Failed to update ssl context: %s" , e );
106
89
}
107
90
108
- ManagedChannelBuilder <?> channelBuilder ;
109
- if (overrideChannelBuilderSupplier != null ) {
110
- channelBuilder = overrideChannelBuilderSupplier .get ();
111
- } else {
112
- channelBuilder = ManagedChannelBuilder .forTarget (databaseInfo .getHost ());
113
- if (!databaseInfo .isSslEnabled ()) {
114
- // Note that the boolean flag does *NOT* switch the wire format from Protobuf to Plaintext.
115
- // It merely turns off SSL encryption.
116
- channelBuilder .usePlaintext ();
117
- }
91
+ ManagedChannelBuilder <?> channelBuilder =
92
+ ManagedChannelBuilder .forTarget (databaseInfo .getHost ());
93
+ if (!databaseInfo .isSslEnabled ()) {
94
+ // Note that the boolean flag does *NOT* switch the wire format from Protobuf to Plaintext.
95
+ // It merely turns off SSL encryption.
96
+ channelBuilder .usePlaintext ();
118
97
}
119
98
120
99
// Ensure gRPC recovers from a dead connection. (Not typically necessary, as the OS will
0 commit comments