目录
1.修改device/mediatek/system/common/device.mk
2.修改device/mediatek/system/common/mtklog/mtklog-config-bsp-eng.prop,修改为false是为了开机的时候不要自动启动
3.修改device/mediatek/vendor/common/device.mk
4.修改vendor/mediatek/proprietary/external/NetworkLogD/netdiag/commandlistening.cpp
5.修改vendor/mediatek/proprietary/external/mobile_log_d/config.c
6.修改vendor/mediatek/proprietary/packages/apps/EngineerMode/Android.mk
7.修改vendor/mediatek/proprietary/packages/apps/EngineerMode/AndroidManifest.xml 添加暗码
8.修改vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/EngineerModeReceiver.java
9.vendor/mediatek/proprietary/packages/apps/MTKLogger/Android.mk
10.修改vendor/mediatek/proprietary/packages/apps/MTKLogger/AndroidManifest.xml,不显示应用图标
11.修改vendor/mediatek/proprietary/packages/apps/MTKLogger/src/com/debug/loggerui/utils/Utils.java,更换log的保存路径为内部SD卡
在user版本无法使用Mtklogger,需要客户抓log的时候非常麻烦。
现在把MtkLogger在user版本中打开,方便抓log
1.修改device/mediatek/system/common/device.mk
--- a/device/mediatek/system/common/device.mk
+++ b/device/mediatek/system/common/device.mk
@@ -690,13 +690,13 @@ $(call inherit-product-if-exists, vendor/mediatek/common/device-vendor.mk)# mtklog configifeq ($(strip $(MTK_BASIC_PACKAGE)), yes)
- ifeq ($(TARGET_BUILD_VARIANT),eng)
+ ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug user),)PRODUCT_COPY_FILES += $(LOCAL_PATH)/mtklog/mtklog-config-basic-eng.prop:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/mtklog-config.prop:mtkelsePRODUCT_COPY_FILES += $(LOCAL_PATH)/mtklog/mtklog-config-basic-user.prop:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/mtklog-config.prop:mtkendifelse
- ifeq ($(TARGET_BUILD_VARIANT),eng)
+ ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug user),)PRODUCT_COPY_FILES += $(LOCAL_PATH)/mtklog/mtklog-config-bsp-eng.prop:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/mtklog-config.prop:mtkelsePRODUCT_COPY_FILES += $(LOCAL_PATH)/mtklog/mtklog-config-bsp-user.prop:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/mtklog-config.prop:mtk
@@ -2469,7 +2469,7 @@ ifneq ($(wildcard vendor/mediatek/internal/mtklog_enable),)MSSI_HAVE_AEE_FEATURE = noendif# Case: Customer eng/userdebug load
-else ifneq ($(strip $(TARGET_BUILD_VARIANT)),user)
+else ifneq ($(strip $(TARGET_BUILD_VARIANT)),eng userdebug user)PRODUCT_SYSTEM_DEFAULT_PROPERTIES += ro.vendor.customer_logpath=/dataPRODUCT_PACKAGES += log-handlerPRODUCT_PACKAGES += loghidlsysservice
@@ -3736,7 +3736,7 @@ ifeq ($(strip $(MSSI_MTK_ENGINEERMODE_APP)), yes)PRODUCT_PACKAGES += libem_audio_jniPRODUCT_PACKAGES += libem_aoltest_jnielse
- ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug),)
+ ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug user),)PRODUCT_PACKAGES += EngineerModePRODUCT_PACKAGES += libem_support_jniPRODUCT_PACKAGES += libem_usb_jni
2.修改device/mediatek/system/common/mtklog/mtklog-config-bsp-eng.prop,修改为false是为了开机的时候不要自动启动
--- a/device/mediatek/system/common/mtklog/mtklog-config-bsp-eng.prop
+++ b/device/mediatek/system/common/mtklog/mtklog-config-bsp-eng.prop
@@ -1,14 +1,14 @@# mtk log path can be set as system_data or device_storage or portable_storage
-mtklog_path = system_data
+mtklog_path = device_storagecom.mediatek.log.mobile.customer = MTK_Internal
-com.mediatek.log.mobile.AllMode = true
+com.mediatek.log.mobile.AllMode = false-com.mediatek.log.mobile.enabled = true
-com.mediatek.log.modem.enabled = true
-com.mediatek.log.net.enabled = true
-com.mediatek.log.connsysfw.enabled = true
-com.mediatek.log.gpshost.enabled = true
-com.mediatek.log.bthost.enabled = true
+com.mediatek.log.mobile.enabled = false
+com.mediatek.log.modem.enabled = false
+com.mediatek.log.net.enabled = false
+com.mediatek.log.connsysfw.enabled = false
+com.mediatek.log.gpshost.enabled = false
+com.mediatek.log.bthost.enabled = falsecom.mediatek.log.mobile.maxsize = 1000com.mediatek.log.mobile.totalmaxsize = 1000
@@ -17,7 +17,7 @@ com.mediatek.log.net.maxsize =600com.mediatek.log.connsysfw.maxsize = 2000com.mediatek.log.bthost.maxsize = 2000-com.mediatek.log.wifisa.enabled = true
+com.mediatek.log.wifisa.enabled = falsecom.mediatek.log.wifisa.size = 30com.mediatek.log.wifisa.count = 3
3.修改device/mediatek/vendor/common/device.mk
--- a/device/mediatek/vendor/common/device.mk
+++ b/device/mediatek/vendor/common/device.mk
@@ -579,7 +579,7 @@ ifeq ($(strip $(MTK_ENGINEERMODE_APP)),yes)DEVICE_MANIFEST_FILE += $(LOCAL_PATH)/project_manifest/manifest_em.xmlPRODUCT_PACKAGES += em_hidlelse
- ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug),)
+ ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug user),)DEVICE_MANIFEST_FILE += $(LOCAL_PATH)/project_manifest/manifest_em.xmlPRODUCT_PACKAGES += em_hidlendif
4.修改vendor/mediatek/proprietary/external/NetworkLogD/netdiag/commandlistening.cpp
--- a/vendor/mediatek/proprietary/external/NetworkLogD/netdiag/commandlistening.cpp
+++ b/vendor/mediatek/proprietary/external/NetworkLogD/netdiag/commandlistening.cpp
@@ -180,7 +180,7 @@ bool commandlistening::isCustomerUserLoad() {property_get("ro.build.type", buildtype, "user");if (0 == strncmp("0",internal,strlen("0"))&& 0 == strncmp("user",buildtype,strlen("userdebug"))) {
- result = true;
+ //result = true;}LOGD("isCustomerUserLoad()? %d,internal = %s,buildtype =%s",
5.修改vendor/mediatek/proprietary/external/mobile_log_d/config.c
--- a/vendor/mediatek/proprietary/external/mobile_log_d/config.c
+++ b/vendor/mediatek/proprietary/external/mobile_log_d/config.c
@@ -775,10 +775,13 @@ int update_sd_context(const char* path) {}int load_type() {
+ return 0;
+ /*char build_type[BUFFER_SIZE_128] = {0};char internal_prpject[BUFFER_SIZE_128] = {0};property_get("ro.build.type", build_type, "");property_get("ro.vendor.mtklog_internal", internal_prpject, "");if (strcmp(build_type, "user") != 0 || strcmp(internal_prpject, "1") == 0) return 0;return 1;
+ */
6.修改vendor/mediatek/proprietary/packages/apps/EngineerMode/Android.mk
--- a/vendor/mediatek/proprietary/packages/apps/EngineerMode/Android.mk
+++ b/vendor/mediatek/proprietary/packages/apps/EngineerMode/Android.mk
@@ -64,7 +64,7 @@ LOCAL_STATIC_JAVA_LIBRARIES += vendor.mediatek.hardware.mtkradioex-V3.0-javaendif# Files only for eng/user_debug load
-ifeq ($(TARGET_BUILD_VARIANT), eng)
+#ifeq ($(TARGET_BUILD_VARIANT), eng user)ENG_ONLY_TEL_FILE := $(call all-java-files-under, $(JAVA_SRC_DIR)/amrwb) \$(call all-java-files-under, $(JAVA_SRC_DIR)/sbp) \$(call all-java-files-under, $(JAVA_SRC_DIR)/u3phy) \
@@ -132,7 +132,7 @@ ifeq ($(TARGET_BUILD_VARIANT), eng)$(JAVA_SRC_DIR)/cip/CipPropContentActivity.javaLOCAL_SRC_FILES := $(filter-out $(ENG_ONLY_OTHERS_FILE), $(LOCAL_SRC_FILES))
-endif
+#endififeq (,$(filter $(MSSI_MTK_TELEPHONY_ADD_ON_POLICY),1))
7.修改vendor/mediatek/proprietary/packages/apps/EngineerMode/AndroidManifest.xml 添加暗码
--- a/vendor/mediatek/proprietary/packages/apps/EngineerMode/AndroidManifest.xml
+++ b/vendor/mediatek/proprietary/packages/apps/EngineerMode/AndroidManifest.xml
@@ -611,6 +611,9 @@<dataandroid:host="3646633"android:scheme="android_secret_code" />
+ <data
+ android:host="0594666"
+ android:scheme="android_secret_code" /></intent-filter></receiver><activity
8.修改vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/EngineerModeReceiver.java
--- a/vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/EngineerModeReceiver.java
+++ b/vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/EngineerModeReceiver.java
@@ -39,6 +39,7 @@ import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.net.Uri;
+import android.content.ComponentName;/*** Broadcast receiver for EM start secret code.
@@ -49,18 +50,35 @@ public final class EngineerModeReceiver extends BroadcastReceiver {private static final String TAG = "EngineerModeReceiver";private static final String SECRET_CODE_ACTION= "android.provider.Telephony.SECRET_CODE";
-
+ // process *#*#3646633#*#*
+ private final Uri mEmUri = Uri.parse("android_secret_code://3646633");
+ // process *#*#0594666#*#* mtklog
+ private final Uri mMtklogUri1 = Uri.parse("android_secret_code://0594666");@Overridepublic void onReceive(Context context, Intent intent) {if (intent.getAction() == null) {Elog.e(TAG, "Null action");return;}
+if (intent.getAction().equals(SECRET_CODE_ACTION)) {
- Elog.i(TAG, "Receive secret code intent");
- Intent intentEm = new Intent(context, EngineerMode.class);
- intentEm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intentEm);
- }
+ Uri uri = intent.getData();
+ Elog.i(TAG, "Receive secret code intent and uri is " + uri);
+ if (uri.equals(mEmUri))
+ {
+ Intent intentEm = new Intent(context, EngineerMode.class);
+ intentEm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(intentEm);
+ }else if(uri.equals(mMtklogUri1)){
+ String packageName = "com.debug.loggerui";
+ String className = "com.debug.loggerui.MainActivity";
+ Intent intentEm = new Intent(Intent.ACTION_MAIN);
+ intentEm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ ComponentName cn = new ComponentName(packageName, className);
+ intentEm.setComponent(cn);
+ context.startActivity(intentEm);
+ }
+ }
+}}
9.vendor/mediatek/proprietary/packages/apps/MTKLogger/Android.mk
--- a/vendor/mediatek/proprietary/packages/apps/MTKLogger/Android.mk
+++ b/vendor/mediatek/proprietary/packages/apps/MTKLogger/Android.mk
@@ -3,9 +3,9 @@ LOCAL_PATH:= $(call my-dir)# Build DebugLoggerUI.apkinclude $(CLEAR_VARS)-ifeq ($(TARGET_BUILD_VARIANT), user)
-LOCAL_MANIFEST_FILE := user/AndroidManifest.xml
-endif
+#ifeq ($(TARGET_BUILD_VARIANT), user)
+#LOCAL_MANIFEST_FILE := user/AndroidManifest.xml
+#endifLOCAL_MODULE_TAGS := optionalLOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
10.修改vendor/mediatek/proprietary/packages/apps/MTKLogger/AndroidManifest.xml,不显示应用图标
--- a/vendor/mediatek/proprietary/packages/apps/MTKLogger/AndroidManifest.xml
+++ b/vendor/mediatek/proprietary/packages/apps/MTKLogger/AndroidManifest.xml
@@ -44,7 +44,7 @@<intent-filter><action android:name="android.intent.action.MAIN" />- <category android:name="android.intent.category.LAUNCHER" />
+ <category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
11.修改vendor/mediatek/proprietary/packages/apps/MTKLogger/src/com/debug/loggerui/utils/Utils.java,更换log的保存路径为内部SD卡
--- a/vendor/mediatek/proprietary/packages/apps/MTKLogger/src/com/debug/loggerui/utils/Utils.java
+++ b/vendor/mediatek/proprietary/packages/apps/MTKLogger/src/com/debug/loggerui/utils/Utils.java
@@ -569,7 +569,7 @@ public class Utils {public static final String LOG_PATH_TYPE_SYSTEM_DATA = "system_data";public static final String LOG_PATH_TYPE_DEVICE_STORAGE = "device_storage";public static final String LOG_PATH_TYPE_PORTABLE_STORAGE = "portable_storage";
- public static final String LOG_PATH_TYPE_DEFAULT = LOG_PATH_TYPE_SYSTEM_DATA;
+ public static final String LOG_PATH_TYPE_DEFAULT = LOG_PATH_TYPE_DEVICE_STORAGE;public static final Map<String, Integer> LOG_PATH_TYPE_STRING_MAPS =new HashMap<String, Integer>();