check wear state before get blood info.
authorkfl_614 <kfl_614@163.com>
Mon, 30 Nov 2020 08:46:12 +0000 (16:46 +0800)
committerkfl_614 <kfl_614@163.com>
Mon, 30 Nov 2020 08:46:12 +0000 (16:46 +0800)
.idea/compiler.xml [new file with mode: 0644]
.idea/qaplug_profiles.xml [new file with mode: 0644]
app/src/main/java/com/ic/blood/util/SystemUtils.java [new file with mode: 0644]

diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644 (file)
index 0000000..61a9130
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <bytecodeTargetLevel target="1.8" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml
new file mode 100644 (file)
index 0000000..07de02a
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AnalysisProjectProfileManager">
+    <option name="PROJECT_PROFILE" />
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+    <list size="0" />
+  </component>
+</project>
\ 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 (file)
index 0000000..fb0b9f5
--- /dev/null
@@ -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();
+
+        }
+    }
+}