移除大部分第三方SDK
This commit is contained in:
@ -6,27 +6,21 @@ import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.gh.common.exposure.meta.MetaUtil;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.utils.Util_System_Phone_State;
|
||||
import com.tencent.stat.StatConfig;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.Reader;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
@ -51,10 +45,10 @@ public class DeviceUtils {
|
||||
object.put("mac", getMac(context));
|
||||
object.put("model", MODEL);
|
||||
object.put("manufacturer", MANUFACTURER);
|
||||
object.put("android_id", Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||
object.put("android_id", MetaUtil.getAndroidId());
|
||||
object.put("android_sdk", Build.VERSION.SDK_INT);
|
||||
object.put("android_version", android.os.Build.VERSION.RELEASE);
|
||||
object.put("ip", getIPAddress(context));
|
||||
object.put("ip", "");
|
||||
object.put("network", getNetwork(context));
|
||||
return object;
|
||||
}
|
||||
@ -64,9 +58,9 @@ public class DeviceUtils {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("IMEI", MetaUtil.getIMEI());
|
||||
object.put("ANDROID_ID", Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||
object.put("ANDROID_ID", MetaUtil.getAndroidId());
|
||||
object.put("MAC", getMac(context));
|
||||
object.put("MTA_ID", StatConfig.getMid(context));
|
||||
// object.put("MTA_ID", StatConfig.getMid(context));
|
||||
object.put("MANUFACTURER", MANUFACTURER);
|
||||
object.put("MODEL", MODEL);
|
||||
object.put("ANDROID_SDK", Build.VERSION.SDK_INT);
|
||||
@ -79,39 +73,39 @@ public class DeviceUtils {
|
||||
}
|
||||
|
||||
public static String getMac(Context context) {
|
||||
String str = "";
|
||||
String macSerial = "";
|
||||
try {
|
||||
Process pp = Runtime.getRuntime().exec(
|
||||
"cat /sys/class/net/wlan0/address ");
|
||||
InputStreamReader ir = new InputStreamReader(pp.getInputStream());
|
||||
LineNumberReader input = new LineNumberReader(ir);
|
||||
|
||||
while (null != str) {
|
||||
str = input.readLine();
|
||||
if (str != null) {
|
||||
macSerial = str.trim();// 去空格
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if ("".equals(macSerial)) {
|
||||
try {
|
||||
return loadFileAsString("/sys/class/net/eth0/address")
|
||||
.toUpperCase().substring(0, 17);
|
||||
} catch (FileNotFoundException e) {
|
||||
// do nothing
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
if (TextUtils.isEmpty(macSerial)) { // 备用方案
|
||||
macSerial = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo().getMacAddress();
|
||||
}
|
||||
return macSerial;
|
||||
// String str = "";
|
||||
// String macSerial = "";
|
||||
// try {
|
||||
// Process pp = Runtime.getRuntime().exec(
|
||||
// "cat /sys/class/net/wlan0/address ");
|
||||
// InputStreamReader ir = new InputStreamReader(pp.getInputStream());
|
||||
// LineNumberReader input = new LineNumberReader(ir);
|
||||
//
|
||||
// while (null != str) {
|
||||
// str = input.readLine();
|
||||
// if (str != null) {
|
||||
// macSerial = str.trim();// 去空格
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// if ("".equals(macSerial)) {
|
||||
// try {
|
||||
// return loadFileAsString("/sys/class/net/eth0/address")
|
||||
// .toUpperCase().substring(0, 17);
|
||||
// } catch (FileNotFoundException e) {
|
||||
// // do nothing
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// if (TextUtils.isEmpty(macSerial)) { // 备用方案
|
||||
// macSerial = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo().getMacAddress();
|
||||
// }
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String loadFileAsString(String fileName) throws Exception {
|
||||
@ -243,8 +237,7 @@ public class DeviceUtils {
|
||||
|
||||
@Nullable
|
||||
public static String getTelephonySubscriberId(Context context) {
|
||||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return tm.getSubscriberId();
|
||||
return "";
|
||||
}
|
||||
|
||||
// ping domain
|
||||
|
||||
Reference in New Issue
Block a user