MTK中EntryNewScreen进入新屏幕和GoBackHistory返回原屏幕机制

本文详细阐述了从A屏幕到B屏幕再到A屏幕的切换过程,并深入探讨了如何使用MTK代码进行屏幕退出、历史记录添加、历史记录回退等操作。包括设置全局变量、调用特定函数实现屏幕间跳转和历史管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
以下假设从A屏幕进入B屏幕再返回A屏幕,有兴趣的朋友可以跟踪MTK代码验证一下:
EntryNewScreen(U16 new_scrn_id, exit_func_ptr new_exit_handler, entry_func_ptr new_entry_handler, void *flag)
A->B
1)set global variable currTopScrnID to new_scrn_id(B)
2)call ExecuteCurrExitHandler() -> call ExecuteCurrExitHandler_Ext()
①call mmi_frm_generic_exit_scrn(currExitScrnID(A), curr_entry_handler(EntryA)) -> call mmi_frm_add_history to add A to history
②call curr_exit_handler(curr_exit_scrn_arg_p) to execute ExitA
③reset new_exit_handler and new_entry_handler NULL
④call UI_common_screen_exit() -> call ExitCategoryFunction() -> reset category function
⑤call ClearInputEventHandler(MMI_DEVICE_KEY)
3)set global variable currExitScrnID to new_scrn_id(B)
4)call mmi_frm_set_generic_exit_handler(new_scrn_id, new_exit_handler, new_entry_handler), this function will do:
①set global variable currExitScrnID to new_scrn_id(B)
②set global variable curr_exit_handler to new_exit_handler(ExitB)
③set global variable curr_entry_handler to new_entry_handler(EntryB)
at a word: set currTopScrnID to B -> add A to history -> execute ExitA -> reset category function -> set currExitScrnID to B -> set curr_exit_handler to ExitB -> set curr_entry_handler to EntryB

Call GoBackHistory() B back to A
1)call mmi_frm_go_back_to_history_int(historyData[currHistoryIndex].scrnID)
historyData[currHistoryIndex].scrnID is now A
2)call ExecTopScrnCallbackHandler() -> call ClearDelScrnIDCallbackHandler(currExitScrnID(B), NULL) to delete history in array historyCBHandler[MAX_HISTORY]
3)call mmi_frm_remove_history_node to delete history node
4)call (*(historyData[currHistoryIndex].entryFuncPtr)) (historyData[currHistoryIndex].app_arg) to reentry A
5)set global variable currTopScrnID to new_scrn_id(A)
6)set global variable currExitScrnID to new_scrn_id(A)
7)call mmi_frm_set_generic_exit_handler(new_scrn_id, new_exit_handler, new_entry_handler), this function will do:
①set global variable currExitScrnID to new_scrn_id(A)
②set global variable curr_exit_handler to new_exit_handler(ExitA)
③set global variable curr_entry_handler to new_entry_handler(EntryA)
at a word: delete history in array historyCBHandler[MAX_HISTORY] -> delete history node -> call Entry to reentry A -> set currTopScrnID to A -> set currExitScrnID to A -> set curr_exit_handler to ExitA -> set curr_entry_handler to EntryA

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值