欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

理解你的Android设备:探索build.prop文件中的手机设备信息

最编程 2024-01-29 15:36:39
...

手机设备信息与 Android build.prop 文件

手机设备信息与 Android build.prop 文件

什么是 build.prop 文件

路径: /system/build.prop

说明: build.prop 是 Android 系统中的一个重要的属性文件,记录了系统的设置和改变。

主要信息类型ro.build.*(编译信息),ro.product.*(设备信息),ro.config.*(默认设置信息),dalvik.vm.*(虚拟机信息)等。

获取 Android 设备信息的命令

一种是通过访问 /system/build.prop 文件进行查看


# 打印 /system/build.prop 所有内容
adb shell cat /system/build.prop

# 通过 grep 筛选特定内容
adb shell cat /system/build.prop | grep ro.product

也可以用 ADB 的命令查看


# 显示所有信息
adb shell getprop

# 显示特定信息
adb shell getprop ro.product.model

# 筛选信息
adb shell getprop | grep product

部分 build.prop 信息说明

参数 说明 例子
ro.build.display.full_id 显示标识,标识显示设备的完整版本号 ro.build.display.full_id=A31u_11_A.04_160613
ro.product.model 机器型号 ro.product.model=A31u
ro.product.device 设备名 ro.product.device=A31u
ro.product.name=A31u 机器名 ro.product.name=A31u
ro.build.id=KTU84P 编译标识 ro.build.id=KTU84P
ro.build.display.id 显示标识 ro.build.display.id=KTU84P release-keys
ro.build.version.incremental 版本增加说明 ro.build.version.incremental=eng.root.20160613
ro.build.version.sdk 编译时使用的 SDK 版本 ro.build.version.sdk=19
ro.build.version.codename 版本编码名称 ro.build.version.codename=REL
ro.build.version.release 公布的版本(一般用于手机信息的系统版本) ro.build.version.release=4.4.4
ro.build.date 系统编译时间 ro.build.date=Mon Jun 13 21:38:06 CST 2016
ro.build.date.utc 系统编译时间(UTC版本) ro.build.date.utc=1465825086
ro.build.type 系统编译类型 ro.build.type=user
ro.build.user 系统用户名 ro.build.user=root
ro.build.host 系统主机名 ro.build.host=ubuntu-121-114
ro.build.tags 系统标记 ro.build.tags=release-keys
ro.product.model 机器型号 ro.product.model=msm8916_32
ro.product.brand 机器品牌 ro.product.brand=OPPO
ro.product.name 机器 ro.product.name=msm8916_32
ro.product.device 设备名 ro.product.device=msm8916_32
ro.product.board 主板名 ro.product.board=msm8916
ro.product.cpu.abi CPU 支持的架构 ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2 CPU 支持的架构 ro.product.cpu.abi2=armeabi
ro.product.manufacturer 制造商 ro.product.manufacturer=OPPO
ro.product.locale.language 系统语言 ro.product.locale.language=zh
ro.product.locale.region 系统所在区域 ro.product.locale.region=CN
ro.wifi.channels WiFi的网络信道(空表示自动识别) ro.wifi.channels=
ro.board.platform 主板板卡型号 ro.board.platform=msm8916
debug.sf.hw 硬件 GPU 加速(1:开启,0:关闭) debug.sf.hw=1
dalvik.vm.heapsize Dalvik 虚拟内存大小 dalvik.vm.heapsize=36m
dalvik.vm.heapstartsize Dalvik 虚拟内存初始堆栈大小 dalvik.vm.heapstartsize=12m
dalvik.vm.heapgrowthlimit Dalvik 虚拟内存堆栈增长极限 dalvik.vm.heapgrowthlimit=128m
dalvik.vm.heapsize Dalvik 虚拟内存最大堆栈大小 dalvik.vm.heapsize=256m
dalvik.vm.heaptargetutilization Dalvik 堆指标利用效率/堆内存利用百分比 dalvik.vm.heaptargetutilization=0.75
net.bt.name 蓝牙网络中显示的名字 net.bt.name=Android
ro.config.alarm_alert 默认闹钟铃声 ro.config.alarm_alert=alarm_005.ogg
ro.config.ringtone 默认响铃铃声 ro.config.ringtone=ringtone_001.ogg
ro.config.ringtone_sim2 默认响铃铃声(卡2) ro.config.ringtone_sim2=ringtone_005.ogg
ro.config.notification_sound 默认通知铃声 ro.config.notification_sound=notification_001.ogg
ro.config.notification_sim2 默认通知铃声(卡2) ro.config.notification_sim2=notification_009.ogg
ro.com.android.dateformat 默认时间格式 ro.com.android.dateformat=MM-dd-yyyy

JNI 获取设备信息

知道一些字段的信息,那么就可以通过 JNI 的一些接口访问部分信息了。

(不需要繁琐的用 JNI 调用 Java 接口提取设备信息)


#include <sys/system_properties.h>

...

{
    char info[256];
    __system_property_get("ro.build.version.sdk", info);    // 获取 SDK 版本。提取的信息会存入 info 中。

    ...
    
    __system_property_get("ro.product.model", info);        // 获取机型。提取的信息会存入 info 中。
    ...
    
    __system_property_get("ro.serialno", info);             // 获取序列号。提取的信息会存入 info 中。
}

需要包含 <sys/system_properties.h> 头文件。

调用 __system_property_get 接口。【int __system_property_get(const char* __name, char* __value)

附录:一个设备的 build.prop 文件内容


# run command:
#    `adb shell cat /system/build.prop`
#
#
# begin build oppo properties
# autogenerated by oppo_buildinfo.sh
ro.build.date.Ymd=160613
ro.build.date.ymd=160613
ro.build.date.YmdHM=201606132138
ro.build.display.full_id=A31u_11_A.04_160613
ro.common.soft=MSM_15006
ro.product.model=A31u
persist.sys.assert.panic=true
persist.sys.oppo.dump=1
persist.sys.cfu_auto=1
ro.product.device=A31u
ro.product.name=A31u
ro.build.product=A31u
ro.build.version.ota=A31u_11.A.04_004_201606131927
ro.build.soft.majorversion=
ro.build.display.id=A31u_11_160613
ro.build.soft.version=A.04
ro.xxversion=v0.5
ro.build.kernel.id=3.10.28-G201606131927
sys.foreground_process=android
ro.oppo.version=
persist.sys.timezone=Asia/Shanghai
persist.sys.oppo.region=CN
persist.power.useautobrightadj=true
persist.sys.modem=yes
persist.sys.net=yes
persist.sys.assert.state=true
persist.oppo.ctsversion=false
ro.build.fingerprint=OPPO/A31u/A31u:4.4.4/KTU84P/1390465867:user/release-keys
ro.build.oppofingerprint=
persist.radio.multisim.config=dsds
# end build oppo properties
ro.rf_version=W_G_L_15006
ro.telephony.default_network=9,1
persist.sys.autoclearsave=3
persist.sys.assert.state=false
persist.sys.assert.panic=false
persist.sys.oppo.dump=0
ro.build.release_type=true
persist.sys.oem_smooth=1
ro.qualcomm.svi=0
persist.radio.lte_vrte_ltd=1
persist.sys.savetosdcard=cache
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=KTU84P
ro.build.display.id=KTU84P release-keys
ro.build.version.incremental=eng.root.20160613
ro.build.version.sdk=19
ro.build.version.codename=REL
ro.build.version.release=4.4.4
ro.build.date=Mon Jun 13 21:38:06 CST 2016
ro.build.date.utc=1465825086
ro.build.type=user
ro.build.user=root
ro.build.host=ubuntu-121-114
ro.build.tags=release-keys
ro.product.model=msm8916_32
ro.product.brand=OPPO
ro.product.name=msm8916_32
ro.product.device=msm8916_32
ro.product.board=msm8916
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=OPPO
ro.product.locale.language=zh
ro.product.locale.region=CN
ro.wifi.channels=
ro.board.platform=msm8916
# ro.build.product is obsolete; use ro.product.device
# Do not try to parse ro.build.description or .fingerprint
ro.build.description=msm8916_32-user 4.4.4 KTU84P eng.root.20160613 release-keys
ro.build.fingerprint=OPPO/msm8916_32/msm8916_32:4.4.4/KTU84P/eng.root.20160613:user/release-keys
ro.build.characteristics=default
ro.build.version.opporom=V2.0.1
ro.rom.different.version=ColorOS2.0.1
# end build properties
#
# from device/qcom/msm8916_32/system_cu.prop
#
#
# system.prop for msm8916
#

#rild.libpath=/system/lib/libreference-ril.so
rild.libpath=/system/vendor/lib/libril-qc-qmi-1.so
rild.libargs=-d /dev/smd0
persist.rild.nitz_plmn=
persist.rild.nitz_long_ons_0=
persist.rild.nitz_long_ons_1=
persist.rild.nitz_long_ons_2=
persist.rild.nitz_long_ons_3=
persist.rild.nitz_short_ons_0=
persist.rild.nitz_short_ons_1=
persist.rild.nitz_short_ons_2=
persist.rild.nitz_short_ons_3=
ril.subscription.types=NV,RUIM
DEVICE_PROVISIONED=1
# Start in cdma mode
ro.telephony.default_network=5

debug.sf.hw=1
debug.egl.hw=1
debug.composition.type=c2d
persist.hwc.mdpcomp.enable=true
debug.mdpcomp.logs=0
#Enable translucent status bar feature
persist.hwc.ptor.enable=true
dalvik.vm.heapsize=36m
dev.pm.dyn_samplingrate=1
persist.demo.hdmirotationlock=false
debug.sf.gpu_comp_tiling=1

#ro.hdmi.enable=true
#tunnel.decode=true
#tunnel.audiovideo.decode=true
#lpa.decode=false
#lpa.use-stagefright=true
#persist.speaker.prot.enable=false

#
# system props for the cne module
#

persist.cne.feature=1

#
# system props for the dpm module
#

#ifndef VENDOR_EDIT
#LinJie.Xu@Prd.Android.USB, 2014/10/27, Modify for Qcom chen yan provider modify
#wenhua.Leng@Prd.Android.USB, 2015/04/28, Modify for Qcom gaojiugang provider modify
#persist.dpm.feature=0
#else /* VENDOR_EDIT */
#persist.dpm.feature=4
persist.dpm.feature=7
#endif /* VENDOR_EDIT */



#system props for the MM modules
media.stagefright.enable-player=true
media.stagefright.enable-http=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
media.stagefright.enable-fma2dp=true
media.stagefright.enable-scan=true
media.swhevccodectype=0
media.hwhevccodectype=0
mmp.enable.3g2=true
mm.enable.smoothstreaming=true
mm.disable.sec_smoothstreaming=true
media.aac_51_output_enabled=true
#codecs:(PARSER_)AAC AC3 ASF AVI DTS 3G2 MP2TS QCP FLAC
mm.enable.qcom_parser=168563

#
# system props for the data modules
#
ro.use_data_netmgrd=true
persist.data.netmgrd.qos.enable=true

#system props for time-services
persist.timed.enable=true

#
# system prop for opengles version
#
# 196608 is decimal for 0x30000 to report version 3
ro.opengles.version=196608

# System property for cabl
#ifdnef VENDOR_EDIT
#Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/09/02  shutdown cabl
#ro.qualcomm.cabl=2
#else
ro.qualcomm.cabl=0
#endif

#
# System props for telephony
# System prop to turn on CdmaLTEPhone always
telephony.lteOnCdmaDevice=1
persist.omh.enabled=false

#
# System props for bluetooh
# System prop to turn on hfp client
#ifdef VENDOR_EDIT
#HuiTao@Prd.BasicSrv.BT, 2014/08/06 Modify for Close HFP Client
bluetooth.hfp.client=0
bluetooth.a2dp.sink.enabled=false
#else
#bluetooth.hfp.client=1
#endif

#Simulate sdcard on /data/media
#
persist.fuse_sdcard=true

#
#snapdragon value add features
#
ro.qc.sdk.audio.ssr=false
##fluencetype can be "fluence" or "fluencepro" or "none"
ro.qc.sdk.audio.fluencetype=none
persist.audio.fluence.voicecall=true
persist.audio.fluence.voicerec=false
persist.audio.fluence.speaker=true
#Set for msm8916
tunnel.audio.encode = false
#Buffer size in kbytes for compress offload playback
audio.offload.buffer.size.kb=32
#use VERY_HIGH_QUALITY for audio resampler
af.resampler.quality=4
#Enable offload audio video playback by default
av.offload.enable=false
#enable voice path for PCM VoIP by default
use.voice.path.for.pcm.voip=true
#
#System property for FM transmitter
#
ro.fm.transmitter=false
#enable dsp gapless mode by default
audio.offload.gapless.enabled=true

#Audio voice concurrency related flags
voice.playback.conc.disabled=true
voice.record.conc.disabled=true
voice.voip.conc.disabled=true

#Set composition for USB
#ifndef VENDOR_EDIT
#LinJie.Xu@Prd.Android.USB, 2014/07/29, Remove for we don't need initialize persist.sys.usb.config
#persist.sys.usb.config=diag,serial_smd,rmnet_bam,adb
#endif /* VENDOR_EDIT */



# set max starting background services
ro.config.max_starting_bg=8

#property to enable user to access Google WFD settings
persist.debug.wfd.enable=1
#propery to enable VDS WFD solution
persist.hwc.enable_vds=1

#property to enable narrow search range for video encoding
vidc.enc.narrow.searchrange=1

#ifdef VENDOR_EDIT
#Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/10/11  Add for 14005 performance
sys.hwc.gpu_perf_mode=1
#endif /* VENDOR_EDIT */


#hwui properties
#ro.hwui.texture_cache_size=72
ro.hwui.layer_cache_size=48
ro.hwui.r_buffer_cache_size=8
ro.hwui.path_cache_size=32
ro.hwui.gradient_cache_size=1
ro.hwui.drop_shadow_cache_size=6
ro.hwui.texture_cache_flushrate=0.4
ro.hwui.text_small_cache_width=1024
ro.hwui.text_small_cache_height=1024
ro.hwui.text_large_cache_width=2048
ro.hwui.text_large_cache_height=1024

#
# ADDITIONAL_BUILD_PROPERTIES
#
dalvik.vm.heapminfree=4m
dalvik.vm.heapstartsize=12m
keyguard.no_require_sim=true
ro.com.android.dataroaming=false
ro.com.android.dateformat=MM-dd-yyyy
ro.config.alarm_alert=alarm_005.ogg
ro.config.ringtone=ringtone_001.ogg
ro.config.ringtone_sim2=ringtone_005.ogg
ro.config.notification_sound=notification_001.ogg
ro.config.notification_sim2=notification_009.ogg
ro.carrier=unknown
ro.oppo.theme.version=701
ro.vendor.extension_library=/vendor/lib/libqc-opt.so
persist.radio.apm_sim_not_pwdn=1
dalvik.vm.heapgrowthlimit=128m
dalvik.vm.heapsize=256m
dalvik.vm.heaptargetutilization=0.75
dalvik.vm.heapmaxfree=8m
drm.service.enabled=true
persist.sys.dalvik.vm.lib=libdvm.so
net.bt.name=Android
dalvik.vm.stack-trace-file=/data/anr/traces.txt
persist.gps.qc_nlp_in_use=1
persist.loc.nlp_name=com.qualcomm.services.location
ro.gps.agps_provider=1
ro.pip.gated=0

©著作权归作者所有,转载或内容合作请联系作者

推荐阅读