1、自行车模型、小巴模型还未更换
2、更新AiSDK=升级日志模块

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-19 21:52:05 +08:00
parent 26d1dfb20a
commit fa86e69213
8 changed files with 373 additions and 92 deletions

View File

@@ -258,12 +258,10 @@ class DebugSettingView @JvmOverloads constructor(
LogUtils.getConfig().isLogSwitch = false
Logger.init(LogLevel.OFF)
com.mogo.utils.logger.Logger.init(com.mogo.utils.logger.LogLevel.OFF)
com.mogo.cloud.utils.logger.Logger.init(com.mogo.cloud.utils.logger.LogLevel.OFF)
} else {
LogUtils.getConfig().isLogSwitch = true
Logger.init(LogLevel.DEBUG)
com.mogo.utils.logger.Logger.init(com.mogo.utils.logger.LogLevel.DEBUG)
com.mogo.cloud.utils.logger.Logger.init(com.mogo.cloud.utils.logger.LogLevel.DEBUG)
}
}
tbADASLog.setOnCheckedChangeListener { buttonView, isChecked ->

View File

@@ -0,0 +1,107 @@
package com.mogo.eagle.core.utilcode.mogo;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* 设备信息
*/
public class DevicesUtils {
private static final String PROPERTIES = "android.os.SystemProperties";
private static final String GSM_SERIAL = "gsm.serial";
private static final String GET = "get";
public static String getSn(){
return getSystemProperties(GSM_SERIAL);
}
public static String getSystemProperties(String name ) {
String value = "";
try {
Class< ? > c = Class.forName( PROPERTIES );
Method get = c.getMethod( GET, String.class );
value = (String) get.invoke( c, name );
} catch ( ClassNotFoundException var3 ) {
var3.printStackTrace();
} catch ( NoSuchMethodException var4 ) {
var4.printStackTrace();
} catch ( InvocationTargetException var5 ) {
var5.printStackTrace();
} catch ( IllegalAccessException var6 ) {
var6.printStackTrace();
}
return value;
}
public static String getNetworkTypeName(Context context) {
String typeName = "unknown";
if (context != null) {
ConnectivityManager connectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager == null) {
return typeName;
}
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if (networkInfo != null) {
typeName = networkInfo.getTypeName();
}
}
return typeName;
}
public static int getNetworkType(Context context) {
if (context != null) {
ConnectivityManager connectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetInfo != null) {
return activeNetInfo.getType();
}
}
}
return -1;
}
public static boolean isSdkHigherThan18() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
}
public static String getVersionName(Context context) {
String appVersion = "";
try {
if (context != null) {
String packageName = context.getApplicationInfo().packageName;
appVersion = context.getPackageManager().getPackageInfo(packageName, 0).versionName;
}
} catch (Exception e) {
e.printStackTrace();
}
return appVersion;
}
public static int getVersionCode(Context context) {
String pkgName = context.getPackageName();
try {
PackageInfo e = context.getPackageManager().getPackageInfo(pkgName, 0);
if (e != null) {
return e.versionCode;
}
} catch (Exception var2) {
var2.printStackTrace();
}
return 1;
}
}

View File

@@ -0,0 +1,172 @@
package com.mogo.eagle.core.utilcode.mogo;
import android.content.Context;
import android.net.ConnectivityManager;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* @author wangzhiyuan
* @since 2018/2/7
*/
public class TelephoneUtil {
public static String sn = "";
public static String fotaVersion = "";
public static String fotaDevice = "";
public static String imei = "";
public static String iccid = "";
public static String vin = "";
public static String getFotaDevice() {
if (TextUtils.isEmpty(fotaDevice)) {
String device = "";
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
device = (String) get.invoke(c, "ro.fota.device");
if (!TextUtils.isEmpty(device)) {
device = device.trim();
}
} catch (Exception e) {
e.printStackTrace();
}
fotaDevice = device;
}
return fotaDevice;
}
public static String getFotaVersion() {
if (TextUtils.isEmpty(fotaVersion)) {
String version = "";
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
version = (String) get.invoke(c, "ro.fota.version");
if (!TextUtils.isEmpty(version)) {
version = version.trim();
}
} catch (Exception e) {
e.printStackTrace();
}
fotaVersion = version;
}
return fotaVersion;
}
public static boolean getMobileDataState(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// Android 5.0之前
ConnectivityManager conMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
Class<?> conMgrClass = null;
Object iConMgr = null;
try {
conMgrClass = Class.forName(conMgr.getClass().getName());//ConnectivityManager
Field iConMgrField = conMgrClass.getDeclaredField("mService");//IConnectivityManager
iConMgrField.setAccessible(true);
iConMgr = iConMgrField.get(conMgr);//获得ConnectivityManager的IConnectivityManager实例
Class<?> iConMgrClass = Class.forName(iConMgr.getClass().getName());
Method getMobileDataEnabledMethod = iConMgrClass.getDeclaredMethod("getMobileDataEnabled");
if (getMobileDataEnabledMethod != null) {
getMobileDataEnabledMethod.setAccessible(true);
boolean result = (Boolean) getMobileDataEnabledMethod.invoke(iConMgr);
Logger.d("TelephoneUtil", "getMobileDataEnabled = " + result);
return result;
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
// Android 5.0之后(包含)
TelephonyManager telephonyService = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try {
Method getDataEnabled = telephonyService.getClass().getDeclaredMethod("getDataEnabled");
if (null != getDataEnabled) {
boolean result = (Boolean) getDataEnabled.invoke(telephonyService);
Logger.d("TelephoneUtil", "getDataEnabled = " + result);
return result;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
public static void setMobileDataState(Context context, boolean enable) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// Android 5.0之前
ConnectivityManager conMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
Class<?> conMgrClass = null;
Object iConMgr = null;
try {
conMgrClass = Class.forName(conMgr.getClass().getName());//ConnectivityManager
Field iConMgrField = conMgrClass.getDeclaredField("mService");//IConnectivityManager
iConMgrField.setAccessible(true);
iConMgr = iConMgrField.get(conMgr);//获得ConnectivityManager的IConnectivityManager实例
Class<?> iConMgrClass = Class.forName(iConMgr.getClass().getName());
Method setMobileDataEnabledMethod = iConMgrClass.getDeclaredMethod("setMobileDataEnabled", boolean.class);
if (setMobileDataEnabledMethod != null) {
setMobileDataEnabledMethod.setAccessible(true);
setMobileDataEnabledMethod.invoke(iConMgr, enable);
Logger.d("TelephoneUtil", "setMobileDataEnabled = " + enable);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
// Android 5.0之后(包含)
try {
TelephonyManager telephonyService = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Method setDataEnabledMethod = telephonyService.getClass().getDeclaredMethod("setDataEnabled", boolean.class);
if (null != setDataEnabledMethod) {
setDataEnabledMethod.invoke(telephonyService, enable);
Logger.d("TelephoneUtil", "setDataEnabled = " + enable);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static String getSerialNumber() {
if (TextUtils.isEmpty(sn)) {
String serial = "";
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
serial = (String) get.invoke(c, "zhidao.serial");
if (TextUtils.isEmpty(serial)) {
serial = (String) get.invoke(c, "gsm.serial");
}
if (TextUtils.isEmpty(serial)) {
serial = (String) get.invoke(c, "ro.serialno");
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (serial.startsWith("ZD") || serial.startsWith("XT")) {
sn = serial;
} else {
return serial;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return sn;
}
}