在Android开发中,可以通过c接口直接获取设备属性,系统接口为:
int __system_property_get(const char* name, char* value);
作者: [email protected] 微信: hybase
下面是作者使用的常用属性
#include
typedef struct SDeviceInfo
{
char szId[128];
char szPlatform[128];
char szHardware[128];
char szBrand[128];
char szManufacturer[128];
char szCpuAbi[128];
char szCpuAbiList[256];
char szModel[128];
char szDevice[128];
char szBoard[128];
} SDeviceInfo;
static SDeviceInfo g_devInfo;
__system_property_get("ro.build.id", g_devInfo.szId);
__system_property_get("ro.hardware", g_devInfo.szHardware);
__system_property_get("ro.board.platform", g_devInfo.szPlatform);
__system_property_get("ro.product.brand", g_devInfo.szBrand);
__system_property_get("ro.product.manufacturer", g_devInfo.szManufacturer);
__system_property_get("ro.product.cpu.abi", g_devInfo.szCpuAbi);
__system_property_get("ro.product.cpu.abilist", g_devInfo.szCpuAbiList);
__system_property_get("ro.product.model", g_devInfo.szModel);
__system_property_get("ro.product.device", g_devInfo.szDevice);
__system_property_get("ro.product.board", g_devInfo.szBoard);
华为电视查询结果
[device_info_init] ro.build.id : HUAWEIKANT-350S
[device_info_init] ro.board.platform : honghu818
[device_info_init] ro.hardware : honghu8xx
[device_info_init] ro.product.brand : HUAWEI
[device_info_init] ro.product.manufacturer: HUAWEI
[device_info_init] ro.product.cpu.abi: arm64-v8a
[device_info_init] ro.product.cpu.abilist: arm64-v8a,armeabi-v7a,armeabi
[device_info_init] ro.product.model : KANT-350S
[device_info_init] ro.product.device : HWKANT-350S
[device_info_init] ro.product.board : KANT
* ro.product.brand 品牌客户名称,
* ro.product.model 终端用户可见的产品名称,可以有空格
* ro.product.manufacturer 产品/硬件的制造商名称
* ro.product.name 手机正式名称客户项目代号,不要有空格,如果包含空格,会导致Google账号无法登陆
* ro.product.board 采用的底板/处理器客户项目代号
* ro.product.device 采用的设备,作用范围:adb shell进去时显示的名称客户项目代号,不要有空格
* ro.build.product 已经过时,现在使用“ro.product.device”,等同于“ro.product.device”
下面是通过adb方式查询到的详情。供读者参考。
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=LMY47V
ro.build.display.id=LMY47V.20181229 test-keys
ro.build.version.incremental=20181229
ro.build.version.sdk=22
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=5.1.1
ro.build.version.security_patch=2015-11-01
ro.build.version.base_os=
ro.build.date=Sat Dec 29 15:13:24 CST 2018
ro.build.date.utc=1546067604
ro.build.type=user
ro.build.user=www-data
ro.build.host=rjyby07
ro.build.tags=test-keys
ro.build.flavor=p351-user
ro.product.model=8A20 V8E
ro.product.brand=Skyworth
ro.product.name=p351
ro.product.device=p351
ro.product.board=p351
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.cpu.abilist=armeabi-v7a,armeabi
ro.product.cpu.abilist32=armeabi-v7a,armeabi
ro.product.cpu.abilist64=
ro.product.manufacturer=Skyworth
ro.product.locale.language=zh
ro.product.locale.region=CN
ro.wifi.channels=11
ro.board.platform=gxbaby
# ro.build.product is obsolete; use ro.product.device
ro.build.product=p351
# Do not try to parse description, fingerprint, or thumbprint
ro.build.description=p351-user 5.1.1 LMY47V 20181229 test-keys
ro.build.fingerprint=Skyworth/p351/p351:5.1.1/LMY47V/20181229:user/test-keys
ro.build.characteristics=mbx,nosdcard
# end build properties
#
# from device/customer/p351/system.prop
#
#add for Coocaa5.x by liyang
init.svc.adbd=stopping
persist.sys.usb.config=mtp
ro.build.dev_owner=system
ro.build.3Dflag=0
ro.sf.lcd_density=240
ro.product.model=8A20 V8E
ro.product.brand=Skyworth
ro.product.manufacturer=Skyworth
ro.build.ccos.type=mix
ro.build.skymodel=8A20
ro.build.skytype=V8E
ro.build.skymid=T968
ro.build.skyversion.svn=default
ro.build.skyversion.tianci=default
persist.service.homepage.pkg=com.coocaa.homeshell
persist.service.homepage.cls=com.coocaa.homeshell.Activity
third.get.4k=1
third.get.h265=1
#SystemService set
third.get.mac=0
third.get.barcode=0
third.get.launcher.start=0
third.get.factory=0
third.get.facSingleKeyEnable=false
#add by liyang end
#add by sunsikai for new start flow start
persist.get.facSingleKeyEnable=0
#add by sunsikai for new start flow end
# Set display related config
ro.platform.has.mbxuimode=true
ro.platform.has.tvuimode=true
ro.platform.has.realoutputmode=true
debug.hwui.render_dirty_regions=false
#camera max to 720p
ro.camera.preview.MaxSize=1280x720
ro.camera.preview.LimitedRate=1280x720x30,640x480x30,320x240x28
ro.camera.preview.UseMJPEG=1
persist.sys.fastboot=false
persist.sys.strictmode.disable=true
#if wifi Only
ro.radio.noril=false
#if need pppoe
ro.net.pppoe=true
#Dolby DD+ decoder option
#for TV/IPTV need set RF drc mode by default
#if defined this prop,will overwrite the value of
#/sys/class/audiodsp/ac3_drc_control
#"CUSTOM_0","CUSTOM_1","LINE","RF"
ro.dolby.drcmode=3
#this prop to for videoplayer display the DD+/DD icon when playback
ro.platform.support.dolby=true
#DTS decoder option
#display dts icon when playback
ro.platform.support.dts=true
#DTS-HD support prop
#ro.platform.support.dtstrans=true
#ro.platform.support.dtsmulasset=true
#DTS-HD prop end
# Enable player buildin
media.amplayer.seekkeyframe=true
media.amsuperplayer.enable=true
media.amplayer.enable-acodecs=ac3,eac3,rm,dts
media.amplayer.enable=true
media.amsuperplayer.m4aplayer=STAGEFRIGHT_PLAYER
media.amsuperplayer.defplayer=PV_PLAYER
media.amplayer.thumbnail=true
media.amplayer.widevineenable=false
media.amplayer.dsource4local=1
media.amplayer.startmode=true
media.arm.audio.decoder=ape,flac,dts,ac3,eac3,wma,wmapro,mp3,aac,vorbis,raac,cook,amr,pcm,adpcm,aac_latm,rm
media.wfd.use-pcm-audio=false
media.wfd.videoresolution-type=1
media.wfd.videoresolution-group=0
media.wfd.videoframerate=24
media.wfd.video-bitrate=2000000
media.html5videowin.enable=1
media.decoder.vfm.defmap=decoder ppmgr deinterlace amvideo
media.dtv.running=1
const.bootanim.delay=2500
#add for not seek chinese track automaticly
audio.track.default.chinese=false
#add for video boot, 1 means use video boot, others not .
service.bootvideo=1
# default boot video volume
sys.bootvideo.vol=5
# Define drm for this device
drm.service.enabled=1
#used forward seek for libplayer
media.libplayer.seek.fwdsearch=1
#fix dd test av sync
media.libplayer.fillzerothrsh=27000
#disable slowsync
libplayer.slowsync.disable=true
#fix hls sync
libplayer.livets.softdemux=1
libplayer.netts.recalcpts=1
#map volume
ro.audio.mapvalue=0,0,0,0
#add livhls,libcurl as default hls
media.libplayer.curlenable=true
media.libplayer.modules=vhls_mod,dash_mod,curl_mod,prhls_mod,vm_mod
#add for chezhenwu
media.libplayer.show_firstframe=0
#Hdmi In
ro.sys.hdmiin.enable=true
mbx.hdmiin.switchfull=false
mbx.hdmiin.videolayer=false
#adb
service.adb.tcp.port=5555
#switch different remote control
persist.sys.remoteid=0e
#hdcp22_key control
persist.sys.hdcp22key=false
#blutooth volume
persist.sys.T868.bluth.val=30
######## UBOOTENV VARIBLES - r/w as system properties ##########
#
# Now we can load ubootenv varibles to system properties.
# We use a special prefix ("ubootenv.var" as default) to indicate that the 'property'
# actually is an ubootenv varible.
#
# A ubootenv 'property' will be initialized during system booting. And when user set
# a different value, it will be written back to ubootenv device immediately.
#
## prefix of ubootenv varibles - should less than 16 chars.
#UBOOTENV MTD NAME
#ubootenv.var.bootcmd=
#ubootenv.var.cpuclock=
#ubootenv.var.gpuclock=
#ubootenv.var.memsize=
#ubootenv.var.ethaddr=
#ubootenv.var.ipaddr=
#ubootenv.var.gatewayip=
ubootenv.var.outputmode=
#ubootenv.var.screenratio=
#ubootenv.var.oobeflag=
ubootenv.var.480p_x=
ubootenv.var.480p_y=
ubootenv.var.480p_w=
ubootenv.var.480p_h=
ubootenv.var.480i_x=
ubootenv.var.480i_y=
ubootenv.var.480i_w=
ubootenv.var.480i_h=
ubootenv.var.576p_x=
ubootenv.var.576p_y=
ubootenv.var.576p_w=
ubootenv.var.576p_h=
ubootenv.var.576i_x=
ubootenv.var.576i_y=
ubootenv.var.576i_w=
ubootenv.var.576i_h=
ubootenv.var.720p_x=
ubootenv.var.720p_y=
ubootenv.var.720p_w=
ubootenv.var.720p_h=
ubootenv.var.1080p_x=
ubootenv.var.1080p_y=
ubootenv.var.1080p_w=
ubootenv.var.1080p_h=
ubootenv.var.1080i_x=
ubootenv.var.1080i_y=
ubootenv.var.1080i_w=
ubootenv.var.1080i_h=
ubootenv.var.4k2k24hz_x=
ubootenv.var.4k2k24hz_y=
ubootenv.var.4k2k24hz_w=
ubootenv.var.4k2k24hz_h=
ubootenv.var.4k2k25hz_x=
ubootenv.var.4k2k25hz_y=
ubootenv.var.4k2k25hz_w=
ubootenv.var.4k2k25hz_h=
ubootenv.var.4k2k30hz_x=
ubootenv.var.4k2k30hz_y=
ubootenv.var.4k2k30hz_w=
ubootenv.var.4k2k30hz_h=
ubootenv.var.4k2k50hz_x=
ubootenv.var.4k2k50hz_y=
ubootenv.var.4k2k50hz_w=
ubootenv.var.4k2k50hz_h=
ubootenv.var.4k2k60hz_x=
ubootenv.var.4k2k60hz_y=
ubootenv.var.4k2k60hz_w=
ubootenv.var.4k2k60hz_h=
ubootenv.var.4k2ksmpte_x=
ubootenv.var.4k2ksmpte_y=
ubootenv.var.4k2ksmpte_w=
ubootenv.var.4k2ksmpte_h=
ubootenv.var.digitaudiooutput=
ubootenv.var.defaulttvfrequency=
ubootenv.var.has.accelerometer=
ubootenv.var.cecconfig=
ubootenv.var.cvbsmode=
ubootenv.var.hdmimode=
ubootenv.var.is.bestmode=
ubootenv.var.disp.fromleft=
ubootenv.var.edid.crcvalue=
## p351 control uboot env
ubootenv.var.firstboot=
ubootenv.var.ipaddr=
ubootenv.var.gatewayip=
ubootenv.var.suspend=
ubootenv.var.ubootversion=
ubootenv.var.usbboot=
#disable panel rotate
ubootenv.var.has.accelerometer=
ubootenv.var.upgradefbc=
ubootenv.var.outputmode=
ubootenv.var.lcd_reverse=
ubootenv.var.console_bug=
ubootenv.var.panel_id=
ubootenv.var.panel_type=
ubootenv.var.bootfusb=
ubootenv.var.reboot_mode=
ubootenv.var.bootonetime=
tv.need.preview_window=true
#TV project,set omx to video layer,or PQ hasn't effect
media.omx.display_mode=1
#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.config.wallpaper=/system/etc/default_wallpaper.png
ro.build.skyversion=018.012.290
ro.com.android.dateformat=MM-dd-yyyy
ro.config.ringtone=Ring_Synth_04.ogg
ro.config.notification_sound=pixiedust.ogg
ro.carrier=unknown
ro.config.alarm_alert=Alarm_Classic.ogg
ro.opengles.version=131072
camera.disable_zsl_mode=1
ro.app.optimization=true
ro.product.firmware=00502001
ro.product.otaupdateurl=http://10.28.11.53:8080/otaupdate/update
persist.sys.timezone=Asia/Shanghai
dalvik.vm.heapstartsize=16m
dalvik.vm.heapgrowthlimit=192m
dalvik.vm.heapsize=512m
dalvik.vm.heaptargetutilization=0.75
dalvik.vm.heapminfree=512k
dalvik.vm.heapmaxfree=8m
sys.fb.bits=32
ro.hdmi.device_type=0
wifi.interface=wlan0
config.disable_bluetooth=false
ro.config.media_vol_steps=100
ro.product.support.tvaudio=true
drm.service.enable=true
ro.platform.has.pppoe=true
config.disable_instaboot=false
persist.sys.dalvik.vm.lib.2=libart.so
dalvik.vm.isa.arm.features=default
dalvik.vm.dexopt-flags=m=y
net.bt.name=Android