當前位置:編程學習大全網 - 編程語言 - Android編譯版本eng,user和userdebug的區別

Android編譯版本eng,user和userdebug的區別

Android編譯版本eng、user和userdebug的區別:

壹、Android官網的解釋

eng This is the default flavor. A plain make is the same as make eng.

* Installs modules tagged with: eng, debug, user, and/or development.

* Installs non-APK modules that have no tags specified.

* Installs APKs according to the product definition files, in addition to tagged APKs.

* ro.secure=0

* ro.debuggable=1

* ro.kernel.android.checkjni=1

* adb is enabled by default.

* Setupwizard is optional

user make user

This is the flavor intended to be the final release bits.

* Installs modules tagged with user.

* Installs non-APK modules that have no tags specified.

* Installs APKs according to the product definition files; tags are ignored for APK modules.

* ro.secure=1

* ro.debuggable=0

* adb is disabled by default.

* Enable dex pre-optimization for all TARGET projects in default to speed up device first boot-up

userdebug make userdebug

The same as user, except:

* Also installs modules tagged with debug.

* ro.debuggable=1

* adb is enabled by default.

二、對編譯版本MTK的補充說明

MTK 補充說明差異:(

(1) Debug/LOG 方面,原則上user 版本只能抓到有限的資訊,eng 可以抓到更多的資訊,Debug 能力更強,推崇使用eng 版本開發測試

* 因user/eng 版本設置ro.secure不同,導致user 版本adb 只擁有shell 權限,而eng 版本具有root 權限

* MTK System LOG 在ICS 以後,在user 版本默認關閉全部LOG, 在eng 版本中默認打開,以便抓到完整的資訊

* 在eng 版本上,LOG 量 >= user 版本的log 量,壹些地方會直接check eng/user 版本來確認是否打印LOG

* user 版本默認關閉uart, eng 版本默認開啟uart

* 在eng 版本上,開啟ANR 的predump, 會抓取ftrace,可以得到更多ANR的資訊

* 在eng 版本上,可用rtt 抓取backtrace,可開啟kdb 進行kernel debug, 可用ftrace 抓取cpu 執行場景

* MTK aee 在ENG 版本抓取更多的異常資訊,比如native exception 會抓取core dump 信息

(2) 性能方面,原則上進行性能測試請使用user 版本測試

* user 版本為提高第壹次開機速度,使用了DVM 的預優化,將dex 文件分解成可直接load 運行的odex 文件,ENG 版本不會開啟這項優化

* 更少的LOG 打印,uart 的關閉,原則上user 版本的性能要優於eng 版本

(3) 如何確認user/eng 版本

* Java 層,check android.os.Build 類中的TYPE 值

* native 層,property_get("ro.build.type", char* value, "eng"); 然後check value 值

* Debug 時, adb shell getprop ro.build.type 返回值如果是user 即user 版本,eng 即eng 版本

* Log 確認, mobile log/Aplog_xxxxx/versions 中查看ro.build.type 屬性

(4) 如何編譯user/eng 版本

* 默認編譯是eng 版本,如果需要編譯user 版本,請加入參數 -o=TARGET_BUILD_VARIANT=user 如:

./mk -o=TARGET_BUILD_VARIANT=user mt6577_phone new

default.prop和/system/build.prop

三、編譯版本與ADB、root的控制關系

1. root權限:adb.c中與屬性ro.kernel.qemu(是否是模擬器)、ro.secure、ro.debuggable、service.adb.root幾個相關聯。

service.adb.root : services.c -> restart_root_service()中設置

build/core/main.mk的如下地方決定了了ro.secure和ro.debuggable的值

user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))

enable_target_debugging := true

tags_to_install :=

ifneq (,$(user_variant))

# Target is secure in user builds.

ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1

...

else # !user_variant

# Turn on checkjni for non-user builds.

ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1

# Set device insecure for non-user builds.

ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0

# Allow mock locations by default for non user builds

ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1

endif # !user_variant

ifeq (true,$(strip $(enable_target_debugging)))

# Target is more debuggable and adbd is on by default

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1

# Include the debugging/testing OTA keys in this build.

INCLUDE_TEST_OTA_KEYS := true

else # !enable_target_debugging

# Target is less debuggable and adbd is off by default

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0

endif # !enable_target_debugging

## eng ##

...

endif

2. 是否開啟adbd服務:UsbDeviceManager.java中與屬性persist.sys.usb.config、sys.usb.config、persist.service.adb.enable幾個相關聯

persist.sys.usb.config:/build/tools/post_process_props.py中根據ro.debuggable來設置persist.sys.usb.config的初始值

sys.usb.config:UsbDeviceManager.java -> setUsbConfig

文件init.clippers.usb.rc中監聽了sys.usb.config屬性變化時的動作

on property:sys.usb.config=adb

  • 上一篇:切實重視高中信息技術理論課的實效性_信息技術手段教學實效
  • 下一篇:管理者要具備哪些條件?
  • copyright 2024編程學習大全網