diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 2968dd1c4a..264706ea3f 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -27,7 +27,6 @@ - diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index ba5c4d9161..06b0bf1efa 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -9,8 +9,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Resources; import android.net.Uri; -import android.net.wifi.WifiInfo; -import android.net.wifi.WifiManager; import android.os.Build; import android.provider.Settings; import android.text.SpannableStringBuilder; @@ -21,7 +19,6 @@ import android.util.AndroidRuntimeException; import android.view.View; import android.view.Window; import android.widget.Toast; - import androidx.annotation.DimenRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -31,6 +28,7 @@ import androidx.core.app.NavUtils; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import com.google.android.material.snackbar.Snackbar; + import com.mapswithme.maps.BuildConfig; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; @@ -42,16 +40,12 @@ import com.mapswithme.util.log.LoggerFactory; import java.io.Closeable; import java.io.IOException; import java.lang.ref.WeakReference; -import java.net.NetworkInterface; -import java.security.MessageDigest; import java.text.DateFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Calendar; -import java.util.Collections; import java.util.Currency; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -386,76 +380,6 @@ public class Utils }).show(); } - @NonNull - public static String getMacAddress(@NonNull Context context, boolean md5Decoded) - { - byte[] macBytes = null; - String address = ""; - try - { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - { - WifiManager manager = (WifiManager) context.getApplicationContext(). - getSystemService(Context.WIFI_SERVICE); - if (manager == null) - return ""; - WifiInfo info = manager.getConnectionInfo(); - address = info.getMacAddress(); - macBytes = address.getBytes(); - } - else - { - List all = Collections.list(NetworkInterface.getNetworkInterfaces()); - for (NetworkInterface nif : all) - { - if (!nif.getName().equalsIgnoreCase("wlan0")) - continue; - - macBytes = nif.getHardwareAddress(); - if (macBytes == null) - return ""; - - StringBuilder result = new StringBuilder(); - for (int i = 0; i < macBytes.length; i++) - { - result.append(String.format("%02X", (0xFF & macBytes[i]))); - if (i + 1 != macBytes.length) - result.append(":"); - } - address = result.toString(); - } - } - } - catch (Exception exc) - { - return ""; - } - return md5Decoded ? decodeMD5(macBytes) : address; - } - - @NonNull - private static String decodeMD5(@Nullable byte[] bytes) - { - if (bytes == null || bytes.length == 0) - return ""; - - try - { - MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); - digest.update(bytes); - byte[] messageDigest = digest.digest(); - - StringBuilder hexString = new StringBuilder(); - for (int i = 0; i < messageDigest.length; i++) - hexString.append(String.format("%02X", (0xFF & messageDigest[i]))); - return hexString.toString(); - } - catch (Exception e) - { - return ""; - } - } - public static boolean isAppInstalled(@NonNull Context context, @NonNull String packageName) { try