Android system is not MIUI, Flyme, EMUI

Source: Internet
Author: User

//Read system configuration Information Build.prop classImportAndroid.os.Environment;ImportJava.io.File;ImportJava.io.FileInputStream;ImportJava.io.IOException;ImportJava.util.Collection;ImportJava.util.Enumeration;ImportJava.util.Map.Entry;ImportJava.util.Properties;ImportJava.util.Set; Public  class buildproperties {    Private FinalProperties Properties;Private buildproperties()throwsIOException {properties =NewProperties (); Properties.load (NewFileInputStream (NewFile (Environment.getrootdirectory (),"Build.prop"))); } Public Boolean ContainsKey(FinalObject key) {returnProperties.containskey (key); } Public Boolean Containsvalue(FinalObject value) {returnProperties.containsvalue (value); } PublicSet<entry<object, object>>EntrySet() {returnProperties.entryset (); } PublicStringGetProperty(FinalString name) {returnProperties.getproperty (name); } PublicStringGetProperty(FinalString name,FinalString DefaultValue) {returnProperties.getproperty (name, DefaultValue); } Public Boolean IsEmpty() {returnProperties.isempty (); } PublicEnumeration<object>Keys() {returnProperties.keys (); } PublicSet<object>KeySet() {returnProperties.keyset (); } Public int size() {returnProperties.size (); } PublicCollection<object>Values() {returnProperties.values (); } Public StaticBuildpropertiesnewinstance()throwsIOException {return NewBuildproperties (); }}ImportAndroid.os.Build;ImportJava.io.IOException;ImportJava.lang.reflect.Method;/** * Judging the system is not miui,flyme,emui */ Public  class osutils {    Private Static FinalString Key_emui_version_code ="Ro.build.version.emui";Private Static FinalString Key_miui_version_code ="Ro.miui.ui.version.code";Private Static FinalString Key_miui_version_name ="Ro.miui.ui.version.name";Private Static FinalString Key_miui_internal_storage ="Ro.miui.internal.storage";Private Static Boolean ispropertiesexist(String ... keys) {Try{Buildproperties prop = Buildproperties.newinstance (); for(String Key:keys) {String str = prop.getproperty (key);if(str = =NULL)return false; }return true; }Catch(IOException e) {return false; }    } Public Static Boolean Isemui() {returnIspropertiesexist (Key_emui_version_code); } Public Static Boolean ISMIUI() {returnIspropertiesexist (Key_miui_version_code, Key_miui_version_name, key_miui_internal_storage); } Public Static Boolean Isflyme() {Try{Finalmethod = Build.class.getMethod ("Hassmartbar");returnMethod! =NULL; }Catch(FinalException e) {return false; }    }}

Copyright NOTICE: This article is Sunger original article, without BO Master permission cannot reprint.

Android system is not MIUI, Flyme, EMUI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.