当前位置:   article > 正文

Android通过SystemProperties类查看系统参数_查看persist.sys

查看persist.sys

首先我们通过adb命令  adb shell ---》回车---》 getprop

得到以下系统参数

  1. [audio.hdmi.available]: [1]
  2. [audio.hdmi.expected]: [0]
  3. [audio.input.active]: [AUDIO_CODEC]
  4. [audio.output.active]: [AUDIO_CODEC,AUDIO_HDMI]
  5. [dalvik.vm.heapgrowthlimit]: [96m]
  6. [dalvik.vm.heapmaxfree]: [8m]
  7. [dalvik.vm.heapminfree]: [2m]
  8. [dalvik.vm.heapsize]: [256m]
  9. [dalvik.vm.heapstartsize]: [8m]
  10. [dalvik.vm.heaptargetutilization]: [0.75]
  11. [dalvik.vm.stack-trace-file]: [/data/anr/traces.txt]
  12. [debug.egl.hw]: [1]
  13. [dev.bootcomplete]: [1]
  14. [gsm.current.phone-type]: [1]
  15. [gsm.operator.alpha]: []
  16. [gsm.operator.iso-country]: []
  17. [gsm.operator.isroaming]: [false]
  18. [gsm.operator.numeric]: []
  19. [gsm.sim.state]: [NOT_READY]
  20. [gsm.version.ril-impl]: [Quectel_Android_RIL_SR01A41V02]
  21. [hwui.render_dirty_regions]: [false]
  22. [init.svc.adbd]: [running]
  23. [init.svc.bootanim]: [stopped]
  24. [init.svc.console]: [running]
  25. [init.svc.debuggerd]: [running]
  26. [init.svc.drm]: [running]
  27. [init.svc.gpio]: [running]
  28. [init.svc.installd]: [running]
  29. [init.svc.isomountmanager]: [running]
  30. [init.svc.keystore]: [running]
  31. [init.svc.media]: [running]
  32. [init.svc.netd]: [running]
  33. [init.svc.p2p_supplicant]: [running]
  34. [init.svc.preinstall]: [stopped]
  35. [init.svc.property]: [running]
  36. [init.svc.ril-daemon]: [running]
  37. [init.svc.securefile]: [running]
  38. [init.svc.sensors]: [stopped]
  39. [init.svc.servicemanager]: [running]
  40. [init.svc.surfaceflinger]: [running]
  41. [init.svc.tvdecoderserver]: [running]
  42. [init.svc.u3gmonitor]: [running]
  43. [init.svc.ueventd]: [running]
  44. [init.svc.vold]: [running]
  45. [init.svc.zygote]: [running]
  46. [keyguard.no_require_sim]: [true]
  47. [mediasw.sft.rawdata]: [PCM]
  48. [net.bt.name]: [Android]
  49. [net.change]: [net.qtaguid_enabled]
  50. [net.hostname]: [android-66ccfd4a013cea3a]
  51. [net.qtaguid_enabled]: [1]
  52. [net.tcp.buffersize.default]: [4096,87380,110208,4096,16384,110208]
  53. [net.tcp.buffersize.edge]: [4093,26280,35040,4096,16384,35040]
  54. [net.tcp.buffersize.gprs]: [4092,8760,11680,4096,8760,11680]
  55. [net.tcp.buffersize.hspa]: [4094,87380,262144,4096,16384,262144]
  56. [net.tcp.buffersize.lte]: [524288,1048576,2097152,262144,524288,1048576]
  57. [net.tcp.buffersize.umts]: [4094,87380,110208,4096,16384,110208]
  58. [net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576]
  59. [persist.sys.country]: [CN]
  60. [persist.sys.device_name]: [MiniMax]
  61. [persist.sys.language]: [zh]
  62. [persist.sys.profiler_ms]: [0]
  63. [persist.sys.strictmode.disable]: [1]
  64. [persist.sys.strictmode.visual]: [0]
  65. [persist.sys.sw.firstLaunch]: [false]
  66. [persist.sys.timezone]: [Asia/Shanghai]
  67. [persist.sys.usb.config]: [mass_storage,adb]
  68. [rild.libargs]: [-d/dev/ttyUSB2]
  69. [rild.libpath]: [/system/lib/libreference-EC20-ril.so]
  70. [ro.allow.mock.location]: [1]
  71. [ro.audio.multi.output]: [true]
  72. [ro.baseband]: [unknown]
  73. [ro.board.platform]: [exDroid]
  74. [ro.bootloader]: [unknown]
  75. [ro.bootmode]: [unknown]
  76. [ro.build.characteristics]: [tablet]
  77. [ro.build.date.utc]: [1468285100]
  78. [ro.build.date]: [Tue Jul 12 08:58:20 CST 2016]
  79. [ro.build.description]: [sugar_adtv-eng 4.2.2 JDQ39 20160712 test-keys]
  80. [ro.build.display.id]: [sugar_adtv-eng 4.2.2 JDQ39 20180428 test-keys]
  81. [ro.build.fingerprint]: [softwinners/sugar_adtv/sugar-adtv:4.2.2/JDQ39/20160712:eng/test-keys]
  82. [ro.build.host]: [zhm]
  83. [ro.build.id]: [JDQ39]
  84. [ro.build.product]: [sugar-adtv]
  85. [ro.build.tags]: [test-keys]
  86. [ro.build.type]: [eng]
  87. [ro.build.user]: [zhm]
  88. [ro.build.version.codename]: [REL]
  89. [ro.build.version.incremental]: [20160712]
  90. [ro.build.version.release]: [4.2.2]
  91. [ro.build.version.sdk]: [17]
  92. [ro.com.android.dateformat]: [MM-dd-yyyy]
  93. [ro.config.alarm_alert]: [Alarm_Classic.ogg]
  94. [ro.config.notification_sound]: [pixiedust.ogg]
  95. [ro.config.ringtone]: [Ring_Synth_04.ogg]
  96. [ro.debuggable]: [1]
  97. [ro.display.switch]: [1]
  98. [ro.factorytest]: [0]
  99. [ro.hardware]: [sun7i]
  100. [ro.kernel.android.checkjni]: [0]
  101. [ro.opengles.version]: [131072]
  102. [ro.product.board]: [wing]
  103. [ro.product.brand]: [softwinners]
  104. [ro.product.cpu.abi2]: [armeabi]
  105. [ro.product.cpu.abi]: [armeabi-v7a]
  106. [ro.product.device]: [56iqDS]
  107. [ro.product.firmware]: [v2.0]
  108. [ro.product.locale.language]: [en]
  109. [ro.product.locale.region]: [US]
  110. [ro.product.manufacturer]: [unknown]
  111. [ro.product.model]: [SoftwinerEvb]
  112. [ro.product.name]: [sugar_adtv]
  113. [ro.property.tabletUI]: [true]
  114. [ro.revision]: [0]
  115. [ro.runtime.firstboot]: [1420070452201]
  116. [ro.secure]: [0]
  117. [ro.serialno]: []
  118. [ro.softmouse.bottom.code]: [108]
  119. [ro.softmouse.left.code]: [105]
  120. [ro.softmouse.leftbtn.code]: [28]
  121. [ro.softmouse.midbtn.code]: [52]
  122. [ro.softmouse.right.code]: [106]
  123. [ro.softmouse.rightbtn.code]: [-1]
  124. [ro.softmouse.top.code]: [103]
  125. [ro.sw.defaultlauncherclass]: [com.softwinner.launcher.Launcher]
  126. [ro.sw.defaultlauncherpackage]: [com.softwinner.launcher]
  127. [ro.sw.directlypoweroff]: [true]
  128. [ro.sw.shortpressleadshut]: [false]
  129. [ro.sw.videotrimming]: [1]
  130. [ro.udisk.lable]: [sugar]
  131. [ro.wifi.channels]: []
  132. [service.bootanim.exit]: [1]
  133. [sys.boot_completed]: [1]
  134. [sys.sensors]: [1]
  135. [sys.settings_global_version]: [5]
  136. [sys.settings_secure_version]: [10]
  137. [sys.settings_system_version]: [9]
  138. [sys.usb.config]: [mass_storage,adb]
  139. [sys.usb.state]: [mass_storage,adb]
  140. [system_init.startsurfaceflinger]: [0]
  141. [telephony.lteOnCdmaDevice]: [0]
  142. [wifi.interface]: [wlan0]
  143. [wifi.supplicant_scan_interval]: [15]
  144. [wlan.driver.status]: [ok]
  145. [wlan.wfddnsmasq.peer]: []
  146. [wlan.wfdp2p.addr]: []
  147. [wlan.wfdp2p.role]: []

格式为“[参数名]:[参数值]”

各个开发板拿到的系统参数会有差异。

在应用内我们可以通过android.os.Build拿到部分系统参数,但是拿到的系统参数有限。百度后发现可以通过SystemProperties这个类取获取更多的系统参数。SystemProperties类在应用中是无法访问的,我们需要在app下的build.gradle文件下新增以下内容

  1. android {
  2. ...............
  3. //以下是为了找到android.os.SystemProperties这个隐藏的类
  4. String SDK_DIR = System.getenv("ANDROID_SDK_HOME")
  5. //("TAG", "SDK_DIR = " + SDK_DIR );
  6. if(SDK_DIR == null) {
  7. Properties props = new Properties()
  8. props.load(new FileInputStream(project.rootProject.file("local.properties")))
  9. SDK_DIR = props.get('sdk.dir');
  10. }
  11. dependencies {
  12. compileOnly files("${SDK_DIR}/platforms/android-21/data/layoutlib.jar")
  13. }
  14. //以上是为了找到android.os.SystemProperties这个隐藏的类
  15. }

之后我们可以通过

android.os.SystemProperties.get("gsm.version.ril-impl")

这种方式取得所需的系统参数。get方法中所填的参数可填入刚刚通过adb命令拿到的参数名。

 

参考:https://blog.csdn.net/yf1252555020/article/details/82148176

 

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/242294
推荐阅读
相关标签
  

闽ICP备14008679号