Skip to content

Instantly share code, notes, and snippets.

@SemonCat
Created April 10, 2015 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SemonCat/81207622ffb75aa7b150 to your computer and use it in GitHub Desktop.
Save SemonCat/81207622ffb75aa7b150 to your computer and use it in GitHub Desktop.
private static boolean needToCheckCTA() {
boolean result = false;
Class<?> mClassType = null;
Method mGetIntMethod = null;
try {
mClassType = Class.forName("android.os.SystemProperties");
mGetIntMethod = mClassType.getDeclaredMethod("getInt", String.class, int.class);
Integer v;
try {
v = (Integer) mGetIntMethod.invoke(mClassType, "persist.sys.cta.security", 0);
result = v.intValue() == 1 ? true : false;
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment