Skip to content

Commit

Permalink
增加root权限工具类
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 18, 2017
1 parent 5dd29a0 commit 863fb09
Showing 1 changed file with 29 additions and 0 deletions.
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;
}
}

}

0 comments on commit 863fb09

Please sign in to comment.