Skip to content

Commit 863fb09

Browse files
author
371718330@qq.com
committed
增加root权限工具类
1 parent 5dd29a0 commit 863fb09

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.jingewenku.abrahamcaijin.commonutil;
2+
3+
/**
4+
* @Description:主要功能:判断手机是否具有root权限工具类
5+
* @Prject: CommonUtilLibrary
6+
* @Package: com.jingewenku.abrahamcaijin.commonutil
7+
* @author: AbrahamCaiJin
8+
* @date: 2017年05月24日 18:12
9+
* @Copyright: 个人版权所有
10+
* @Company:
11+
* @version: 1.0.0
12+
*/
13+
14+
import java.io.File;
15+
16+
public class RootPermissionUtils {
17+
/**
18+
* 根据/system/bin/或/system/xbin目录下是否存在su文件判断是否已ROOT
19+
* @return true:已ROOT
20+
*/
21+
public static boolean isRoot() {
22+
try {
23+
return new File("/system/bin/su").exists() || new File("/system/xbin/su").exists();
24+
} catch (Exception e) {
25+
return false;
26+
}
27+
}
28+
29+
}

0 commit comments

Comments
 (0)