Android通过SystemProperties类查看系统参数
生活随笔
收集整理的這篇文章主要介紹了
Android通过SystemProperties类查看系统参数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先我們通過adb命令? adb shell ---》回車---》?getprop
得到以下系統參數
[audio.hdmi.available]: [1] [audio.hdmi.expected]: [0] [audio.input.active]: [AUDIO_CODEC] [audio.output.active]: [AUDIO_CODEC,AUDIO_HDMI] [dalvik.vm.heapgrowthlimit]: [96m] [dalvik.vm.heapmaxfree]: [8m] [dalvik.vm.heapminfree]: [2m] [dalvik.vm.heapsize]: [256m] [dalvik.vm.heapstartsize]: [8m] [dalvik.vm.heaptargetutilization]: [0.75] [dalvik.vm.stack-trace-file]: [/data/anr/traces.txt] [debug.egl.hw]: [1] [dev.bootcomplete]: [1] [gsm.current.phone-type]: [1] [gsm.operator.alpha]: [] [gsm.operator.iso-country]: [] [gsm.operator.isroaming]: [false] [gsm.operator.numeric]: [] [gsm.sim.state]: [NOT_READY] [gsm.version.ril-impl]: [Quectel_Android_RIL_SR01A41V02] [hwui.render_dirty_regions]: [false] [init.svc.adbd]: [running] [init.svc.bootanim]: [stopped] [init.svc.console]: [running] [init.svc.debuggerd]: [running] [init.svc.drm]: [running] [init.svc.gpio]: [running] [init.svc.installd]: [running] [init.svc.isomountmanager]: [running] [init.svc.keystore]: [running] [init.svc.media]: [running] [init.svc.netd]: [running] [init.svc.p2p_supplicant]: [running] [init.svc.preinstall]: [stopped] [init.svc.property]: [running] [init.svc.ril-daemon]: [running] [init.svc.securefile]: [running] [init.svc.sensors]: [stopped] [init.svc.servicemanager]: [running] [init.svc.surfaceflinger]: [running] [init.svc.tvdecoderserver]: [running] [init.svc.u3gmonitor]: [running] [init.svc.ueventd]: [running] [init.svc.vold]: [running] [init.svc.zygote]: [running] [keyguard.no_require_sim]: [true] [mediasw.sft.rawdata]: [PCM] [net.bt.name]: [Android] [net.change]: [net.qtaguid_enabled] [net.hostname]: [android-66ccfd4a013cea3a] [net.qtaguid_enabled]: [1] [net.tcp.buffersize.default]: [4096,87380,110208,4096,16384,110208] [net.tcp.buffersize.edge]: [4093,26280,35040,4096,16384,35040] [net.tcp.buffersize.gprs]: [4092,8760,11680,4096,8760,11680] [net.tcp.buffersize.hspa]: [4094,87380,262144,4096,16384,262144] [net.tcp.buffersize.lte]: [524288,1048576,2097152,262144,524288,1048576] [net.tcp.buffersize.umts]: [4094,87380,110208,4096,16384,110208] [net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576] [persist.sys.country]: [CN] [persist.sys.device_name]: [MiniMax] [persist.sys.language]: [zh] [persist.sys.profiler_ms]: [0] [persist.sys.strictmode.disable]: [1] [persist.sys.strictmode.visual]: [0] [persist.sys.sw.firstLaunch]: [false] [persist.sys.timezone]: [Asia/Shanghai] [persist.sys.usb.config]: [mass_storage,adb] [rild.libargs]: [-d/dev/ttyUSB2] [rild.libpath]: [/system/lib/libreference-EC20-ril.so] [ro.allow.mock.location]: [1] [ro.audio.multi.output]: [true] [ro.baseband]: [unknown] [ro.board.platform]: [exDroid] [ro.bootloader]: [unknown] [ro.bootmode]: [unknown] [ro.build.characteristics]: [tablet] [ro.build.date.utc]: [1468285100] [ro.build.date]: [Tue Jul 12 08:58:20 CST 2016] [ro.build.description]: [sugar_adtv-eng 4.2.2 JDQ39 20160712 test-keys] [ro.build.display.id]: [sugar_adtv-eng 4.2.2 JDQ39 20180428 test-keys] [ro.build.fingerprint]: [softwinners/sugar_adtv/sugar-adtv:4.2.2/JDQ39/20160712:eng/test-keys] [ro.build.host]: [zhm] [ro.build.id]: [JDQ39] [ro.build.product]: [sugar-adtv] [ro.build.tags]: [test-keys] [ro.build.type]: [eng] [ro.build.user]: [zhm] [ro.build.version.codename]: [REL] [ro.build.version.incremental]: [20160712] [ro.build.version.release]: [4.2.2] [ro.build.version.sdk]: [17] [ro.com.android.dateformat]: [MM-dd-yyyy] [ro.config.alarm_alert]: [Alarm_Classic.ogg] [ro.config.notification_sound]: [pixiedust.ogg] [ro.config.ringtone]: [Ring_Synth_04.ogg] [ro.debuggable]: [1] [ro.display.switch]: [1] [ro.factorytest]: [0] [ro.hardware]: [sun7i] [ro.kernel.android.checkjni]: [0] [ro.opengles.version]: [131072] [ro.product.board]: [wing] [ro.product.brand]: [softwinners] [ro.product.cpu.abi2]: [armeabi] [ro.product.cpu.abi]: [armeabi-v7a] [ro.product.device]: [56iqDS] [ro.product.firmware]: [v2.0] [ro.product.locale.language]: [en] [ro.product.locale.region]: [US] [ro.product.manufacturer]: [unknown] [ro.product.model]: [SoftwinerEvb] [ro.product.name]: [sugar_adtv] [ro.property.tabletUI]: [true] [ro.revision]: [0] [ro.runtime.firstboot]: [1420070452201] [ro.secure]: [0] [ro.serialno]: [] [ro.softmouse.bottom.code]: [108] [ro.softmouse.left.code]: [105] [ro.softmouse.leftbtn.code]: [28] [ro.softmouse.midbtn.code]: [52] [ro.softmouse.right.code]: [106] [ro.softmouse.rightbtn.code]: [-1] [ro.softmouse.top.code]: [103] [ro.sw.defaultlauncherclass]: [com.softwinner.launcher.Launcher] [ro.sw.defaultlauncherpackage]: [com.softwinner.launcher] [ro.sw.directlypoweroff]: [true] [ro.sw.shortpressleadshut]: [false] [ro.sw.videotrimming]: [1] [ro.udisk.lable]: [sugar] [ro.wifi.channels]: [] [service.bootanim.exit]: [1] [sys.boot_completed]: [1] [sys.sensors]: [1] [sys.settings_global_version]: [5] [sys.settings_secure_version]: [10] [sys.settings_system_version]: [9] [sys.usb.config]: [mass_storage,adb] [sys.usb.state]: [mass_storage,adb] [system_init.startsurfaceflinger]: [0] [telephony.lteOnCdmaDevice]: [0] [wifi.interface]: [wlan0] [wifi.supplicant_scan_interval]: [15] [wlan.driver.status]: [ok] [wlan.wfddnsmasq.peer]: [] [wlan.wfdp2p.addr]: [] [wlan.wfdp2p.role]: []格式為“[參數名]:[參數值]”
各個開發板拿到的系統參數會有差異。
在應用內我們可以通過android.os.Build拿到部分系統參數,但是拿到的系統參數有限。百度后發現可以通過SystemProperties這個類取獲取更多的系統參數。SystemProperties類在應用中是無法訪問的,我們需要在app下的build.gradle文件下新增以下內容
android {...............//以下是為了找到android.os.SystemProperties這個隱藏的類String SDK_DIR = System.getenv("ANDROID_SDK_HOME")//("TAG", "SDK_DIR = " + SDK_DIR );if(SDK_DIR == null) {Properties props = new Properties()props.load(new FileInputStream(project.rootProject.file("local.properties")))SDK_DIR = props.get('sdk.dir');}dependencies {compileOnly files("${SDK_DIR}/platforms/android-21/data/layoutlib.jar")}//以上是為了找到android.os.SystemProperties這個隱藏的類 }之后我們可以通過
android.os.SystemProperties.get("gsm.version.ril-impl")這種方式取得所需的系統參數。get方法中所填的參數可填入剛剛通過adb命令拿到的參數名。
?
參考:https://blog.csdn.net/yf1252555020/article/details/82148176
?
?
?
總結
以上是生活随笔為你收集整理的Android通过SystemProperties类查看系统参数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux防火墙禁用traceroute
- 下一篇: 计算机专业,买什么配置的电脑比较合适?