Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cash_plugin_toolbox
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
cash_plugin_toolbox
Commits
afeedf26
Commit
afeedf26
authored
Jun 20, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update DeviceInfo
parent
68803fe0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
src/main/java/com/common/toolbox/app_utils/DeviceInfo.java
+14
-5
No files found.
src/main/java/com/common/toolbox/app_utils/DeviceInfo.java
View file @
afeedf26
...
@@ -13,11 +13,16 @@ import java.util.UUID;
...
@@ -13,11 +13,16 @@ import java.util.UUID;
*/
*/
public
class
DeviceInfo
{
public
class
DeviceInfo
{
private
static
final
String
SIGN_PATH
=
Environment
.
getExternalStorageDirectory
()
+
"/sw_config/device.json"
;
private
static
final
String
SIGN_PATH
=
Environment
.
getExternalStorageDirectory
()
+
"/sw_config/device.json"
;
public
static
String
DEVICE_SIGN
=
""
;
public
static
String
SD_SIGN
=
""
;
/**
/**
* 读取SD卡中的设备指纹
* 读取SD卡中的设备指纹
*/
*/
public
static
String
getDeviceSignFromSD
()
{
public
static
String
getDeviceSignFromSD
()
{
if
(!
TextUtils
.
isEmpty
(
SD_SIGN
))
{
return
SD_SIGN
;
}
String
device_sign
=
""
;
String
device_sign
=
""
;
File
file
=
new
File
(
SIGN_PATH
);
File
file
=
new
File
(
SIGN_PATH
);
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
...
@@ -39,10 +44,11 @@ public class DeviceInfo {
...
@@ -39,10 +44,11 @@ public class DeviceInfo {
}
}
//如果取不到就生成一个新的
//如果取不到就生成一个新的
if
(
TextUtils
.
isEmpty
(
device_sign
))
{
if
(
TextUtils
.
isEmpty
(
device_sign
))
{
return
writeSDSign
();
device_sign
=
writeSDSign
();
}
else
{
return
device_sign
;
}
}
SD_SIGN
=
device_sign
;
return
SD_SIGN
;
}
}
/**
/**
...
@@ -76,7 +82,9 @@ public class DeviceInfo {
...
@@ -76,7 +82,9 @@ public class DeviceInfo {
* 根据硬件信息计算设备指纹
* 根据硬件信息计算设备指纹
*/
*/
public
static
String
getSignFromHardware
()
{
public
static
String
getSignFromHardware
()
{
if
(!
TextUtils
.
isEmpty
(
DEVICE_SIGN
))
{
return
DEVICE_SIGN
;
}
String
device_id
=
Build
.
BOARD
+
Build
.
BRAND
+
String
device_id
=
Build
.
BOARD
+
Build
.
BRAND
+
Build
.
CPU_ABI
+
Build
.
DEVICE
+
Build
.
CPU_ABI
+
Build
.
DEVICE
+
Build
.
DISPLAY
+
Build
.
HOST
+
Build
.
DISPLAY
+
Build
.
HOST
+
...
@@ -85,7 +93,8 @@ public class DeviceInfo {
...
@@ -85,7 +93,8 @@ public class DeviceInfo {
Build
.
TAGS
+
Build
.
TYPE
+
Build
.
TAGS
+
Build
.
TYPE
+
Build
.
USER
;
Build
.
USER
;
return
StringUtils
.
MD5
(
device_id
);
DEVICE_SIGN
=
StringUtils
.
MD5
(
device_id
);
return
DEVICE_SIGN
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment