1、电信自注册使用的app
MTK平台默认使用的短信自注册是DeviceRegister
数据域自注册是SelfRegister
客户可以在项目查看到这两个app的源码:
/vendor/mediatek/proprietary/packages/apps/DeviceRegister
/vendor/mediatek/proprietary/packages/apps/SelfRegister
2、若要编译DeviceRegister 和SelfRegister两个app,需要打开对应的宏控
alps/device/mediatek/[project name]/ProjectConfig.mk
MTK_DEVREG_APP=yes
MTK_CT4GREG_APP=yes
3、自注册测试步骤/如何抓取自注册mtklog
(1)进入工程模式*#*#3646633#*#*->Log and Debugging ->MTKLogger -> 按下Start 按钮开始录制log
(2)打开数据业务 (测试数据域自注册,此步骤必做)
支持移动数据连接、wifi 数据连接
优先使用wifi 数据连接
(3)切换工模里自注册为开,步骤是:
Engineer Mode->Hardware Testing->Device Register->Send Auto Register Message
(4)关机
插卡/换卡 开机,等待自注册数据发出(2-5分钟)
(5)停止 mtklog
Note:OP09的项目,第(3)步骤默认已打开
注册过程完全在后台进行,即:无论是发送注册信息,还是接收注册成功确认信息,都不给用户提示。是否注册成功需要分析mtklog来确定。
4、简单分析mtklog
(1)分析短信自注册
主要看main_log (mtklog\mobilelog\APLog_XXX\main_log),搜索关键字DeviceRegister
//检查工模设置的Send Auto Register Message是否enabled。如果为false,请再次进入工模查看,可能测试时忘记这个步骤了
10-28 20:08:44.573 5190 5190 I DeviceRegister/AgentProxy: Get the switch value = 1
10-28 20:08:44.573 5190 5190 I DeviceRegister/AgentProxy: Feature is enabled? True
//发送自注册短信
10-28 20:10:07.569 5969 6002 D DeviceRegister/RegisterMessage: message:
10-28 20:10:07.572 5969 6002 I DeviceRegister/PlatformManager: Send message. length 101 from slot 0
//发送短信成功!
10-28 20:10:09.681 5969 5969 I DeviceRegister/SmsSendReceiver: Send register message success.
//自注册成功,服务器返回success
10-28 20:10:43.754 5969 5969 I DeviceRegister/PlatformManager: Register success!
10-28 20:10:43.754 5969 5969 I DeviceRegister/AgentProxy: setRegisterFlag true
10-28 20:10:43.811 5969 5969 I DeviceRegister/RegisterService: Register success!
(2)分析数据域自注册
主要看main_log (mtklog\mobilelog\APLog_XXX\main_log),搜索关键字SelfRegister
//检查网络连接
10-28 20:09:03.803 5488 5889 I SelfRegister/RegisterService: [onAvailable] network 100
//组装JSON
10-28 20:09:53.942 5488 6564 D SelfRegister/RegisterMessage: Generate data: {......}
//将打包后的数据通过 HTTP 协议向自注册管理平台发送
10-28 20:09:53.947 5488 6564 D SelfRegister/Utils: Enter httpSend()...
10-28 20:09:54.530 5488 6564 D SelfRegister/Utils: httpSend(), Status code: 200
//收到自注册管理平台的校验结果
10-28 20:09:54.538 5488 5488 I SelfRegister/Utils: Result code 0, desc Success
10-28 20:09:54.576 5488 5488 D AgentProxy: setSelfRegisterFlag true
10-28 20:09:54.538 5488 5488 I SelfRegister/RegisterService: analyseResponse(), resultCode:0 resultDesc:Success
5、客制化
5.1 How to modify the default value of switch in EngineerMode?
alps/device/mediatek/[project name]/custom.conf
“0” or non-existent of “dm.SmsRegState” represent not open by default.
5.2 How to modify the Manufacture and Software version?
The Manufacture and Software version need customized by hand in the following path of source code before build.
Note that Manufacture name letters count<=3, and the SoftwareVersion name letters count <= 60, or else they will be cut.
Get the customized information such as Manufacture name and SoftwareVersion name. The customized information is writtened in the file”alps/device/mediatek/[project name]/custom.conf”, and the framework provided API for getting it.
CustomProperties.getString(String moduleName, String key, String defaultValue);
6、案例分析
(1)数据自注册失败
09-20 19:08:52.539883 431 431 I DmAgent : readSelfRegisterFlag
09-20 19:08:52.541774 431 431 D DmAgent : the readSelfRegisterFlag buffer = 1
09-20 19:08:52.541831 431 431 D DmAgent : readSelfRegisterFlag = 1
09-20 19:08:52.541880 431 431 I DmAgent : readSelfRegisterFlag done
09-20 19:08:52.546670 3338 3338 I SelfRegister/RegisterService: IccId is identical, no need
09-20 19:08:52.546704 3338 3338 I SelfRegister/RegisterService: No need to register, stop
当前测试样机已经数据域自注册过,所以下次开机不会再次进行数据域自注册
(2)短信自注册失败
// 不重复注册
08-27 15:35:05.152995 3072 5117 I DeviceRegister/PlatformManager: Imsi info is the same.
08-27 15:35:05.154922 3072 5117 I DeviceRegister/PlatformManager: Compare 8037CC82, 86186903003757
08-27 15:35:05.155105 3072 5117 D DeviceRegister/RegisterService: imsi and meid same
08-27 15:35:05.155141 3072 5117 D DeviceRegister/RegisterService: Phone not need to register.
//重复注册
08-27 14:25:18.282401 3095 5575 I DeviceRegister/PlatformManager: Imsi info is the same.
08-27 14:25:18.282697 3095 5575 I DeviceRegister/PlatformManager: Compare 803ADEF7, 86140203005878
08-27 14:25:18.284007 3095 5575 D DeviceRegister/RegisterMessage: getRegisterMessage
08-27 14:25:18.284107 3095 5575 D DeviceRegister/RegisterMessage: generateMessageData
修改方案
//在ACTION_SMS_STATE_CHANGED和ACTION_CDMA_CARD_ESN_OR_MEID想添加如下信息
if (notFirst && receivedCardMeidOrEsn) {
Log.i(TAG, "Ignore duplicate messages, do nothing.");
return;
}