[MTK FP]如何通过ICON ID的value找到对应的ICON

来源:互联网 发布:windows toolkit 下载 编辑:程序博客网 时间:2024/06/07 02:20

Hardware platform: MT6250

Software platform: MTK 11B

Lcd size: 220X176

 

1.       问题描述

如上图,如果接收到MMS provision手机显示为默认图片(没有图片时显示该图片)。以此案例为例,本文介绍一种根据icon idvalue来查找该icon放置位置的方法。

2.      icon idvalue跟踪

通常的界面跟踪方法,就是打断点在函数void dm_redraw_category_screen(void)上,然后观察ShowCategoryXXXScreen()的调用细节,这里的细节如下:

         继续在下面函数打断点:

              S32 mmi_um_ui_sh_get_async_item(S32 start_index, gui_iconlist_menu_item *menu_data, S32 num_of_item)

        从该函数继续跟踪,代码堆栈如下:

        srv_um_cache_search()

        srv_um_check_msg_info_by_ref()

        mmi_um_ui_fsm_ef_srv_check_msg_info_by_ref()

        mmi_um_ui_fsm_ef_get_msg_info()

        mmi_um_ui_sh_get_async_item()

        load_chunk_asyncdynamic_item_buffer()

        gui_list_menu_locate_highlighted_item()

        gui_list_menu_goto_item()

        gui_asyncdynamic_list_menu_goto_item()

        asyncdynamic_list_goto_item_no_redraw()

        wgui_async_list_resize_multi_icontext_menu()

        ShowCategory263Screen_ext()

         观察下图,可以查看icon_idvalue0xcc6d

 

3.       根据icon idvalue来查找icon idname

Icon id的值为0xcc6d,也就是十进制的52333

任意查看一个icon id对应的十进制值,比如mmi_rp_app_unifiedmessage_def.h中:

IMG_UM_UNREAD_ICON = 51240 + 1, /* BASE_ID + 1 */

这里IMG_UM_UNREAD_ICON的值为51241,而值52333icon id应该在那个文件中呢?

 

所有定义资源id value的头文件,都在mmi_rp_all_defs.h中被include。那么我们以上面的mmi_rp_app_unifiedmessage_def.h文件为例看下他们之间的关系吧。

a.       mmi_rp_all_defs.h包含mmi_rp_app_unifiedmessage_def.h

……

#include "mmi_rp_app_unifiedmessage_def.h"

#include "mmi_rp_app_search_web_def.h"

……

b.       mmi_rp_app_unifiedmessage_def.h中定义了IMG_UM_UNREAD_ICONvalue

/******************** Image resource IDs - begin ********************/

typedef enum

{

    IMG_UM_UNREAD_ICON = 51240 + 1, /* BASE_ID + 1 */

    IMG_UM_SEND_FAILED_ICON,

    IMG_UM_MAIN_ID,

    ……

    MMI_RP_APP_UNIFIEDMESSAGE_IMG_MAX

}mmi_rp_app_unifiedmessage_img_enum;

/******************** Image resource IDs - finish ********************/

         如果我们能够把每个.h文件中定义的BASE_ID value.h文件名按顺序列出来,那我们可以根据icon id value所在的范围,找出其所在的文件,然后在文件中找到其name

 

         下面的python程序就可以按序列出每个.h文件中定义的BASE_ID value.h文件名:

 

# -*- coding: utf-8 -*-# It is ok at python-3.3.1rc1.msi installer condition.import osimport reimport localedef print_base_image_id_by_filename(filename, dictonary):    start = False    f = open(filename, 'r')    for tmp_line in f:        if re.match(r'^/[*]+ Image resource IDs - begin [*]+/$', tmp_line):            start = True        if re.match(r'^/[*]+ Image resource IDs - finish [*]+/$', tmp_line):            start = False        if start:            m = re.match(r'^[ \t]+[\w_\d]+ = (\d+) \+ ', tmp_line)            if m:                s = locale.atoi(m.group(1))                 dictonary[s] = filename    f.close()def print_image_id(filename):    dictonary = {}    f = open(filename, 'r')    for line in f:        m = re.match(r'^#include "(.*)"$', line)        if m:            print_base_image_id_by_filename(m.group(1), dictonary)    f_output = open('aest.txt', 'w+')    for number in sorted(dictonary.keys()):        f_output.write(locale.str(number))        f_output.write('\t')        f_output.write(dictonary[number])        f_output.write('\n')    f_output.close()    f.close()print_image_id(r'mmi_rp_all_defs.h')

 

本程序基于python-3.3.1rc1.msi安装程序运行。所有的.h文件都在如下目录,这里也把python程序放置到这个目录下:

\mtk_6250\plutommi\Customer\CustomerInc\

并运行程序,最终生成的a_output.txt内容如下:

         …….

         52230       mmi_rp_app_cca_def.h

        52331       mmi_rp_app_provbox_def.h

        52567       mmi_rp_app_nss_def.h

         …….

 

如上,52333这个值会出现在文件mmi_rp_app_provbox_def.h中,通过该文件来查看icon idname

typedef enum

{

    IMG_ID_PROVBOX_APP_ICON = 52331 + 1, /* BASE_ID + 1 */

    IMG_ID_PROVBOX_UNREAD,

    IMG_ID_PROVBOX_READ,

    MMI_RP_APP_PROVBOX_IMG_MAX

}mmi_rp_app_provbox_img_enum;


 

4.       根据icon id的名称来查找icon id的路径

ProvBox.res中可以查到IMG_ID_PROVBOX_UNREAD的路径为:

\\\\MainLCD\\\\ProvBox\\\\ProvBox_MsgUnread.pbm

PR中,在图片包中文件名称为ProvBox_MsgUnread.png,而这里索引的名称是以.pbm为后缀的,所以修改为如下即可:

\\\\MainLCD\\\\ProvBox\\\\ProvBox_MsgUnread.png

 

5.       代码修改后效果查看

 

原创粉丝点击