File tree 1 file changed +9
-8
lines changed
transport/transport-runtime/src/main/java/com/google/android/datatransport/runtime 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 19
19
import androidx .annotation .WorkerThread ;
20
20
import com .google .android .datatransport .Priority ;
21
21
import com .google .android .datatransport .Transport ;
22
+ import com .google .android .datatransport .runtime .logging .Logging ;
22
23
23
24
@ Discouraged (
24
25
message =
25
26
"TransportRuntime is not a realtime delivery system, don't use unless you absolutely must." )
26
27
public final class ForcedSender {
28
+ private static final String LOG_TAG = "ForcedSender" ;
29
+
30
+ @ SuppressLint ("DiscouragedApi" )
27
31
@ WorkerThread
28
32
public static void sendBlocking (Transport <?> transport , Priority priority ) {
29
- @ SuppressLint ("DiscouragedApi" )
30
- TransportContext context = getTransportContextOrThrow (transport ).withPriority (priority );
31
- TransportRuntime .getInstance ().getUploader ().logAndUpdateState (context , 1 );
32
- }
33
-
34
- private static TransportContext getTransportContextOrThrow (Transport <?> transport ) {
35
33
if (transport instanceof TransportImpl ) {
36
- return ((TransportImpl <?>) transport ).getTransportContext ();
34
+ TransportContext context =
35
+ ((TransportImpl <?>) transport ).getTransportContext ().withPriority (priority );
36
+ TransportRuntime .getInstance ().getUploader ().logAndUpdateState (context , 1 );
37
+ } else {
38
+ Logging .w (LOG_TAG , "Expected instance of `TransportImpl`, got `%s`." , transport );
37
39
}
38
- throw new IllegalArgumentException ("Expected instance of TransportImpl." );
39
40
}
40
41
41
42
private ForcedSender () {}
You can’t perform that action at this time.
0 commit comments