/** * 判断当前手机是否有ROOT权限 * * @return */ public boolean isRoot() { boolean bool = false; try { if ((!new File("/system/bin/su").exists()) && (!new File("/system/xbin/su").exists())) { bool = false; } else { bool = true; } } catch (Exception e) { } LogUtils.e("root:" + bool); return bool; }
/* * 判断设备 是否使用代理上网 * */ private boolean isWifiProxy(Context context) { final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES .ICE_CREAM_SANDWICH; String proxyAddress; int proxyPort; if (IS_ICS_OR_LATER) { proxyAddress = System.getProperty("http.proxyHost"); String portStr = System.getProperty("http.proxyPort"); proxyPort = Integer.parseInt((portStr != null ? portStr : "-1")); } else { proxyAddress = android.net.Proxy.getHost(context); proxyPort = android.net.Proxy.getPort(context); } LogUtils.e("isWifiProxy:" + ((!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1))); return (!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1); }