Commit 95b4e97a authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

More logs

parent 7f678459
......@@ -474,14 +474,13 @@ public class AndroidPlatformHelper {
}
Log.i("[Platform Helper] Network should be reachable");
Network network = mConnectivityManager.getActiveNetwork();
if (network == null) {
Log.e("[Platform Helper] getActiveNetwork() returned null !");
NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
if (networkInfo == null) {
Log.e("[Platform Helper] getActiveNetworkInfo() returned null !");
setNetworkReachable(mNativePtr, false);
return;
}
NetworkInfo networkInfo = mConnectivityManager.getNetworkInfo(network);
Log.i("[Platform Helper] Active network type is " + networkInfo.getTypeName());
if (!networkInfo.isAvailable()) {
Log.e("[Platform Helper] getActiveNetwork() isn't available !");
......@@ -494,6 +493,7 @@ public class AndroidPlatformHelper {
return;
}
Log.i("[Platform Helper] Active network state " + networkInfo.getState() + " / " + networkInfo.getDetailedState());
int currentNetworkType = networkInfo.getType();
if (mLastNetworkType != -1 && mLastNetworkType != currentNetworkType) {
Log.i("[Platform Helper] Network type has changed (last one was " + mLastNetworkType + "), disable network reachability first");
......@@ -519,6 +519,7 @@ public class AndroidPlatformHelper {
private synchronized void startNetworkMonitoring() {
if (!mMonitoringEnabled) return;
mNetworkManager = new NetworkManager(this);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mNetworkManager = new NetworkManager(this);
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
......
......@@ -44,6 +44,7 @@ public class NetworkManager extends BroadcastReceiver implements NetworkManagerI
@Override
public void onReceive(Context context, Intent intent) {
mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
Log.i("[Platform Helper] [Network Manager] Broadcast receiver called");
if (mHelper != null) {
mHelper.postNetworkUpdateRunner();
}
......
......@@ -19,13 +19,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
package org.linphone.core.tools;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.Build;
......@@ -49,9 +49,29 @@ public class NetworkManagerAbove21 implements NetworkManagerInterface {
@Override
public void onLost(Network network) {
Log.i("[Platform Helper] [Network Manager 21] A network is lost");
Log.i("[Platform Helper] [Network Manager 21] A network has been lost");
mHelper.postNetworkUpdateRunner();
}
@Override
public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) {
Log.i("[Platform Helper] [Network Manager 21] onCapabilitiesChanged " + network.toString() + ", " + networkCapabilities.toString());
}
@Override
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
Log.i("[Platform Helper] [Network Manager 21] onLinkPropertiesChanged " + network.toString() + ", " + linkProperties.toString());
}
@Override
public void onLosing(Network network, int maxMsToLive) {
Log.i("[Platform Helper] [Network Manager 21] onLosing " + network.toString());
}
@Override
public void onUnavailable() {
Log.i("[Platform Helper] [Network Manager 21] onUnavailable");
}
};
}
......
......@@ -20,14 +20,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
package org.linphone.core.tools;
import android.Manifest;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkCapabilities;
import android.net.ProxyInfo;
import android.net.NetworkRequest;
import android.os.Build;
......@@ -52,9 +52,29 @@ public class NetworkManagerAbove24 implements NetworkManagerInterface {
@Override
public void onLost(Network network) {
Log.i("[Platform Helper] [Network Manager 24] A network is lost");
Log.i("[Platform Helper] [Network Manager 24] A network has been lost");
mHelper.postNetworkUpdateRunner();
}
@Override
public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) {
Log.i("[Platform Helper] [Network Manager 24] onCapabilitiesChanged " + network.toString() + ", " + networkCapabilities.toString());
}
@Override
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
Log.i("[Platform Helper] [Network Manager 24] onLinkPropertiesChanged " + network.toString() + ", " + linkProperties.toString());
}
@Override
public void onLosing(Network network, int maxMsToLive) {
Log.i("[Platform Helper] [Network Manager 24] onLosing " + network.toString());
}
@Override
public void onUnavailable() {
Log.i("[Platform Helper] [Network Manager 24] onUnavailable");
}
};
}
......
......@@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
package org.linphone.core.tools;
import android.Manifest;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
......@@ -54,18 +52,28 @@ public class NetworkManagerAbove26 implements NetworkManagerInterface {
@Override
public void onLost(Network network) {
Log.i("[Platform Helper] [Network Manager 26] A network is lost");
Log.i("[Platform Helper] [Network Manager 26] A network has been lost");
mHelper.updateNetworkReachability();
}
@Override
public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) {
Log.i("[Platform Helper] [Network Manager 26] A network capabilities has changed: " + network.toString() + " : " + networkCapabilities.toString() + " (" + networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) + ")");
Log.i("[Platform Helper] [Network Manager 26] onCapabilitiesChanged " + network.toString() + ", " + networkCapabilities.toString());
}
@Override
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
Log.i("[Platform Helper] [Network Manager 26] A network link properties has changed: " + network.toString() + " : " + linkProperties.toString());
Log.i("[Platform Helper] [Network Manager 26] onLinkPropertiesChanged " + network.toString() + ", " + linkProperties.toString());
}
@Override
public void onLosing(Network network, int maxMsToLive) {
Log.i("[Platform Helper] [Network Manager 26] onLosing " + network.toString());
}
@Override
public void onUnavailable() {
Log.i("[Platform Helper] [Network Manager 26] onUnavailable");
}
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment