SimDetection.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:205k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * SimDetection.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is for handle Normal Bootup
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  *
  219.  * removed!
  220.  * removed!
  221.  * removed!
  222.  *
  223.  * removed!
  224.  * removed!
  225.  * removed!
  226.  *
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  *
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  *
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  *
  239.  * removed!
  240.  * removed!
  241.  * removed!
  242.  *
  243.  * removed!
  244.  * removed!
  245.  * removed!
  246.  *
  247.  * removed!
  248.  * removed!
  249.  * removed!
  250.  *
  251.  * removed!
  252.  * removed!
  253.  * removed!
  254.  *
  255.  * removed!
  256.  * removed!
  257.  * removed!
  258.  *
  259.  * removed!
  260.  * removed!
  261.  * removed!
  262.  *
  263.  * removed!
  264.  * removed!
  265.  * removed!
  266.  *
  267.  * removed!
  268.  * removed!
  269.  * removed!
  270.  *
  271.  * removed!
  272.  * removed!
  273.  * removed!
  274.  *
  275.  * removed!
  276.  * removed!
  277.  * removed!
  278.  *
  279.  * removed!
  280.  * removed!
  281.  * removed!
  282.  *
  283.  * removed!
  284.  * removed!
  285.  * removed!
  286.  *
  287.  * removed!
  288.  * removed!
  289.  * removed!
  290.  *
  291.  * removed!
  292.  * removed!
  293.  * removed!
  294.  *
  295.  * removed!
  296.  * removed!
  297.  * removed!
  298.  *
  299.  * removed!
  300.  * removed!
  301.  * removed!
  302.  *
  303.  * removed!
  304.  * removed!
  305.  * removed!
  306.  *
  307.  * removed!
  308.  * removed!
  309.  * removed!
  310.  *
  311.  * removed!
  312.  * removed!
  313.  * removed!
  314.  *
  315.  * removed!
  316.  * removed!
  317.  * removed!
  318.  *
  319.  * removed!
  320.  * removed!
  321.  * removed!
  322.  *
  323.  * removed!
  324.  * removed!
  325.  * removed!
  326.  *
  327.  * removed!
  328.  * removed!
  329.  * removed!
  330.  *
  331.  * removed!
  332.  * removed!
  333.  * removed!
  334.  *
  335.  * removed!
  336.  * removed!
  337.  * removed!
  338.  *
  339.  * removed!
  340.  * removed!
  341.  * removed!
  342.  *
  343.  * removed!
  344.  * removed!
  345.  * removed!
  346.  *
  347.  * removed!
  348.  * removed!
  349.  * removed!
  350.  *
  351.  * removed!
  352.  * removed!
  353.  * removed!
  354.  *
  355.  * removed!
  356.  * removed!
  357.  * removed!
  358.  *
  359.  * removed!
  360.  * removed!
  361.  * removed!
  362.  *
  363.  * removed!
  364.  * removed!
  365.  * removed!
  366.  *
  367.  * removed!
  368.  * removed!
  369.  * removed!
  370.  *
  371.  * removed!
  372.  * removed!
  373.  * removed!
  374.  *
  375.  * removed!
  376.  * removed!
  377.  * removed!
  378.  *
  379.  * removed!
  380.  * removed!
  381.  * removed!
  382.  *
  383.  * removed!
  384.  * removed!
  385.  * removed!
  386.  *
  387.  * removed!
  388.  * removed!
  389.  * removed!
  390.  *
  391.  * removed!
  392.  * removed!
  393.  * removed!
  394.  *
  395.  * removed!
  396.  * removed!
  397.  * removed!
  398.  *
  399.  * removed!
  400.  * removed!
  401.  * removed!
  402.  *
  403.  * removed!
  404.  * removed!
  405.  * removed!
  406.  *
  407.  * removed!
  408.  * removed!
  409.  * removed!
  410.  *
  411.  * removed!
  412.  * removed!
  413.  * removed!
  414.  *
  415.  * removed!
  416.  * removed!
  417.  * removed!
  418.  *
  419.  * removed!
  420.  * removed!
  421.  * removed!
  422.  *
  423.  * removed!
  424.  * removed!
  425.  * removed!
  426.  *
  427.  * removed!
  428.  * removed!
  429.  * removed!
  430.  *
  431.  * removed!
  432.  * removed!
  433.  * removed!
  434.  *
  435.  * removed!
  436.  * removed!
  437.  * removed!
  438.  *
  439.  * removed!
  440.  * removed!
  441.  * removed!
  442.  *
  443.  * removed!
  444.  * removed!
  445.  * removed!
  446.  *
  447.  * removed!
  448.  * removed!
  449.  * removed!
  450.  *
  451.  * removed!
  452.  * removed!
  453.  * removed!
  454.  *
  455.  * removed!
  456.  * removed!
  457.  * removed!
  458.  *
  459.  * removed!
  460.  * removed!
  461.  * removed!
  462.  *
  463.  * removed!
  464.  * removed!
  465.  * removed!
  466.  *
  467.  * removed!
  468.  * removed!
  469.  * removed!
  470.  *
  471.  * removed!
  472.  * removed!
  473.  * removed!
  474.  *
  475.  * removed!
  476.  * removed!
  477.  * removed!
  478.  *
  479.  * removed!
  480.  * removed!
  481.  * removed!
  482.  *
  483.  * removed!
  484.  * removed!
  485.  * removed!
  486.  *
  487.  * removed!
  488.  * removed!
  489.  * removed!
  490.  *
  491.  * removed!
  492.  * removed!
  493.  * removed!
  494.  *
  495.  * removed!
  496.  * removed!
  497.  * removed!
  498.  *
  499.  * removed!
  500.  * removed!
  501.  * removed!
  502.  *
  503.  * removed!
  504.  * removed!
  505.  * removed!
  506.  *
  507.  * removed!
  508.  * removed!
  509.  * removed!
  510.  *
  511.  * removed!
  512.  * removed!
  513.  * removed!
  514.  *
  515.  * removed!
  516.  * removed!
  517.  * removed!
  518.  *
  519.  * removed!
  520.  * removed!
  521.  * removed!
  522.  *
  523.  * removed!
  524.  * removed!
  525.  * removed!
  526.  *
  527.  * removed!
  528.  * removed!
  529.  * removed!
  530.  *
  531.  * removed!
  532.  * removed!
  533.  * removed!
  534.  *
  535.  * removed!
  536.  * removed!
  537.  * removed!
  538.  *
  539.  * removed!
  540.  * removed!
  541.  * removed!
  542.  *
  543.  * removed!
  544.  * removed!
  545.  * removed!
  546.  *
  547.  * removed!
  548.  * removed!
  549.  * removed!
  550.  *
  551.  * removed!
  552.  * removed!
  553.  * removed!
  554.  *
  555.  * removed!
  556.  * removed!
  557.  * removed!
  558.  *
  559.  * removed!
  560.  * removed!
  561.  * removed!
  562.  *
  563.  * removed!
  564.  * removed!
  565.  * removed!
  566.  *
  567.  * removed!
  568.  * removed!
  569.  * removed!
  570.  *
  571.  * removed!
  572.  * removed!
  573.  * removed!
  574.  *
  575.  * removed!
  576.  * removed!
  577.  * removed!
  578.  *
  579.  * removed!
  580.  * removed!
  581.  * removed!
  582.  *
  583.  * removed!
  584.  * removed!
  585.  * removed!
  586.  *
  587.  * removed!
  588.  * removed!
  589.  * removed!
  590.  *
  591.  * removed!
  592.  * removed!
  593.  * removed!
  594.  *
  595.  * removed!
  596.  * removed!
  597.  * removed!
  598.  *
  599.  * removed!
  600.  * removed!
  601.  * removed!
  602.  *
  603.  * removed!
  604.  * removed!
  605.  * removed!
  606.  *
  607.  * removed!
  608.  * removed!
  609.  * removed!
  610.  *
  611.  * removed!
  612.  * removed!
  613.  * removed!
  614.  *
  615.  * removed!
  616.  * removed!
  617.  * removed!
  618.  *
  619.  * removed!
  620.  * removed!
  621.  * removed!
  622.  *
  623.  * removed!
  624.  * removed!
  625.  * removed!
  626.  *
  627.  * removed!
  628.  * removed!
  629.  * removed!
  630.  *
  631.  * removed!
  632.  * removed!
  633.  * removed!
  634.  *
  635.  * removed!
  636.  * removed!
  637.  * removed!
  638.  *
  639.  * removed!
  640.  * removed!
  641.  * removed!
  642.  *
  643.  * removed!
  644.  * removed!
  645.  * removed!
  646.  *
  647.  * removed!
  648.  * removed!
  649.  * removed!
  650.  *
  651.  * removed!
  652.  * removed!
  653.  * removed!
  654.  *
  655.  * removed!
  656.  * removed!
  657.  * removed!
  658.  *
  659.  * removed!
  660.  * removed!
  661.  * removed!
  662.  *
  663.  * removed!
  664.  * removed!
  665.  * removed!
  666.  *
  667.  * removed!
  668.  * removed!
  669.  * removed!
  670.  *
  671.  * removed!
  672.  * removed!
  673.  * removed!
  674.  *
  675.  * removed!
  676.  * removed!
  677.  * removed!
  678.  *
  679.  *------------------------------------------------------------------------------
  680.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  681.  *============================================================================
  682.  ****************************************************************************/
  683. /**
  684.  * Copyright Notice
  685.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  686.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  687.  *  (It is illegal to remove this copyright notice from this software or any
  688.  *  portion of it)
  689.  */
  690. /**************************************************************
  691.    FILENAME : SimDetection.c
  692.    PURPOSE     : handle Normal Bootup
  693.    REMARKS     : nil
  694.    AUTHOR      : Deepali Gupta
  695.    DATE     : 12/03/03
  696. **************************************************************/
  697. #include "MMI_features.h"       /* Robin 1217 */
  698. #include "StdC.h"
  699. #include "L4Dr1.h"
  700. #include "HistoryGprot.h"
  701. #include "SubLCDHistoryGprot.h"
  702. #include "wgui_categories.h"
  703. #include "wgui_categories_inputs.h"
  704. #include "wgui_categories_popup.h"
  705. #include "wgui_categories_CM.h"
  706. #include "CommonScreens.h"
  707. #include "MiscFunctions.h"
  708. #include "CustDataRes.h"
  709. #include "ProtocolEvents.h"
  710. #include "TimerEvents.h"
  711. #include "SimDetectionGprot.h"
  712. #include "SimDetectionDef.h"
  713. #include "PixtelDataTypes.h"
  714. #include "QuickAccessMenuItem_def.h"
  715. #include "QuickAccessMenuItemProt.h"    /* diamond, 2005/10/29, keypad lock in insert sim screen */
  716. #include "SimDetectionGexdcl.h"
  717. #include "EventsDcl.h"
  718. #include "QueueGProt.h"
  719. #include "Unicodexdcl.h"
  720. #include "ProtocolEvents.h"
  721. #include "DebugInitDef.h"
  722. #include "UCS2prot.h"
  723. #include "TaskInit.h"
  724. #include "wgui_status_icons.h"
  725. #include "CustMenuRes.h"
  726. #include "Globaldefs.h"
  727. #include "IdleAppDef.h"
  728. #include "AlarmFrameworkProt.h"
  729. #include "SSCStringHandle.h"
  730. #include "PhoneBookTypes.h"
  731. #include "SettingProfile.h"
  732. #include "SettingGprots.h"
  733. #include "ProfileGprots.h"
  734. #include "PersonalizationDef.h"
  735. #include "PersonalizationProt.h"
  736. #include "SettingsGexdcl.h"
  737. #include "gpioInc.h"
  738. #include "KeyBrd.h"
  739. #include "MainMenuDef.h"
  740. #include "PowerOnChargerProt.h"
  741. #include "ProfilesGexdcl.h"
  742. #include "bootup.h"
  743. #include "CallSetUp.h"
  744. #include "PhoneBookGprot.h"
  745. #include "IdleAppProt.h"
  746. #include "FunAndGamesDefs.h"
  747. #include "GSM7BitDefaultAlphabet.h"
  748. #include "SecuritySetup.h"
  749. #include "SATGProts.h"
  750. #include "mmi_trc.h"
  751. #include "GlobalScrEnum.h"
  752. #include "VolumeHandler.h"
  753. #include "CallManagementIdDef.h" /* CM_SCR_MARKER */
  754. #ifdef __MMI_STATUS_ICON_SIGNAL_WITH_LINE_SWITCH__      /* 022505 Calvin added */
  755. #include "StatusIconRes.h"
  756. #endif 
  757. #include "L4Dr.h"
  758. #include "SimDetectionHwMapFile.h"
  759. #include "custom_util.h"
  760. #include "CustResDef.h"
  761. #include "SettingDefs.h"
  762. #include "SettingsGdcl.h"
  763. #include "PhoneSetupGprots.h"
  764. #ifdef __MMI_USB_SUPPORT__
  765. #include "USBDeviceGprot.h"
  766. #endif 
  767. #ifdef __MMI_BT_SUPPORT__
  768. #include "BTMMIScrGprots.h"
  769. #endif 
  770. #ifdef __MMI_POC__
  771. #include "PoCGProt.h"
  772. #endif 
  773. #ifdef __FS_CHECKDRIVE_SUPPORT__
  774. #include "Fmt_struct.h"
  775. #ifdef __MMI_FILE_MANAGER__
  776. #include "FileManagerGProt.h"
  777. #endif 
  778. #endif /* __FS_CHECKDRIVE_SUPPORT__ */ 
  779. #ifdef __MMI_TOUCH_SCREEN__
  780. #include "Wgui_touch_screen.h"
  781. #endif 
  782. #if defined(__MMI_DOWNLOAD_AGENT__)
  783. #include "App_mine.h"
  784. #include "FileMgr.h"
  785. #include "DLAgentDef.h"
  786. #include "DLAgentGProt.h"
  787. #endif /* defined(__MMI_DOWNLOAD_AGENT__) */ 
  788. #ifdef __MMI_IRDA_SUPPORT__
  789. #include "IrdaMMIGprots.h"
  790. #include "IrdaMMIScr.h"
  791. extern void mmi_irda_exec_close_menu(void);
  792. #endif /* __MMI_IRDA_SUPPORT__ */ 
  793. #ifdef __CTM_SUPPORT__
  794. #include "TextPhoneProt.h"
  795. #endif
  796. #if (defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P)
  797. #include "vObjects.h"
  798. #endif
  799. #ifdef __MMI_WLAN_FEATURES__
  800. #include "NetworkSetupDefs.h"
  801. #ifdef __MMI_IMPS__
  802. #include "Mmi_imps_gprot.h"
  803. #endif
  804. #endif /* __MMI_WLAN_FEATURES__ */
  805. /* External Functions   */
  806. extern void FillCountDownNumber(sim_chv_info_struct chv_info);
  807. extern void FillCountDownString(U8 TypeOfPass, U8 *PassCountdownDisp);
  808. extern void CallBackPowerOnAnimationComplete(GDI_RESULT ret);
  809. extern void DeInitSpecialMode(void);
  810. extern void goto_opening_screen(void);
  811. extern void MakeCall(PS8 strBumber);
  812. extern void IdleSetStatusIcon(S16);
  813. extern void IdleResetStatusIcon(S16);
  814. /* extern void RstSmuVerifyPINRspHdlr(void *); */
  815. extern void InitInsertSimApp(void);
  816. extern void RefreshDisplayOwnerNumber(U8 lineid);
  817. extern pBOOL isInCall(void);
  818. #ifdef __J2ME__
  819. extern void jvm_enter_idle_screen_notify(void);
  820. #include "javaAgencyGprot.h"
  821. #endif /* __J2ME__ */ 
  822. void PowerOnBatteryIndicationComplete(void);
  823. void InsertSimSetKeyPadLockFlag(void);
  824. extern void mdi_audio_set_audio_mode(U8 mode);
  825. extern void SATMessageWaitTimer(void);
  826. #ifdef __MMI_BT_SUPPORT__
  827. extern MMI_BOOL mmi_bt_ps_stack_and_hw_init(MMI_BOOL flight_mode, MMI_BOOL sim_inserted);
  828. #endif 
  829. /* Global Variables  */
  830. #if ( defined(__MMI_ENGINEER_MODE__) || defined(__MMI_FACTORY_MODE__))
  831. extern U8 gCurrentMode;
  832. #endif 
  833. extern charbat_context_struct g_charbat_context;
  834. extern U8 isEarphonePlugged;
  835. /* Password buffers for PIN, PUK, phone lock and personalization lock */
  836. S8 gInputNewPinBufferSecondTime[MAX_PWD_LENGTH_MMI * ENCODING_LENGTH];
  837. S8 gInputNewPinBufferFirstTime[MAX_PWD_LENGTH_MMI * ENCODING_LENGTH];
  838. S8 gInputPwdBuffer[MAX_PWD_LENGTH_MMI * ENCODING_LENGTH];
  839. /* Service area display buffers for line 1 and line 2 */
  840. S8 gHomePLMNNum[MAX_PLMN_LEN_MMI + 1];
  841. S8 gSimEccNumList[MAX_ECC_NUMBER_LIST_LENGTH][(EMERGENCY_NUMBER_LENGTH + 1)];
  842. S8 gServProvderName[MAX_LENGTH_SERVICE_PROVIDER * ENCODING_LENGTH];
  843. S8 gOperatorName[MAX_LENGTH_OPERATOR_NAME * ENCODING_LENGTH];
  844. S8 gShortOperatorName[MAX_LENGTH_SHORT_OPERATOR_NAME * ENCODING_LENGTH];
  845. S8 gOwnerName[MAX_LENGTH_OWNER_NUMBER * ENCODING_LENGTH];
  846. U8 gOpNameValid = 0;
  847. U8 gShortOpnameValid = 0;
  848. U8 gSpnValid = 0;
  849. MMI_OWNER_NUMBER_STRUCT gDispOwnerNumber[2];
  850. #ifdef __MMI_WLAN_FEATURES__
  851. U8 gWLANProviderName[MAX_LENGTH_DISPLAY_NAME * ENCODING_LENGTH];
  852. #endif
  853. /* SIM indication structures to hold the corresponding actions after power on animation completes */
  854. MMISMUPASSWDREQIND gSMUPwdDataStruct;
  855. MMISMUFAILIND gSMUFailIndStruct;
  856. /* ECC buffers */
  857. U16 EmergencyNumber[MAX_EMERGENCYNUMBER][4] = 
  858. {
  859.     {0x0039, 0x0031, 0x0031, 0x00},
  860. #if defined(__MEXICO_ECC__)
  861.     {0x0030, 0x0038, 0x0030, 0x00},
  862.     {0x0030, 0x0036, 0x0030, 0x00},
  863.     {0x0030, 0x0038, 0x00},
  864. #endif /* defined(__MEXICO_ECC__) */ 
  865. #if defined(__CPHS__)
  866.     {0x0039, 0x0039, 0x0039, 0x00},
  867. #endif
  868.     {0x0031, 0x0031, 0x0032, 0x00}
  869. };
  870. U8 gCPHSRetryCount = 0;
  871. /* extern U8 isIdleScreenReached; */
  872. typedef enum
  873. {
  874.     SIM_ERROR_DISPLAY_INSERT_SIM,
  875.     SIM_ERROR_DISPLAY_SIM_ACCESS_ERROR
  876. } SIM_ERROR_DISPLAY;
  877. U16 simErrorDisplayString = STR_SIM_INSERTION_MSG;
  878. #if defined(__FS_CHECKDRIVE_SUPPORT__)
  879. // NOT DONE or NONE: 0
  880. // SKIP: 1
  881. // DONE: 2
  882. // Processing: 3
  883. U8 SanityCheckDone = 0;
  884. #else /* defined(__FS_CHECKDRIVE_SUPPORT__) */ 
  885. U8 SanityCheckDone = 2;
  886. #endif /* defined(__FS_CHECKDRIVE_SUPPORT__) */ 
  887. extern pwr_context_struct g_pwr_context;    /* in BootupApp.c */
  888. /*****************************************************************************
  889.  * FUNCTION
  890.  *  mmi_flight_mode_popup_in_dialing_sos
  891.  * DESCRIPTION
  892.  *  Popup "flight mode" when dial SOS from insert SIM screen (only for touch screen phones)
  893.  * PARAMETERS
  894.  *  void
  895.  * RETURNS
  896.  *  void
  897.  *****************************************************************************/
  898. void mmi_flight_mode_popup_in_dialing_sos(void)
  899. {
  900.     /*----------------------------------------------------------------*/
  901.     /* Local Variables                                                */
  902.     /*----------------------------------------------------------------*/
  903.     /*----------------------------------------------------------------*/
  904.     /* Code Body                                                      */
  905.     /*----------------------------------------------------------------*/
  906. #ifdef __FLIGHT_MODE_SUPPORT__
  907.     DisplayPopup((U8*) GetString(STR_MENU_FLIGHT_MODE), IMG_GLOBAL_ERROR, 0, 2000, (U8) ERROR_TONE);
  908. #endif
  909. }
  910. /*****************************************************************************
  911.  * FUNCTION
  912.  *  InitSimDetection
  913.  * DESCRIPTION
  914.  *  Initialize all protocol handlers for SIM Messages
  915.  * PARAMETERS
  916.  *  void
  917.  * RETURNS
  918.  *  void
  919.  *****************************************************************************/
  920. void InitSimDetection(void)
  921. {
  922.     /*----------------------------------------------------------------*/
  923.     /* Local Variables                                                */
  924.     /*----------------------------------------------------------------*/
  925.     /*----------------------------------------------------------------*/
  926.     /* Code Body                                                      */
  927.     /*----------------------------------------------------------------*/
  928.     SetProtocolEventHandler(SimECCInfoSave, PRT_SMU_STARTUP_INFO_IND);
  929.     /* SimPasswdReqResponse: this indication implies that SIM is valid and may need security check */
  930.     SetProtocolEventHandler(SimPasswdReqResponse, MSG_ID_GET_PIN_RES);
  931.     /* SimQueryFailureRsp: this indication implies that SIM is invalid or not inserted */
  932.     SetProtocolEventHandler(SimQueryFailureRsp, MSG_ID_SIM_CARD_FAILURE);
  933.     g_keylock_context.gKeyPadLockFlag = 0;
  934. }
  935. /**************************************************************************
  936. *        Bootup Revise                *
  937. **************************************************************************/
  938. /* diamond, 2005/08/16 bootup revise */
  939. /*****************************************************************************
  940.  * FUNCTION
  941.  *  mmi_sim_error_hide_menu_items
  942.  * DESCRIPTION
  943.  *  Hide some menu items for no sim or sim blocked case
  944.  * PARAMETERS
  945.  *  void
  946.  * RETURNS
  947.  *  void
  948.  *****************************************************************************/
  949. static void mmi_sim_error_hide_menu_items(void)
  950. {
  951.     /*----------------------------------------------------------------*/
  952.     /* Local Variables                                                */
  953.     /*----------------------------------------------------------------*/
  954.     /*----------------------------------------------------------------*/
  955.     /* Code Body                                                      */
  956.     /*----------------------------------------------------------------*/
  957.     mmi_frm_hide_menu_item(MENU_IDLE_SCR_DISP);          /* Hide "Display Characteristic" in No SIM screen */
  958.     mmi_frm_hide_menu_item(MENU9146_WELCOME_TEXT);       /* Hide "Greeting Text" in No SIM screen */
  959.     mmi_frm_hide_menu_item(MENU_SETTING_DEDICATED_KEYS); /* Hide "Dedicated key" in No SIM screen */
  960. #ifdef __MMI_NITZ__
  961.     mmi_frm_hide_menu_item(MENU9145_SETTIMEANDDATENITZ); /* Hide "Auto update of date and time" in No SIM screen */
  962.     mmi_frm_hide_menu_item(MENU_SETTING_MENU_TREE);
  963. #endif /* __MMI_NITZ__ */ 
  964.     mmi_frm_hide_menu_item(MENU9169_SIM_LOCK);           /* Hide "SIM Lock" in No SIM screen */
  965.     mmi_frm_hide_menu_item(MENU9167_FIXED_DIAL);         /* Hide "Fixed Dial" in No SIM screen */
  966.     mmi_frm_hide_menu_item(MENU9168_BARRED_DAIL);        /* Hide "Barred Dail" in No SIM screen */
  967.     mmi_frm_hide_menu_item(MENU9174_CP_PIN1);            /* Hide "Change Password/PIN1" in No SIM screen */
  968.     mmi_frm_hide_menu_item(MENU9175_CP_PIN2);            /* Hide "Change Password/PIN2" in No SIM screen */
  969.     mmi_frm_hide_menu_item(MENU_SETTING_SPEED_DIAL);     /* Hide "Speed Dial" in No SIM screen */
  970. #ifdef __MMI_WLAN_FEATURES__
  971.     mmi_frm_hide_menu_item(MENU9186_SELECTION_MODE);
  972.     mmi_frm_hide_menu_item(MENU9189_GPRS_CONNECTION_MODE);
  973. #if defined(__GSM_RAT__) && defined(__WCDMA_RAT__)
  974.     mmi_frm_hide_menu_item(MENU_ID_NETSET_SERVICE_SELECTION);
  975.     mmi_frm_hide_menu_item(MENU_ID_NETSET_NETWORK_INFO);
  976. #endif
  977. #ifdef __MMI_USER_CTRL_PLMN_SUPPORT__
  978.     mmi_frm_hide_menu_item(MENU_ID_NETSET_USER_CTRL_PLMN);
  979. #endif
  980.     mmi_frm_hide_menu_item(MESSAGES_MENU_SMS_MENUID);      /* SMS */
  981.     mmi_frm_hide_menu_item(MESSAGES_MENU_MMS_MENUID);      /* MMS */
  982.     mmi_frm_hide_menu_item(MENU_CHATAPP_ID);               /* Chat */
  983.     mmi_frm_hide_menu_item(MESSAGES_MENU_VMAIL_MENUID);    /* Voice Mail */
  984.     mmi_frm_hide_menu_item(MESSAGES_MENU_CB_MENUID);       /* Cell Broadcast */
  985.     mmi_frm_hide_menu_item(MENU_ID_UM_MAIN);               /* Unified Message */
  986.     mmi_frm_hide_menu_item(MENU_CALL_TIME_SETUP);          /* Call Time */
  987.     mmi_frm_hide_menu_item(MENU_CALL_HISTORY_CALLCOST);    /* Call Cost */
  988.     mmi_frm_hide_menu_item(MENU_CALL_HISTORY_SMSCOUNTER);  /* SMS Counter */
  989.     mmi_frm_hide_menu_item(MENU_CALL_HISTORY_GPRSCOUNTER); /* GPRS Counter */
  990.     g_pwr_context.CurrentServiceType = LIMITED_SERVICE; /* force to enter GSM no service state */
  991.     g_pwr_context.PowerOnNWStatus |= MMI_NW_STATUS_NETWORK_FLAG;
  992.     mmi_idle_notify_bootup_ready_to_wap();
  993. #ifdef __MMI_IMPS__
  994.     mmi_imps_notify_idle_reached();
  995. #endif 
  996. #endif /* __MMI_WLAN_FEATURES__ */
  997. }
  998. /*****************************************************************************
  999.  * FUNCTION
  1000.  *  InitSimErrorScreen
  1001.  * DESCRIPTION
  1002.  *  Initialize and enter SIM error screen
  1003.  * PARAMETERS
  1004.  *  error       [IN]        
  1005.  * RETURNS
  1006.  *  void
  1007.  *****************************************************************************/
  1008. void InitSimErrorScreen(void)
  1009. {
  1010.     /*----------------------------------------------------------------*/
  1011.     /* Local Variables                                                */
  1012.     /*----------------------------------------------------------------*/
  1013.     /*----------------------------------------------------------------*/
  1014.     /* Code Body                                                      */
  1015.     /*----------------------------------------------------------------*/
  1016.     InitInsertSimApp();
  1017.     RemoveStatusIconsForSimRemoved();
  1018. #ifdef __MMI_WLAN_FEATURES__
  1019.     mmi_netset_update_preferred_mode_menu();
  1020. #endif
  1021.     mmi_sim_error_hide_menu_items();
  1022.     EntryScrnSimErrorScreen();
  1023. }
  1024. /*****************************************************************************
  1025.  * FUNCTION
  1026.  *  InitSimBlockedScreen
  1027.  * DESCRIPTION
  1028.  *  Initialize and enter SIM blocked screen
  1029.  * PARAMETERS
  1030.  *  void
  1031.  * RETURNS
  1032.  *  void
  1033.  *****************************************************************************/
  1034. void InitSimBlockedScreen(void)
  1035. {
  1036.     /*----------------------------------------------------------------*/
  1037.     /* Local Variables                                                */
  1038.     /*----------------------------------------------------------------*/
  1039.     /*----------------------------------------------------------------*/
  1040.     /* Code Body                                                      */
  1041.     /*----------------------------------------------------------------*/
  1042.     InitInsertSimApp();
  1043.     RemoveStatusIconsForSimRemoved();
  1044. #ifdef __MMI_WLAN_FEATURES__
  1045.     mmi_netset_update_preferred_mode_menu();
  1046. #endif
  1047.     mmi_sim_error_hide_menu_items();
  1048.     EntryScrnSimBlockRsp();
  1049. }
  1050. /*****************************************************************************
  1051.  * FUNCTION
  1052.  *  InitEnterPasswordScreen
  1053.  * DESCRIPTION
  1054.  *  Initialize password screen
  1055.  * PARAMETERS
  1056.  *  pendingAlarm        [IN]        
  1057.  * RETURNS
  1058.  *  void
  1059.  *****************************************************************************/
  1060. void InitEnterPasswordScreen(pBOOL pendingAlarm)
  1061. {
  1062.     /*----------------------------------------------------------------*/
  1063.     /* Local Variables                                                */
  1064.     /*----------------------------------------------------------------*/
  1065.     /*----------------------------------------------------------------*/
  1066.     /* Code Body                                                      */
  1067.     /*----------------------------------------------------------------*/
  1068.     if (mmi_bootup_is_searching_or_idle_reached() == MMI_FALSE && pendingAlarm)
  1069.     {
  1070.         PendingAlarmInPwronPeriod();
  1071.     }
  1072.     if (g_charbat_context.isChargerConnected == 1 && g_charbat_context.ChargingComplete == 0)
  1073.     {
  1074.         IdleScreenChargerConnected(KAL_FALSE);
  1075.     }
  1076. }
  1077. /*****************************************************************************
  1078.  * FUNCTION
  1079.  *  ValidatePassword
  1080.  * DESCRIPTION
  1081.  *  Validate password
  1082.  * PARAMETERS
  1083.  *  void
  1084.  * RETURNS
  1085.  *  void
  1086.  *****************************************************************************/
  1087. void ValidatePassword(void)
  1088. {
  1089.     /*----------------------------------------------------------------*/
  1090.     /* Local Variables                                                */
  1091.     /*----------------------------------------------------------------*/
  1092.     /* used to verify PIN or phone lock in power on period */
  1093.     MYQUEUE Message;
  1094.     MMISMUVERIFYPINREQ *local_data;
  1095.     /*----------------------------------------------------------------*/
  1096.     /* Code Body                                                      */
  1097.     /*----------------------------------------------------------------*/
  1098.     ClearInputEventHandler(MMI_DEVICE_ALL); /* send message and wait response in the same screen and no input can be accepted */
  1099.     PRINT_INFORMATION(("@@@@@ Sending request for verifying password @@@@@"));
  1100.     Message.oslSrcId = MOD_MMI;
  1101.     Message.oslDestId = MOD_L4C;
  1102.     Message.oslMsgId = PRT_MMI_SMU_VERIFY_PIN_REQ;
  1103.     local_data = (MMISMUVERIFYPINREQ*) OslConstructDataPtr(sizeof(MMISMUVERIFYPINREQ));
  1104.     local_data->pin_type = MMI_TYPE_UNSPECIFIED;
  1105.     /* Change gInputPwdBuffer to ASCII then copy local_data->pin */
  1106.     UnicodeToAnsii((S8*) local_data->pin, (S8*) gInputPwdBuffer);
  1107.     Message.oslDataPtr = (oslParaType*) local_data;
  1108.     Message.oslPeerBuffPtr = NULL;
  1109.     OslMsgSendExtQueue(&Message);
  1110. }
  1111. /* end, diamond */
  1112. /**************************************************************************
  1113.    SIM Error APIs:
  1114.       void EntryScrnSimErrorScreen(void)
  1115.       void ExitScrnSimErrorScreen(void)
  1116.       void ShowSubLCDSimError(void)
  1117.       void ExitSubLCDSimError(void)
  1118. **************************************************************************/
  1119. /*****************************************************************************
  1120.  * FUNCTION
  1121.  *  EntryScrnSimErrorScreen
  1122.  * DESCRIPTION
  1123.  *  Entry screen when no SIM is inserted
  1124.  * PARAMETERS
  1125.  *  void
  1126.  * RETURNS
  1127.  *  void
  1128.  *****************************************************************************/
  1129. #ifdef __J2ME__
  1130. extern BOOL java_is_launch_after_install(void);
  1131. extern void mmi_java_send_mid_start_req(game_type_enum type);
  1132. #endif /* __J2ME__ */ 
  1133. void EntryScrnSimErrorScreen(void)
  1134. {
  1135.     /*----------------------------------------------------------------*/
  1136.     /* Local Variables                                                */
  1137.     /*----------------------------------------------------------------*/
  1138.     U8 *guiBuffer;  /* Buffer holding history data */
  1139.     U16 InsertSIMScreenDigits[MAX_INSERT_SCR_DIGITS] =
  1140.         {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_STAR, KEY_POUND};
  1141.     /*----------------------------------------------------------------*/
  1142.     /* Code Body                                                      */
  1143.     /*----------------------------------------------------------------*/
  1144. #ifdef __MMI_WLAN_FEATURES__
  1145.     if (mmi_netset_get_active_preferred_mode() != P_GSM_ONLY)
  1146.     {
  1147.         EntryIdleScreen();
  1148.         return;
  1149.     }
  1150. #endif /* __MMI_WLAN_FEATURES__ */
  1151.     EntryNewScreen(SCR_SIM_INSERTION, ExitScrnSimErrorScreen, EntryScrnSimErrorScreen, NULL);
  1152.     DinitHistory();         /* Dinit History is called to prevent memory leak */
  1153.     DeInitSpecialMode();    /* Back from engineer mode or factory mode */
  1154.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  1155.     g_pwr_context.PrevScreenIndicator = ENTER_SIM_INSERTION;
  1156.     g_idle_context.IsOnSimErrorScreen = 1;
  1157.     /* Fix the case that caller group LED could not demo after entering FM/EM and then back to INSERT_SIM */
  1158. #if ( defined(__MMI_ENGINEER_MODE__) || defined(__MMI_FACTORY_MODE__))
  1159.     gCurrentMode = NORMAL_MODE;
  1160. #endif 
  1161. #ifdef __MMI_DOWNLOAD_AGENT__
  1162.     mmi_da_enter_idle_screen_notify();
  1163. #endif 
  1164.     /* Provide Java functions in the SIM error main menu */
  1165. #ifdef __J2ME__
  1166.     jvm_enter_idle_screen_notify();
  1167. #endif 
  1168.     /* diamond, 2005/10/29, keypad lock in insert sim screen */
  1169.     mmi_idle_start_keypad_lock();
  1170.     if (mmi_bootup_get_active_flight_mode() == 0)
  1171.     {
  1172.         mmi_frm_kbd_reg_pre_key_hdlr(IdleScreenEmergencyCallCheckNKeypadLock);
  1173.     }
  1174.     /* end, diamond */
  1175.     guiBuffer = GetCurrGuiBuffer(SCR_SIM_INSERTION);
  1176.     ShowSubLCDScreen(ShowSubLCDSimError);
  1177.     DinitSubLCDHistory();
  1178. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) )
  1179.     EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
  1180. #endif 
  1181.     if (0)
  1182.     {
  1183.     }
  1184. #ifdef __J2ME__
  1185.     else if (mmi_java_is_launch_after_install())
  1186.     {
  1187.         mmi_java_send_mid_start_req(GAMETYPE_JAVA_GAME);
  1188.     }
  1189. #endif /* __J2ME__ */ 
  1190. #if (defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P)
  1191.     else if (mmi_vobj_is_pending_object())
  1192.     {
  1193.         mmi_vobj_entry_recv_object(); /* unread vObjects */
  1194.     }
  1195. #endif /* defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P) */
  1196. #ifdef __MMI_DOWNLOAD_AGENT__
  1197.     else if (mmi_da_launch_ring_buffer_check())
  1198.     {
  1199.         mmi_da_entry_new_push_ind();
  1200.     }
  1201. #endif /* __MMI_DOWNLOAD_AGENT__ */ 
  1202.     else
  1203.     {
  1204.         if (g_keylock_context.gKeyPadLockFlag == 0) /* keypad is not locked */
  1205.         {
  1206.             ShowCategory123Screen(
  1207.                 0,
  1208.                 0,
  1209.                 STR_GLOBAL_OPTIONS,
  1210.                 IMG_GLOBAL_OPTIONS,
  1211.                 STR_RSK_SOS,
  1212.                 0,
  1213.                 simErrorDisplayString,
  1214.                 IMG_SIM_INSERTION_MSG,    //Old:IMG_GLOBAL_WARNING      //KP Jerry modify on 2007-3-6
  1215.                 NULL);
  1216.         #if ( (defined __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) )
  1217.             SetCenterSoftkeyFunction(HandleInsertSIMScrDigitEntry, KEY_EVENT_UP);
  1218.         #endif 
  1219.             SetLeftSoftkeyFunction(EntryScrSimOptionMenu, KEY_EVENT_UP);
  1220.         #if ( (defined __FLIGHT_MODE_SUPPORT__) && (defined __MMI_TOUCH_SCREEN__) )
  1221.             if (mmi_bootup_get_active_flight_mode() == 1)
  1222.                 SetRightSoftkeyFunction(mmi_flight_mode_popup_in_dialing_sos, KEY_EVENT_UP);
  1223.             else
  1224.         #endif
  1225.                 SetRightSoftkeyFunction(ShowMakeSOSCallScr, KEY_EVENT_UP);
  1226.             SetGroupKeyHandler(
  1227.                 HandleInsertSIMScrDigitEntry,
  1228.                 InsertSIMScreenDigits,
  1229.                 MAX_INSERT_SCR_DIGITS - 1,
  1230.                 KEY_EVENT_DOWN);
  1231.             SetDefaultVolumeKeyHandlers();
  1232.         #ifdef __MMI_TOUCH_SCREEN__
  1233.             wgui_register_status_icon_pen_event_hdlr(
  1234.                 STATUS_ICON_KEYPAD_LOCK,
  1235.                 WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON,
  1236.                 InsertSimSetKeyPadLockFlag);
  1237.         #endif /* __MMI_TOUCH_SCREEN__ */ 
  1238.         }
  1239.         else
  1240.         {
  1241.             mmi_idle_set_keypad_lock_string();
  1242.         #if (defined  __MMI_TOUCH_SCREEN__ && defined __MMI_WGUI_CSK_ENABLE__ )
  1243.             ResetCenterSoftkey();
  1244.         #endif 
  1245.             ShowCategory123Screen(
  1246.                 0,
  1247.                 0,
  1248.                 g_keylock_context.KeyLockLSKStringID,
  1249.                 g_keylock_context.KeyLockLSKIconID,
  1250.                 g_keylock_context.KeyLockRSKStringID,
  1251.                 g_keylock_context.KeyLockRSKIconID,
  1252.                 simErrorDisplayString,
  1253.                 IMG_GLOBAL_WARNING,
  1254.                 NULL);
  1255.         #if defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__)
  1256.             SetGroupKeyHandler(
  1257.                 EntryScrKeyPadLockOnPessingAnyKey,
  1258.                 (PU16) PresentAllKeys,
  1259.                 (U8) TOTAL_KEYS,
  1260.                 (U16) KEY_EVENT_DOWN);
  1261.         #endif /* defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__) */ 
  1262.         #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  1263.             mmi_idle_pen_block();   /* diamond, 2005/12/22 Disable touch panel if re-entry idle keypad lock screen */
  1264.             SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  1265.         #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  1266.         #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27    /* Robin 1223 */
  1267.             SetRightSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_UP);
  1268.         #endif 
  1269.         #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__    /* Robin 1223 */
  1270.             SetLeftSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_UP);
  1271.         #endif 
  1272.         #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  1273.             if (g_idle_context.IsRSKPressOnScreenSaver)
  1274.             {
  1275.                 EntryScrAfterPessingRSK();
  1276.                 g_idle_context.IsRSKPressOnScreenSaver = 0;
  1277.             }
  1278.         }
  1279.         InitEnterPasswordScreen(MMI_FALSE);
  1280.     }
  1281.     /* max: to prevent pending alarm */
  1282.     PendingAlarmReminder();
  1283. }
  1284. /*****************************************************************************
  1285.  * FUNCTION
  1286.  *  ExitScrnSimErrorScreen
  1287.  * DESCRIPTION
  1288.  *  Exit screen when no SIM is inserted
  1289.  * PARAMETERS
  1290.  *  void
  1291.  * RETURNS
  1292.  *  void
  1293.  *****************************************************************************/
  1294. void ExitScrnSimErrorScreen(void)
  1295. {
  1296.     /*----------------------------------------------------------------*/
  1297.     /* Local Variables                                                */
  1298.     /*----------------------------------------------------------------*/
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Code Body                                                      */
  1301.     /*----------------------------------------------------------------*/
  1302.     g_idle_context.IsOnSimErrorScreen = 0;
  1303.     mmi_frm_kbd_reg_pre_key_hdlr(NULL);
  1304. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  1305.     ResetCenterSoftkey();
  1306. #endif 
  1307.     if (g_keylock_context.gKeyPadLockFlag == 1)
  1308.     {
  1309.     #ifdef __MMI_TOUCH_SCREEN__
  1310.         ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
  1311.         mmi_pen_unblock();  /* diamond, 2005/12/22 Enable touch panel if exit idle keypad lock screen */
  1312.     #else 
  1313.         HideStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  1314.     #endif 
  1315.     }
  1316. #ifdef __MMI_TOUCH_SCREEN__
  1317.     wgui_reset_status_icon_pen_event_hdlr();
  1318. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1319.     StopTimer(IDLE_APP_AUTO_LOCK_TIMER_ID);
  1320. }
  1321. /*****************************************************************************
  1322.  * FUNCTION
  1323.  *  ShowSubLCDSimError
  1324.  * DESCRIPTION
  1325.  *  Entry screen for sublcd when no SIM is inserted
  1326.  * PARAMETERS
  1327.  *  void
  1328.  * RETURNS
  1329.  *  void
  1330.  *****************************************************************************/
  1331. void ShowSubLCDSimError(void)
  1332. {
  1333.     /*----------------------------------------------------------------*/
  1334.     /* Local Variables                                                */
  1335.     /*----------------------------------------------------------------*/
  1336.     U16 stringID =
  1337.         (simErrorDisplayString ==
  1338.          SIM_ERROR_DISPLAY_SIM_ACCESS_ERROR) ? STR_SUBLCD_SIM_ACCESS_ERROR_MSG : STR_SUBLCD_SIM_INSERTION_MSG;
  1339.     /*----------------------------------------------------------------*/
  1340.     /* Code Body                                                      */
  1341.     /*----------------------------------------------------------------*/
  1342.     ExecSubLCDCurrExitHandler();
  1343. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1344.     if (IsClamClose())
  1345.     {
  1346.         ShowSubLCDAnalogClockScreen();
  1347.     }
  1348.     else
  1349.     {
  1350.         ShowSubLCDLogoString();
  1351.     }
  1352. #else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1353.     ShowCategory301Screen((PU8) GetString(stringID), 0, NULL);
  1354. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1355.     SetSubLCDExitHandler(ExitSubLCDSimError);
  1356.     g_idle_context.IsSubLcdOnIdleScreen = SUBLCD_ON_IDLE_INSERT_SIM;
  1357. }
  1358. /*****************************************************************************
  1359.  * FUNCTION
  1360.  *  ExitSubLCDSimError
  1361.  * DESCRIPTION
  1362.  *  Exit screen for sublcd when no SIM is inserted
  1363.  * PARAMETERS
  1364.  *  void
  1365.  * RETURNS
  1366.  *  void
  1367.  *****************************************************************************/
  1368. void ExitSubLCDSimError(void)
  1369. {
  1370.     /*----------------------------------------------------------------*/
  1371.     /* Local Variables                                                */
  1372.     /*----------------------------------------------------------------*/
  1373.     SubLCDHistoryNode SubLCDHistory;
  1374.     /*----------------------------------------------------------------*/
  1375.     /* Code Body                                                      */
  1376.     /*----------------------------------------------------------------*/
  1377.     SubLCDHistory.entryFuncPtr = ShowSubLCDSimError;
  1378.     AddSubLCDHistory(&SubLCDHistory);
  1379.     g_idle_context.IsSubLcdOnIdleScreen = SUBLCD_NOT_ON_IDLE;
  1380. }
  1381. /**************************************************************************
  1382.    SIM Blocked APIs:
  1383.       void ExitScrnSimBlockRsp(void)
  1384.       void EntryScrnSimBlockRsp(void)
  1385.       void ShowSubLCDBlockedSIM(void)
  1386.       void ExitSubLCDBlockedSIM(void)
  1387. **************************************************************************/
  1388. /*****************************************************************************
  1389.  * FUNCTION
  1390.  *  ExitScrnSimBlockRsp
  1391.  * DESCRIPTION
  1392.  *  Exit screen when SIM is blocked
  1393.  * PARAMETERS
  1394.  *  void
  1395.  * RETURNS
  1396.  *  void
  1397.  *****************************************************************************/
  1398. void ExitScrnSimBlockRsp(void)
  1399. {
  1400.     /*----------------------------------------------------------------*/
  1401.     /* Local Variables                                                */
  1402.     /*----------------------------------------------------------------*/
  1403.     /*----------------------------------------------------------------*/
  1404.     /* Code Body                                                      */
  1405.     /*----------------------------------------------------------------*/
  1406.     g_idle_context.IsOnSimErrorScreen = 0;
  1407.     mmi_frm_kbd_reg_pre_key_hdlr(NULL);
  1408. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  1409.     ResetCenterSoftkey();
  1410. #endif 
  1411.     if (g_keylock_context.gKeyPadLockFlag == 1)
  1412.     {
  1413.     #ifdef __MMI_TOUCH_SCREEN__
  1414.         ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
  1415.         mmi_pen_unblock();  /* diamond, 2005/12/22 Enable touch panel if exit idle keypad lock screen */
  1416.     #else 
  1417.         HideStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  1418.     #endif 
  1419.     }
  1420. #ifdef __MMI_TOUCH_SCREEN__
  1421.     wgui_reset_status_icon_pen_event_hdlr();
  1422. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1423.     StopTimer(IDLE_APP_AUTO_LOCK_TIMER_ID);
  1424. }
  1425. /*****************************************************************************
  1426.  * FUNCTION
  1427.  *  EntryScrnSimBlockRsp
  1428.  * DESCRIPTION
  1429.  *  Entry screen when SIM is blocked
  1430.  * PARAMETERS
  1431.  *  void
  1432.  * RETURNS
  1433.  *  void
  1434.  *****************************************************************************/
  1435. void EntryScrnSimBlockRsp(void)
  1436. {
  1437.     /*----------------------------------------------------------------*/
  1438.     /* Local Variables                                                */
  1439.     /*----------------------------------------------------------------*/
  1440.     U8 *guiBuffer;  /* Buffer holding history data */
  1441.     U16 BlockSIMScreenDigits[MAX_INSERT_SCR_DIGITS] =
  1442.         {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_STAR, KEY_POUND};
  1443.     /*----------------------------------------------------------------*/
  1444.     /* Code Body                                                      */
  1445.     /*----------------------------------------------------------------*/
  1446. #ifdef __MMI_WLAN_FEATURES__
  1447.     if (mmi_netset_get_active_preferred_mode() != P_GSM_ONLY)
  1448.     {
  1449.         EntryIdleScreen();
  1450.         return;
  1451.     }
  1452. #endif /* __MMI_WLAN_FEATURES__ */
  1453.     EntryNewScreen(SCR_SIM_BLOCK, ExitScrnSimBlockRsp, EntryScrnSimBlockRsp, NULL);
  1454.     DinitHistory();         /* Dinit History is called to prevent memory leak */
  1455.     DeInitSpecialMode();    /* Back from engineer mode or factory mode */
  1456.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  1457.     g_pwr_context.PrevScreenIndicator = ENTER_SIM_BLOCK;
  1458.     g_idle_context.IsOnSimErrorScreen = 1;
  1459. #ifdef __MMI_DOWNLOAD_AGENT__
  1460.     mmi_da_enter_idle_screen_notify();
  1461. #endif 
  1462. #ifdef __J2ME__
  1463.     jvm_enter_idle_screen_notify();
  1464. #endif 
  1465.     /* diamond, 2005/10/29, keypad lock in insert sim screen */
  1466.     mmi_idle_start_keypad_lock();
  1467.     if (mmi_bootup_get_active_flight_mode() == 0)
  1468.     {
  1469.         mmi_frm_kbd_reg_pre_key_hdlr(IdleScreenEmergencyCallCheckNKeypadLock);
  1470.     }
  1471.     /* end, diamond */
  1472.     guiBuffer = GetCurrGuiBuffer(SCR_SIM_BLOCK);
  1473.     ShowSubLCDScreen(ShowSubLCDBlockedSIM);
  1474.     DinitSubLCDHistory();
  1475. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) )
  1476.     EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
  1477. #endif 
  1478.     if (0)
  1479.     {
  1480.     }
  1481. #ifdef __J2ME__
  1482.     else if (mmi_java_is_launch_after_install())
  1483.     {
  1484.         mmi_java_send_mid_start_req(GAMETYPE_JAVA_GAME);
  1485.     }
  1486. #endif /* __J2ME__ */ 
  1487. #if (defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P)
  1488.     else if (mmi_vobj_is_pending_object())
  1489.     {
  1490.         mmi_vobj_entry_recv_object(); /* unread vObjects */
  1491.     }
  1492. #endif /* defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P) */
  1493. #ifdef __MMI_DOWNLOAD_AGENT__
  1494.     else if (mmi_da_launch_ring_buffer_check())
  1495.     {
  1496.         mmi_da_entry_new_push_ind();
  1497.     }
  1498. #endif /* __MMI_DOWNLOAD_AGENT__ */ 
  1499.     else
  1500.     {
  1501.         if (g_keylock_context.gKeyPadLockFlag == 0) /* keypad is not locked */
  1502.         {
  1503.             ShowCategory123Screen(
  1504.                 0,
  1505.                 0,
  1506.                 STR_GLOBAL_OPTIONS,
  1507.                 IMG_GLOBAL_OPTIONS,
  1508.                 STR_RSK_SOS,
  1509.                 0,
  1510.                 simErrorDisplayString,
  1511.                 IMG_GLOBAL_WARNING,
  1512.                 NULL);
  1513.         #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) )
  1514.             SetCenterSoftkeyFunction(HandleInsertSIMScrDigitEntry, KEY_EVENT_UP);
  1515.         #endif 
  1516.             SetLeftSoftkeyFunction(EntryScrSimOptionMenu, KEY_EVENT_UP);
  1517.         #if ( (defined __FLIGHT_MODE_SUPPORT__) && (defined __MMI_TOUCH_SCREEN__) )
  1518.             if (mmi_bootup_get_active_flight_mode() == 1)
  1519.                 SetRightSoftkeyFunction(mmi_flight_mode_popup_in_dialing_sos, KEY_EVENT_UP);
  1520.             else
  1521.         #endif
  1522.                 SetRightSoftkeyFunction(ShowMakeSOSCallScr, KEY_EVENT_UP);
  1523.             SetGroupKeyHandler(
  1524.                 HandleInsertSIMScrDigitEntry,
  1525.                 BlockSIMScreenDigits,
  1526.                 MAX_INSERT_SCR_DIGITS - 1,
  1527.                 KEY_EVENT_DOWN);
  1528.             SetDefaultVolumeKeyHandlers();
  1529.         #ifdef __MMI_TOUCH_SCREEN__
  1530.             wgui_register_status_icon_pen_event_hdlr(
  1531.                 STATUS_ICON_KEYPAD_LOCK,
  1532.                 WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON,
  1533.                 InsertSimSetKeyPadLockFlag);
  1534.         #endif /* __MMI_TOUCH_SCREEN__ */ 
  1535.         }
  1536.         else
  1537.         {
  1538.             mmi_idle_set_keypad_lock_string();
  1539.         #if (defined  __MMI_TOUCH_SCREEN__ && defined __MMI_WGUI_CSK_ENABLE__ )
  1540.             ResetCenterSoftkey();
  1541.         #endif 
  1542.             ShowCategory123Screen(
  1543.                 0,
  1544.                 0,
  1545.                 g_keylock_context.KeyLockLSKStringID,
  1546.                 g_keylock_context.KeyLockLSKIconID,
  1547.                 g_keylock_context.KeyLockRSKStringID,
  1548.                 g_keylock_context.KeyLockRSKIconID,
  1549.                 simErrorDisplayString,
  1550.                 IMG_GLOBAL_WARNING,
  1551.                 NULL);
  1552.         #if defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__)
  1553.             SetGroupKeyHandler(
  1554.                 EntryScrKeyPadLockOnPessingAnyKey,
  1555.                 (PU16) PresentAllKeys,
  1556.                 (U8) TOTAL_KEYS,
  1557.                 (U16) KEY_EVENT_DOWN);
  1558.         #endif /* defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__) */ 
  1559. #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  1560.             mmi_idle_pen_block();   /* diamond, 2005/12/22 Disable touch panel if re-entry idle keypad lock screen */
  1561.             SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  1562.         #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  1563.         #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27    /* Robin 1223 */
  1564.             SetRightSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_UP);
  1565.         #endif 
  1566.         #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__    /* Robin 1223 */
  1567.             SetLeftSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_UP);
  1568.         #endif 
  1569.         #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  1570.             if (g_idle_context.IsRSKPressOnScreenSaver)
  1571.             {
  1572.                 EntryScrAfterPessingRSK();
  1573.                 g_idle_context.IsRSKPressOnScreenSaver = 0;
  1574.             }
  1575.         }
  1576.         InitEnterPasswordScreen(MMI_FALSE);
  1577.     }
  1578. }
  1579. /*****************************************************************************
  1580.  * FUNCTION
  1581.  *  ShowSubLCDBlockedSIM
  1582.  * DESCRIPTION
  1583.  *  Entry screen for sulcd when SIM is blocked
  1584.  * PARAMETERS
  1585.  *  void
  1586.  * RETURNS
  1587.  *  void
  1588.  *****************************************************************************/
  1589. void ShowSubLCDBlockedSIM(void)
  1590. {
  1591.     /*----------------------------------------------------------------*/
  1592.     /* Local Variables                                                */
  1593.     /*----------------------------------------------------------------*/
  1594.     /*----------------------------------------------------------------*/
  1595.     /* Code Body                                                      */
  1596.     /*----------------------------------------------------------------*/
  1597.     ExecSubLCDCurrExitHandler();
  1598. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1599.     if (IsClamClose())
  1600.     {
  1601.         ShowSubLCDAnalogClockScreen();
  1602.     }
  1603.     else
  1604.     {
  1605.         ShowSubLCDLogoString();
  1606.     }
  1607. #else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1608.     ShowCategory301Screen((PU8) GetString(STR_SIM_BLOCK_MSG), 0, NULL);
  1609. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1610.     SetSubLCDExitHandler(ExitSubLCDBlockedSIM);
  1611.     g_idle_context.IsSubLcdOnIdleScreen = SUBLCD_ON_IDLE_SIM_BLOCKED;
  1612. }
  1613. /*****************************************************************************
  1614.  * FUNCTION
  1615.  *  ExitSubLCDBlockedSIM
  1616.  * DESCRIPTION
  1617.  *  Exit screen for sulcd when SIM is blocked
  1618.  * PARAMETERS
  1619.  *  void
  1620.  * RETURNS
  1621.  *  void
  1622.  *****************************************************************************/
  1623. void ExitSubLCDBlockedSIM(void)
  1624. {
  1625.     /*----------------------------------------------------------------*/
  1626.     /* Local Variables                                                */
  1627.     /*----------------------------------------------------------------*/
  1628.     SubLCDHistoryNode SubLCDHistory;
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Code Body                                                      */
  1631.     /*----------------------------------------------------------------*/
  1632.     SubLCDHistory.entryFuncPtr = ShowSubLCDBlockedSIM;
  1633.     AddSubLCDHistory(&SubLCDHistory);
  1634.     g_idle_context.IsSubLcdOnIdleScreen = SUBLCD_NOT_ON_IDLE;
  1635. }
  1636. /**************************************************************************
  1637.    SIM Option Menu APIs:
  1638.       void EntryScrSimOptionMenu(void)
  1639. **************************************************************************/
  1640. /*****************************************************************************
  1641.  * FUNCTION
  1642.  *  EntryScrSimOptionMenu
  1643.  * DESCRIPTION
  1644.  *  Entry function for option button on 'insert sim' / 'blocked sim' / 'flight mode' screen
  1645.  * PARAMETERS
  1646.  *  void
  1647.  * RETURNS
  1648.  *  void
  1649.  *****************************************************************************/
  1650. void EntryScrSimOptionMenu(void)
  1651. {
  1652.     /*----------------------------------------------------------------*/
  1653.     /* Local Variables                                                */
  1654.     /*----------------------------------------------------------------*/
  1655.     U8 *guiBuffer;                      /* Buffer holding history data */
  1656.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  1657.     U16 nDispAttribute;                 /* Stores display attribue */
  1658.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  1659. #if defined(__MMI_VERSION_2__)
  1660.     U16 MenuOptionIconList[MAX_SUB_MENUS] = 
  1661.     {
  1662.     #ifndef __MMI_SERVICE_MENU_NUMERIC_LIST_ICON__
  1663.     #ifdef __MMI_BI_DEGREE_MAIN_MENU_STYLE__
  1664.         MAIN_MENU_AVZONE_TITLE,
  1665.     #endif 
  1666.     #ifdef __MMI_MAINLCD_240X320__
  1667.         IMG_ID_OPTION_MENU_PHONEBOOK_ICON,
  1668.         IMG_ID_OPTION_MENU_MULTIMEDIA_ICON,
  1669.         IMG_ID_OPTION_MENU_FILEMNGR_ICON,
  1670.         IMG_ID_OPTION_MENU_FUNANDGAMES_ICON,
  1671.         IMG_ID_OPTION_MENU_PROFILES_ICON,
  1672.         IMG_ID_OPTION_MENU_ORGANIZER_ICON,
  1673.         IMG_ID_OPTION_MENU_EXTRA_ICON,
  1674.         IMG_ID_OPTION_MENU_SETTINGS_ICON    /* diamond, 2005/12/23 Phone setup in option menu */
  1675.     #else /* __MMI_MAINLCD_240X320__ */ 
  1676.         MAIN_MENU_TITLE_PHONEBOOK_ICON,
  1677.         MAIN_MENU_TITLE_MULTIMEDIA_ICON,
  1678.         IMG_ID_FNG_FMGR_SUB_ICON,
  1679.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1680.         MAIN_MENU_TITLE_PROFILES_ICON,
  1681.         MAIN_MENU_TITLE_ORGANIZER_ICON,
  1682.         MAIN_MENU_TITLE_EXTRA_APP_ICON,
  1683.         MAIN_MENU_TITLE_SETTINGS_ICON       /* diamond, 2005/12/23 Phone setup in option menu */
  1684.     #endif /* __MMI_MAINLCD_240X320__ */ 
  1685.     #else /* __MMI_SERVICE_MENU_NUMERIC_LIST_ICON__ */ 
  1686.         IMG_GLOBAL_L1,
  1687.         IMG_GLOBAL_L2,
  1688.         IMG_GLOBAL_L3,
  1689.         IMG_GLOBAL_L4,
  1690.         IMG_GLOBAL_L5,
  1691.         IMG_GLOBAL_L6,
  1692.         IMG_GLOBAL_L7,
  1693.         IMG_GLOBAL_L8,
  1694.     #if defined(__MMI_BI_DEGREE_MAIN_MENU_STYLE__)
  1695.         IMG_GLOBAL_L9
  1696.     #endif 
  1697.     #endif /* __MMI_SERVICE_MENU_NUMERIC_LIST_ICON__ */ 
  1698.     };
  1699. #else /* defined(__MMI_VERSION_2__) */ 
  1700.     U16 MenuOptionIconList[MAX_SUB_MENUS] = 
  1701.     {
  1702.     #ifndef __MMI_SERVICE_MENU_NUMERIC_LIST_ICON__
  1703.     #ifdef __MMI_MAINLCD_240X320__
  1704.         IMG_ID_OPTION_MENU_MULTIMEDIA_ICON,
  1705.         IMG_ID_OPTION_MENU_FUNANDGAMES_ICON,
  1706.         IMG_ID_OPTION_MENU_PROFILES_ICON,
  1707.         IMG_ID_OPTION_MENU_ORGANIZER_ICON,
  1708.     #else /* __MMI_MAINLCD_240X320__ */ 
  1709.         MAIN_MENU_TITLE_MULTIMEDIA_ICON,
  1710.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1711.         MAIN_MENU_TITLE_PROFILES_ICON,
  1712.         MAIN_MENU_TITLE_ORGANIZER_ICON
  1713.     #endif /* __MMI_MAINLCD_240X320__ */ 
  1714.     #else /* __MMI_SERVICE_MENU_NUMERIC_LIST_ICON__ */ 
  1715.         IMG_GLOBAL_L1,
  1716.         IMG_GLOBAL_L2,
  1717.         IMG_GLOBAL_L3,
  1718.         IMG_GLOBAL_L4
  1719.     #endif /* __MMI_SERVICE_MENU_NUMERIC_LIST_ICON__ */ 
  1720.     };
  1721. #endif /* defined(__MMI_VERSION_2__) */ 
  1722.     /*----------------------------------------------------------------*/
  1723.     /* Code Body                                                      */
  1724.     /*----------------------------------------------------------------*/
  1725. #ifndef __MMI_TOUCH_SCREEN__
  1726. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  1727.     g_idle_context.ToMainMenuScrFromIdleApp = 1;    /* diamond, 2005/10/29, keypad lock in insert sim screen */
  1728. #endif 
  1729. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1730.     EntryNewScreen(SCR_SIM_OPTION, NULL, EntryScrSimOptionMenu, NULL);
  1731.     guiBuffer = GetCurrGuiBuffer(SCR_SIM_OPTION);
  1732.     SetParentHandler(MENU_SIM_OPTION_ID);
  1733.     nNumofItem = GetNumOfChild(MENU_SIM_OPTION_ID);
  1734.     nDispAttribute = GetDispAttributeOfItem(MENU_SIM_OPTION_ID);
  1735.     GetSequenceStringIds(MENU_SIM_OPTION_ID, nStrItemList);
  1736.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1737.     ShowCategory15Screen(
  1738.         STR_SIM_OPTION_CAPTION,
  1739.         0,
  1740.         STR_GLOBAL_OK,
  1741.         IMG_GLOBAL_OK,
  1742.         STR_GLOBAL_BACK,
  1743.         IMG_GLOBAL_BACK,
  1744.         nNumofItem,
  1745.         nStrItemList,
  1746.         MenuOptionIconList,
  1747.         LIST_MENU,
  1748.         0,
  1749.         guiBuffer);
  1750.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1751.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1752.     /* diamond, 2005/10/29, keypad lock in insert sim screen */
  1753. #ifndef __MMI_TOUCH_SCREEN__
  1754. #if (defined(__MMI_KEYPAD_LOCK_PATTERN_2__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
  1755.     if (g_idle_context.ToMainMenuScrFromIdleApp == 1)
  1756.     {
  1757.         StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
  1758.         SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_POUND, KEY_EVENT_UP);
  1759.     }
  1760. #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_2__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */ 
  1761. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1762. }
  1763. /**************************************************************************
  1764.    Enter PIN APIs:
  1765.       void EntryScrEnterPIN(void)
  1766.       void ShowSubLCDEnterPIN(void)
  1767.       void ExitSubLCDEnterPIN(void)
  1768. **************************************************************************/
  1769. /*****************************************************************************
  1770.  * FUNCTION
  1771.  *  EntryScrEnterPIN
  1772.  * DESCRIPTION
  1773.  *  Function inputs PIN from the user
  1774.  * PARAMETERS
  1775.  *  void
  1776.  * RETURNS
  1777.  *  void
  1778.  *****************************************************************************/
  1779. void EntryScrEnterPIN(void)
  1780. {
  1781.     /*----------------------------------------------------------------*/
  1782.     /* Local Variables                                                */
  1783.     /*----------------------------------------------------------------*/
  1784.     U8 PassCountdownDisp[MAX_PASS_COUNTDOWN_DISP];
  1785.     /*----------------------------------------------------------------*/
  1786.     /* Code Body                                                      */
  1787.     /*----------------------------------------------------------------*/
  1788.     EntryNewScreen(SCR_ENTER_PIN, NULL, EntryScrEnterPIN, NULL);
  1789.     DinitHistory();
  1790.     //if(!g_pwr_context.idleScreenFirst)
  1791.     //   g_pwr_context.PowerOnPeriod = 0;
  1792.     g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_SECURITY_SIM_LOCK;    /* 0x12: SIM lock */
  1793.     g_pwr_context.PrevScreenIndicator = ENTER_PIN_SCR;
  1794.     /* If user is entring this screen after SOS call then memset the buffer */
  1795.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave)
  1796.     {
  1797.         memset((S8*) gInputPwdBuffer, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  1798.     }
  1799.     /* Callback to check input password length */
  1800.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  1801.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  1802.     FillCountDownString(MMI_SETTING_TYPE_CHV1, PassCountdownDisp);
  1803.     ShowCategory111Screen(
  1804.         STR_GLOBAL_OK,
  1805.         IMG_GLOBAL_OK,
  1806.         STR_RSK_SOS,
  1807.         0,
  1808.         STR_ENTER_PIN_MSG,
  1809.         INPUT_TYPE_NUMERIC_PASSWORD,
  1810.         (U8*) gInputPwdBuffer,
  1811.         MAX_PWD_LENGTH_MMI,
  1812.         PassCountdownDisp,
  1813.         NULL);
  1814.     ShowSubLCDEnterPIN(); //ShowSubLCDScreen(ShowSubLCDEnterPIN);
  1815.     DinitSubLCDHistory();
  1816.     SetLeftSoftkeyFunction(ValidatePassword, KEY_EVENT_UP);
  1817.     if (mmi_bootup_get_active_flight_mode() == 1)
  1818.     {
  1819.         SetCategory111RightSoftkeyFunction(mmi_flight_mode_popup_in_dialing_sos, KEY_EVENT_UP);
  1820.     }
  1821.     else
  1822.     {
  1823.         SetCategory111RightSoftkeyFunction(ShowMakeSOSCallScr,KEY_EVENT_UP);
  1824.         SetKeyHandler(GoToSOSDialScr,KEY_SEND,KEY_EVENT_UP);
  1825.     }
  1826.     SetKeyHandler(ValidatePassword,KEY_POUND,KEY_EVENT_UP);
  1827.        
  1828.     /* Disable LSK if the input password length isn't enough */
  1829.     gSecuritySetupContext.PasswdLenCheckCallBack = ValidatePassword;
  1830.     if (pfnUnicodeStrlen((S8*) gInputPwdBuffer) < MMI_MIN_PASSWORD_LENGTH)
  1831.     {
  1832.         ChangeLeftSoftkey(0, 0);
  1833.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1834.     }
  1835. }
  1836. /*****************************************************************************
  1837.  * FUNCTION
  1838.  *  ShowSubLCDEnterPIN
  1839.  * DESCRIPTION
  1840.  *  Entry function for sublcd for enter pin
  1841.  * PARAMETERS
  1842.  *  void
  1843.  * RETURNS
  1844.  *  void
  1845.  *****************************************************************************/
  1846. void ShowSubLCDEnterPIN(void)
  1847. {
  1848.     /*----------------------------------------------------------------*/
  1849.     /* Local Variables                                                */
  1850.     /*----------------------------------------------------------------*/
  1851.     /*----------------------------------------------------------------*/
  1852.     /* Code Body                                                      */
  1853.     /*----------------------------------------------------------------*/
  1854.     ExecSubLCDCurrExitHandler();
  1855. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1856.     if (IsClamClose())
  1857.     {
  1858.         ShowSubLCDAnalogClockScreen();
  1859.     }
  1860.     else
  1861.     {
  1862.         ShowSubLCDLogoString();
  1863.     }
  1864. #else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1865.     ShowCategory301Screen((PU8) GetString(STR_SUBLCD_ENTER_PIN_MSG), 0, NULL);
  1866. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1867.     SetSubLCDExitHandler(ExitSubLCDEnterPIN);
  1868. }
  1869. /*****************************************************************************
  1870.  * FUNCTION
  1871.  *  ExitSubLCDEnterPIN
  1872.  * DESCRIPTION
  1873.  *  Exit function for sublcd for enter pin
  1874.  * PARAMETERS
  1875.  *  void
  1876.  * RETURNS
  1877.  *  void
  1878.  *****************************************************************************/
  1879. void ExitSubLCDEnterPIN(void)
  1880. {
  1881.     /*----------------------------------------------------------------*/
  1882.     /* Local Variables                                                */
  1883.     /*----------------------------------------------------------------*/
  1884.     SubLCDHistoryNode SubLCDHistory;
  1885.     /*----------------------------------------------------------------*/
  1886.     /* Code Body                                                      */
  1887.     /*----------------------------------------------------------------*/
  1888.     SubLCDHistory.entryFuncPtr = ShowSubLCDEnterPIN;
  1889.     AddSubLCDHistory(&SubLCDHistory);
  1890. }
  1891. /**************************************************************************
  1892.    Enter Phone Lock APIs:
  1893.       void EntryScrEnterPhoneLock(void)
  1894.       void ShowSubLCDEnterPhoneLock(void)
  1895.       void ExitSubLCDEnterPhoneLock(void)
  1896. **************************************************************************/
  1897. /*****************************************************************************
  1898.  * FUNCTION
  1899.  *  EntryScrEnterPhoneLock
  1900.  * DESCRIPTION
  1901.  *  Entry screen for entring phone lock
  1902.  * PARAMETERS
  1903.  *  void
  1904.  * RETURNS
  1905.  *  void
  1906.  *****************************************************************************/
  1907. void EntryScrEnterPhoneLock(void)
  1908. {
  1909.     /*----------------------------------------------------------------*/
  1910.     /* Local Variables                                                */
  1911.     /*----------------------------------------------------------------*/
  1912.     /*----------------------------------------------------------------*/
  1913.     /* Code Body                                                      */
  1914.     /*----------------------------------------------------------------*/
  1915.     /* diamond, 2006/02/22 Avoid to re-entry phone lock screen by AT emergency call if phone lock is verified */
  1916.     if (g_pwr_context.PowerOnMMIStatus == MMI_POWER_ON_SECURITY_NO_PSWD)
  1917.     {
  1918.         goto_opening_screen();
  1919.         return;
  1920.     }
  1921.     EntryNewScreen(SCR_ENTER_PHONELOCK, NULL, EntryScrEnterPhoneLock, NULL);
  1922.     DinitHistory();
  1923.     //if(!g_pwr_context.idleScreenFirst)
  1924.     //   g_pwr_context.PowerOnPeriod = 0;
  1925.     g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_SECURITY_PHONE_LOCK;  /* 0x11: Phone lock */
  1926.     g_pwr_context.PrevScreenIndicator = ENTER_PHONELOCK;
  1927.     /* If user is entring this screen after SOS call then memset the buffer */
  1928.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave)
  1929.     {
  1930.         memset((S8*) gInputPwdBuffer, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  1931.     }
  1932.     /* Callback to check input password length */
  1933.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  1934.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  1935.     ShowCategory111Screen(
  1936.         STR_GLOBAL_OK,
  1937.         IMG_GLOBAL_OK,
  1938.         STR_RSK_SOS,
  1939.         0,
  1940.         STR_ENTER_PHONELOCK_MSG,
  1941.         INPUT_TYPE_NUMERIC_PASSWORD,
  1942.         (U8*) gInputPwdBuffer,
  1943.         MAX_PWD_LENGTH_MMI,
  1944.         NULL,
  1945.         NULL);
  1946.     ShowSubLCDEnterPhoneLock(); //ShowSubLCDScreen(ShowSubLCDEnterPhoneLock);
  1947.     DinitSubLCDHistory();
  1948.     SetLeftSoftkeyFunction(ValidatePassword, KEY_EVENT_UP);
  1949.     if (mmi_bootup_get_active_flight_mode() == 1)
  1950.     {
  1951.         SetCategory111RightSoftkeyFunction(mmi_flight_mode_popup_in_dialing_sos, KEY_EVENT_UP);
  1952.     }
  1953.     else
  1954.     {
  1955.         SetCategory111RightSoftkeyFunction(ShowMakeSOSCallScr,KEY_EVENT_UP);
  1956.         SetKeyHandler(GoToSOSDialScr,KEY_SEND,KEY_EVENT_UP);
  1957.     }
  1958.     SetKeyHandler(ValidatePassword,KEY_POUND,KEY_EVENT_UP);
  1959.        
  1960.     /* Disable LSK if the input password length isn't enough */
  1961.     gSecuritySetupContext.PasswdLenCheckCallBack = ValidatePassword;
  1962.     if (pfnUnicodeStrlen((S8*) gInputPwdBuffer) < MMI_MIN_PASSWORD_LENGTH)
  1963.     {
  1964.         ChangeLeftSoftkey(0, 0);
  1965.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1966.     }
  1967. }
  1968. /*****************************************************************************
  1969.  * FUNCTION
  1970.  *  ShowSubLCDEnterPhoneLock
  1971.  * DESCRIPTION
  1972.  *  Entry screen of sublcd for entring phone lock
  1973.  * PARAMETERS
  1974.  *  void
  1975.  * RETURNS
  1976.  *  void
  1977.  *****************************************************************************/
  1978. void ShowSubLCDEnterPhoneLock(void)
  1979. {
  1980.     /*----------------------------------------------------------------*/
  1981.     /* Local Variables                                                */
  1982.     /*----------------------------------------------------------------*/
  1983.     /*----------------------------------------------------------------*/
  1984.     /* Code Body                                                      */
  1985.     /*----------------------------------------------------------------*/
  1986.     ExecSubLCDCurrExitHandler();
  1987. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1988.     if (IsClamClose())
  1989.     {
  1990.         ShowSubLCDAnalogClockScreen();
  1991.     }
  1992.     else
  1993.     {
  1994.         ShowSubLCDLogoString();
  1995.     }
  1996. #else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1997.     ShowCategory301Screen((PU8) GetString(STR_SUBLCD_ENTER_PHONELOCK_MSG), 0, NULL);
  1998. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1999.     SetSubLCDExitHandler(ExitSubLCDEnterPhoneLock);
  2000. }
  2001. /*****************************************************************************
  2002.  * FUNCTION
  2003.  *  ExitSubLCDEnterPhoneLock
  2004.  * DESCRIPTION
  2005.  *  Exit screen of sublcd for entring phone lock
  2006.  * PARAMETERS
  2007.  *  void
  2008.  * RETURNS
  2009.  *  void
  2010.  *****************************************************************************/
  2011. void ExitSubLCDEnterPhoneLock(void)
  2012. {
  2013.     /*----------------------------------------------------------------*/
  2014.     /* Local Variables                                                */
  2015.     /*----------------------------------------------------------------*/
  2016.     SubLCDHistoryNode SubLCDHistory;
  2017.     /*----------------------------------------------------------------*/
  2018.     /* Code Body                                                      */
  2019.     /*----------------------------------------------------------------*/
  2020.     SubLCDHistory.entryFuncPtr = ShowSubLCDEnterPhoneLock;
  2021.     AddSubLCDHistory(&SubLCDHistory);
  2022. }
  2023. /**************************************************************************
  2024.    Enter PUK APIs:
  2025.       void EntryScrEnterPUK(void)
  2026.       void ShowSubLCDEnterPUK(void)
  2027.       void ExitSubLCDEnterPUK(void)
  2028.       void EntryScrEnterNewPINFirstTime(void)
  2029.       void EntryScrEnterNewPINSecondTime(void)
  2030.       void ValidatePUK(void)
  2031.       void ValidateFirstAndSecondPin(void)
  2032.       void EntryScrPinDoNotMatch(void)
  2033. **************************************************************************/
  2034. /*****************************************************************************
  2035.  * FUNCTION
  2036.  *  EntryScrEnterPUK
  2037.  * DESCRIPTION
  2038.  *  Function inputs PUK from the user
  2039.  * PARAMETERS
  2040.  *  void
  2041.  * RETURNS
  2042.  *  void
  2043.  *****************************************************************************/
  2044. void EntryScrEnterPUK(void)
  2045. {
  2046.     /*----------------------------------------------------------------*/
  2047.     /* Local Variables                                                */
  2048.     /*----------------------------------------------------------------*/
  2049.     U8 PassCountdownDisp[MAX_PASS_COUNTDOWN_DISP];
  2050.     /*----------------------------------------------------------------*/
  2051.     /* Code Body                                                      */
  2052.     /*----------------------------------------------------------------*/
  2053.     EntryNewScreen(SCR_ENTER_PUK, NULL, EntryScrEnterPUK, NULL);
  2054.     DinitHistory();
  2055.     g_pwr_context.PrevScreenIndicator = ENTER_PUK_SCR;
  2056.     //if(!g_pwr_context.idleScreenFirst) 
  2057.     //   g_pwr_context.PowerOnPeriod = 0;
  2058.     g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_SECURITY_SIM_LOCK;    /* 0x12: SIM lock */
  2059.     /* If user is entring this screen after SOS call then memset the buffer */
  2060.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave)
  2061.     {
  2062.         memset((S8*) gInputPwdBuffer, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2063.     }
  2064.     /* Callback to check input password length */
  2065.     RegisterInputBoxValidationFunction(ScrSettingPukValidation);
  2066.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  2067.     FillCountDownString(MMI_SETTING_TYPE_UBCHV1, PassCountdownDisp);
  2068.     sprintf(g_idle_context.DialPadCallBuffer, ""); /* reset dial pad for input * to start ssc */
  2069.     ShowCategory111Screen(
  2070.         STR_GLOBAL_OK,
  2071.         IMG_GLOBAL_OK,
  2072.         STR_RSK_SOS,
  2073.         0,
  2074.         STR_ENTER_PUK_MSG,
  2075.         INPUT_TYPE_NUMERIC_PASSWORD,
  2076.         (U8*) gInputPwdBuffer,
  2077.         MAX_PWD_LENGTH_MMI,
  2078.         PassCountdownDisp,
  2079.         NULL);
  2080.     ShowSubLCDScreen(ShowSubLCDEnterPUK);
  2081.     DinitSubLCDHistory();
  2082.     SetLeftSoftkeyFunction(EntryScrEnterNewPINFirstTime, KEY_EVENT_UP);
  2083.     SetKeyHandler(EntryScrEnterNewPINFirstTime, KEY_POUND, KEY_EVENT_UP);
  2084.     SetKeyHandler(SSCHandleEnterPUK, KEY_STAR, KEY_EVENT_DOWN); /* Allow enter SSC in PUK screen */
  2085.     if (mmi_bootup_get_active_flight_mode() == 1)
  2086.     {
  2087.         SetCategory111RightSoftkeyFunction(mmi_flight_mode_popup_in_dialing_sos, KEY_EVENT_UP);
  2088.     }
  2089.     else
  2090.     {
  2091.         SetCategory111RightSoftkeyFunction(ShowMakeSOSCallScr, KEY_EVENT_UP);
  2092.         SetKeyHandler(GoToSOSDialScr, KEY_SEND, KEY_EVENT_UP);
  2093.     }
  2094.     /* Disable LSK if the input password length isn't enough */
  2095.     gSecuritySetupContext.PasswdLenCheckCallBack = EntryScrEnterNewPINFirstTime;
  2096.     if (pfnUnicodeStrlen((S8*) gInputPwdBuffer) < MMI_MIN_PUK_LENGTH)
  2097.     {
  2098.         ChangeLeftSoftkey(0, 0);
  2099.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  2100.     }
  2101. }
  2102. /*****************************************************************************
  2103.  * FUNCTION
  2104.  *  ShowSubLCDEnterPUK
  2105.  * DESCRIPTION
  2106.  *  Entry function for sublcd screen enter PUK
  2107.  * PARAMETERS
  2108.  *  void
  2109.  * RETURNS
  2110.  *  void
  2111.  *****************************************************************************/
  2112. void ShowSubLCDEnterPUK(void)
  2113. {
  2114.     /*----------------------------------------------------------------*/
  2115.     /* Local Variables                                                */
  2116.     /*----------------------------------------------------------------*/
  2117.     /*----------------------------------------------------------------*/
  2118.     /* Code Body                                                      */
  2119.     /*----------------------------------------------------------------*/
  2120.     ExecSubLCDCurrExitHandler();
  2121. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  2122.     if (IsClamClose())
  2123.     {
  2124.         ShowSubLCDAnalogClockScreen();
  2125.     }
  2126.     else
  2127.     {
  2128.         ShowSubLCDLogoString();
  2129.     }
  2130. #else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  2131.     ShowCategory301Screen((PU8) GetString(STR_SUBLCD_ENTER_PUK_MSG), 0, NULL);
  2132. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  2133.     SetSubLCDExitHandler(ExitSubLCDEnterPUK);
  2134. }
  2135. /*****************************************************************************
  2136.  * FUNCTION
  2137.  *  ExitSubLCDEnterPUK
  2138.  * DESCRIPTION
  2139.  *  Exit function for sublcd screen enter PUK
  2140.  * PARAMETERS
  2141.  *  void
  2142.  * RETURNS
  2143.  *  void
  2144.  *****************************************************************************/
  2145. void ExitSubLCDEnterPUK(void)
  2146. {
  2147.     /*----------------------------------------------------------------*/
  2148.     /* Local Variables                                                */
  2149.     /*----------------------------------------------------------------*/
  2150.     SubLCDHistoryNode SubLCDHistory;
  2151.     /*----------------------------------------------------------------*/
  2152.     /* Code Body                                                      */
  2153.     /*----------------------------------------------------------------*/
  2154.     SubLCDHistory.entryFuncPtr = ShowSubLCDEnterPUK;
  2155.     AddSubLCDHistory(&SubLCDHistory);
  2156. }
  2157. /*****************************************************************************
  2158.  * FUNCTION
  2159.  *  EntryScrEnterNewPINFirstTime
  2160.  * DESCRIPTION
  2161.  *  Function inputs new PIN first time from the user
  2162.  * PARAMETERS
  2163.  *  void
  2164.  * RETURNS
  2165.  *  void
  2166.  *****************************************************************************/
  2167. void EntryScrEnterNewPINFirstTime(void)
  2168. {
  2169.     /*----------------------------------------------------------------*/
  2170.     /* Local Variables                                                */
  2171.     /*----------------------------------------------------------------*/
  2172.     /*----------------------------------------------------------------*/
  2173.     /* Code Body                                                      */
  2174.     /*----------------------------------------------------------------*/
  2175.     //if(!g_pwr_context.idleScreenFirst) 
  2176.     //   g_pwr_context.PowerOnPeriod = 0;
  2177.     g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_SECURITY_SIM_LOCK;    /* 0x12: SIM lock */
  2178.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave)
  2179.     {
  2180.         memset((S8*) gInputNewPinBufferFirstTime, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2181.     }
  2182.     /* else if(pfnUnicodeStrlen((S8*)gInputPwdBuffer) < MMI_MIN_PUK_LENGTH)
  2183.        {
  2184.        if(pfnUnicodeStrlen((S8*)gInputPwdBuffer) <=0)
  2185.        {
  2186.        return;
  2187.        }
  2188.        else
  2189.        {
  2190.        memset((S8*)gInputPwdBuffer,0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2191.        EntryScrInvalidPINPUKPLOCKLength();
  2192.        return;
  2193.        }
  2194.        } */
  2195.     EntryNewScreen(SCR_ENTER_NEW_PIN, NULL, EntryScrEnterNewPINFirstTime, NULL);
  2196.     g_pwr_context.PrevScreenIndicator = ENTER_NEW_PIN;
  2197.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  2198.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  2199.     ShowCategory111Screen(
  2200.         STR_GLOBAL_OK,
  2201.         IMG_GLOBAL_OK,
  2202.         STR_GLOBAL_BACK,
  2203.         IMG_GLOBAL_BACK,
  2204.         STR_ENTER_NEW_PIN_MSG,
  2205.         INPUT_TYPE_NUMERIC_PASSWORD,
  2206.         (U8*) gInputNewPinBufferFirstTime,
  2207.         MAX_PWD_LENGTH_MMI,
  2208.         NULL,
  2209.         NULL);
  2210.     SetLeftSoftkeyFunction(EntryScrEnterNewPINSecondTime, KEY_EVENT_UP);
  2211.     if (mmi_bootup_get_active_flight_mode() == 0)
  2212.     {
  2213.         SetKeyHandler(GoToSOSDialScr,KEY_SEND,KEY_EVENT_UP);
  2214.     }
  2215.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2216.     SetKeyHandler(EntryScrEnterNewPINSecondTime,KEY_POUND,KEY_EVENT_UP);
  2217.        
  2218.     gSecuritySetupContext.PasswdLenCheckCallBack = EntryScrEnterNewPINSecondTime;
  2219.     if (pfnUnicodeStrlen((S8*) gInputNewPinBufferFirstTime) < MMI_MIN_PASSWORD_LENGTH)
  2220.     {
  2221.         ChangeLeftSoftkey(0, 0);
  2222.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  2223.     }
  2224. }
  2225. /*****************************************************************************
  2226.  * FUNCTION
  2227.  *  EntryScrEnterNewPINSecondTime
  2228.  * DESCRIPTION
  2229.  *  Function confirms new PIN from user
  2230.  * PARAMETERS
  2231.  *  void
  2232.  * RETURNS
  2233.  *  void
  2234.  *****************************************************************************/
  2235. void EntryScrEnterNewPINSecondTime(void)
  2236. {
  2237.     /*----------------------------------------------------------------*/
  2238.     /* Local Variables                                                */
  2239.     /*----------------------------------------------------------------*/
  2240.     /*----------------------------------------------------------------*/
  2241.     /* Code Body                                                      */
  2242.     /*----------------------------------------------------------------*/
  2243.     g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_SECURITY_SIM_LOCK;    /* 0x12: SIM lock */
  2244.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave)
  2245.     {
  2246.         memset((S8*) gInputNewPinBufferSecondTime, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2247.     }
  2248.     /* else if(pfnUnicodeStrlen((S8*)gInputNewPinBufferFirstTime) < MMI_MIN_PASSWORD_LENGTH) 
  2249.        {
  2250.        if(pfnUnicodeStrlen((S8*)gInputNewPinBufferFirstTime) <=0)
  2251.        {
  2252.        return;
  2253.        }
  2254.        else
  2255.        {
  2256.        memset((S8*)gInputNewPinBufferFirstTime,0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2257.        EntryScrInvalidPINPUKPLOCKLength();
  2258.        return;
  2259.        }
  2260.        } */
  2261.     EntryNewScreen(SCR_ENTER_CONFIRM_PIN, NULL, EntryScrEnterNewPINSecondTime, NULL);
  2262.     g_pwr_context.PrevScreenIndicator = ENTER_CONFIRM_PIN;
  2263.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  2264.     g_pwr_context.SOSCallFlagTOAvoidHistorySave = 0;
  2265.     ShowCategory111Screen(
  2266.         STR_GLOBAL_OK,
  2267.         IMG_GLOBAL_OK,
  2268.         STR_GLOBAL_BACK,
  2269.         IMG_GLOBAL_BACK,
  2270.         STR_ENTER_PIN_AGAIN_MSG,
  2271.         INPUT_TYPE_NUMERIC_PASSWORD,
  2272.         (U8*) gInputNewPinBufferSecondTime,
  2273.         MAX_PWD_LENGTH_MMI,
  2274.         NULL,
  2275.         NULL);
  2276.     SetLeftSoftkeyFunction(ValidateFirstAndSecondPin, KEY_EVENT_UP);
  2277.     if (mmi_bootup_get_active_flight_mode() == 0)
  2278.     {
  2279.         SetKeyHandler(GoToSOSDialScr,KEY_SEND,KEY_EVENT_UP);
  2280.     }
  2281.     SetKeyHandler(ValidateFirstAndSecondPin,KEY_POUND,KEY_EVENT_UP);
  2282.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2283.        
  2284.     gSecuritySetupContext.PasswdLenCheckCallBack = ValidateFirstAndSecondPin;
  2285.     if (pfnUnicodeStrlen((S8*) gInputNewPinBufferSecondTime) < MMI_MIN_PASSWORD_LENGTH)
  2286.     {
  2287.         ChangeLeftSoftkey(0, 0);
  2288.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  2289.     }
  2290. }
  2291. /*****************************************************************************
  2292.  * FUNCTION
  2293.  *  ValidatePUK
  2294.  * DESCRIPTION
  2295.  *  Function to validate PUK
  2296.  * PARAMETERS
  2297.  *  void
  2298.  * RETURNS
  2299.  *  void
  2300.  *****************************************************************************/
  2301. void ValidatePUK(void)
  2302. {
  2303.     /*----------------------------------------------------------------*/
  2304.     /* Local Variables                                                */
  2305.     /*----------------------------------------------------------------*/
  2306.     /* Validate password send message to L4  MSG_ID_MMI_VERIFY_PIN_REQ */
  2307.     MYQUEUE Message;
  2308.     MMISMUVERIFYPINREQ *local_data;
  2309.     /*----------------------------------------------------------------*/
  2310.     /* Code Body                                                      */
  2311.     /*----------------------------------------------------------------*/
  2312.     ClearInputEventHandler(MMI_DEVICE_ALL); /* send message and wait response in the same screen and no input can be accepted */ 
  2313.     PRINT_INFORMATION(("@@@@@ Sending request for verifying pin  @@@@@"));
  2314.     Message.oslSrcId = MOD_MMI;
  2315.     Message.oslDestId = MOD_L4C;
  2316.     Message.oslMsgId = PRT_MMI_SMU_VERIFY_PIN_REQ;
  2317.     local_data = (MMISMUVERIFYPINREQ*) OslConstructDataPtr(sizeof(MMISMUVERIFYPINREQ));
  2318.     local_data->pin_type = MMI_TYPE_UBCHV1;
  2319.     UnicodeToAnsii((S8*) local_data->pin, (S8*) gInputPwdBuffer);
  2320.     UnicodeToAnsii((S8*) local_data->new_pin, (S8*) gInputNewPinBufferFirstTime);
  2321.     Message.oslDataPtr = (oslParaType*) local_data;
  2322.     Message.oslPeerBuffPtr = NULL;
  2323.     OslMsgSendExtQueue(&Message);
  2324. }
  2325. /*****************************************************************************
  2326.  * FUNCTION
  2327.  *  ValidateFirstAndSecondPin
  2328.  * DESCRIPTION
  2329.  *  Function to validate First and Second PIN
  2330.  * PARAMETERS
  2331.  *  void
  2332.  * RETURNS
  2333.  *  void
  2334.  *****************************************************************************/
  2335. void ValidateFirstAndSecondPin(void)
  2336. {
  2337.     /*----------------------------------------------------------------*/
  2338.     /* Local Variables                                                */
  2339.     /*----------------------------------------------------------------*/
  2340.     /*----------------------------------------------------------------*/
  2341.     /* Code Body                                                      */
  2342.     /*----------------------------------------------------------------*/
  2343.     //if(!g_pwr_context.idleScreenFirst) 
  2344.     //   g_pwr_context.PowerOnPeriod = 1;
  2345.     /* if(pfnUnicodeStrlen((S8*)gInputNewPinBufferSecondTime) < MMI_MIN_PASSWORD_LENGTH)
  2346.        {
  2347.        if(pfnUnicodeStrlen((S8*)gInputNewPinBufferSecondTime) <=0)
  2348.        {
  2349.        return;
  2350.        }
  2351.        else
  2352.        {
  2353.        memset((S8*)gInputNewPinBufferSecondTime,0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2354.        EntryScrInvalidPINPUKPLOCKLength();
  2355.        return;
  2356.        }
  2357.        } */
  2358.     if (memcmp
  2359.         ((S8*) gInputNewPinBufferSecondTime, (S8*) gInputNewPinBufferFirstTime,
  2360.          (MAX_PWD_LENGTH_MMI - 1) * ENCODING_LENGTH) == 0)
  2361.     {
  2362.         PRINT_INFORMATION(("Both Pin matches , calling ValidatePUK"));
  2363.         ValidatePUK(); /* Also Store new pin to the Simulator [Manish to be done later] */
  2364.     }
  2365.     else
  2366.     {
  2367.         EntryScrPinDoNotMatch();
  2368.     }
  2369. }
  2370. /*****************************************************************************
  2371.  * FUNCTION
  2372.  *  EntryScrPinDoNotMatch
  2373.  * DESCRIPTION
  2374.  *  Display Message 'PIN inputs do not match'
  2375.  * PARAMETERS
  2376.  *  void
  2377.  * RETURNS
  2378.  *  void
  2379.  *****************************************************************************/
  2380. void EntryScrPinDoNotMatch(void)
  2381. {
  2382.     /*----------------------------------------------------------------*/
  2383.     /* Local Variables                                                */
  2384.     /*----------------------------------------------------------------*/
  2385.     /*----------------------------------------------------------------*/
  2386.     /* Code Body                                                      */
  2387.     /*----------------------------------------------------------------*/
  2388.     memset((S8*) gInputNewPinBufferSecondTime, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2389.     memset((S8*) gInputNewPinBufferFirstTime, 0, MAX_PWD_LENGTH_MMI * ENCODING_LENGTH);
  2390.     DisplayPopup((U8*) GetString(STR_PIN_DONOT_MATCH), IMG_GLOBAL_ERROR, 0, 2000, (U8) ERROR_TONE);
  2391.     DeleteUptoScrID(SCR_ENTER_NEW_PIN);
  2392. }
  2393. /**************************************************************************
  2394.    S.O.S APIs:
  2395.       void GoToSOSDialScr(void)
  2396.       void HandleInsertSIMScrDigitEntry(void)
  2397.       void DialSOSNumber(void)
  2398.       void ExitDialSOSNumber(void)
  2399.       void ShowMakeSOSCallScr(void)
  2400.       void ExitShowMakeSOSCallScr(void)
  2401.       pBOOL IsSOSCall(void)
  2402.       void EntryScrSOSErrorMessage(U16 string_id)
  2403.       void EntryScrEmergencyCallDialing(void)
  2404.       pBOOL IsSOSPossible(void)
  2405.       pBOOL CheckSIMSOSEntries(S8* tempbuffer)
  2406.       pBOOL CheckValidEmergencyNo1(S8 *tempbuffer)
  2407.       void SimECCInfoSave(void *inMsg)
  2408. **************************************************************************/
  2409. /*****************************************************************************
  2410.  * FUNCTION
  2411.  *  GoToSOSDialScr
  2412.  * DESCRIPTION
  2413.  *  Function takes care that from which buffer DialPadBuffer should be filled up
  2414.  * PARAMETERS
  2415.  *  void
  2416.  * RETURNS
  2417.  *  void
  2418.  *****************************************************************************/
  2419. void GoToSOSDialScr(void)
  2420. {
  2421.     /*----------------------------------------------------------------*/
  2422.     /* Local Variables                                                */
  2423.     /*----------------------------------------------------------------*/
  2424.     /*----------------------------------------------------------------*/
  2425.     /* Code Body                                                      */
  2426.     /*----------------------------------------------------------------*/
  2427.     if (g_pwr_context.PrevScreenIndicator == ENTER_NEW_PIN)
  2428.     {
  2429.         pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gInputNewPinBufferFirstTime);
  2430.     }
  2431.     else if (g_pwr_context.PrevScreenIndicator == ENTER_CONFIRM_PIN)
  2432.     {
  2433.         pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gInputNewPinBufferSecondTime);
  2434.     }
  2435.     else
  2436.     {
  2437.         pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gInputPwdBuffer);
  2438.     }
  2439.     if (gSecuritySetupContext.PINBlocked)
  2440.     {
  2441.         pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gSecuritySetupContext.NewPassword);
  2442.     }
  2443.     EntryScrEmergencyCallDialing();
  2444. }
  2445. /*****************************************************************************
  2446.  * FUNCTION
  2447.  *  HandleInsertSIMScrDigitEntry
  2448.  * DESCRIPTION
  2449.  *  Handle digit entry on insert SIM
  2450.  * PARAMETERS
  2451.  *  void
  2452.  * RETURNS
  2453.  *  void
  2454.  *****************************************************************************/
  2455. void HandleInsertSIMScrDigitEntry(void)
  2456. {
  2457.     /*----------------------------------------------------------------*/
  2458.     /* Local Variables                                                */
  2459.     /*----------------------------------------------------------------*/
  2460.     U16 Keycode, Keytype;
  2461.     /*----------------------------------------------------------------*/
  2462.     /* Code Body                                                      */
  2463.     /*----------------------------------------------------------------*/
  2464.     GetkeyInfo(&Keycode, &Keytype);
  2465.     sprintf(g_idle_context.DialPadCallBuffer, "");
  2466.     g_idle_context.IdleScreenDigitKeyCode = Keycode;
  2467.     DialSOSNumber();
  2468. }
  2469. /*****************************************************************************
  2470.  * FUNCTION
  2471.  *  DialSOSNumber
  2472.  * DESCRIPTION
  2473.  *  Function to make SOS calls
  2474.  * PARAMETERS
  2475.  *  void
  2476.  * RETURNS
  2477.  *  void
  2478.  *****************************************************************************/
  2479. void DialSOSNumber(void)
  2480. {
  2481.     /*----------------------------------------------------------------*/
  2482.     /* Local Variables                                                */
  2483.     /*----------------------------------------------------------------*/
  2484.     U8 *guiBuffer;  /* Buffer holding history data */
  2485.     /*----------------------------------------------------------------*/
  2486.     /* Code Body                                                      */
  2487.     /*----------------------------------------------------------------*/
  2488.     g_idle_context.IsOnSimErrorDialerScreen = 1;
  2489.     EntryNewScreen(SCR_DIAL_SOS_NUM, ExitDialSOSNumber, NULL, NULL);
  2490.     guiBuffer = GetCurrGuiBuffer(SCR_SIM_INSERTION);
  2491.     ShowCategory16Screen(
  2492.         STR_GLOBAL_SAVE,
  2493.         0,
  2494.         STR_GLOBAL_BACK,
  2495.         0,
  2496.         (U8*) g_idle_context.DialPadCallBuffer,
  2497.         MAX_DIAL_PAD,
  2498.         guiBuffer);
  2499.     if (g_idle_context.IdleScreenDigitKeyCode >= 0)
  2500.     {
  2501.         ExecuteCurrKeyHandler(g_idle_context.IdleScreenDigitKeyCode, KEY_EVENT_DOWN);
  2502.     }
  2503.     /* 090605 Dialing Calvin Start */
  2504. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  2505. #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
  2506.     SetDialingKeypadCallHandler(EntryScrEmergencyCallDialing);
  2507. #else 
  2508.     SetCenterSoftkeyFunction(EntryScrEmergencyCallDialing, KEY_EVENT_UP);
  2509. #endif 
  2510. #endif /* ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) ) */ 
  2511.     /* 090605 Dialing Calvin Start */
  2512. #ifdef __FLIGHT_MODE_SUPPORT__
  2513.     if (mmi_bootup_get_active_flight_mode() == 0)   /* 2005/11/01 Cannot allow to dial in flight mode insert SIM screen */
  2514. #endif 
  2515.         SetKeyHandler(EntryScrEmergencyCallDialing, KEY_SEND, KEY_EVENT_UP);
  2516.     SetCategory16RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2517.     /* diamond, 2005/11/20 Allow to entry phonebook in insert SIM screen */
  2518.     SetLeftSoftkeyFunction(IdleDialPadSavePhoneBook, KEY_EVENT_UP);
  2519.     /* For processing SSC */
  2520.     if ((g_pwr_context.PrevScreenIndicator == ENTER_SIM_INSERTION) ||
  2521.         (g_pwr_context.PrevScreenIndicator == ENTER_SIM_BLOCK))
  2522.     {
  2523.         SetKeyHandler(SSCStringParsing1, KEY_POUND, KEY_EVENT_UP);
  2524.     }
  2525. }
  2526. /*****************************************************************************
  2527.  * FUNCTION
  2528.  *  ExitDialSOSNumber
  2529.  * DESCRIPTION
  2530.  *  Exit Function for dial SOS screen
  2531.  * PARAMETERS
  2532.  *  void
  2533.  * RETURNS
  2534.  *  void
  2535.  *****************************************************************************/
  2536. void ExitDialSOSNumber(void)
  2537. {
  2538.     /*----------------------------------------------------------------*/
  2539.     /* Local Variables                                                */
  2540.     /*----------------------------------------------------------------*/
  2541.     /*----------------------------------------------------------------*/
  2542.     /* Code Body                                                      */
  2543.     /*----------------------------------------------------------------*/
  2544.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave != 1)   /* to avoid history save */
  2545.     {
  2546.         GenericExitScreen(SCR_DIAL_SOS_NUM, DialSOSNumber);
  2547.     }
  2548.     g_idle_context.IdleScreenDigitKeyCode = -1;
  2549.     g_idle_context.IsOnSimErrorDialerScreen = 0;
  2550. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) )
  2551.     ResetCenterSoftkey();
  2552. #endif 
  2553. }
  2554. /*****************************************************************************
  2555.  * FUNCTION
  2556.  *  ShowMakeSOSCallScr
  2557.  * DESCRIPTION
  2558.  *  Function to make SOS calls
  2559.  * PARAMETERS
  2560.  *  void
  2561.  * RETURNS
  2562.  *  void
  2563.  *****************************************************************************/
  2564. void ShowMakeSOSCallScr(void)
  2565. {
  2566.     /*----------------------------------------------------------------*/
  2567.     /* Local Variables                                                */
  2568.     /*----------------------------------------------------------------*/
  2569.     /*----------------------------------------------------------------*/
  2570.     /* Code Body                                                      */
  2571.     /*----------------------------------------------------------------*/
  2572. #if !defined(__MMI_TOUCH_SCREEN__) || ( defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) && !defined(__MMI_SLIDE__))     //KP Jerry add "defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-27
  2573. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-26
  2574.     if (GetActiveScreenId() == SCR_SIM_INSERTION || GetActiveScreenId() == SCR_SIM_BLOCK)
  2575.     {
  2576.         g_idle_context.RskPressedFromIdleApp = 1;   /* diamond, 2005/10/29, keypad lock in insert sim screen */
  2577.     }
  2578. #endif /* __MMI_KEYPAD_LOCK_PATTERN_1__ || __MMI_KEYPAD_LOCK_PATTERN_3__ || __MMI_KEYPAD_LOCK_PATTERN_4__ */      //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  2579. #endif /* (!__MMI_TOUCH_SCREEN__) || (__MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) */      //KP Jerry add "__MMI_TOUCH_SCREEN__ && __MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-27
  2580.     EntryNewScreen(SCR_MAKE_SOS_CALL, ExitShowMakeSOSCallScr, NULL, NULL);
  2581. #ifdef __MMI_TOUCH_SCREEN__
  2582.     if (g_keylock_context.gKeyPadLockFlag)
  2583.     {
  2584.         mmi_pen_unblock();
  2585.     }
  2586. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2587.     AnsiiToUnicodeString(g_idle_context.DialPadCallBuffer, "112");
  2588.     ShowCategory165Screen(
  2589.         STR_GLOBAL_YES,
  2590.         IMG_GLOBAL_YES,
  2591.         STR_GLOBAL_NO,
  2592.         IMG_GLOBAL_NO,
  2593.         get_string(STR_DIAL_EMERGENCY_NUMBER),
  2594.         IMG_GLOBAL_QUESTION,
  2595.         NULL);
  2596.     SetLeftSoftkeyFunction(EntryScrEmergencyCallDialing, KEY_EVENT_UP);
  2597.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2598.     /* changed end key press from up to down to clear END key mapping to DisplayIdleScreen which is done at time of    ExecuteCurrExitHandler(). --vanita */
  2599.     SetKeyHandler(GoBackHistory, KEY_END, KEY_EVENT_DOWN);
  2600.     playRequestedTone(WARNING_TONE);
  2601.     /* diamond, 2005/10/29, keypad lock in insert sim screen */
  2602. #if !defined(__MMI_TOUCH_SCREEN__) || ( defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) && !defined(__MMI_SLIDE__))     //KP Jerry add "defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-27
  2603. #if (defined(__MMI_KEYPAD_LOCK_PATTERN_1__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
  2604.     /* if(g_idle_context.ToNameScrFromIdleApp==1) */
  2605.     if (g_idle_context.RskPressedFromIdleApp == 1)
  2606.     {
  2607.         StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
  2608.         SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_POUND, KEY_EVENT_UP);
  2609.     }
  2610. #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_1__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */ 
  2611. //KP Jerry add on 2007-3-26 start
  2612. #if (defined(__MMI_KEYPAD_LOCK_PATTERN_3__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
  2613.     /* if(g_idle_context.ToNameScrFromIdleApp==1) */
  2614.     if (g_idle_context.RskPressedFromIdleApp == 1)
  2615.     {
  2616.         StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
  2617.         SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_STAR, KEY_EVENT_UP);
  2618.     }
  2619. #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_3__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */ 
  2620. //KP Jerry add on 2007-3-26 end
  2621. //KP Jerry add on 2007-4-23 start
  2622. #if (defined(__MMI_KEYPAD_LOCK_PATTERN_4__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
  2623.     /* if(g_idle_context.ToNameScrFromIdleApp==1) */
  2624.     if (g_idle_context.RskPressedFromIdleApp == 1)
  2625.     {
  2626.         StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
  2627.         SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_CAMERA, KEY_EVENT_UP);
  2628.     }
  2629. #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_4__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */ 
  2630. //KP Jerry add on 2007-4-23 end
  2631. #endif /* (!__MMI_TOUCH_SCREEN__) || (__MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) */      //KP Jerry add "__MMI_TOUCH_SCREEN__ && __MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-27
  2632. }
  2633. /*****************************************************************************
  2634.  * FUNCTION
  2635.  *  ExitShowMakeSOSCallScr
  2636.  * DESCRIPTION
  2637.  *  Exit Function for make SOS call screen
  2638.  * PARAMETERS
  2639.  *  void
  2640.  * RETURNS
  2641.  *  void
  2642.  *****************************************************************************/
  2643. void ExitShowMakeSOSCallScr(void)
  2644. {
  2645.     /*----------------------------------------------------------------*/
  2646.     /* Local Variables                                                */
  2647.     /*----------------------------------------------------------------*/
  2648.     /*----------------------------------------------------------------*/
  2649.     /* Code Body                                                      */
  2650.     /*----------------------------------------------------------------*/
  2651.     if (g_pwr_context.SOSCallFlagTOAvoidHistorySave != 1)
  2652.     {
  2653.         /* GenericExitScreen(SCR_MAKE_SOS_CALL, ShowMakeSOSCallScr); */
  2654.     }
  2655.     stopRequestedTone(WARNING_TONE);
  2656. }
  2657. /*****************************************************************************
  2658.  * FUNCTION
  2659.  *  IsSOSCall
  2660.  * DESCRIPTION
  2661.  *  Function for CM to notify is SOS
  2662.  * PARAMETERS
  2663.  *  void
  2664.  * RETURNS
  2665.  *  void
  2666.  *****************************************************************************/
  2667. pBOOL IsSOSCall(void)
  2668. {
  2669.     /*----------------------------------------------------------------*/
  2670.     /* Local Variables                                                */
  2671.     /*----------------------------------------------------------------*/
  2672.     /*----------------------------------------------------------------*/
  2673.     /* Code Body                                                      */
  2674.     /*----------------------------------------------------------------*/
  2675.     return g_pwr_context.ForCMToIdentifySOSCall;
  2676. }
  2677. /*****************************************************************************
  2678.  * FUNCTION
  2679.  *  EntryScrSOSErrorMessage
  2680.  * DESCRIPTION
  2681.  *  Popup error message for SOS screen
  2682.  * PARAMETERS
  2683.  *  string_id       [IN]        
  2684.  * RETURNS
  2685.  *  void
  2686.  *****************************************************************************/
  2687. void EntryScrSOSErrorMessage(U16 string_id)
  2688. {
  2689.     /*----------------------------------------------------------------*/
  2690.     /* Local Variables                                                */
  2691.     /*----------------------------------------------------------------*/
  2692.     historyNode *History;
  2693.     /*----------------------------------------------------------------*/
  2694.     /* Code Body                                                      */
  2695.     /*----------------------------------------------------------------*/
  2696.     DisplayPopup((U8*) GetString(string_id), IMG_GLOBAL_ERROR, 0, 2000, (U8) ERROR_TONE);
  2697.     if (IsScreenPresent(SCR_ID_SECSET_PUK1))
  2698.     {
  2699.         if (GetHistoryScrID(SCR_ID_SECSET_PUK1, &History) == ST_SUCCESS)
  2700.         {
  2701.             if (History->inputBuffer != NULL)
  2702.             {
  2703.                 memset(History->inputBuffer, 0, ENCODING_LENGTH);
  2704.             }
  2705.             if (History->guiBuffer != NULL)
  2706.             {
  2707.                 memset(History->guiBuffer, 0, 2);
  2708.             }
  2709.         }
  2710.         DeleteUptoScrID(SCR_ID_SECSET_PUK1);
  2711.     }
  2712. }
  2713. /*****************************************************************************
  2714.  * FUNCTION
  2715.  *  EntryScrEmergencyCallDialing
  2716.  * DESCRIPTION
  2717.  *  Show the message Emergency Call Dialing
  2718.  * PARAMETERS
  2719.  *  void
  2720.  * RETURNS
  2721.  *  void