--- /dev/null
+package com.ic.launcher.util;
+
+
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+
+public class SystemUtils {
+
+ public static String GetCidFromSystem() {
+ String cid_file = getSystemProperties("ro.product.partitionpath") + "miscdata";
+ byte[] resCid = new byte[16];
+ try {
+ byte[] buf = new byte[50];
+ FileInputStream inputStream = new FileInputStream(cid_file);
+ int len = inputStream.read(buf);
+ if (len < 50) return null;
+ for (int i = 0; i < 16; i++) {
+ resCid[i] = buf[i + 28];
+ }
+ for (int i = 0; i < 16; i++) {
+ if ((resCid[i] >= 0x30 && resCid[i] <= 0x39) || (resCid[i] >= 0x61 && resCid[i] <= 0x7A) || (resCid[i] >= 0x41 && resCid[i] <= 0x5A)) {
+ // valid
+ } else {
+ // invalid
+ for (int j = 28; j < 28 + 16; j++) {
+ resCid[j] = 0x30;
+ }
+ break;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ String cid = new String(resCid);
+ return cid;
+ }
+
+ public static boolean showOutTemp(){
+ boolean show=true;
+ show=!getSystemPropertiesBoolean("persyst.sys.disableTempOut",false);
+ return show;
+ }
+ public static boolean isL02()
+ {
+ String launcher=getLauncherName();
+ if (launcher.equals("l02")){
+ return true;
+ }
+ return false;
+ }
+ public static boolean isDC001()
+ {
+ String launcher=getLauncherName();
+ if (launcher.equals("dc001")){
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean h88tinyMode(){
+ String launcher=getLauncherName();
+ if (launcher.equals("h88tiny")){
+ return true;
+ }
+ return false;
+ }
+ public static boolean isH88()
+ {
+ String launcher=getLauncherName();
+ if (launcher.equals("h88")){
+ return true;
+ }
+ return false;
+ }
+ public static boolean isS123()
+ {
+ String launcher=getLauncherName();
+ if (launcher.equals("s123")){
+ return true;
+ }
+ return false;
+ }
+ public static boolean isq3fyt()
+ {
+ String launcher=getLauncherName();
+ if (launcher.equals("q3fyt")){
+ return true;
+ }
+ return false;
+ }
+ public static String getLauncherName(){
+ String launchername=getSystemPropertiesString("persist.sys.launcherName","l02");
+ return launchername;
+ }
+
+ public static boolean isYT(){
+ String launcher=getLauncherName();
+ if (launcher.equals("q3fyt")){
+ return true;
+ }
+ return false;
+ }
+
+
+ public static String getSystemPropertiesString(String prop,String defaultvlaue){
+ String ret=defaultvlaue;
+ String temp=getSystemProperties(prop);
+ if (!temp.trim().isEmpty()){
+ ret = temp;
+ }
+ return ret;
+ }
+ public static boolean getSystemPropertiesBoolean(String prop,boolean defaultvlaue){
+
+ boolean ret=defaultvlaue;
+ String temp=getSystemProperties(prop);
+ if (!temp.trim().isEmpty()){
+ if( temp.trim().equals("true")) {
+ ret = true;
+ }else if (temp.trim().equals("false")) {
+ ret = false;
+ }
+ }
+
+ return ret;
+ }
+ public static String getSystemProperties(String prop) {
+
+ String str = "";
+ Class clazz = null;
+ try {
+ clazz = Class.forName("android.os.SystemProperties");
+ str = (String) clazz.getMethod("get", new Class[]{String.class}).invoke(clazz, new Object[]{prop});
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return str;
+ }
+
+ static public void setSystemProperties(String key, String defaultValue) {
+
+ String value = defaultValue;
+ try {
+
+ Class<?> c = Class.forName("android.os.SystemProperties");
+
+ Method get = c.getMethod("set", String.class, String.class);
+
+ get.invoke(c, key, value);
+
+ } catch (Exception e) {
+
+ e.printStackTrace();
+
+ }
+ }
+}