From: kfl_614 Date: Mon, 30 Nov 2020 08:46:12 +0000 (+0800) Subject: check wear state before get blood info. X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=b61e84a15608c52fb2df1099b1382432c736126d;p=IcBlood.git check wear state before get blood info. --- diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml new file mode 100644 index 0000000..07de02a --- /dev/null +++ b/.idea/qaplug_profiles.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/ic/blood/util/SystemUtils.java b/app/src/main/java/com/ic/blood/util/SystemUtils.java new file mode 100644 index 0000000..fb0b9f5 --- /dev/null +++ b/app/src/main/java/com/ic/blood/util/SystemUtils.java @@ -0,0 +1,157 @@ +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(); + + } + } +}