Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
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
lib_base
Commits
3170cd74
Commit
3170cd74
authored
Dec 24, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
a4b1e70e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
11 deletions
+42
-11
src/main/java/tech/starwin/utils/context_utils/DeviceUtils.java
+42
-11
No files found.
src/main/java/tech/starwin/utils/context_utils/DeviceUtils.java
View file @
3170cd74
...
@@ -17,10 +17,10 @@ import android.os.StatFs;
...
@@ -17,10 +17,10 @@ import android.os.StatFs;
import
android.os.SystemClock
;
import
android.os.SystemClock
;
import
android.provider.Settings
;
import
android.provider.Settings
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.common.bean.AppInfoBean
;
import
com.common.bean.AppInfoBean
;
import
com.common.bean.DeviceInfoBean
;
import
com.common.bean.DeviceInfoBean
;
import
com.common.bean.DisplayBean
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -30,7 +30,6 @@ import java.net.NetworkInterface;
...
@@ -30,7 +30,6 @@ import java.net.NetworkInterface;
import
java.net.SocketException
;
import
java.net.SocketException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.TimeZone
;
import
java.util.TimeZone
;
...
@@ -40,7 +39,6 @@ import tech.starwin.LibConfig;
...
@@ -40,7 +39,6 @@ import tech.starwin.LibConfig;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.format_utils.StringFormat
;
import
tech.starwin.utils.format_utils.StringFormat
;
import
com.common.bean.DisplayBean
;
/**
/**
* Created by SiKang on 2019-11-15.
* Created by SiKang on 2019-11-15.
...
@@ -48,7 +46,7 @@ import com.common.bean.DisplayBean;
...
@@ -48,7 +46,7 @@ import com.common.bean.DisplayBean;
public
class
DeviceUtils
{
public
class
DeviceUtils
{
private
DeviceInfoBean
deviceInfoBean
;
private
DeviceInfoBean
deviceInfoBean
;
private
static
DeviceUtils
deviceUtils
=
new
DeviceUtils
();
private
static
DeviceUtils
deviceUtils
=
new
DeviceUtils
();
private
String
activePkgList
;
private
String
activePkgList
;
private
String
[]
pkgBlackList
=
new
String
[]{
private
String
[]
pkgBlackList
=
new
String
[]{
...
@@ -151,7 +149,7 @@ public class DeviceUtils {
...
@@ -151,7 +149,7 @@ public class DeviceUtils {
deviceInfoBean
.
setMacAddress
(
getMacAddress
());
deviceInfoBean
.
setMacAddress
(
getMacAddress
());
deviceInfoBean
.
setUpTime
(
SystemClock
.
elapsedRealtime
());
deviceInfoBean
.
setUpTime
(
SystemClock
.
elapsedRealtime
());
deviceInfoBean
.
setCameraNum
(
Camera
.
getNumberOfCameras
());
deviceInfoBean
.
setCameraNum
(
Camera
.
getNumberOfCameras
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
...
@@ -165,7 +163,7 @@ public class DeviceUtils {
...
@@ -165,7 +163,7 @@ public class DeviceUtils {
/**
/**
* 设备信息
* 设备信息
*
*
/
*/
public
DeviceInfoBean
getDeviceInfo
()
{
public
DeviceInfoBean
getDeviceInfo
()
{
return
deviceInfoBean
;
return
deviceInfoBean
;
}
}
...
@@ -173,7 +171,7 @@ public class DeviceUtils {
...
@@ -173,7 +171,7 @@ public class DeviceUtils {
/**
/**
* 已安装应用列表
* 已安装应用列表
*
*
/
*/
public
List
<
AppInfoBean
>
getAppList
(
Context
context
)
{
public
List
<
AppInfoBean
>
getAppList
(
Context
context
)
{
List
<
AppInfoBean
>
appList
=
new
ArrayList
<>();
List
<
AppInfoBean
>
appList
=
new
ArrayList
<>();
try
{
try
{
...
@@ -272,7 +270,7 @@ public class DeviceUtils {
...
@@ -272,7 +270,7 @@ public class DeviceUtils {
//如果发现包名黑名单,true
//如果发现包名黑名单,true
for
(
String
pkgName
:
pkgBlackList
)
{
for
(
String
pkgName
:
pkgBlackList
)
{
LogUtils
.
d
(
"DeviceUtilsInfo"
,
StringFormat
.
fromBase64
(
pkgName
));
LogUtils
.
d
(
"DeviceUtilsInfo"
,
StringFormat
.
fromBase64
(
pkgName
));
if
(
activePkgList
.
contains
(
StringFormat
.
fromBase64
(
pkgName
)))
{
if
(
activePkgList
.
contains
(
StringFormat
.
fromBase64
(
pkgName
)))
{
return
true
;
return
true
;
}
}
...
@@ -284,7 +282,41 @@ public class DeviceUtils {
...
@@ -284,7 +282,41 @@ public class DeviceUtils {
}
}
DisplayBean
displayBean
=
PreferencesManager
.
get
().
getCustomerInfo
();
DisplayBean
displayBean
=
PreferencesManager
.
get
().
getCustomerInfo
();
return
(
displayBean
!=
null
&&
displayBean
.
isFakeProductFlag
());
return
(
displayBean
!=
null
&&
displayBean
.
isFakeProductFlag
());
}
/**
* 进入假界面原因
*/
public
String
fakeReason
(
Context
context
)
{
//如果是渠道包,忽略
if
(
LibConfig
.
IS_COLLECT_MODE
||
PreferencesManager
.
get
().
isSafeUser
())
{
return
""
;
}
if
(
TextUtils
.
isEmpty
(
activePkgList
))
{
activePkgList
=
getActivePkgs
(
context
,
100
);
}
//如果发现包名黑名单,true
for
(
String
pkgName
:
pkgBlackList
)
{
LogUtils
.
d
(
"DeviceUtilsInfo"
,
StringFormat
.
fromBase64
(
pkgName
));
if
(
activePkgList
.
contains
(
StringFormat
.
fromBase64
(
pkgName
)))
{
return
pkgName
;
}
}
//时区不是印尼,true
if
(!
isIDTime
(
TimeZone
.
getDefault
()))
{
return
"timeZone"
;
}
DisplayBean
displayBean
=
PreferencesManager
.
get
().
getCustomerInfo
();
if
((
displayBean
!=
null
&&
displayBean
.
isFakeProductFlag
())){
return
"display"
;
}
else
{
return
""
;
}
}
}
...
@@ -292,7 +324,7 @@ public class DeviceUtils {
...
@@ -292,7 +324,7 @@ public class DeviceUtils {
* 根据硬件信息计算设备指纹
* 根据硬件信息计算设备指纹
*/
*/
public
static
String
getSignFromHardware
()
{
public
static
String
getSignFromHardware
()
{
return
Build
.
BOARD
+
Build
.
BRAND
+
return
Build
.
BOARD
+
Build
.
BRAND
+
Build
.
CPU_ABI
+
Build
.
DEVICE
+
Build
.
CPU_ABI
+
Build
.
DEVICE
+
Build
.
DISPLAY
+
Build
.
HOST
+
Build
.
DISPLAY
+
Build
.
HOST
+
Build
.
ID
+
Build
.
MANUFACTURER
+
Build
.
ID
+
Build
.
MANUFACTURER
+
...
@@ -321,7 +353,6 @@ public class DeviceUtils {
...
@@ -321,7 +353,6 @@ public class DeviceUtils {
}
}
private
long
[]
getRAMInfo
(
Context
context
)
{
private
long
[]
getRAMInfo
(
Context
context
)
{
ActivityManager
manager
=
(
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
ActivityManager
manager
=
(
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
ActivityManager
.
MemoryInfo
info
=
new
ActivityManager
.
MemoryInfo
();
ActivityManager
.
MemoryInfo
info
=
new
ActivityManager
.
MemoryInfo
();
...
...
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