Remove network type information from NetworkUtils (#4996)

* Remove network type information from NetworkUtils

* Ignore dependent tests
This commit is contained in:
Madhur Gupta 2022-06-28 08:41:09 +05:30 committed by GitHub
parent e5e5a8df91
commit d45123d53e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -49,6 +49,8 @@ public class NetworkUtils {
return NetworkConnectionType.WIFI; return NetworkConnectionType.WIFI;
} }
// TODO for Android 12+ request permission from user is mandatory
/*
int mobileNetwork = telephonyManager.getNetworkType(); int mobileNetwork = telephonyManager.getNetworkType();
switch (mobileNetwork) { switch (mobileNetwork) {
case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_GPRS:
@ -71,6 +73,8 @@ public class NetworkUtils {
default: default:
return NetworkConnectionType.UNKNOWN; return NetworkConnectionType.UNKNOWN;
} }
*/
return NetworkConnectionType.UNKNOWN;
} }
/** /**

View file

@ -8,6 +8,7 @@ import android.telephony.TelephonyManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import fr.free.nrw.commons.utils.model.NetworkConnectionType; import fr.free.nrw.commons.utils.model.NetworkConnectionType;
@ -97,6 +98,7 @@ public class NetworkUtilsTest {
} }
@Test @Test
@Ignore("Fix these test with telemetry permission")
public void testCellular2GNetwork() { public void testCellular2GNetwork() {
Context mockContext = mock(Context.class); Context mockContext = mock(Context.class);
Application mockApplication = mock(Application.class); Application mockApplication = mock(Application.class);
@ -123,6 +125,7 @@ public class NetworkUtilsTest {
} }
@Test @Test
@Ignore("Fix these test with telemetry permission")
public void testCellular3GNetwork() { public void testCellular3GNetwork() {
Context mockContext = mock(Context.class); Context mockContext = mock(Context.class);
Application mockApplication = mock(Application.class); Application mockApplication = mock(Application.class);
@ -149,6 +152,7 @@ public class NetworkUtilsTest {
} }
@Test @Test
@Ignore("Fix these test with telemetry permission")
public void testCellular4GNetwork() { public void testCellular4GNetwork() {
Context mockContext = mock(Context.class); Context mockContext = mock(Context.class);
Application mockApplication = mock(Application.class); Application mockApplication = mock(Application.class);