在做项目的时候,经常需要采集一些设备信息,但又不经常用,所以有时候会查询需求满足的接口是哪个,所以周末就针对此整理了一下
Build.ID; //Either a changelist number, or a label like "M4-rc20".
Build.DISPLAY; //A build ID string meant for displaying to the user(设置-关于手机-版本号)
Build.PRODUCT; //The name of the overall product.(整个产品的名称)
Build.DEVICE; //The name of the industrial design.(工业设计名称--设备名称)
Build.BOARD; //The name of the underlying board, like "goldfish".(主板名称)
Build.MANUFACTURER; //The manufacturer of the product/hardware.(硬件制造商)
Build.BRAND; //The consumer-visible brand with which the product/hardware will be associated, if any.(设备品牌)
Build.MODEL; //The end-user-visible name for the end product.(终端用户可见的设备型号)
Build.BOOTLOADER; //The system bootloader version number.(系统程序的版本号)
Build.HARDWARE; // The name of the hardware (from the kernel command line or /proc).(硬件名称)
Build.SERIAL; // A hardware serial number, if available.Alphanumeric only, case-insensitive.(硬件序列号)
Build.TYPE; //The type of build, like "user" or "eng".(设备版本类型)
Build.TAGS; //Comma-separated tags describing the build, like "unsigned,debug".(设备标签,未签名/测试)
/** A string that uniquely identifies this build. Do not attempt to parse this value.
* 设备唯一标示,是由build的多个设备信息拼接而成
* getString("ro.product.brand") + '/' +//BRAND
* getString("ro.product.name") + '/' +//PRODUCT
* getString("ro.product.device") + ':' +//DEVICE
* getString("ro.build.version.release") + '/' +//VERSION.RELEASE
* getString("ro.build.id") + '/' +//ID
* getString("ro.build.version.incremental") + ':' +//VERSION.INCREMENTAL
* getString("ro.build.type") + '/' +//TYPE
* getString("ro.build.tags")
* */
Build.FINGERPRINT;
// The following properties only make sense for internal engineering builds.
//主要for工程师调试版本
Build.HOST;
Build.USER;
Build.TIME;
Build.VERSION.INCREMENTAL; //The internal value used by the underlying source control to represent this build.E.g., a perforce changelist number or a git hash.
Build.VERSION.SDK_INT; //The user-visible SDK version of the framework;
* its possible values are defined in {@link Build.VERSION_CODES}.
Build.VERSION.CODENAME //The current development codename, or the string "REL" if this is a release build.
Build.VERSION.RELEASE; //The user-visible version string. E.g., "1.0" or "3.4b5". (Android SDK version)
Build.VERSION.BASE_OS; //The base OS build the product is based on.
补充,Build.TYPE返回结果表示:
user表示用户版,有限的访问权限,适合product环境;adb默认是关闭的
userdebug,和user类似,具有root和debug权限;
eng 表示工程师版, 可调试;adb默认是打开的
看英文描述有时候并不能确定返回的值是否满足自己的需求,故针对此写了测试用例,查看了返回结果,针对结果看描述就会更清楚其表达
key | google nexus5 | 小米6 原生系统 | 小米3 MIUI系统 |
---|---|---|---|
android.os.Build#ID | M4B30Z | OPR1.170623.027 | MMB29M |
android.os.Build#DISPLAY | M4B30Z | sagit-eng 8.0.0 OPR1.170623.027 2017.12.20_aosp-debug test-keys | MMB29M test-keys |
android.os.Build#PRODUCT | hammerhead | sagit | cancro |
android.os.Build#DEVICE | hammerhead | sagit | cancro |
android.os.Build#BOARD | hammerhead | msm8998 | MSM8974 |
android.os.Build#MANUFACTURER | LGE | Xiaomi | Xiaomi |
android.os.Build#BRAND | Xiaomi | Xiaomi | |
android.os.Build#MODEL | Nexus 5 | MI 6 | MI 3W |
android.os.Build#BOOTLOADER | HHZ20h | unknown | unknown |
android.os.Build#HARDWARE | hammerhead | qcom | qcom |
android.os.Build#SERIAL | 037abc3e09318c78 | c3b4ba0d | 584db4 |
android.os.Build#TYPE | user | eng | user |
android.os.Build#TAGS | release-keys | test-keys | test-keys |
android.os.Build#FINGERPRINT | google/hammerhead/hammerhead:6.0.1/M4B30Z/3437181:user/release-keys | Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/2017.12.20_aosp-debug:eng/test-keys | Xiaomi/cancro/cancro:6.0.1/MMB29M/7.12.16:user/test-keys |
android.os.Build#HOST | wpdu6.hot.corp.google.com | c3-miui-sdk-fe01.bj | c3-miui-ota-bd122.bj |
android.os.Build#USER | android-build | work | builder |
android.os.Build#TIME | 478203422000 | 1513737970000 | 1513410304000 |
android.os.Build#VERSION.INCREMENTAL | 3437181 | 2017.12.20_aosp-debug | 7.12.16 |
android.os.Build#VERSION.SDK_INT | 23 | 26 | 23 |
android.os.Build#VERSION.CODENAME | REL | REL | REL |
android.os.Build#VERSION.RELEASE | 6.0.1 | 8.0.0 | 6.0.1 |
android.os.Build#VERSION.BASE_OS |
上述数据源log打印数据如下
12-23 12:56:32.511 I/android.os.Build#ID: (29436): M4B30Z
12-23 12:56:32.511 I/android.os.Build#DISPLAY: (29436): M4B30Z
12-23 12:56:32.511 I/android.os.Build#PRODUCT: (29436): hammerhead
12-23 12:56:32.511 I/android.os.Build#DEVICE: (29436): hammerhead
12-23 12:56:32.511 I/android.os.Build#BOARD: (29436): hammerhead
12-23 12:56:32.511 I/android.os.Build#MANUFACTURER: (29436): LGE
12-23 12:56:32.511 I/android.os.Build#BRAND: (29436): google
12-23 12:56:32.511 I/android.os.Build#MODEL: (29436): Nexus 5
12-23 12:56:32.511 I/android.os.Build#BOOTLOADER: (29436): HHZ20h
12-23 12:56:32.511 I/android.os.Build#HARDWARE: (29436): hammerhead
12-23 12:56:32.511 I/android.os.Build#SERIAL: (29436): 037abc3e09318c78
12-23 12:56:32.511 I/android.os.Build#TYPE: (29436): user
12-23 12:56:32.511 I/android.os.Build#TAGS: (29436): release-keys
12-23 12:56:32.511 I/android.os.Build#FINGERPRINT: (29436): google/hammerhead/hammerhead:6.0.1/M4B30Z/3437181:user/release-keys
12-23 12:56:32.511 I/android.os.Build#HOST: (29436): wpdu6.hot.corp.google.com
12-23 12:56:32.511 I/android.os.Build#USER: (29436): android-build
12-23 12:56:32.512 I/android.os.Build#TIME: (29436): 1478203422000
12-23 12:56:32.512 I/android.os.Build#VERSION.INCREMENTAL: (29436): 3437181
12-23 12:56:32.512 I/android.os.Build#VERSION.SDK_INT: (29436): 23
12-23 12:56:32.512 I/android.os.Build#VERSION.CODENAME: (29436): REL
12-23 12:56:32.512 I/android.os.Build#VERSION.RELEASE: (29436): 6.0.1
12-23 05:18:00.959 I/android.os.Build#ID: (10108): OPR1.170623.027
12-23 05:18:00.959 I/android.os.Build#DISPLAY: (10108): sagit-eng 8.0.0 OPR1.170623.027 2017.12.20_aosp-debug test-keys
12-23 05:18:00.959 I/android.os.Build#PRODUCT: (10108): sagit
12-23 05:18:00.959 I/android.os.Build#DEVICE: (10108): sagit
12-23 05:18:00.960 I/android.os.Build#BOARD: (10108): msm8998
12-23 05:18:00.960 I/android.os.Build#MANUFACTURER: (10108): Xiaomi
12-23 05:18:00.960 I/android.os.Build#BRAND: (10108): Xiaomi
12-23 05:18:00.960 I/android.os.Build#MODEL: (10108): MI 6
12-23 05:18:00.960 I/android.os.Build#BOOTLOADER: (10108): unknown
12-23 05:18:00.960 I/android.os.Build#HARDWARE: (10108): qcom
12-23 05:18:00.960 I/android.os.Build#SERIAL: (10108): c3b4ba0d
12-23 05:18:00.960 I/android.os.Build#TYPE: (10108): eng
12-23 05:18:00.960 I/android.os.Build#TAGS: (10108): test-keys
12-23 05:18:00.960 I/android.os.Build#FINGERPRINT: (10108): Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/2017.12.20_aosp-debug:eng/test-keys
12-23 05:18:00.960 I/android.os.Build#HOST: (10108): c3-miui-sdk-fe01.bj
12-23 05:18:00.960 I/android.os.Build#USER: (10108): work
12-23 05:18:00.960 I/android.os.Build#TIME: (10108): 1513737970000
12-23 05:18:00.960 I/android.os.Build#VERSION.INCREMENTAL: (10108): 2017.12.20_aosp-debug
12-23 05:18:00.960 I/android.os.Build#VERSION.SDK_INT: (10108): 26
12-23 05:18:00.960 I/android.os.Build#VERSION.CODENAME: (10108): REL
12-23 05:18:00.960 I/android.os.Build#VERSION.RELEASE: (10108): 8.0.0
12-23 05:18:00.960 I/android.os.Build#VERSION.BASE_OS: (10108):
12-23 12:55:05.725 I/android.os.Build#ID: (16606): MMB29M
12-23 12:55:05.725 I/android.os.Build#DISPLAY: (16606): MMB29M test-keys
12-23 12:55:05.725 I/android.os.Build#PRODUCT: (16606): cancro
12-23 12:55:05.725 I/android.os.Build#DEVICE: (16606): cancro
12-23 12:55:05.725 I/android.os.Build#BOARD: (16606): MSM8974
12-23 12:55:05.725 I/android.os.Build#MANUFACTURER: (16606): Xiaomi
12-23 12:55:05.725 I/android.os.Build#BRAND: (16606): Xiaomi
12-23 12:55:05.725 I/android.os.Build#MODEL: (16606): MI 3W
12-23 12:55:05.725 I/android.os.Build#BOOTLOADER: (16606): unknown
12-23 12:55:05.725 I/android.os.Build#HARDWARE: (16606): qcom
12-23 12:55:05.725 I/android.os.Build#SERIAL: (16606): 584db4
12-23 12:55:05.725 I/android.os.Build#TYPE: (16606): user
12-23 12:55:05.725 I/android.os.Build#TAGS: (16606): test-keys
12-23 12:55:05.725 I/android.os.Build#FINGERPRINT: (16606): Xiaomi/cancro/cancro:6.0.1/MMB29M/7.12.16:user/test-keys
12-23 12:55:05.725 I/android.os.Build#HOST: (16606): c3-miui-ota-bd122.bj
12-23 12:55:05.725 I/android.os.Build#USER: (16606): builder
12-23 12:55:05.725 I/android.os.Build#TIME: (16606): 1513410304000
12-23 12:55:05.727 I/android.os.Build#VERSION.INCREMENTAL: (16606): 7.12.16
12-23 12:55:05.727 I/android.os.Build#VERSION.SDK_INT: (16606): 23
12-23 12:55:05.727 I/android.os.Build#VERSION.CODENAME: (16606): REL
12-23 12:55:05.727 I/android.os.Build#VERSION.RELEASE: (16606): 6.0.1
转自:https://blog.csdn.net/dzkdxyx/article/details/78879521