forked from AbrahamCaiJin/CommonUtilLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5dd29a0
commit 863fb09
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
CommonUtil/src/main/java/com/jingewenku/abrahamcaijin/commonutil/RootPermissionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.jingewenku.abrahamcaijin.commonutil; | ||
|
||
/** | ||
* @Description:主要功能:判断手机是否具有root权限工具类 | ||
* @Prject: CommonUtilLibrary | ||
* @Package: com.jingewenku.abrahamcaijin.commonutil | ||
* @author: AbrahamCaiJin | ||
* @date: 2017年05月24日 18:12 | ||
* @Copyright: 个人版权所有 | ||
* @Company: | ||
* @version: 1.0.0 | ||
*/ | ||
|
||
import java.io.File; | ||
|
||
public class RootPermissionUtils { | ||
/** | ||
* 根据/system/bin/或/system/xbin目录下是否存在su文件判断是否已ROOT | ||
* @return true:已ROOT | ||
*/ | ||
public static boolean isRoot() { | ||
try { | ||
return new File("/system/bin/su").exists() || new File("/system/xbin/su").exists(); | ||
} catch (Exception e) { | ||
return false; | ||
} | ||
} | ||
|
||
} |