Created
January 30, 2015 10:16
-
-
Save NLMartian/ce1efbf34fbceb8b79a4 to your computer and use it in GitHub Desktop.
判断ROM是否为MIUI
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
public static boolean isMIUI() { | |
String propName = "ro.miui.ui.version.name"; | |
String line; | |
BufferedReader input = null; | |
try { | |
Process p = Runtime.getRuntime().exec("getprop " + propName); | |
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); | |
line = input.readLine(); | |
input.close(); | |
} catch (IOException ex) { | |
return false; | |
} finally { | |
if (input != null) { | |
try { | |
input.close(); | |
} catch (IOException e) { | |
} | |
} | |
} | |
return line != null && line.length() > 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment