@@ -46,16 +46,19 @@ public class ConnectivityServiceImpl implements ConnectivityService {
4646 private final ConnectivityManager .NetworkCallback networkCallback = new ConnectivityManager .NetworkCallback () {
4747 @ Override
4848 public void onAvailable (@ NonNull Network network ) {
49+ Log_OC .d (TAG , "network available" );
4950 updateConnectivity ();
5051 }
5152
5253 @ Override
5354 public void onLost (@ NonNull Network network ) {
55+ Log_OC .w (TAG , "connection lost" );
5456 updateConnectivity ();
5557 }
5658
5759 @ Override
5860 public void onCapabilitiesChanged (@ NonNull Network network , @ NonNull NetworkCapabilities networkCapabilities ) {
61+ Log_OC .d (TAG , "capability changed" );
5962 updateConnectivity ();
6063 }
6164 };
@@ -81,17 +84,20 @@ public ConnectivityServiceImpl(@NonNull Context context,
8184 // Register callback for real-time network updates
8285 connectivityManager .registerDefaultNetworkCallback (networkCallback );
8386 updateConnectivity ();
87+ Log_OC .d (TAG , "connectivity service constructed" );
8488 }
8589
8690 public void updateConnectivity () {
8791 Network activeNetwork = connectivityManager .getActiveNetwork ();
8892 if (activeNetwork == null ) {
93+ Log_OC .w (TAG , "active network is null, connectivity is disconnected" );
8994 currentConnectivity = Connectivity .DISCONNECTED ;
9095 return ;
9196 }
9297
9398 NetworkCapabilities capabilities = connectivityManager .getNetworkCapabilities (activeNetwork );
9499 if (capabilities == null ) {
100+ Log_OC .w (TAG , "capabilities is null, connectivity is disconnected" );
95101 currentConnectivity = Connectivity .DISCONNECTED ;
96102 return ;
97103 }
@@ -119,6 +125,7 @@ private boolean isSupportedTransport(@NonNull NetworkCapabilities capabilities)
119125 public void isNetworkAndServerAvailable (@ NonNull GenericCallback <Boolean > callback ) {
120126 executor .execute (() -> {
121127 boolean available = !isInternetWalled ();
128+ Log_OC .d (TAG , "isNetworkAndServerAvailable: " + available );
122129 mainThreadHandler .post (() -> callback .onComplete (available ));
123130 });
124131 }
@@ -132,6 +139,7 @@ public boolean isConnected() {
132139 public boolean isInternetWalled () {
133140 Boolean cached = walledCheckCache .getValue ();
134141 if (cached != null ) {
142+ Log_OC .d (TAG , "isInternetWalled(): cached value is used, isWalled: " + cached );
135143 return cached ;
136144 }
137145
@@ -144,6 +152,7 @@ public boolean isInternetWalled() {
144152 currentConnectivity .isMetered ()) {
145153 final var result = !currentConnectivity .isConnected ();
146154 walledCheckCache .setValue (result );
155+ Log_OC .d (TAG , "isInternetWalled(): early return conditions are not matched, isWalled: " + result );
147156 return result ;
148157 }
149158
@@ -167,6 +176,7 @@ public boolean isInternetWalled() {
167176 }
168177
169178 walledCheckCache .setValue (isWalled );
179+ Log_OC .d (TAG , "isInternetWalled(): server check, isWalled: " + isWalled );
170180 return isWalled ;
171181 }
172182
0 commit comments