我們有時(shí)候需要判斷手機(jī)設(shè)備的類型,屬于那家公司,這時(shí)候我們就需要查看 Build 這個(gè)類了,Build 相當(dāng)于主板的 Bois 里面存儲(chǔ)有設(shè)備的相關(guān)信息

公司主營(yíng)業(yè)務(wù):成都做網(wǎng)站、網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出卡若免費(fèi)做網(wǎng)站回饋大家。
一般我們比較關(guān)心下面幾個(gè)參數(shù):
這期中一些參數(shù)其實(shí)是出乎我們的意料的,比如 Build.DISPLAY 顯示什么內(nèi)容的都有,主板有時(shí)候沒有數(shù)據(jù),能準(zhǔn)確獲取到的基本就是廠商了,注意廠商名字不是隨意的,而是全完和廠商品牌一致,這也是我們判斷設(shè)備歸屬的比較準(zhǔn)確的標(biāo)準(zhǔn)了
廠商標(biāo)識(shí)一覽:
暫時(shí)先這些內(nèi)容,有新的我再添加進(jìn)來
硬件抽象層模塊編寫規(guī)范
硬件抽象層最終都會(huì)生成.so文件,放到系統(tǒng)對(duì)應(yīng)的目錄中。在系統(tǒng)使用的時(shí)候,系統(tǒng)會(huì)去對(duì)應(yīng)目錄下加載so文件,實(shí)現(xiàn)硬件抽象層的功能。因此硬件抽象層的加載過程就是我們使用so的一個(gè)接口。先了解加載過程從源頭了解抽象層模塊兒的編寫規(guī)范。
1、硬件抽象層加載過程
系統(tǒng)在加載so的過程中,會(huì)去兩個(gè)目錄下查找對(duì)應(yīng)id的so文件。這兩個(gè)目錄分別是/system/lib/hw和/vendor/lib/hw。
so文件的名字分為兩個(gè)部分例如id.prop.so,第一部分是模塊id。第二部分是系統(tǒng)prop的值,獲取順序?yàn)椤皉o.hardware”、“ro.producat.board”、“ro.board.platform”、“ro.arch”,如果prop都找不到的話,就用default。(不是找不到prop的值,是找不到prop值對(duì)應(yīng)的so文件)。
負(fù)責(zé)加載硬件抽象層模塊的函數(shù)是hw_get_module,所在的文件是/hardware/libhardware/hardware.c如下:
/** Base path of the hal modules */
#if defined(__LP64__)
#define HAL_LIBRARY_PATH1 "/system/lib64/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw"
#else
#define HAL_LIBRARY_PATH1 "/system/lib/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"
#endif
/**
* There are a set of variant filename for modules. The form of the filename
* is ".variant.so" so for the led module the Dream variants?
* of base "ro.product.board", "ro.board.platform" and "ro.arch" would be:
*
* led.trout.so
* led.msm7k.so
* led.ARMV6.so
* led.default.so
*/
static const char *variant_keys[] = {
"ro.hardware", ?/* This goes first so that it can pick up a different
file on the emulator. */
"ro.product.board",
"ro.board.platform",
"ro.arch"
};
static const int HAL_VARIANT_KEYS_COUNT =
(sizeof(variant_keys)/sizeof(variant_keys[0]));
/**
* Load the file defined by the variant and if successful
* return the dlopen handle and the hmi.
* @return 0 = success, !0 = failure.
*/
static int load(const char *id,
const char *path,
const struct hw_module_t **pHmi)
{
int status;
void *handle;
struct hw_module_t *hmi;
/*
* load the symbols resolving undefined symbols before
* dlopen returns. Since RTLD_GLOBAL is not or'd in with
* RTLD_NOW the external symbols will not be global
*/
handle = dlopen(path, RTLD_NOW);
if (handle == NULL) {
char const *err_str = dlerror();
ALOGE("load: module=%s\n%s", path, err_str?err_str:"unknown");
status = -EINVAL;
goto done;
}
/* Get the address of the struct hal_module_info. */
const char *sym = HAL_MODULE_INFO_SYM_AS_STR;
hmi = (struct hw_module_t *)dlsym(handle, sym);
if (hmi == NULL) {
ALOGE("load: couldn't find symbol %s", sym);
status = -EINVAL;
goto done;
}
/* Check that the id matches */
if (strcmp(id, hmi-id) != 0) {
ALOGE("load: id=%s != hmi-id=%s", id, hmi-id);
status = -EINVAL;
goto done;
}
hmi-dso = handle;
/* success */
status = 0;
done:
if (status != 0) {
hmi = NULL;
if (handle != NULL) {
dlclose(handle);
handle = NULL;
}
} else {
ALOGV("loaded HAL id=%s path=%s hmi=%p handle=%p",
id, path, *pHmi, handle);
}
*pHmi = hmi;
return status;
}
/*
* Check if a HAL with given name and subname exists, if so return 0, otherwise
* otherwise return negative. ?On success path will contain the path to the HAL.
*/
static int hw_module_exists(char *path, size_t path_len, const char *name,
const char *subname)
{
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH2, name, subname);
if (access(path, R_OK) == 0)
return 0;
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH1, name, subname);
if (access(path, R_OK) == 0)
return 0;
return -ENOENT;
}
int hw_get_module_by_class(const char *class_id, const char *inst,
const struct hw_module_t **module)
{
int i;
char prop[PATH_MAX];
char path[PATH_MAX];
char name[PATH_MAX];
char prop_name[PATH_MAX];
if (inst)
snprintf(name, PATH_MAX, "%s.%s", class_id, inst);
else
strlcpy(name, class_id, PATH_MAX);
/*
* Here we rely on the fact that calling dlopen multiple times on
* the same .so will simply increment a refcount (and not load
* a new copy of the library).
* We also assume that dlopen() is thread-safe.
*/
/* First try a property specific to the class and possibly instance */
snprintf(prop_name, sizeof(prop_name), "ro.hardware.%s", name);
if (property_get(prop_name, prop, NULL) 0) {
if (hw_module_exists(path, sizeof(path), name, prop) == 0) {
goto found;
}
}
/* Loop through the configuration variants looking for a module */
for (i=0 ; iHAL_VARIANT_KEYS_COUNT; i++) {
if (property_get(variant_keys[i], prop, NULL) == 0) {
continue;
}
if (hw_module_exists(path, sizeof(path), name, prop) == 0) {
goto found;
}
}
/* Nothing found, try the default */
if (hw_module_exists(path, sizeof(path), name, "default") == 0) {
goto found;
}
return -ENOENT;
found:
/* load the module, if this fails, we're doomed, and we should not try
* to load a different variant. */
return load(class_id, path, module);
}
int hw_get_module(const char *id, const struct hw_module_t **module)
{
return hw_get_module_by_class(id, NULL, module);
}
找到so文件之后,調(diào)用方法load方法去加載對(duì)應(yīng)的so文件,并返回hw_module_t結(jié)構(gòu)體。load方法源碼在上面程序中。
load方法首先調(diào)用dlopen加載對(duì)應(yīng)的so文件到內(nèi)存中。然后用dlsym方法找到變量HAL_MODULE_INFO_SYM_AS_STR符號(hào)對(duì)應(yīng)的地址,這個(gè)地址也就是一個(gè)hw_module_t結(jié)構(gòu)體,然后從這個(gè)結(jié)構(gòu)體中拿出id比對(duì)load方法出入的id是否一致,如果是的話表示打開成功。加載過程完成。
HAL_MODULE_INFO_SYM_AS_STR這個(gè)符號(hào)值為HMI,也就是必須要保證這個(gè)符號(hào)之后是一個(gè)hw_module_t。接下來的規(guī)范中有這個(gè)要求。
到此,模塊加載完成
2、硬件抽象層模塊編寫規(guī)范
硬件抽象層有兩個(gè)結(jié)構(gòu)體,一個(gè)是hw_module_t和hw_device_t,定義在hardware.h中。
首先說一下hw_module_t的編寫規(guī)范。
1、必須要有一個(gè)“自定義硬件抽象層結(jié)構(gòu)體”,且結(jié)構(gòu)體第一個(gè)變量類型要為hw_module_t。
2、必須存在一個(gè)HARDWARE_MODULE_INFO_TAG的符號(hào),且指向“自定義硬件抽象層結(jié)構(gòu)體”。在加載的時(shí)候根據(jù)這個(gè)符號(hào)找到地址,并把地址的轉(zhuǎn)變?yōu)閔w_module_t,這也是為什么第一條中hw_module_t必須要在第一個(gè)的原因。
3、hw_module_t的tag必須為HARDWARE_MODULE_TAG
4、結(jié)構(gòu)體中要有一個(gè)方法列表,其中要有一個(gè)open方法。用open方法獲得hw_device_t
接下來說一下hw_device_t的編寫規(guī)范
1、必須要有一個(gè)“自定義硬件設(shè)備結(jié)構(gòu)體”,且結(jié)構(gòu)體第一個(gè)變量類型要為hw_device_t。
2、hw_device_t的tag必須為HARDWARE_DEVICE_TAG
3、要有一個(gè)close函數(shù)指針,來關(guān)閉設(shè)備
按照上面規(guī)范編寫的硬件抽象層就可以由系統(tǒng)加載并正確獲取到device。具體的應(yīng)用層邏輯在device中實(shí)現(xiàn)。
你們知道查看電腦硬件信息有哪些 方法 嗎,下面是我?guī)戆沧渴謾C(jī)查看硬件信息方法的內(nèi)容,歡迎閱讀!
安卓手機(jī)查看硬件信息方法:
找到到手機(jī)的“設(shè)置”按鈕,在設(shè)置里面可以找到一個(gè)“關(guān)于手機(jī)”的信息
點(diǎn)開“關(guān)于手機(jī)”可以查詢到手機(jī)的硬件配置 和 操作系統(tǒng) 信息,這些大部分都是準(zhǔn)確得
在設(shè)置里面的“電池”選項(xiàng),可以查看到手機(jī)的耗電情況,如果屏幕耗電量太大,可以將手機(jī)的屏幕亮度調(diào)暗點(diǎn),
在設(shè)置里面的“存儲(chǔ)”選項(xiàng),可以查看到手機(jī)的存儲(chǔ)情況,定期清理一些緩存文件可以手機(jī)運(yùn)行速度變快
在設(shè)置里面的“WALN”選項(xiàng),可以查看到手無線網(wǎng)卡的mac地址,如果一些場(chǎng)合要進(jìn)行mac地址綁定,可以用的到。
看了“安卓手機(jī)查看硬件信息方法”的內(nèi)容的人還看:
1. android硬件信息怎么查看
2. android怎么獲取硬件信息
3. 怎么檢測(cè)手機(jī)硬件信息
4. 360怎么檢查手機(jī)硬件信息
5. win7查看硬件信息方法
6. 怎么檢測(cè)手機(jī)硬件廠家
7. 怎么檢測(cè)手機(jī)硬件問題
8. 查看電腦配置的方法與技巧
9. 怎么檢測(cè)手機(jī)硬件好壞
10. win7如何查看硬件信息
您的開發(fā)編譯機(jī)必須達(dá)到或超出以下硬件要求:
如果是 Gingerbread (2.3.x) 及更高版本(包括 master 分支),需要使用 64 位環(huán)境。如果是較低的版本,則可以在 32 位系統(tǒng)中進(jìn)行編譯。
如果是校驗(yàn)代碼,至少需要 100GB 可用磁盤空間;如果要進(jìn)行編譯,則還需要 150GB。如果要進(jìn)行多次編譯或使用 ccache,則需要更多空間。
如果您在虛擬機(jī)中運(yùn)行 Linux,則至少需要 16GB 的 RAM/交換空間(swap)。
本文名稱:android硬件,android硬件檢測(cè)
當(dāng)前路徑:http://chinadenli.net/article46/dsgdjeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營(yíng)銷、網(wǎng)站收錄、網(wǎng)站內(nèi)鏈、企業(yè)建站、營(yíng)銷型網(wǎng)站建設(shè)、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)