{"id":227,"date":"2016-12-20T16:07:54","date_gmt":"2016-12-20T08:07:54","guid":{"rendered":"http:\/\/www.prayerlaputa.com\/?p=227"},"modified":"2016-12-20T16:07:54","modified_gmt":"2016-12-20T08:07:54","slug":"%e3%80%90%e8%bd%ac%e5%8f%91%e3%80%91android-%e7%b3%bb%e7%bb%9f%e6%98%af%e4%b8%8d%e6%98%afmiui%e3%80%81flyme%e3%80%81emui","status":"publish","type":"post","link":"http:\/\/prayerlaputa.com\/?p=227","title":{"rendered":"\u3010\u8f6c\u53d1\u3011Android \u7cfb\u7edf\u662f\u4e0d\u662fMIUI\u3001Flyme\u3001EMUI"},"content":{"rendered":"<p>\u5de5\u4f5c\u4e2d\u9047\u5230\u201c\u5224\u65adandroid\u624b\u673a\u7684rom\u662f\u54ea\u4e00\u4e2a\u7248\u672c\u201d\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u641c\u5230\u5982\u4e0b\u89e3\u51b3\u65b9\u6848\uff0c\u5177\u4f53\u51fa\u81ea\u54ea\u91cc\u4e0d\u786e\u5b9a\uff08\u7f51\u4e0a\u8f6c\u8f7d\u592a\u591a\uff0c\u4e5f\u6ca1\u6807\u6ce8\u51fa\u5904\u2026\u2026\uff09\uff0c\u6211\u662f\u5728\u8fd9\u91cc\u770b\u5230\u7684\uff1a<a href=\"http:\/\/mojijs.com\/2015\/10\/211671\/index.html\">http:\/\/mojijs.com\/2015\/10\/211671\/index.html<\/a>\u00a0\u4ee3\u7801\u590d\u5236\u4e0b\u6765\u5373\u53ef\u7528\uff0c\u6211\u5df2\u7ecf\u9a8c\u8bc1\u8fc7\uff0cO(\u2229_\u2229)O~<br \/>\n<!--more--><br \/>\n&nbsp;<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\n\/\/\u8bfb\u53d6\u7cfb\u7edf\u914d\u7f6e\u4fe1\u606fbuild.prop\u7c7b\nimport android.os.Environment;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.util.Collection;\nimport java.util.Enumeration;\nimport java.util.Map.Entry;\nimport java.util.Properties;\nimport java.util.Set;\npublic class BuildProperties {\n    private final Properties properties;\n    private BuildProperties() throws IOException {\n        properties = new Properties();\n        properties.load(new FileInputStream(new File(Environment.getRootDirectory(), &quot;build.prop&quot;)));\n    }\n    public boolean containsKey(final Object key) {\n        return properties.containsKey(key);\n    }\n    public boolean containsValue(final Object value) {\n        return properties.containsValue(value);\n    }\n    public Set&lt;Entry&lt;Object, Object&gt;&gt; entrySet() {\n        return properties.entrySet();\n    }\n    public String getProperty(final String name) {\n        return properties.getProperty(name);\n    }\n    public String getProperty(final String name, final String defaultValue) {\n        return properties.getProperty(name, defaultValue);\n    }\n    public boolean isEmpty() {\n        return properties.isEmpty();\n    }\n    public Enumeration&lt;Object&gt; keys() {\n        return properties.keys();\n    }\n    public Set&lt;Object&gt; keySet() {\n        return properties.keySet();\n    }\n    public int size() {\n        return properties.size();\n    }\n    public Collection&lt;Object&gt; values() {\n        return properties.values();\n    }\n    public static BuildProperties newInstance() throws IOException {\n        return new BuildProperties();\n    }\n}\nimport android.os.Build;\nimport java.io.IOException;\nimport java.lang.reflect.Method;\n\/**\n * \u5224\u65ad\u7cfb\u7edf\u662f\u4e0d\u662fmiui\uff0cflyme\uff0cemui\n *\/\npublic class OSUtils {\n    private static final String KEY_EMUI_VERSION_CODE = &quot;ro.build.version.emui&quot;;\n    private static final String KEY_MIUI_VERSION_CODE = &quot;ro.miui.ui.version.code&quot;;\n    private static final String KEY_MIUI_VERSION_NAME = &quot;ro.miui.ui.version.name&quot;;\n    private static final String KEY_MIUI_INTERNAL_STORAGE = &quot;ro.miui.internal.storage&quot;;\n    private static boolean isPropertiesExist(String... keys) {\n        try {\n            BuildProperties prop = BuildProperties.newInstance();\n            for (String key : keys) {\n                String str = prop.getProperty(key);\n                if (str == null)\n                    return false;\n            }\n            return true;\n        } catch (IOException e) {\n            return false;\n        }\n    }\n    public static boolean isEMUI() {\n        return isPropertiesExist(KEY_EMUI_VERSION_CODE);\n    }\n    public static boolean isMIUI() {\n        return isPropertiesExist(KEY_MIUI_VERSION_CODE, KEY_MIUI_VERSION_NAME, KEY_MIUI_INTERNAL_STORAGE);\n    }\n    public static boolean isFlyme() {\n        try {\n            final Method method = Build.class.getMethod(&quot;hasSmartBar&quot;);\n            return method != null;\n        } catch (final Exception e) {\n            return false;\n        }\n    }\n}\n<\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5de5\u4f5c\u4e2d\u9047\u5230\u201c\u5224\u65adandroid\u624b\u673a\u7684rom\u662f\u54ea\u4e00\u4e2a\u7248\u672c\u201d\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u641c\u5230\u5982\u4e0b\u89e3\u51b3\u65b9\u6848\uff0c\u5177\u4f53\u51fa\u81ea\u54ea\u91cc\u4e0d\u786e\u5b9a\uff08\u7f51\u4e0a <a href='http:\/\/prayerlaputa.com\/?p=227' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[2,6],"tags":[26,33],"_links":{"self":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/posts\/227"}],"collection":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227"}],"version-history":[{"count":0,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions"}],"wp:attachment":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}