public static boolean isRoot() { Process process = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec(“su”); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(“exit\n”); os.flush(); int exitValue = process.waitFor(); if (exitValue == 0) { return true; } else { return false; } } catch (Exception e) { Log.d(TAG, “Unexpected error – Here is what I know: “ + e.getMessage()); return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { e.printStackTrace(); } } }
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
|小黑屋|手机版|站点找错-建议|AI手机网 |Sitemap
GMT+8, 2025-5-3 09:02 , Processed in 0.697422 second(s), 28 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.