int main函数
mmi.cpp
agent_main.cpp
diag_main.cpp
debug_main.cpp
misc启动进入mmi:
第一个进程:mmi mmi starting MMI_PROC_TYPE(MMI_PROC_TYPE_MMI)
第二个进程:log launch log process
第二个进程:mmi_diag Start diag daemon for handling diag command from PC tool MMI_PROC_TYPE(MMI_PROC_TYPE_MMI_DIAG);
第四个~第N个进程:mmi_agent Fork module process MMI_PROC_TYPE(MMI_PROC_TYPE_MMI_AGENT);
开始测试:switch_module
主进程的flow:
mmi.cpp
pre_config
init_config /*Initialize configuration */
post_config
init_controller /*Load controller */
build_main_ui /*Initial the MMI screen */
start_threads /*Start threads */
launch_controller /*Launch threads */
launch_clients
is_autostart /*Start Background Test */
start_autorun
sem_wait
write_file //WAKE_UNLOCK
pre_config
pre_config
parse_strings //加载各种bin执行、库、节点文件
launch_log /**start logcat process*/ fork 出一个进程来记录log
write_file //持一把wake lock,保持屏幕常亮
sem_init //初始化信号灯 g_sem_exit:mmi进程退出 g_msg_sem:同步消息的处理 g_sem_accept_ready:创建mmi_socket服务端 g_data_print_sem:sensor提示信息的打印 g_result_sem:各种RF传输外设的测试结果
pthread_mutex_init //创建互斥锁g_cur_layout_mutex 关于当前模块的layout界面
init_draw /**Init draw*/ MMI_ALOGI("start draw init!");
--> init_surface //MMI_ALOGI("start init surface");
--> sem_init //(draw_control_t) g_draw.sem 同步刷新ui界面
create_func_map //创建各种函数的调用map表
is_create_mmi_cfg //Check "/etc/mmi/mmi.xml" 等whether exist
create_mmi_cfg // parse file: "/etc/mmi/mmi.xml" 根据mmi.xml文件创建mmi.cfg // create file: "/cache/FTM_AP/mmi.cfg" mmi.cfg保存各种测试项的配置要求 ordered_ui_module module_ui_map // create file: "/cache/FTM_AP/mmi-pcba.cfg"
init_config
init_config
load_config // /cache/FTM_AP/mmi.cfg 初始化该配置文件,解析各个模块的测试要求 , 保存module_info数据到数据结构: g_ordered_modules g_modules_map
init_lang //加载语言、字体配置
init_layout // /*Load more layout */ /etc/mmi/layout/ 目录下的各种layout文件 各种layout.xml文件创建一个layout数据
--> load_layout 解析各个layout文件,并根据解析创建button等控件,保存其数据在对象layout中
g_layout_map:保存各个已经初始化后的layout对象
init_module_mode /*Initial all module running mode */ 迭代g_ordered_modules 指明所有模块的运行模式:module_info->mode = g_test_mode(ffbm-02)
init_nodup_map /*Initial the duplicate module map */ 迭代g_ordered_modules 在所有运行同一个lib库的模块中只保存最后一个数据:g_nodup_modules_map
g_res_file // /cache/FTM_AP/mmi.res 保存各种测试项的结果
post_config
post_config
restore_result /**Restore the latest result*/ g_res_file // MMI_ALOGI("start post config");
--> 根据g_res_file文件初始化各个模块的最近测试结果:module_info- >result = SUCCESS;
init_controller
init_controller
--> /* used to store diag,debug module */ < string, module_info * > g_controller_map;
new module_info(CLIENT_DIAG_NAME) /**Init Diag module*/ /**Diag control mmi commands list*/
new module_info(CLIENT_DEBUG_NAME) /**Init debug module*/
g_controller_map : CLIENT_DIAG_NAME、CLI