implement ConnectivityManager using GNetworkMonitor

This commit is contained in:
Julian Winkler
2024-03-17 18:36:48 +01:00
parent 14217e8724
commit b14549e639
5 changed files with 93 additions and 9 deletions

View File

@@ -1,20 +1,25 @@
package android.net;
class Network {}
public class ConnectivityManager {
public class NetworkCallback {}
public class NetworkCallback {
public void onAvailable(Network network) {}
public void onLost(Network network) {}
}
public NetworkInfo getNetworkInfo(int networkType) {
return null; // this means the network type is not supported, which should make properly coded apps cease any attempts to use network-related APIs
}
public NetworkInfo getActiveNetworkInfo() {
return new NetworkInfo();
return new NetworkInfo(nativeGetNetworkAvailable());
}
public void registerNetworkCallback(NetworkRequest request, NetworkCallback callback) {}
public native void registerNetworkCallback(NetworkRequest request, NetworkCallback callback);
public boolean isActiveNetworkMetered() {
return false;
}
public native boolean isActiveNetworkMetered();
protected native boolean nativeGetNetworkAvailable();
}