File tree Expand file tree Collapse file tree 5 files changed +16
-14
lines changed
utilcode/src/main/java/com/blankj/utilcode/util Expand file tree Collapse file tree 5 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 7
7
- tools
8
8
- platform-tools
9
9
- tools
10
- - build-tools-26 .0.2
11
- - android-26
10
+ - build-tools-27 .0.0
11
+ - android-27
12
12
13
13
licenses :
14
14
- ' android-sdk-license-.+'
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ task clean(type: Delete) {
30
30
31
31
ext {
32
32
// Sdk and tools
33
- compile_sdk_version = 26
34
- build_tools_version = ' 26 .0.0'
33
+ compile_sdk_version = 27
34
+ build_tools_version = ' 27 .0.0'
35
35
min_sdk_version = 14
36
- target_sdk_version = 26
36
+ target_sdk_version = 27
37
37
38
38
version_code = 1_013_003
39
39
version_name = ' 1.13.3' // E.g 1.9.72 => 1,009,072
Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ public static String getMacAddress() {
113
113
@ SuppressLint ({"HardwareIds" , "MissingPermission" })
114
114
private static String getMacAddressByWifiInfo () {
115
115
try {
116
- @ SuppressLint ( "WifiManagerLeak" )
117
- WifiManager wifi = (WifiManager ) Utils . getApp () .getSystemService (Context .WIFI_SERVICE );
116
+ Context context = Utils . getApp (). getApplicationContext ();
117
+ WifiManager wifi = (WifiManager ) context .getSystemService (Context .WIFI_SERVICE );
118
118
if (wifi != null ) {
119
119
WifiInfo info = wifi .getConnectionInfo ();
120
120
if (info != null ) return info .getMacAddress ();
@@ -197,8 +197,9 @@ private static String getMacAddressByFile() {
197
197
if (name != null ) {
198
198
result = ShellUtils .execCmd ("cat /sys/class/net/" + name + "/address" , false );
199
199
if (result .result == 0 ) {
200
- if (result .successMsg != null ) {
201
- return result .successMsg ;
200
+ String address = result .successMsg ;
201
+ if (address != null && address .length () > 0 ) {
202
+ return address ;
202
203
}
203
204
}
204
205
}
Original file line number Diff line number Diff line change @@ -64,10 +64,10 @@ public static String getForegroundProcessName() {
64
64
Log .i ("ProcessUtils" , list .toString ());
65
65
if (list .size () <= 0 ) {
66
66
Log .i ("ProcessUtils" ,
67
- "getForegroundProcessName() called" + ": 无 \" 有权查看使用权限的应用 \" 选项 " );
67
+ "getForegroundProcessName: noun of access to usage information. " );
68
68
return null ;
69
69
}
70
- try {// 有"有权查看使用权限的应用"选项
70
+ try {// Access to usage information.
71
71
ApplicationInfo info =
72
72
pm .getApplicationInfo (Utils .getApp ().getPackageName (), 0 );
73
73
AppOpsManager aom =
@@ -82,7 +82,8 @@ public static String getForegroundProcessName() {
82
82
if (aom .checkOpNoThrow (AppOpsManager .OPSTR_GET_USAGE_STATS ,
83
83
info .uid ,
84
84
info .packageName ) != AppOpsManager .MODE_ALLOWED ) {
85
- Log .i ("ProcessUtils" , "没有打开\" 有权查看使用权限的应用\" 选项" );
85
+ Log .i ("ProcessUtils" ,
86
+ "getForegroundProcessName: refuse to device usage stats." );
86
87
return null ;
87
88
}
88
89
}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public final class Utils {
34
34
@ SuppressLint ("StaticFieldLeak" )
35
35
private static Application sApplication ;
36
36
37
- static LinkedList <Activity > sActivityList = new LinkedList <>();
37
+ private static LinkedList <Activity > sActivityList = new LinkedList <>();
38
38
39
39
private static ActivityLifecycleCallbacks mCallbacks = new ActivityLifecycleCallbacks () {
40
40
@ Override
@@ -84,7 +84,7 @@ private Utils() {
84
84
* @param context context
85
85
*/
86
86
public static void init (@ NonNull final Context context ) {
87
- Utils .sApplication = (( Application ) context .getApplicationContext () );
87
+ Utils .sApplication = (Application ) context .getApplicationContext ();
88
88
Utils .sApplication .registerActivityLifecycleCallbacks (mCallbacks );
89
89
}
90
90
You can’t perform that action at this time.
0 commit comments