📄 miscfunctions.c
字号:
#ifdef __NEW_STATUS_ICONS_STYLE__
extern BOOL g_is_need_draw_statusicons;
#endif
// wangbei add end
/*****************************************************************************
* Local Variable
*****************************************************************************/
#if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
U8 FMPatternBuffer[20];
S8 *ssc_fm_string = SSC_FACTORY_MODE;
#endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
/*****************************************************************************
* Local Function
*****************************************************************************/
void mmi_pwron_exit_animation_screen(void);
void exit_custom_startup_screen(void);
/*****************************************************************************
*
* Power On
*
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* goto_opening_screen
* DESCRIPTION
* go to opening screen
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void goto_opening_screen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (GetAbnormalReset() == 1) /* abnormal reset */
{
TurnOnBacklight(1);
ResetAbnormalReset();
/* to initialize SMS/CPHS after abnormal reset */
CSPModifyHiliteHandlers();
BeforeEntryIdleScr();
}
else
{
TurnOnBacklight(1);
ClearInputEventHandler(MMI_DEVICE_ALL);
ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
InitAllApplications();
exit_custom_startup_screen();
}
GetPhoneLock(); /* diamond, 2006/02/27 Move this function call here because smu is not initialized in exception power on */
// wangbei add begin 20070411
#ifdef MESSAGE_PHONEBOOK_LOCK
GetMessageLock();
GetPhonebookLock();
#endif
// wangbei add end
}
/*****************************************************************************
* FUNCTION
* exit_custom_startup_screen
* DESCRIPTION
* exit power on animation screen
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void exit_custom_startup_screen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (GetAbnormalReset() == 0)
{
gui_hide_animations();
CSPModifyHiliteHandlers(); /* CSP Functionality needs to be here after all
applications have initialised */
ShowWelcomeScr();
ShowIdleAppSubLcd();
}
}
#if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
/*****************************************************************************
* FUNCTION
* CallBackPowerOnAnimationCompleteWrapper
* DESCRIPTION
* wrapper function to enumate poweron animation play finish
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void CallBackPowerOnAnimationCompleteWrapper(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
CallBackPowerOnAnimationComplete(0);
}
/*****************************************************************************
* FUNCTION
* DirectModeToFM
* DESCRIPTION
* Direct entry factory mode
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void DirectModeToFM(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
DirectMode = TRUE;
/* Low battery shutdown */
if (((g_charbat_context.batteryStatus == PMIC_VBAT_STATUS || /* Battery Status */
g_charbat_context.batteryStatus == PMIC_CHARGER_OUT) && g_charbat_context.isChargerConnected == 0) && (g_charbat_context.chargerLevel == BATTERY_LOW_POWEROFF)) /* Battery Level */
{
ShowLowPowerShutdownScr();
return;
}
gui_hide_animations();
EntryFMMenu();
}
/*****************************************************************************
* FUNCTION
* KeyPatternIdentifier
* DESCRIPTION
* Key Pattern Identifier
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void KeyPatternIdentifier(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 Keycode, Keytype;
/* Avoid compile warning because KEY_0 is 0 for now,
but it might be changed to non-zero value in the future. */
S16 Keycode_signed;
static U8 index = 0;
U8 *pTemp;
U8 len;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
GetkeyInfo(&Keycode, &Keytype);
Keycode_signed = (S16) Keycode;
len = (strlen((char*)(ssc_fm_string)));
if (index < len)
{
/* Only accept '#' , '*', '0' ~ '9' */
if (Keycode == KEY_POUND)
{
FMPatternBuffer[index] = '#';
}
else if (Keycode == KEY_STAR)
{
FMPatternBuffer[index] = '*';
}
else if ((Keycode_signed >= KEY_0) && (Keycode <= KEY_9)) /* 0 ~ 9 */
{
FMPatternBuffer[index] = Keycode + '0';
}
index++;
}
if (index == len)
{
pTemp = (U8*) ssc_fm_string;
if (strcmp((S8*) pTemp, (S8*) FMPatternBuffer) == 0)
{
ClearKeyHandler(KEY_POUND, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_STAR, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_0, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_1, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_2, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_3, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_4, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_5, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_6, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_7, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_8, KEY_EVENT_DOWN);
ClearKeyHandler(KEY_9, KEY_EVENT_DOWN);
DirectModeToFM();
}
}
}
#endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
/*****************************************************************************
* FUNCTION
* mmi_pwron_play_video_callback
* DESCRIPTION
* play power on video result callback function
* PARAMETERS
* result [IN] Play video's reult
* RETURNS
* void
*****************************************************************************/
void mmi_pwron_play_video_callback(MDI_RESULT result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_ANIMATION_FINISH));
if (g_pwron_is_terminate_diplay)
{
/* means already terminated by time out, shall skip this callback */
return;
}
/* treat as gif animation */
/* change to GIF's return */
if (result < 0)
{
/* return false, will force to enter the next procedure of power on */
CallBackPowerOnAnimationComplete(-1);
}
else
{
/* play finish successfully - reset flag to PWRON_DISPLAY_SUCCESS */
g_pwron_is_successful_play = TRUE;
/* call before access NVRAM */
CallBackPowerOnAnimationComplete(GDI_GIF_LAST_FRAME);
}
}
/*****************************************************************************
* FUNCTION
* mmi_pwron_show_image_callback
* DESCRIPTION
* show power on image result callback function
* PARAMETERS
* result [IN] Play video's reult
* RETURNS
* void
*****************************************************************************/
void mmi_pwron_show_image_callback(GDI_RESULT result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_IMAGE_FINISH));
if (g_pwron_is_terminate_diplay)
{
/* means already terminated by time out, shall skip this callback */
return;
}
if (result < 0 && result != GDI_IMAGE_IS_STILL_IMAGE)
{
/* return false, will force to enter the next procedure of power on */
CallBackPowerOnAnimationComplete(result);
}
/* diamond, 2005/08/28 fix still image cannot enter idle screen issue */
else if (result == GDI_IMAGE_IS_STILL_IMAGE)
{
g_pwron_is_successful_play = TRUE;
CallBackPowerOnAnimationComplete(result);
}
/* end, diamond */
else
{
/* play finish successfully */
g_pwron_is_successful_play = TRUE;
/* call before access NVRAM */
CallBackPowerOnAnimationComplete(GDI_SUCCEED);
}
}
/*****************************************************************************
* FUNCTION
* mmi_pwron_froce_terminate_display
* DESCRIPTION
* force terminate power on display
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_pwron_froce_terminate_display(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_ANIMATION_TIMEOUT));
/* if never successfully play once, force stop */
if (!g_pwron_is_successful_play)
{
g_pwron_is_terminate_diplay = TRUE;
g_pwron_is_successful_play = TRUE;
/* mimic gif last frame callback */
CallBackPowerOnAnimationComplete(GDI_GIF_LAST_FRAME);
/* start another timer to try */
gui_start_timer(200, mmi_pwron_froce_terminate_display);
}
}
/*****************************************************************************
* FUNCTION
* mmi_pwron_stop_animation
* DESCRIPTION
* this function is used to stop power on animation screen, called when ready
* to enter idle screen, it is used to solve NVRAM & timer interlace problem
*
* [Note]
* when ready to enter power on screen, it will enter goto_opening_screen(),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -