Commit afeedf26 by sikang

update DeviceInfo

parent 68803fe0
......@@ -13,11 +13,16 @@ import java.util.UUID;
*/
public class DeviceInfo {
private static final String SIGN_PATH = Environment.getExternalStorageDirectory() + "/sw_config/device.json";
public static String DEVICE_SIGN = "";
public static String SD_SIGN = "";
/**
* 读取SD卡中的设备指纹
*/
public static String getDeviceSignFromSD() {
if (!TextUtils.isEmpty(SD_SIGN)) {
return SD_SIGN;
}
String device_sign = "";
File file = new File(SIGN_PATH);
if (file.exists()) {
......@@ -39,10 +44,11 @@ public class DeviceInfo {
}
//如果取不到就生成一个新的
if (TextUtils.isEmpty(device_sign)) {
return writeSDSign();
} else {
return device_sign;
device_sign = writeSDSign();
}
SD_SIGN = device_sign;
return SD_SIGN;
}
/**
......@@ -76,7 +82,9 @@ public class DeviceInfo {
* 根据硬件信息计算设备指纹
*/
public static String getSignFromHardware() {
if (!TextUtils.isEmpty(DEVICE_SIGN)) {
return DEVICE_SIGN;
}
String device_id = Build.BOARD + Build.BRAND +
Build.CPU_ABI + Build.DEVICE +
Build.DISPLAY + Build.HOST +
......@@ -85,7 +93,8 @@ public class DeviceInfo {
Build.TAGS + Build.TYPE +
Build.USER;
return StringUtils.MD5(device_id);
DEVICE_SIGN = StringUtils.MD5(device_id);
return DEVICE_SIGN;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment