Brew is event-driven and can send or receive specified events through relevant methods in the ishell interface. The distribution and processing of events in the system is implemented through the aee layer. The methods for sending events include ishell_sendevent and ishell_postevent. The methods for receiving specific events are mainly implemented through the ishell_registerpolicy method, or through the settings in the MIF file. If the application registers an event, the aee layer sends the evt_notify event to the application when the event occurs.
Some events do not need to be registered, such as general system events evt_app_start, evt_app_stop, evt_app_suspend, and evt_app_resume. Mobile Keyboard Events generally do not need to be registered, such as evt_key_press, evt_key, evt_key_release, and evt_char. Before brew 3.1, only visible applications on the top of the screen can receive Keyboard Events, from Brew 3.1, all applications can receive Keyboard Events. If it is not a mobile phone screen top-layer visual application, you must register the nmask_shell_key notification to receive the relevant Keyboard Events.
Control events are generally named with the prefix evt_ctl, such as evt_ctl_tab and evt_ctl_add_item. Dialog Box events are generally named with the prefix evt_dialog. If an application uses a control or dialog box, it generally Processes related events. Generally, there are two methods to Set alert events: ishell_setalarm and ialarmmgr_setalarm. When the alert time is approaching, the evt_alarm event will be sent to the application. The evt_alarm event type is distinguished by mask.
The message queue of an event has no priority. All events have the same priority, that is, the system regards all messages as having the same priority, A message can be processed only after processing is completed, that is, the event processing method is returned. Therefore, an application must receive and process event messages from the system in a timely manner, and return control to the system in a timely manner to ensure the normal operation of the application. If the processing method of an event in the program runs for a long time and the system cannot return a response to another system event in time, aee will consider it as a system error. to avoid damage to the system, the device is forced to restart.