Skip to content

Commit f640d70

Browse files
committed
Log warning when given wrong type.
1 parent 98309d0 commit f640d70

File tree

1 file changed

+7
-0
lines changed
  • transport/transport-runtime/src/main/java/com/google/android/datatransport/runtime

1 file changed

+7
-0
lines changed

transport/transport-runtime/src/main/java/com/google/android/datatransport/runtime/ForcedSender.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,28 @@
1414

1515
package com.google.android.datatransport.runtime;
1616

17+
import android.annotation.SuppressLint;
1718
import androidx.annotation.Discouraged;
1819
import androidx.annotation.WorkerThread;
1920
import com.google.android.datatransport.Priority;
2021
import com.google.android.datatransport.Transport;
22+
import com.google.android.datatransport.runtime.logging.Logging;
2123

2224
@Discouraged(
2325
message =
2426
"TransportRuntime is not a realtime delivery system, don't use unless you absolutely must.")
2527
public final class ForcedSender {
28+
private static final String LOG_TAG = "ForcedSender";
29+
30+
@SuppressLint("DiscouragedApi")
2631
@WorkerThread
2732
public static void sendBlocking(Transport<?> transport, Priority priority) {
2833
if (transport instanceof TransportImpl) {
2934
TransportContext context =
3035
((TransportImpl<?>) transport).getTransportContext().withPriority(priority);
3136
TransportRuntime.getInstance().getUploader().logAndUpdateState(context, 1);
37+
} else {
38+
Logging.w(LOG_TAG, "Expected instance of `TransportImpl`, got `%s`.", transport);
3239
}
3340
}
3441

0 commit comments

Comments
 (0)