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

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.  *  IdleApp.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  This file is for The Idle screen application
  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.  * removed!
  235.  *
  236.  * removed!
  237.  * removed!
  238.  * removed!
  239.  *
  240.  * removed!
  241.  * removed!
  242.  * removed!
  243.  *
  244.  * removed!
  245.  *
  246.  * removed!
  247.  * removed!
  248.  * removed!
  249.  *
  250.  * removed!
  251.  * removed!
  252.  * removed!
  253.  *
  254.  * removed!
  255.  * removed!
  256.  * removed!
  257.  *
  258.  * removed!
  259.  * removed!
  260.  * removed!
  261.  *
  262.  * removed!
  263.  * removed!
  264.  * removed!
  265.  *
  266.  * removed!
  267.  * removed!
  268.  * removed!
  269.  *
  270.  * removed!
  271.  * removed!
  272.  * removed!
  273.  *
  274.  * removed!
  275.  * removed!
  276.  * removed!
  277.  *
  278.  * removed!
  279.  * removed!
  280.  * removed!
  281.  *
  282.  * removed!
  283.  * removed!
  284.  * removed!
  285.  *
  286.  * removed!
  287.  * removed!
  288.  * removed!
  289.  *
  290.  * removed!
  291.  * removed!
  292.  * removed!
  293.  *
  294.  * removed!
  295.  * removed!
  296.  * removed!
  297.  *
  298.  * removed!
  299.  * removed!
  300.  * removed!
  301.  *
  302.  * removed!
  303.  * removed!
  304.  * removed!
  305.  *
  306.  * removed!
  307.  * removed!
  308.  * removed!
  309.  *
  310.  * removed!
  311.  * removed!
  312.  * removed!
  313.  *
  314.  * removed!
  315.  * removed!
  316.  * removed!
  317.  *
  318.  * removed!
  319.  * removed!
  320.  * removed!
  321.  *
  322.  * removed!
  323.  * removed!
  324.  * removed!
  325.  *
  326.  * removed!
  327.  * removed!
  328.  * removed!
  329.  *
  330.  * removed!
  331.  * removed!
  332.  * removed!
  333.  *
  334.  * removed!
  335.  * removed!
  336.  * removed!
  337.  *
  338.  * removed!
  339.  * removed!
  340.  * removed!
  341.  *
  342.  * removed!
  343.  * removed!
  344.  * removed!
  345.  *
  346.  * removed!
  347.  * removed!
  348.  * removed!
  349.  *
  350.  * removed!
  351.  * removed!
  352.  * removed!
  353.  *
  354.  * removed!
  355.  * removed!
  356.  * removed!
  357.  *
  358.  * removed!
  359.  * removed!
  360.  * removed!
  361.  *
  362.  * removed!
  363.  * removed!
  364.  * removed!
  365.  *
  366.  * removed!
  367.  * removed!
  368.  * removed!
  369.  *
  370.  * removed!
  371.  * removed!
  372.  * removed!
  373.  *
  374.  * removed!
  375.  * removed!
  376.  * removed!
  377.  *
  378.  * removed!
  379.  * removed!
  380.  * removed!
  381.  *
  382.  * removed!
  383.  * removed!
  384.  * removed!
  385.  *
  386.  * removed!
  387.  * removed!
  388.  * removed!
  389.  *
  390.  * removed!
  391.  * removed!
  392.  * removed!
  393.  *
  394.  * removed!
  395.  * removed!
  396.  * removed!
  397.  *
  398.  * removed!
  399.  * removed!
  400.  * removed!
  401.  *
  402.  * removed!
  403.  * removed!
  404.  * removed!
  405.  *
  406.  * removed!
  407.  * removed!
  408.  * removed!
  409.  *
  410.  * removed!
  411.  * removed!
  412.  * removed!
  413.  *
  414.  * removed!
  415.  * removed!
  416.  * removed!
  417.  *
  418.  * removed!
  419.  * removed!
  420.  * removed!
  421.  *
  422.  * removed!
  423.  * removed!
  424.  * removed!
  425.  *
  426.  * removed!
  427.  * removed!
  428.  * removed!
  429.  *
  430.  * removed!
  431.  * removed!
  432.  * removed!
  433.  *
  434.  * removed!
  435.  * removed!
  436.  * removed!
  437.  *
  438.  * removed!
  439.  * removed!
  440.  * removed!
  441.  *
  442.  * removed!
  443.  * removed!
  444.  * removed!
  445.  *
  446.  * removed!
  447.  * removed!
  448.  * removed!
  449.  *
  450.  * removed!
  451.  * removed!
  452.  * removed!
  453.  *
  454.  * removed!
  455.  * removed!
  456.  * removed!
  457.  *
  458.  * removed!
  459.  * removed!
  460.  * removed!
  461.  *
  462.  * removed!
  463.  * removed!
  464.  * removed!
  465.  *
  466.  * removed!
  467.  * removed!
  468.  * removed!
  469.  *
  470.  * removed!
  471.  * removed!
  472.  * removed!
  473.  *
  474.  * removed!
  475.  * removed!
  476.  * removed!
  477.  *
  478.  * removed!
  479.  * removed!
  480.  * removed!
  481.  *
  482.  * removed!
  483.  * removed!
  484.  * removed!
  485.  *
  486.  * removed!
  487.  * removed!
  488.  * removed!
  489.  *
  490.  * removed!
  491.  * removed!
  492.  * removed!
  493.  *
  494.  * removed!
  495.  * removed!
  496.  * removed!
  497.  *
  498.  * removed!
  499.  * removed!
  500.  * removed!
  501.  *
  502.  * removed!
  503.  * removed!
  504.  * removed!
  505.  *
  506.  * removed!
  507.  * removed!
  508.  * removed!
  509.  *
  510.  * removed!
  511.  * removed!
  512.  * removed!
  513.  *
  514.  * removed!
  515.  * removed!
  516.  * removed!
  517.  *
  518.  * removed!
  519.  * removed!
  520.  * removed!
  521.  *
  522.  * removed!
  523.  * removed!
  524.  * removed!
  525.  *
  526.  * removed!
  527.  * removed!
  528.  * removed!
  529.  *
  530.  * removed!
  531.  * removed!
  532.  * removed!
  533.  *
  534.  * removed!
  535.  * removed!
  536.  * removed!
  537.  *
  538.  * removed!
  539.  * removed!
  540.  * removed!
  541.  *
  542.  * removed!
  543.  * removed!
  544.  * removed!
  545.  *
  546.  * removed!
  547.  * removed!
  548.  * removed!
  549.  *
  550.  * removed!
  551.  * removed!
  552.  * removed!
  553.  *
  554.  * removed!
  555.  * removed!
  556.  * removed!
  557.  *
  558.  * removed!
  559.  * removed!
  560.  * removed!
  561.  *
  562.  * removed!
  563.  * removed!
  564.  * removed!
  565.  *
  566.  * removed!
  567.  * removed!
  568.  * removed!
  569.  *
  570.  * removed!
  571.  * removed!
  572.  * removed!
  573.  *
  574.  * removed!
  575.  * removed!
  576.  * removed!
  577.  *
  578.  * removed!
  579.  * removed!
  580.  * removed!
  581.  *
  582.  * removed!
  583.  * removed!
  584.  * removed!
  585.  *
  586.  * removed!
  587.  * removed!
  588.  * removed!
  589.  *
  590.  * removed!
  591.  * removed!
  592.  * removed!
  593.  *
  594.  * removed!
  595.  * removed!
  596.  * removed!
  597.  *
  598.  * removed!
  599.  * removed!
  600.  * removed!
  601.  *
  602.  * removed!
  603.  * removed!
  604.  * removed!
  605.  *
  606.  * removed!
  607.  * removed!
  608.  * removed!
  609.  *
  610.  * removed!
  611.  * removed!
  612.  * removed!
  613.  *
  614.  * removed!
  615.  * removed!
  616.  * removed!
  617.  *
  618.  * removed!
  619.  * removed!
  620.  * removed!
  621.  *
  622.  * removed!
  623.  * removed!
  624.  * removed!
  625.  *
  626.  * removed!
  627.  * removed!
  628.  * removed!
  629.  *
  630.  * removed!
  631.  * removed!
  632.  * removed!
  633.  *
  634.  * removed!
  635.  * removed!
  636.  * removed!
  637.  *
  638.  * removed!
  639.  * removed!
  640.  * removed!
  641.  *
  642.  * removed!
  643.  * removed!
  644.  * removed!
  645.  *
  646.  * removed!
  647.  * removed!
  648.  * removed!
  649.  *
  650.  * removed!
  651.  * removed!
  652.  * removed!
  653.  *
  654.  * removed!
  655.  * removed!
  656.  * removed!
  657.  *
  658.  * removed!
  659.  * removed!
  660.  * removed!
  661.  *
  662.  * removed!
  663.  * removed!
  664.  * removed!
  665.  *
  666.  * removed!
  667.  * removed!
  668.  * removed!
  669.  *
  670.  * removed!
  671.  * removed!
  672.  * removed!
  673.  *
  674.  * removed!
  675.  * removed!
  676.  * removed!
  677.  *
  678.  * removed!
  679.  * removed!
  680.  * removed!
  681.  *
  682.  * removed!
  683.  * removed!
  684.  * removed!
  685.  *
  686.  * removed!
  687.  * removed!
  688.  * removed!
  689.  *
  690.  * removed!
  691.  * removed!
  692.  * removed!
  693.  *
  694.  * removed!
  695.  * removed!
  696.  * removed!
  697.  *
  698.  * removed!
  699.  * removed!
  700.  * removed!
  701.  *
  702.  * removed!
  703.  * removed!
  704.  * removed!
  705.  *
  706.  * removed!
  707.  * removed!
  708.  * removed!
  709.  *
  710.  * removed!
  711.  * removed!
  712.  * removed!
  713.  *
  714.  * removed!
  715.  * removed!
  716.  * removed!
  717.  *
  718.  * removed!
  719.  * removed!
  720.  * removed!
  721.  *
  722.  * removed!
  723.  * removed!
  724.  * removed!
  725.  *
  726.  * removed!
  727.  * removed!
  728.  * removed!
  729.  *
  730.  * removed!
  731.  * removed!
  732.  * removed!
  733.  *
  734.  * removed!
  735.  * removed!
  736.  * removed!
  737.  *
  738.  * removed!
  739.  * removed!
  740.  * removed!
  741.  *
  742.  * removed!
  743.  * removed!
  744.  * removed!
  745.  *
  746.  * removed!
  747.  * removed!
  748.  * removed!
  749.  *
  750.  * removed!
  751.  * removed!
  752.  * removed!
  753.  *
  754.  * removed!
  755.  * removed!
  756.  * removed!
  757.  *
  758.  * removed!
  759.  * removed!
  760.  * removed!
  761.  *
  762.  * removed!
  763.  * removed!
  764.  * removed!
  765.  *
  766.  * removed!
  767.  * removed!
  768.  * removed!
  769.  *
  770.  * removed!
  771.  * removed!
  772.  * removed!
  773.  *
  774.  * removed!
  775.  * removed!
  776.  * removed!
  777.  *
  778.  * removed!
  779.  * removed!
  780.  * removed!
  781.  *
  782.  * removed!
  783.  * removed!
  784.  * removed!
  785.  *
  786.  * removed!
  787.  * removed!
  788.  * removed!
  789.  *
  790.  * removed!
  791.  * removed!
  792.  * removed!
  793.  *
  794.  * removed!
  795.  * removed!
  796.  * removed!
  797.  *
  798.  * removed!
  799.  * removed!
  800.  * removed!
  801.  *
  802.  * removed!
  803.  * removed!
  804.  * removed!
  805.  *
  806.  * removed!
  807.  * removed!
  808.  * removed!
  809.  *
  810.  * removed!
  811.  * removed!
  812.  * removed!
  813.  *
  814.  * removed!
  815.  * removed!
  816.  * removed!
  817.  *
  818.  * removed!
  819.  * removed!
  820.  * removed!
  821.  *
  822.  * removed!
  823.  * removed!
  824.  * removed!
  825.  *
  826.  * removed!
  827.  * removed!
  828.  * removed!
  829.  *
  830.  * removed!
  831.  * removed!
  832.  * removed!
  833.  *
  834.  * removed!
  835.  * removed!
  836.  * removed!
  837.  *
  838.  * removed!
  839.  * removed!
  840.  * removed!
  841.  *
  842.  * removed!
  843.  * removed!
  844.  * removed!
  845.  *
  846.  * removed!
  847.  * removed!
  848.  * removed!
  849.  *
  850.  * removed!
  851.  * removed!
  852.  * removed!
  853.  *
  854.  * removed!
  855.  * removed!
  856.  * removed!
  857.  *
  858.  * removed!
  859.  * removed!
  860.  * removed!
  861.  *
  862.  * removed!
  863.  * removed!
  864.  * removed!
  865.  *
  866.  *------------------------------------------------------------------------------
  867.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  868.  *============================================================================
  869.  ****************************************************************************/
  870. /****************************************************************************
  871. * Include Files                                                                
  872. *****************************************************************************/
  873. #include "stdC.h"
  874. #include "MMI_Features.h"
  875. #include "L4Dr.h"
  876. #include "L4Dr1.h"
  877. #include "MiscFunctions.h"
  878. #include "KeyBrd.h"
  879. #include "DebugInitDef.h"
  880. #include "gdi_include.h"
  881. #include "CustDataRes.h"
  882. #include "CustMenuRes.h"
  883. #include "gui_themes.h"
  884. #include "GlobalConstants.h"
  885. #include "HistoryGprot.h"
  886. #include "DateTimeGprot.h"
  887. #include "CommonScreens.h"      /* DisplayPopup */
  888. #include "wgui_categories.h"
  889. #include "wgui_categories_CM.h"
  890. #include "wgui_categories_multimedia.h"
  891. #include "wgui_categories_idlescreen.h"
  892. #include "wgui_status_icons.h"
  893. #include "wgui_softkeys.h"
  894. #include "UCS2prot.h"
  895. #include "worldclock.h"
  896. #include "IdleAppDef.h"
  897. #include "IdleAppProt.h"
  898. #include "Globaldefs.h"
  899. #include "CallHistoryGProts.h"
  900. #include "SettingProfile.h"
  901. #include "ProfileGprots.h"
  902. #include "SimDetectionGexdcl.h"
  903. #include "SimDetectionGprot.h"
  904. #include "FontRes.h"
  905. #include "KeyBrd.h"
  906. #include "CallManagementGprot.h"
  907. #include "CallHistoryMain.h"    /* CHISTResetCallLogIndex */
  908. #include "SSCStringHandle.h"
  909. #include "SettingGprots.h"
  910. #include "audioinc.h"
  911. #include "gpioInc.h"
  912. #include "SettingProfile.h"
  913. #include "Unicodexdcl.h"
  914. #include "SpeedDial.h"
  915. #include "MessagesResourceData.h"
  916. #include "SubLCDHistoryGprot.h"
  917. #include "WPSSProtos.h"
  918. #include "PowerOnChargerProt.h"
  919. #include "FunAndGamesDefs.h"
  920. #include "NVRAMType.h"
  921. #include "NVRAMProt.h"
  922. #include "NVRAMEnum.h"
  923. #include "DownloadDefs.h"
  924. #include "QuickAccessMenuItemProt.h"
  925. #include "AlarmFrameworkProt.h"
  926. #include "ProfilesGexdcl.h"
  927. #include "PhoneBookDef.h"
  928. #include "PhoneBookTypes.h"
  929. #include "PhoneBookProt.h"
  930. #include "PhoneBookGprot.h"
  931. #include "mdi_datatype.h"
  932. #include "mdi_audio.h"
  933. #include "PhoneSetupGprots.h"
  934. #include "OrganizerGprot.h"     /* OrgDeInit */
  935. #include "SettingDefs.h"        /* ST_NOTIFYDURATION define */
  936. #include "SettingProfile.h"     /* SUCCESS_TONE define */
  937. #include "GlobalScrEnum.h"      /* GLOBAL_SCR_DUMMY */
  938. #include "Fat_fs.h"
  939. #include "FileSystemDef.h"      /* file function */
  940. #include "FileManagerGProt.h"   /* file path / file error */
  941. #include "FileManagerDef.h"     /* error string id */
  942. #include "statusiconres.h"
  943. #include "FlightModeGProt.h"
  944. #include "VolumeHandler.h"
  945. #if defined(__MMI_DATE_TIME_SETTING_REMINDER__)
  946. #include "rtc_sw.h"
  947. #endif 
  948. /* JBRW Sandeep */
  949. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  950. #include "JBrowserMMIGProts.h"
  951. #endif 
  952. /* Manish - adding for JMMS */
  953. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  954. #include "JMMSPushHandling.h"
  955. #include "JMMSMainMMS.h"
  956. #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */ 
  957. /* Dara */
  958. #if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
  959. #include "JProvProts.h"
  960. #endif 
  961. #include "TimerEvents.h"
  962. #include "wgui_status_icons.h"
  963. #include "wgui_ems.h"
  964. #include "ShortcutsProts.h"     /* for 4-dedicated shortcuts 0101 */
  965. #include "SATGProts.h"
  966. #ifdef WAP_SUPPORT
  967. #include "Wapadp.h"
  968. #endif 
  969. #ifdef __MMI_USB_SUPPORT__
  970. #include "USBDeviceGprot.h"
  971. #endif 
  972. #ifdef __J2ME__
  973. #include "javaAgencyGprot.h"
  974. #include "jvm_adaptor.h"
  975. #endif /* __J2ME__ */ 
  976. #ifdef __MMI_SWFLASH__
  977. #include "SWFlashGprot.h"
  978. #endif /* __MMI_SWFLASH__ */ 
  979. #ifdef __MMI_IRDA_SUPPORT__
  980. #include "IrdaMMIGprots.h"
  981. #endif 
  982. #ifdef __MMI_OPP_SUPPORT__
  983. #include "OPPMMIGprots.h"
  984. #endif 
  985. #ifdef __MOD_SMSAL__
  986. #include "MessagesExDcl.h"
  987. #include "SMSApi.h"
  988. #endif /* __MOD_SMSAL__ */ 
  989. #ifdef __MMI_CAMERA__
  990. #include "lcd_if.h"     /* LCD layer enable flag */
  991. #include "gdi_lcd_config.h"
  992. #include "MMI_features_camera.h"
  993. #include "mdi_datatype.h"
  994. #include "mdi_camera.h" /* camera lib */
  995. #include "CameraApp.h"
  996. #endif /* __MMI_CAMERA__ */ 
  997. #ifdef MMI_ON_HARDWARE_P
  998. #include "mmi_trc.h"
  999. #include "custom_util.h"
  1000. #endif /* MMI_ON_HARDWARE_P */ 
  1001. #include "NITZ.h"
  1002. #include "vObjects.h"
  1003. #include "KeyBrd.h"
  1004. #include "OSThreadInterfaceGprot.h"
  1005. #include "EventsGprot.h"
  1006. #include "NetworkSetupDefs.h"   /* Cylen, __MANUAL_MODE_NW_SEL__ */
  1007. #include "NetworkSetupGProt.h"
  1008. #ifdef __MMI_IMPS__
  1009. #include "mmi_imps_gprot.h"
  1010. #endif 
  1011. /* micha_POC */
  1012. #ifdef __MMI_POC__
  1013. #include "PoCGProt.h"
  1014. #endif 
  1015. #ifdef __MMI_VOIP__
  1016. #include "VoIPDef.h"
  1017. #include "VoIPGProt.h"
  1018. #endif /* __MMI_VOIP__ */
  1019. #ifdef __MMI_TOUCH_SCREEN__
  1020. #include "TouchScreenGProt.h"
  1021. #include "wgui_touch_screen.h"
  1022. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1023. #ifdef __MMI_UNIFIED_MESSAGE__
  1024. #include "UnifiedMessageGProt.h"
  1025. #endif 
  1026. #if defined(__MMI_DOWNLOAD_AGENT__)
  1027. #include "App_mine.h"
  1028. #include "DLAgentDef.h"
  1029. #include "DLAgentGProt.h"
  1030. #endif /* defined(__MMI_DOWNLOAD_AGENT__) */ 
  1031. #ifdef __MMI_SML_MENU__
  1032. #include "PersonalizationProt.h"
  1033. #endif
  1034. #ifdef __SYNCML_SUPPORT__
  1035. #include "SyncMLGProt.h"
  1036. #endif
  1037. #if defined(__FOTA_ENABLE__)
  1038. #include "DeviceManagementGProt.h"
  1039. #endif
  1040. //KP Jerry add on 2007-4-12 start
  1041. #ifdef __MMI_MESSAGES_SENDMSG_QUICKLY__
  1042. #include "SmsGuiInterfaceType.h"
  1043. #endif
  1044. //KP Jerry add on 2007-4-12 end
  1045. //KP Jerry add for third sevice on 2007-03-26 start
  1046. #ifdef __KONG_NET_SP__
  1047. //#include "custom_mmi_default_value_pluto.h"
  1048. #include "NVRAMProt.h"
  1049. #include "GlobalDefs.h"
  1050. #include "NVRAMType.h"
  1051. #include "CustResDef.h"
  1052. #include "SmsGuiInterfaceType.h"
  1053. #include "WrapperGprot.h"
  1054. #include "DateTimeType.h"
  1055. #include "Wap.h"
  1056. #include "wap_ps_struct.h"
  1057. #include "SmsGuiInterfaceType.h" 
  1058. #include "MessagesResourceData.h"
  1059. #endif
  1060. //KP Jerry add for third sevice on 2007-03-26 end
  1061. #undef __NEWSIMULATOR
  1062. /***************************************************************************** 
  1063. * Define
  1064. *****************************************************************************/
  1065. /***************************************************************************** 
  1066. * Typedef 
  1067. *****************************************************************************/
  1068. /* diamond, 2005/10/12 idle revise */
  1069. typedef void (*FuncPtr) (void);
  1070. typedef U8(*FuncPtrRtn) (void);
  1071. typedef struct _idle_callback_info
  1072. {
  1073.     FuncPtrRtn idle_callback_chk_f; /* callback to check if there is any pending event in idle screen */
  1074.     FuncPtr idle_callback_exe_f;    /* callback to execute the corresponding function in idle screen  */
  1075. } IDLECALLBACKINFO;
  1076. /* end, diamond */
  1077. /****************************************************************************
  1078. * Global Variable                                                           
  1079. *****************************************************************************/
  1080. extern U16 gCurrLangIndex;
  1081. extern U16 gMaxDeployedLangs;
  1082. /* extern U8    isIdleScreenReached; */
  1083. extern S32 MAIN_LCD_device_width;
  1084. extern sLanguageDetails *gLanguageArray;
  1085. #ifdef __HOMEZONE_SUPPORT__
  1086. extern U8 *gHomezoneText;
  1087. #endif 
  1088. extern U16 simErrorDisplayString;
  1089. /****************************************************************************
  1090. * Global Function                                                           
  1091. *****************************************************************************/
  1092. //KP Jerry add on 2007-4-24 start
  1093. #ifdef __MMI_SLIDE__
  1094. extern U8 gMMIClamState;
  1095. #endif
  1096. extern void mmi_audply_entry_main(void);     //KP Jerry add on 2007-4-24
  1097. //KP Jerry add on 2007-4-24 end
  1098. extern void EmergencyCallCheck(S16 keyCode, S16 keyType);
  1099. extern void mmi_java_entry_mid_launch(void);
  1100. extern void MMIProcessActionMsg(void);
  1101. extern U8 *GetDeliverdReportMessage(void);
  1102. extern kal_bool INT_USBBoot(void);
  1103. extern EMSData *GetClass0MessagePtr(void);
  1104. extern U8 *GetClass0MessageHeader(void);
  1105. extern BOOL IsMyTimerExist(U16 nTimerId);
  1106. extern void SATEVDLIdleScreenAvaliable(void);
  1107. extern void mmiapi_enter_idle_screen_notify(void);
  1108. #ifdef WAP_SUPPORT
  1109. extern void wap_internet_key_hdlr(void);
  1110. #endif 
  1111. #ifdef __J2ME__
  1112. extern void j2me_enter_idle_screen_notify(void);
  1113. #endif 
  1114. #ifdef __MMI_AUDIO_PLAYER__
  1115. extern BOOL mmi_audply_is_playing(void);
  1116. extern void mmi_audply_set_subLCD_shown(BOOL is_shown);
  1117. #endif /* __MMI_AUDIO_PLAYER__ */ 
  1118. #ifdef __MMI_FM_RADIO__
  1119. extern BOOL mmi_fmrdo_is_power_on(void);
  1120. extern void mmi_fmrdo_set_subLCD_shown(BOOL is_shown);
  1121. void mmi_fmrdo_power_on(BOOL turn_on);
  1122. #endif /* __MMI_FM_RADIO__ */ 
  1123. #if defined(__MMI_VRSD__)
  1124. extern void mmi_vrsd_rcg_pre_entry(void);
  1125. #endif 
  1126. #if defined(__MMI_VRSD_DIAL__)
  1127. extern BOOL mmi_vrsddial_check_sim_change(void);
  1128. #endif 
  1129. #if defined(__MMI_VRSI__)
  1130. extern void mmi_vrsi_rcg_pre_entry(void);
  1131. #endif 
  1132. #ifdef MMI_ON_WIN32
  1133. extern void MMI_system_keybord_handler(S32 key_code, S32 key_state);
  1134. #endif 
  1135. /* Associate caller group in SIM card entry */
  1136. #if defined(__MMI_PHB_CALLERGROUP_IN_SIM__)
  1137. extern BOOL mmi_phb_init_check_sim_change(void);
  1138. #endif 
  1139. #ifdef __MMI_WGUI_MINI_TAB_BAR__
  1140. extern void ClndrPreEntryApp(void);
  1141. extern void fmgr_launch(void);
  1142. #endif /* __MMI_WGUI_MINI_TAB_BAR__ */ 
  1143. /* diamond, 2005/07/05 Flight mode */
  1144. #ifdef __FLIGHT_MODE_SUPPORT__
  1145. extern void EntryScrSimOptionMenu(void);
  1146. void EntryFlightModeIdleScreen(void);
  1147. void EntryFlightModeKeypadLockScreen(void);
  1148. void FlightModeDigitHandler(void);
  1149. #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  1150. /* end, diamond */
  1151. extern void InsertSimSetKeyPadLockFlag(void);
  1152. extern void UI_set_font(UI_font_type f);
  1153. static U8 mmi_idle_missed_call_check(void);
  1154. #ifdef __MMI_NITZ__
  1155. static U8 mmi_idle_pending_nitz_check(void);
  1156. #endif 
  1157. #if defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT)
  1158. static U8 mmi_idle_widget_check_and_display_new_msg(void);
  1159. #endif 
  1160. /***************************************************************************** 
  1161. * Local Variable
  1162. *****************************************************************************/
  1163. idle_context_struct g_idle_context = 
  1164. {
  1165.     0,                      /* IsOnIdleScreen */
  1166.     SUBLCD_NOT_ON_IDLE,     /* IsSubLcdOnIdleScreen */
  1167.     0,                      /* IsOnDialerScreen */
  1168.     0,                      /* IsOnSimErrorScreen */
  1169.     0,                      /* IsOnSimErrorDialerScreen */
  1170.     0,                      /* IsScrSvrSleepIn */
  1171.     0,                      /* IsRSKPressOnScreenSaver */
  1172.     0,                      /* LongPressEnable */
  1173.     0,                      /* AvoidHistoryofDialerScreen */
  1174.     0,                      /* ScreenSaverRunFlag */
  1175.     0,                      /* ToNameScrFromIdleApp */
  1176. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  1177.     0,                      /* ToMainMenuScrFromIdleApp */
  1178. #endif 
  1179.     0,                      /* RskPressedFromIdleApp */
  1180.     -1,                     /* IdleScreenDigitKeyCode */
  1181.     SET_CURRENT_PROFILE,    /* ToggleProfile */
  1182.     0,                      /* AutoLockTimeOut */
  1183.     {0}                     /* All dialled digits from idle screen */
  1184. };
  1185. idle_keylock_struct g_keylock_context = 
  1186. {
  1187.     0,      /* gKeyPadLockFlag */
  1188.     0,      /* KeyLockLSKStringID */
  1189.     0,      /* KeyLockRSKStringID */
  1190.     0,      /* KeyLockLSKIconID */
  1191.     0,      /* KeyLockRSKIconID */
  1192.     NULL    /* diamond, 2006/03/26 Generic exit function for keypad lock callback screens */
  1193. };
  1194. #ifdef __MMI_NITZ__
  1195. static idle_nitz_struct g_nitz_display = 
  1196. {
  1197.     0,      /* opname_from_nitz */
  1198.     0,      /* country_init */
  1199.     {0},    /* plmn[] */
  1200.     {0}     /* display_name[] */
  1201. };
  1202. #endif /* __MMI_NITZ__ */ 
  1203. static const IDLECALLBACKINFO mmi_idle_callbacks[] = 
  1204. {
  1205.     /* How to add callbacks for idle screen/keypad lock ? */
  1206.     /* 1. Fill the callbacks into this array     */
  1207.     /* Notice that the function type !        */
  1208.     /* 1. Checking  function should be U8 XXX(void)    */
  1209.     /* 2. Execution function should be void XXX(void)  */
  1210. #ifdef __MMI_SAT_DISPLAY_TEXT_WITH_KEYPAD_LOCK__
  1211.     {mmi_sat_is_pending_idle_sat_cmd, mmi_sat_execute_idle_sat_cmd},
  1212. #endif
  1213. #ifdef __J2ME__
  1214.     {mmi_java_is_launch_after_install, mmi_java_entry_mid_launch}, /* new Java midlet */
  1215. #endif 
  1216.     {mmi_idle_missed_call_check, EntryCHISTNotifyMissedCall}, /* missed call */
  1217.     {mmi_msg_need_class0_msg_ind, mmi_msg_entry_class0_msg_ind}, /* new class 0 message */
  1218. #ifdef __MMI_UNIFIED_MESSAGE__
  1219.     {mmi_um_check_new_msg, mmi_um_pre_entry_new_msg_ind}, /* new unified message */
  1220. #else 
  1221.     {mmi_msg_need_new_msg_ind, mmi_msg_entry_new_msg_ind}, /* new short message */
  1222. #endif 
  1223.     {mmi_msg_need_mem_exceed_ind, mmi_msg_entry_mem_exceed_ind}, /* memory exceed notification */
  1224.     {mmi_msg_need_delivery_report_ind, mmi_msg_entry_deliver_report_ind}, /* deliver report */
  1225.     {mmi_msg_need_waiting_ind, mmi_msg_entry_msg_waiting_ind}, /* waiting message */
  1226. #ifdef __MMI_VOIP__
  1227.     {mmi_voip_need_msg_waiting_ind, mmi_voip_entry_msg_waiting_ind},
  1228. #endif
  1229. #ifdef __MMI_IMPS__
  1230.     {mmi_imps_check_invite_in_idle, NULL}, /* IMPS invitation */
  1231. #endif 
  1232. #if (defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P)
  1233.     {mmi_vobj_is_pending_object, mmi_vobj_entry_recv_object}, /* unread vObjects */
  1234. #endif 
  1235. #if defined(__MMI_IRDA_SUPPORT__)
  1236.     {mmi_irda_get_recv_files_cnt, mmi_irda_entry_idle_notify_scr}, /* files from IrDA */
  1237. #endif 
  1238. #if (defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) && defined(__MMI_IRDA_SUPPORT__))
  1239.     {mmi_irda_is_any_theme_file_rcv, mmi_irda_theme_show_idle_notify_scr}, /* downloadable theme from IrDA */
  1240. #endif 
  1241. #if defined(__MMI_NITZ__)
  1242.     {mmi_idle_pending_nitz_check, EntryNitzScreen}, /* NITZ */
  1243. #endif 
  1244.     {mmi_msg_need_new_cb_ind, mmi_msg_entry_new_cb_ind}, /* new CB message */
  1245. #if defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT)
  1246.     {mmi_idle_widget_check_and_display_new_msg, NULL}, /* new message from widget */
  1247. #endif 
  1248. #if defined(__MMI_PHB_CALLERGROUP_IN_SIM__)
  1249.     {mmi_phb_init_check_sim_change, NULL}, /* associate caller group in SIM card entry */
  1250. #endif 
  1251. #if defined(__MMI_VRSD_DIAL__)
  1252.     {mmi_vrsddial_check_sim_change, NULL}, /* VRSD dial */
  1253. #endif 
  1254. #if defined(__MMI_OPP_SUPPORT__)
  1255.     {mmi_opp_get_recv_files_cnt, mmi_opp_entry_idle_notify_scr}, /* files from Bluetooth */
  1256. #endif
  1257. #if defined(__MMI_DOWNLOAD_AGENT__)
  1258.     {mmi_da_launch_ring_buffer_check, mmi_da_entry_new_push_ind}, /* download agent */
  1259. #endif 
  1260. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  1261.     {mmi_jmms_need_mms_ind, mmi_jmms_entry_new_mms_ind}, /* new mms message */
  1262. #endif 
  1263. #if !defined (__MMI_UNIFIED_MESSAGE__) && defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  1264.     {mmi_brw_new_push_msg_ind, mmi_brw_entry_new_push_msg_ind},  /* new wap push message */
  1265. #endif 
  1266. #if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
  1267.     {mmi_prov_check_and_install_new_settings, mmi_prov_show_install_settings_dialog},
  1268. #endif 
  1269. #ifdef __SYNCML_SUPPORT__
  1270.     {mmi_syncml_is_sync_alarm_expired, mmi_syncml_sync_alarm_hdlr}, /* sync */
  1271. #endif
  1272. #ifdef __MMI_USER_CTRL_PLMN_SUPPORT__
  1273.     {mmi_netset_unknown_operator_check, mmi_netset_unknown_operator_query}, /* user control plmn */
  1274. #endif
  1275. #if defined(__FOTA_ENABLE__)
  1276.     {mmi_dm_fwu_check_download_finish, mmi_dm_fwu_entry_download_finish_ind}, /* firmware upgrade finished */
  1277. #endif
  1278.     {NULL, NULL}                                            /* dummy one, please add callbacks before this entity */
  1279. };
  1280. extern S8 *idle_screen_wallpaper_name;
  1281. /*****************************************************************************
  1282. * Local Function 
  1283. *****************************************************************************/
  1284. static U16 idleLRStringtID = 0; /* for __MANUAL_MODE_NW_SEL__ */
  1285. /*****************************************************************************
  1286.  * FUNCTION
  1287.  *  mmi_idle_exe_callback
  1288.  * DESCRIPTION
  1289.  *  Execute callbacks before entry idle screen
  1290.  * PARAMETERS
  1291.  *  void
  1292.  * RETURNS
  1293.  *  void
  1294.  *****************************************************************************/
  1295. static pBOOL mmi_idle_exe_callback(void)
  1296. {
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Local Variables                                                */
  1299.     /*----------------------------------------------------------------*/
  1300.     U8 i;
  1301.     pBOOL rtn = MMI_FALSE;
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Code Body                                                      */
  1304.     /*----------------------------------------------------------------*/
  1305.     for (i = 0; mmi_idle_callbacks[i].idle_callback_chk_f != NULL; i++)
  1306.     {
  1307.         //if(mmi_idle_callbacks[i].idle_callback_chk_f != NULL)
  1308.         //{
  1309.         if ((*mmi_idle_callbacks[i].idle_callback_chk_f) ())
  1310.         {
  1311.             rtn = MMI_TRUE;
  1312.             if (mmi_idle_callbacks[i].idle_callback_exe_f != NULL)
  1313.             {
  1314.                 (*mmi_idle_callbacks[i].idle_callback_exe_f) ();
  1315.             }
  1316.             break;
  1317.         }
  1318.         /* } */
  1319.     }
  1320.     return rtn;
  1321. }
  1322. /*****************************************************************************
  1323.  * FUNCTION
  1324.  *  mmi_idle_missed_call_check
  1325.  * DESCRIPTION
  1326.  *  Wrapper for idle screen callback
  1327.  * PARAMETERS
  1328.  *  void
  1329.  * RETURNS
  1330.  *  void
  1331.  *****************************************************************************/
  1332. static U8 mmi_idle_missed_call_check(void)
  1333. {
  1334.     /*----------------------------------------------------------------*/
  1335.     /* Local Variables                                                */
  1336.     /*----------------------------------------------------------------*/
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Code Body                                                      */
  1339.     /*----------------------------------------------------------------*/
  1340.     if (GetMissedCallFlag() && CHISTGetMissedCallCountBeforeView())
  1341.     {
  1342.         return MMI_TRUE;
  1343.     }
  1344.     else
  1345.     {
  1346.         return MMI_FALSE;
  1347.     }
  1348. }
  1349. #ifdef __MMI_NITZ__
  1350. /*****************************************************************************
  1351.  * FUNCTION
  1352.  *  mmi_idle_pending_nitz_check
  1353.  * DESCRIPTION
  1354.  *  Wrapper for idle screen callback
  1355.  * PARAMETERS
  1356.  *  void
  1357.  * RETURNS
  1358.  *  void
  1359.  *****************************************************************************/
  1360. static U8 mmi_idle_pending_nitz_check(void)
  1361. {
  1362.     /*----------------------------------------------------------------*/
  1363.     /* Local Variables                                                */
  1364.     /*----------------------------------------------------------------*/
  1365.     /*----------------------------------------------------------------*/
  1366.     /* Code Body                                                      */
  1367.     /*----------------------------------------------------------------*/
  1368.     return (U8) g_nitz_cntx.IsNITZPending;
  1369. }
  1370. /*****************************************************************************
  1371.  * FUNCTION
  1372.  *  mmi_idle_update_opname_from_nitz
  1373.  * DESCRIPTION
  1374.  *  Update NITZ network name if a new message is received
  1375.  * PARAMETERS
  1376.  *  void
  1377.  * RETURNS
  1378.  *  void
  1379.  *****************************************************************************/
  1380. void mmi_idle_update_opname_from_nitz(void)
  1381. {
  1382.     if (mmi_idle_is_on_idle_screen())
  1383.     {
  1384.         EntryIdleScreen(); /* IdleRefreshServiceIndicationArea(); */
  1385.     }
  1386. }
  1387. /*****************************************************************************
  1388.  * FUNCTION
  1389.  *  mmi_idle_update_nitz_content
  1390.  * DESCRIPTION
  1391.  *  Update NITZ network name from NVRAM
  1392.  * PARAMETERS
  1393.  *  void
  1394.  * RETURNS
  1395.  *  void
  1396.  *****************************************************************************/
  1397. void mmi_idle_update_nitz_content(void)
  1398. {
  1399.     /*----------------------------------------------------------------*/
  1400.     /* Local Variables                                                */
  1401.     /*----------------------------------------------------------------*/
  1402.     U8 max_display_length = MAX_LENGTH_DISPLAY_NAME;
  1403.     U8 mcc_tmp_unicode[4 * ENCODING_LENGTH];
  1404.     U8 tmp_plmn[MAX_PLMN_LEN_MMI + 1];
  1405.     U8 tmp_display_name[MAX_LENGTH_DISPLAY_NAME * ENCODING_LENGTH];
  1406.     U8 iCnt = 0;
  1407.     S32 StringWidth, StringHeight;
  1408.     stFontAttribute prev_f;
  1409.     /*----------------------------------------------------------------*/
  1410.     /* Code Body                                                      */
  1411.     /*----------------------------------------------------------------*/
  1412.     memset(tmp_plmn, 0 , MAX_PLMN_LEN_MMI + 1);
  1413.     memset(tmp_display_name, 0, MAX_LENGTH_DISPLAY_NAME);
  1414.     mmi_nitz_get_nitz_nw_name(tmp_plmn, tmp_display_name, (U8) MAX_LENGTH_DISPLAY_NAME - 1, &g_nitz_display.country_init);
  1415.     if (strlen((S8*)tmp_plmn) != 0 && strlen((S8*)tmp_display_name) != 0)
  1416.     {
  1417.      strcpy((S8*)g_nitz_display.plmn, (S8*)tmp_plmn);
  1418.         if (g_nitz_display.country_init)
  1419.         {
  1420.             max_display_length -= 4;    /* 1 space char and 3 mcc digits */
  1421.         }
  1422.         
  1423.         if (pfnUnicodeStrlen((S8*) tmp_display_name) >= max_display_length)
  1424.         {
  1425.             pfnUnicodeStrncpy((S8*) g_nitz_display.display_name, (S8*) tmp_display_name, max_display_length);
  1426.         }
  1427.         else
  1428.         {
  1429.             pfnUnicodeStrcpy((S8*) g_nitz_display.display_name, (S8*) tmp_display_name);
  1430.         }
  1431.         /* add check if the NITZ display name exceeds the LCD width */
  1432.         memcpy(&prev_f, UI_font, sizeof(stFontAttribute));
  1433.         UI_set_font(&UI_DEFAULT_FONT);
  1434.         for (iCnt = (U8) pfnUnicodeStrlen((PS8) g_nitz_display.display_name); iCnt > 0; iCnt--)
  1435.         {
  1436.             Get_StringWidthHeight((U8*) g_nitz_display.display_name, &StringWidth, &StringHeight);
  1437.             if ((StringWidth + 1) >= MAIN_LCD_device_width - (ICON_WIDTH << 1))
  1438.             {
  1439.                 g_nitz_display.display_name[iCnt * ENCODING_LENGTH] = 0x0;
  1440.                 g_nitz_display.display_name[iCnt * ENCODING_LENGTH + 1] = 0x0;
  1441.             }
  1442.             else
  1443.             {
  1444.                 break;
  1445.             }
  1446.         }
  1447.         UI_set_font(&prev_f);
  1448.         if (g_nitz_display.country_init)
  1449.         {
  1450.             AnsiiNToUnicodeString((S8*) mcc_tmp_unicode, (S8*) g_nitz_display.plmn, 3);
  1451.             pfnUnicodeStrcat((S8*) g_nitz_display.display_name, " ");
  1452.             pfnUnicodeStrcat((S8*) g_nitz_display.display_name, (S8*) mcc_tmp_unicode);
  1453.         }
  1454.         g_nitz_display.opname_from_nitz = 1;
  1455.     }
  1456.     else
  1457.     {
  1458.         g_nitz_display.opname_from_nitz = 0;
  1459.     }
  1460. }
  1461. /*****************************************************************************
  1462.  * FUNCTION
  1463.  *  mmi_idle_check_nitz_display_validation
  1464.  * DESCRIPTION
  1465.  *  
  1466.  * PARAMETERS
  1467.  *  void
  1468.  * RETURNS
  1469.  *  
  1470.  *****************************************************************************/
  1471. pBOOL mmi_idle_check_nitz_display_validation(void)
  1472. {
  1473.     /*----------------------------------------------------------------*/
  1474.     /* Local Variables                                                */
  1475.     /*----------------------------------------------------------------*/
  1476.     /*----------------------------------------------------------------*/
  1477.     /* Code Body                                                      */
  1478.     /*----------------------------------------------------------------*/
  1479.     if (memcmp(g_nitz_display.plmn, gPLMN, MAX_PLMN_LEN_MMI) != 0)
  1480.     {
  1481.         g_nitz_display.opname_from_nitz = 0;
  1482.         return MMI_FALSE;
  1483.     }
  1484.     else
  1485.     {
  1486.         return MMI_TRUE;
  1487.     }
  1488. }
  1489. #endif /* __MMI_NITZ__ */ 
  1490. /*****************************************************************************
  1491.  * FUNCTION
  1492.  *  mmi_idle_widget_check_and_display_new_msg
  1493.  * DESCRIPTION
  1494.  *  Wrapper for idle screen callback
  1495.  * PARAMETERS
  1496.  *  void
  1497.  * RETURNS
  1498.  *  void
  1499.  *****************************************************************************/
  1500. #if defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT)
  1501. static U8 mmi_idle_widget_check_and_display_new_msg(void)
  1502. {
  1503.     /*----------------------------------------------------------------*/
  1504.     /* Local Variables                                                */
  1505.     /*----------------------------------------------------------------*/
  1506.     /*----------------------------------------------------------------*/
  1507.     /* Code Body                                                      */
  1508.     /*----------------------------------------------------------------*/
  1509.     if (g_keylock_context.gKeyPadLockFlag)
  1510.     {
  1511.         if (widget_MMI_check_and_display_new_msg_when_keypad_lock
  1512.             (g_keylock_context.KeyLockLSKStringID, g_keylock_context.KeyLockLSKIconID,
  1513.              g_keylock_context.KeyLockRSKStringID, g_keylock_context.KeyLockRSKIconID))
  1514.         {
  1515.             return MMI_TRUE;
  1516.         }
  1517.     }
  1518.     else
  1519.     {
  1520.         if (widget_MMI_check_and_display_new_msg())
  1521.         {
  1522.             return MMI_TRUE;
  1523.         }
  1524.     }
  1525.     return MMI_FALSE;
  1526. }
  1527. #endif /* defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT) && !defined (__UNIFIED_MSG_SUPPORT__) */ 
  1528. /*****************************************************************************
  1529.  * FUNCTION
  1530.  *  mmi_idle_pen_block
  1531.  * DESCRIPTION
  1532.  *  
  1533.  * PARAMETERS
  1534.  *  void
  1535.  * RETURNS
  1536.  *  void
  1537.  *****************************************************************************/
  1538. #ifdef __MMI_TOUCH_SCREEN__
  1539. void mmi_idle_pen_block(void)
  1540. {
  1541. #ifndef __MMI_GPIO_DISABLE_SLEEP_MODE__
  1542.     /*----------------------------------------------------------------*/
  1543.     /* Local Variables                                                */
  1544.     /*----------------------------------------------------------------*/
  1545.     extern BOOL gIsInSleepMode;
  1546.     /*----------------------------------------------------------------*/
  1547.     /* Code Body                                                      */
  1548.     /*----------------------------------------------------------------*/
  1549.     if (gIsInSleepMode != 1)
  1550. #endif /* __MMI_GPIO_DISABLE_SLEEP_MODE__ */ 
  1551.         mmi_pen_block();
  1552. }
  1553. #endif /* __MMI_TOUCH_SCREEN__ */
  1554. /*****************************************************************************
  1555.  * FUNCTION
  1556.  *  mmi_idle_set_keypad_lock_string
  1557.  * DESCRIPTION
  1558.  *  This function is used to set keypad lock RSK string
  1559.  * PARAMETERS
  1560.  *  void
  1561.  * RETURNS
  1562.  *  void
  1563.  *****************************************************************************/
  1564. void mmi_idle_set_keypad_lock_string(void)
  1565. {
  1566.     /*----------------------------------------------------------------*/
  1567.     /* Local Variables                                                */
  1568.     /*----------------------------------------------------------------*/
  1569.     /*----------------------------------------------------------------*/
  1570.     /* Code Body                                                      */
  1571.     /*----------------------------------------------------------------*/
  1572.     g_keylock_context.KeyLockRSKStringID = 0;
  1573.     g_keylock_context.KeyLockRSKIconID = 0;
  1574.     g_keylock_context.KeyLockLSKStringID = 0;
  1575.     g_keylock_context.KeyLockLSKIconID = 0;
  1576.     if (g_idle_context.IsOnIdleScreen == 1 || g_idle_context.IsOnSimErrorScreen == 1)
  1577.     {
  1578.     #ifdef __MMI_TOUCH_SCREEN__
  1579.         ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_LOCK);
  1580.     #else 
  1581.         ShowStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  1582.     #endif 
  1583.     #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
  1584.     #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
  1585.         g_keylock_context.KeyLockRSKStringID = SCREEN_LOCKED_TEXT;
  1586.     #else 
  1587.         g_keylock_context.KeyLockRSKStringID = KEYPAD_LOCKED_RSK_TEXT;
  1588.     #endif 
  1589.     #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 
  1590.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  1591.     #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
  1592.         g_keylock_context.KeyLockLSKStringID = SCREEN_LOCKED_TEXT;
  1593.     #else 
  1594.         g_keylock_context.KeyLockLSKStringID = KEYPAD_LOCKED_RSK_TEXT;
  1595.     #endif 
  1596.     #endif /* __MMI_KEYPAD_LOCK_PATTERN_2__ */ 
  1597.     }
  1598.     else
  1599.     {
  1600.         /* If active screen is not idle, pen is not blocked */
  1601.         /* Set RSK/LSK string to "unlock" because it is allowed to click the touch screen to unlock */
  1602.     #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
  1603.         g_keylock_context.KeyLockRSKStringID = KEYPAD_LOCKED_RSK_TEXT;
  1604.     #endif 
  1605.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  1606.         g_keylock_context.KeyLockLSKStringID = KEYPAD_LOCKED_RSK_TEXT;
  1607.     #endif 
  1608.     }
  1609. }
  1610. /*****************************************************************************
  1611.  * FUNCTION
  1612.  *  mmi_idle_dummy_key_handler
  1613.  * DESCRIPTION
  1614.  *  This function is a dummy handler for idle screen keys
  1615.  * PARAMETERS
  1616.  *  void
  1617.  * RETURNS
  1618.  *  void
  1619.  *****************************************************************************/
  1620. static FuncPtr dummyKeyHandler[MAX_KEYS];
  1621. extern FuncPtr currKeyFuncPtrs[MAX_KEYS][MAX_KEY_TYPE];
  1622. static void mmi_idle_dummy_key_handler(void)
  1623. {
  1624.     /*----------------------------------------------------------------*/
  1625.     /* Local Variables                                                */
  1626.     /*----------------------------------------------------------------*/
  1627.     U8 ScreenSaverStatus, ScreenSaverWait;
  1628.     U16 keyCode, keyType;
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Code Body                                                      */
  1631.     /*----------------------------------------------------------------*/
  1632.     PhnsetGetScrSvrSetings(&ScreenSaverStatus, &ScreenSaverWait);
  1633.     GetkeyInfo(&keyCode, &keyType);
  1634.     if (g_idle_context.IsOnIdleScreen)
  1635.     {
  1636.         /* postpone the screensaver after press keys */
  1637.         if (dummyKeyHandler[keyCode] != NULL && !g_keylock_context.gKeyPadLockFlag)
  1638.         {
  1639.             (*dummyKeyHandler[keyCode]) ();
  1640.         }
  1641.         if (keyCode == KEY_ENTER && dummyKeyHandler[keyCode] == NULL && currKeyFuncPtrs[keyCode][KEY_LONG_PRESS] == NULL
  1642.             && !g_keylock_context.gKeyPadLockFlag)
  1643.         {
  1644.             (*dummyKeyHandler[KEY_LSK]) (); /* special case for KEY ENTER with null handler */
  1645.             ClearKeyHandler(KEY_ENTER, KEY_EVENT_DOWN);
  1646.         }
  1647.     }
  1648.     if (g_idle_context.IsOnIdleScreen)
  1649.     {
  1650.         StopTimer(SCREENSAVER_TIMER);
  1651.         StartTimer(SCREENSAVER_TIMER, ScreenSaverWait * 1000, EntryIdleSetScreenSaver);
  1652.     }
  1653. }
  1654. /*****************************************************************************
  1655.  * FUNCTION
  1656.  *  mmi_idle_date_time_reminder
  1657.  * DESCRIPTION
  1658.  *  
  1659.  * PARAMETERS
  1660.  *  void
  1661.  * RETURNS
  1662.  *  void
  1663.  *****************************************************************************/
  1664. static void mmi_idle_date_time_reminder(void)
  1665. {
  1666. #if defined(__MMI_DATE_TIME_SETTING_REMINDER__)
  1667.     /*----------------------------------------------------------------*/
  1668.     /* Local Variables                                                */
  1669.     /*----------------------------------------------------------------*/
  1670.     static BOOL datejust_reminder_shown = MMI_FALSE;
  1671.     /*----------------------------------------------------------------*/
  1672.     /* Code Body                                                      */
  1673.     /*----------------------------------------------------------------*/
  1674. #ifdef MMI_ON_HARDWARE_P
  1675.     if (!datejust_reminder_shown && RTC_is_MS_FirstPowerOn())
  1676. #else 
  1677.     if (!datejust_reminder_shown)
  1678. #endif 
  1679.     {
  1680.         DisplayPopup((PU8) GetString(STR_DATE_TIME_UPDATE_REMINDER), IMG_GLOBAL_OK, 0, 2000, 0);
  1681.         datejust_reminder_shown = MMI_TRUE;
  1682.     }
  1683. #endif /* defined(__MMI_DATE_TIME_SETTING_REMINDER__) */ 
  1684. }
  1685. /*****************************************************************************
  1686.  * FUNCTION
  1687.  *  mmi_idle_dummy_key_in_screensaver
  1688.  * DESCRIPTION
  1689.  *  
  1690.  * PARAMETERS
  1691.  *  void
  1692.  * RETURNS
  1693.  *  void
  1694.  *****************************************************************************/
  1695. static void mmi_idle_dummy_key_in_screensaver(void)
  1696. {
  1697.     /*----------------------------------------------------------------*/
  1698.     /* Local Variables                                                */
  1699.     /*----------------------------------------------------------------*/
  1700.     U8 i;
  1701.     U8 ScreenSaverStatus, ScreenSaverWait;
  1702.     /*----------------------------------------------------------------*/
  1703.     /* Code Body                                                      */
  1704.     /*----------------------------------------------------------------*/
  1705.     PhnsetGetScrSvrSetings(&ScreenSaverStatus, &ScreenSaverWait);
  1706.     /* Compensatory key handler registration for screen saver.             */
  1707.     /* The idea here is to set those keys which are not set with handlers to a dummy handler. */
  1708.     /* But not that END key is still being set a handler (DisplayIdleScreen)        */
  1709.     /* for KEY_EVENT_DOWN in PowerAndEndKeyHandler.                  */
  1710.     if (g_keylock_context.gKeyPadLockFlag)
  1711.     {
  1712.         if (ScreenSaverStatus == 1) /* Screensaver is set to on */
  1713.         {
  1714.             for (i = KEY_0; i < MAX_KEYS; i++)
  1715.             {
  1716.                 if ((GetKeyHandler(i, KEY_EVENT_DOWN) == NULL) && (GetKeyHandler(i, KEY_EVENT_UP) == NULL))
  1717.                 {
  1718.                     SetKeyHandler(mmi_idle_dummy_key_handler, i, KEY_EVENT_DOWN);
  1719.                 }
  1720.             }
  1721.             /*  add this because of PowerAndEndKeyHandler */
  1722.         #ifndef __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  1723.             /* diamond, 2005/12/20 END key is registered to prompt text if __MMI_KEYPAD_LOCK_PROMPT_TEXT__ is on */
  1724.             SetKeyHandler(mmi_idle_dummy_key_handler, KEY_END, KEY_EVENT_DOWN);
  1725.         #endif /* __MMI_KEYPAD_LOCK_PROMPT_TEXT__ */ 
  1726.         }
  1727.     }
  1728.     else
  1729.     {
  1730.         if (ScreenSaverStatus == 1) /* Screensaver is set to on */
  1731.         {
  1732.             for (i = KEY_0; i < MAX_KEYS; i++)
  1733.             {
  1734.                 dummyKeyHandler[i] = GetKeyHandler(i, KEY_EVENT_DOWN);
  1735.                 SetKeyHandler(mmi_idle_dummy_key_handler, i, KEY_EVENT_DOWN);
  1736.             }
  1737.         }
  1738.     }
  1739. }
  1740. /*****************************************************************************
  1741.  * FUNCTION
  1742.  *  mmi_idle_set_eg_events
  1743.  * DESCRIPTION
  1744.  *  
  1745.  * PARAMETERS
  1746.  *  void
  1747.  * RETURNS
  1748.  *  void
  1749.  *****************************************************************************/
  1750. extern void nor_sweep_device(void);
  1751. static void mmi_idle_set_eg_events(void)
  1752. {
  1753. #ifdef __MTK_TARGET__
  1754.     /*----------------------------------------------------------------*/
  1755.     /* Local Variables                                                */
  1756.     /*----------------------------------------------------------------*/
  1757.     pBOOL egIsSet = 0;
  1758.     /*----------------------------------------------------------------*/
  1759.     /* Code Body                                                      */
  1760.     /*----------------------------------------------------------------*/
  1761.     if (!egIsSet)
  1762.     {
  1763.         nor_sweep_device();
  1764.         egIsSet = 1;
  1765.     }
  1766. #endif /* __MTK_TARGET__ */
  1767. }
  1768. /*****************************************************************************
  1769.  * FUNCTION
  1770.  *  mmi_idle_start_keypad_lock
  1771.  * DESCRIPTION
  1772.  *  
  1773.  * PARAMETERS
  1774.  *  void
  1775.  * RETURNS
  1776.  *  void
  1777.  *****************************************************************************/
  1778. void mmi_idle_start_keypad_lock(void)
  1779. {
  1780.     /*----------------------------------------------------------------*/
  1781.     /* Local Variables                                                */
  1782.     /*----------------------------------------------------------------*/
  1783.     /*----------------------------------------------------------------*/
  1784.     /* Code Body                                                      */
  1785.     /*----------------------------------------------------------------*/
  1786. //KP Jerry add on 2007-4-25 start
  1787. #ifdef __MMI_SLIDE__
  1788. if(!gMMIClamState)
  1789. {
  1790. #endif
  1791. //KP Jerry add on 2007-4-25 end
  1792.     mmi_idle_set_eg_events();
  1793.     if (!g_keylock_context.gKeyPadLockFlag) /* keypad isn't lock now */
  1794.     {
  1795.         SETTING_AKPL_TIME GetAutoLockTimeOut = GetAutoKeypadLockTime();
  1796.         switch (GetAutoLockTimeOut)
  1797.         {
  1798.             case TIME_0:
  1799.                 g_idle_context.AutoLockTimeOut = 0;
  1800.                 break;
  1801.             case TIME_5:
  1802.                 g_idle_context.AutoLockTimeOut = 5000;
  1803.                 break;
  1804.             case TIME_30:
  1805.                 g_idle_context.AutoLockTimeOut = 30000;
  1806.                 break;
  1807.             case TIME_60:
  1808.                 g_idle_context.AutoLockTimeOut = 60000;
  1809.                 break;
  1810.             case TIME_2:
  1811.                 g_idle_context.AutoLockTimeOut = 300000;
  1812.                 break;
  1813.         }
  1814.         if (g_idle_context.AutoLockTimeOut != 0)
  1815.         {
  1816.             PRINT_INFORMATION(("[Keypad Lock] mmi_idle_start_keypad_lock: Timer %d start",
  1817.                                g_idle_context.AutoLockTimeOut));
  1818.             if (mmi_bootup_is_sim_valid() == MMI_TRUE)
  1819.             {
  1820.                 StartTimer(IDLE_APP_AUTO_LOCK_TIMER_ID, g_idle_context.AutoLockTimeOut, IdleSetKeyPadLockFlag);
  1821.             }
  1822.             else
  1823.             {
  1824.                 StartTimer(IDLE_APP_AUTO_LOCK_TIMER_ID, g_idle_context.AutoLockTimeOut, InsertSimSetKeyPadLockFlag);
  1825.             }
  1826.         }
  1827.     }
  1828. //KP Jerry add on 2007-4-25 start
  1829. #ifdef __MMI_SLIDE__
  1830. }
  1831. #endif
  1832. //KP Jerry add on 2007-4-25 end
  1833. }
  1834. /*****************************************************************************
  1835.  * FUNCTION
  1836.  *  mmi_idle_restart_keypad_lock_timer
  1837.  * DESCRIPTION
  1838.  *  
  1839.  * PARAMETERS
  1840.  *  void
  1841.  * RETURNS
  1842.  *  void
  1843.  *****************************************************************************/
  1844. void mmi_idle_restart_keypad_lock_timer(void)
  1845. {
  1846.     /*----------------------------------------------------------------*/
  1847.     /* Local Variables                                                */
  1848.     /*----------------------------------------------------------------*/
  1849.     /*----------------------------------------------------------------*/
  1850.     /* Code Body                                                      */
  1851.     /*----------------------------------------------------------------*/
  1852. //KP Jerry add on 2007-4-25 start
  1853. #ifdef __MMI_SLIDE__
  1854. if(!gMMIClamState)
  1855. {
  1856. #endif
  1857. //KP Jerry add on 2007-4-25 end
  1858.     if (g_keylock_context.gKeyPadLockFlag == 1)
  1859.     {
  1860.         return;
  1861.     }
  1862.     if (g_idle_context.AutoLockTimeOut != 0 &&
  1863.         (g_idle_context.IsOnIdleScreen == 1 || g_idle_context.IsOnSimErrorScreen == 1))
  1864.     {
  1865.         StopTimer(IDLE_APP_AUTO_LOCK_TIMER_ID);
  1866.         if (g_idle_context.IsOnIdleScreen == 1)
  1867.         {
  1868.             StartTimer(IDLE_APP_AUTO_LOCK_TIMER_ID, g_idle_context.AutoLockTimeOut, IdleSetKeyPadLockFlag);
  1869.         }
  1870.         if (g_idle_context.IsOnSimErrorScreen == 1)
  1871.         {
  1872.             StartTimer(IDLE_APP_AUTO_LOCK_TIMER_ID, g_idle_context.AutoLockTimeOut, InsertSimSetKeyPadLockFlag);
  1873.         }
  1874.     }
  1875. //KP Jerry add on 2007-4-25 start
  1876. #ifdef __MMI_SLIDE__
  1877. }
  1878. #endif
  1879. //KP Jerry add on 2007-4-25 end
  1880. }
  1881. /*****************************************************************************
  1882.  * FUNCTION
  1883.  *  mmi_idle_start_screensaver
  1884.  * DESCRIPTION
  1885.  *  
  1886.  * PARAMETERS
  1887.  *  void
  1888.  * RETURNS
  1889.  *  void
  1890.  *****************************************************************************/
  1891. void mmi_idle_start_screensaver(void)
  1892. {
  1893.     /*----------------------------------------------------------------*/
  1894.     /* Local Variables                                                */
  1895.     /*----------------------------------------------------------------*/
  1896.     U8 ScreenSaverStatus, ScreenSaverWait;
  1897.     /*----------------------------------------------------------------*/
  1898.     /* Code Body                                                      */
  1899.     /*----------------------------------------------------------------*/
  1900.     PhnsetGetScrSvrSetings(&ScreenSaverStatus, &ScreenSaverWait);
  1901.     if (ScreenSaverStatus == 0xFF)
  1902.     {
  1903.         PhnsetRstScrSvrDefault();
  1904.     }
  1905.     if (ScreenSaverStatus == 1) /* Screensaver is set to on */
  1906.     {
  1907.         StartTimer(SCREENSAVER_TIMER, ScreenSaverWait * 1000, EntryIdleSetScreenSaver);
  1908.     }
  1909. }
  1910. /*****************************************************************************
  1911.  * FUNCTION
  1912.  *  mmi_idle_restart_screensaver_timer
  1913.  * DESCRIPTION
  1914.  *  
  1915.  * PARAMETERS
  1916.  *  void
  1917.  * RETURNS
  1918.  *  void
  1919.  *****************************************************************************/
  1920. void mmi_idle_restart_screensaver_timer(void)
  1921. {
  1922.     /*----------------------------------------------------------------*/
  1923.     /* Local Variables                                                */
  1924.     /*----------------------------------------------------------------*/
  1925.     U8 ScreenSaverStatus, ScreenSaverWait;
  1926.     /*----------------------------------------------------------------*/
  1927.     /* Code Body                                                      */
  1928.     /*----------------------------------------------------------------*/
  1929.     if (g_idle_context.ScreenSaverRunFlag == 1) /* screensaver is running */
  1930.     {
  1931.         return;
  1932.     }
  1933.     if (g_idle_context.IsOnIdleScreen == 1)
  1934.     {
  1935.         PhnsetGetScrSvrSetings(&ScreenSaverStatus, &ScreenSaverWait);
  1936.         if (ScreenSaverStatus == 0xFF)
  1937.         {
  1938.             PhnsetRstScrSvrDefault();
  1939.         }
  1940.         if (ScreenSaverStatus == 1) /* screensaver is active */
  1941.         {
  1942.             StopTimer(SCREENSAVER_TIMER);
  1943.             StartTimer(SCREENSAVER_TIMER, ScreenSaverWait * 1000, EntryIdleSetScreenSaver);
  1944.         }
  1945.     }
  1946. }
  1947. /*****************************************************************************
  1948.  * FUNCTION
  1949.  *  mmi_idle_is_on_idle_screen
  1950.  * DESCRIPTION
  1951.  *  Is on idle screen?
  1952.  * PARAMETERS
  1953.  *  void
  1954.  * RETURNS
  1955.  *  void
  1956.  *****************************************************************************/
  1957. pBOOL mmi_idle_is_on_idle_screen(void)
  1958. {
  1959.     /*----------------------------------------------------------------*/
  1960.     /* Local Variables                                                */
  1961.     /*----------------------------------------------------------------*/
  1962.     /*----------------------------------------------------------------*/
  1963.     /* Code Body                                                      */
  1964.     /*----------------------------------------------------------------*/
  1965.     if (g_idle_context.IsOnIdleScreen == 1)
  1966.     {
  1967.         return MMI_TRUE;
  1968.     }
  1969.     else
  1970.     {
  1971.         return MMI_FALSE;
  1972.     }
  1973. }
  1974. /*****************************************************************************
  1975.  * FUNCTION
  1976.  *  mmi_idle_is_screensaver_running
  1977.  * DESCRIPTION
  1978.  *  Is screensaver running?
  1979.  * PARAMETERS
  1980.  *  void
  1981.  * RETURNS
  1982.  *  void
  1983.  *****************************************************************************/
  1984. pBOOL mmi_idle_is_screensaver_running(void)
  1985. {
  1986.     /*----------------------------------------------------------------*/
  1987.     /* Local Variables                                                */
  1988.     /*----------------------------------------------------------------*/
  1989.     /*----------------------------------------------------------------*/
  1990.     /* Code Body                                                      */
  1991.     /*----------------------------------------------------------------*/
  1992.     if (g_idle_context.ScreenSaverRunFlag == 1)
  1993.     {
  1994.         return MMI_TRUE;
  1995.     }
  1996.     else
  1997.     {
  1998.         return MMI_FALSE;
  1999.     }
  2000. }
  2001. //jerson add begin 20070622
  2002. #ifdef  __MMI_ONEKEY_SNDREC_SUPPORT__
  2003. extern void mmi_sndrec_send_record_req(void);
  2004. #endif
  2005. //jerson add end 20070622
  2006. /*****************************************************************************
  2007.  * FUNCTION
  2008.  *  mmi_idle_entry_idle_screen
  2009.  * DESCRIPTION
  2010.  *  Idle screen with/without keypad lock
  2011.  * PARAMETERS
  2012.  *  void
  2013.  * RETURNS
  2014.  *  void
  2015.  *****************************************************************************/
  2016. void mmi_idle_entry_idle_screen(void)
  2017. {
  2018.     /*----------------------------------------------------------------*/
  2019.     /* Local Variables                                                */
  2020.     /*----------------------------------------------------------------*/
  2021.     U16 IdleScreenDigits[MAX_IDLE_SCREEN_DIGITS] =
  2022.         {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_STAR, KEY_POUND};
  2023. U8 *guiBuffer;
  2024. EntryNewScreen(IDLE_SCREEN_ID, NULL, mmi_idle_entry_idle_screen, NULL);
  2025. guiBuffer = GetCurrGuiBuffer(IDLE_SCREEN_ID);
  2026.     /*----------------------------------------------------------------*/
  2027.     /* Code Body                                                      */
  2028.     /*----------------------------------------------------------------*/
  2029.     IdleRefreshServiceIndicationArea(); /* Refresh Service Indication Area */
  2030. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) && !(defined __MMI_TOUCH_IDLESCREEN_SHORTCUTS__))    /* PMT MANISH   20050623 */
  2031.     EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
  2032. #endif 
  2033. #ifdef __MMI_SWFLASH__
  2034.     if (dispchar_iswp_swflash())
  2035. {
  2036. ShowCategory34Screen(IDLE_SCREEN_LSK_TEXT, IDLE_SCREEN_LSK_ICON, idleLRStringtID, IDLE_SCREEN_RSK_ICON, PhnsetGetCurWallPaperIdx(), idle_screen_wallpaper_name, NULL);
  2037. }
  2038. else
  2039. #endif /* _MMI_SWFLASH__ */
  2040. #ifdef __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__
  2041.     ShowCategory33Screen(IDLE_SCREEN_RSK_TEXT, IDLE_SCREEN_RSK_ICON, idleLRStringtID, IDLE_SCREEN_LSK_ICON, 0,guiBuffer);
  2042. #else 
  2043.     ShowCategory33Screen(IDLE_SCREEN_LSK_TEXT, IDLE_SCREEN_LSK_ICON, idleLRStringtID, IDLE_SCREEN_RSK_ICON, 0,guiBuffer);
  2044. #endif 
  2045.     g_idle_context.LongPressEnable = 0;
  2046.     SetGroupKeyHandler(HandleIdleScreenDigitEntry, IdleScreenDigits, MAX_IDLE_SCREEN_DIGITS - 1, KEY_EVENT_DOWN);
  2047.     IdleSetLRKey(); /* __MANUAL_MODE_NW_SEL__ */
  2048. #ifdef __MMI_TOUCH_SCREEN__
  2049.     wgui_register_status_icon_pen_event_hdlr(
  2050.         STATUS_ICON_KEYPAD_LOCK,
  2051.         WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON,
  2052.         IdleSetKeyPadLockFlag);
  2053. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2054. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) && !(defined __MMI_TOUCH_IDLESCREEN_SHORTCUTS__))    /* PMT MANISH   20050623 */
  2055.     SetCenterSoftkeyFunction(IdleScreenDigitHandler, KEY_EVENT_UP);
  2056. #endif 
  2057. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  2058.     memset((U8*) g_idle_context.DialPadCallBuffer, 0, sizeof((U8*) g_idle_context.DialPadCallBuffer));
  2059. #endif 
  2060.     /* Voice Recognition */
  2061. #if defined(__MMI_VRSD__)
  2062.     SetRightSoftkeyFunction(mmi_vrsd_rcg_pre_entry, KEY_LONG_PRESS);
  2063. #endif 
  2064. #if defined(__MMI_VRSI__)
  2065.     SetRightSoftkeyFunction(mmi_vrsi_rcg_pre_entry, KEY_LONG_PRESS);
  2066. #endif 
  2067.     /* for 4-dedicated shortcuts */
  2068. #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__)
  2069.     //RegisterDedicatedKeyHandlers();
  2070. #elif !defined(__DISABLE_SHORTCUTS_MENU__)
  2071.     SetKeyHandler(EntryShctInIdle, KEY_UP_ARROW, KEY_EVENT_DOWN);
  2072. #endif 
  2073.     SetLeftSoftkeyFunction(EntryPopupMatrix, KEY_LONG_PRESS);
  2074. SetKeyHandler(EntryMainMenuFromIdleScreen,KEY_ENTER,KEY_EVENT_UP);
  2075. //jerson add begin 20070622
  2076. #ifdef  __MMI_ONEKEY_SNDREC_SUPPORT__
  2077. SetKeyHandler(mmi_sndrec_send_record_req,KEY_ENTER,KEY_EVENT_LONG_PRESS);
  2078. #endif
  2079. //jerson add end 20070622
  2080.     /* sync the behavior with DisplayIdleScreen */
  2081.     CHISTResetCallLogIndex();
  2082. #ifdef __MMI_KLG__
  2083.     SetKeyHandler(fmgr_launch, KEY_EXTRA_1, KEY_EVENT_UP);
  2084.     SetKeyHandler(ClndrPreEntryApp, KEY_EXTRA_2, KEY_EVENT_UP);
  2085. #endif /* __MMI_KLG__ */ 
  2086. #ifdef __MMI_UI_CALL_LOG_IN_TAB_PANE__
  2087.     SetKeyHandler(EntryCHISTTabPaneIdleScreen, KEY_SEND, KEY_EVENT_DOWN);       /* diamond, 2005/09/13 key event DOWN to UP */
  2088. #else 
  2089.     SetKeyHandler(CHISTGetCallLogBySENDKey, KEY_SEND, KEY_EVENT_DOWN);  /* diamond, 2005/09/13 key event DOWN to UP */
  2090. #endif 
  2091. #if defined(WAP_SUPPORT) && defined(__MMI_WITH_WAP_KEY__)
  2092.     SetKeyHandler(wap_internet_key_hdlr, KEY_WAP, KEY_LONG_PRESS);
  2093. #endif 
  2094. //KP Jerry add on 2007-4-24 start
  2095.     SetKeyHandler(EntryPhbSpeedDial, KEY_LEFT_SHORTCUT, KEY_EVENT_DOWN);
  2096. #ifdef __MMI_VALUE_ADDED_SERVICE__
  2097.     SetKeyHandler(wap_internet_key_hdlr, KEY_RIGHT_SHORTCUT, KEY_EVENT_DOWN);
  2098. #else
  2099. //    SetKeyHandler(goto_mobile_suite_screen, KEY_RIGHT_SHORTCUT, KEY_EVENT_DOWN);
  2100. #endif
  2101. //KP Jerry add on 2007-4-24 end
  2102.     /* camera fast access key */
  2103. #ifdef __MMI_CAMERA__
  2104. #ifndef __MMI_SCREEN_SNAPSHOT__
  2105. #ifdef __MMI_IDLE_CAMERA_KEY_TO_STOP_AUDIOPLAYER__
  2106.     SetKeyHandler(CheckAndStopAudioPlayer, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
  2107. #else 
  2108.     #ifdef __MMI_SUBLCD_CAMERA__
  2109.     if (IsClamClose())
  2110.         SetKeyHandler(mmi_sublcd_camera_entry_option_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);        
  2111.     else
  2112. //KP Jerry modify on 2007-03-31 start
  2113. #ifdef __MMI_PROFILE_POWER_SAVING__
  2114.     {
  2115.         SetKeyHandler(IdleTogglePowerSavingProfile, CAMERA_SHORTCUT_KEY, KEY_LONG_PRESS);
  2116.         SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_UP);
  2117.     }
  2118. #else
  2119.         SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
  2120. #endif
  2121. //KP Jerry modify on 2007-03-31 end
  2122.     #else
  2123. //KP Jerry modify on 2007-03-31 start
  2124. #ifdef __MMI_PROFILE_POWER_SAVING__
  2125.     SetKeyHandler(IdleTogglePowerSavingProfile, CAMERA_SHORTCUT_KEY, KEY_LONG_PRESS);
  2126.     SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_UP);
  2127. #else
  2128.     SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
  2129. #endif
  2130. //KP Jerry modify on 2007-03-31 end
  2131.     #endif 
  2132. #endif 
  2133. #else /* __MMI_SCREEN_SNAPSHOT__ */ 
  2134. #ifdef __MMI_IDLE_CAMERA_KEY_TO_STOP_AUDIOPLAYER__
  2135.     SetKeyHandler(CheckAndStopAudioPlayer, CAMERA_SHORTCUT_KEY, KEY_EVENT_UP);
  2136. #else 
  2137.     #ifdef __MMI_SUBLCD_CAMERA__
  2138.     if (IsClamClose())
  2139.         SetKeyHandler(mmi_sublcd_camera_entry_option_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);        
  2140.     else
  2141. //KP Jerry modify on 2007-03-31 start
  2142. #ifdef __MMI_PROFILE_POWER_SAVING__
  2143.     {
  2144.         SetKeyHandler(IdleTogglePowerSavingProfile, CAMERA_SHORTCUT_KEY, KEY_LONG_PRESS);
  2145.         SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_UP);
  2146.     }
  2147. #else
  2148.         SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
  2149. #endif
  2150. //KP Jerry modify on 2007-03-31 end
  2151.     #else
  2152. //KP Jerry modify on 2007-03-31 start
  2153. #ifdef __MMI_PROFILE_POWER_SAVING__
  2154.         SetKeyHandler(IdleTogglePowerSavingProfile, CAMERA_SHORTCUT_KEY, KEY_LONG_PRESS);
  2155.         SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_UP);
  2156. #else
  2157.         SetKeyHandler(mmi_camera_entry_app_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
  2158. #endif
  2159. //KP Jerry modify on 2007-03-31 end
  2160.     #endif 
  2161. #endif 
  2162. #endif /* __MMI_SCREEN_SNAPSHOT__ */ 
  2163. #endif /* __MMI_CAMERA__ */ 
  2164.     /* volume key */
  2165.     SetDefaultVolumeKeyHandlers();
  2166.     ForceSubLCDScreen(ShowIdleAppSubLcd);
  2167.     /* 
  2168.      * Compensatory key handler registration for screen saver
  2169.      * The idea here is to set those keys which are not set with handlers to a dummy handler. 
  2170.      * But not that END key is still being set a handler (DisplayIdleScreen)  for KEY_EVENT_DOWN in PowerAndEndKeyHandler. 
  2171.      */
  2172.     mmi_idle_dummy_key_in_screensaver();
  2173. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  2174.     if (mmi_netset_get_active_preferred_mode() == P_WLAN_ONLY || mmi_netset_get_active_preferred_mode() == P_WLAN_PREFERRED)
  2175.     {
  2176.         mmi_netset_set_dial_mode(DIAL_MODE_WLAN);
  2177.     }
  2178.     else
  2179.     {
  2180.         mmi_netset_set_dial_mode(DIAL_MODE_GSM);
  2181.     }
  2182. #endif /* defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) */
  2183. }
  2184. /*****************************************************************************
  2185.  * FUNCTION
  2186.  *  mmi_idle_entry_searching_screen
  2187.  * DESCRIPTION
  2188.  *  Searching screen with/without keypad lock
  2189.  * PARAMETERS
  2190.  *  void
  2191.  * RETURNS
  2192.  *  void
  2193.  *****************************************************************************/
  2194. void mmi_idle_entry_searching_screen(void)
  2195. {
  2196.     /*----------------------------------------------------------------*/
  2197.     /* Local Variables                                                */
  2198.     /*----------------------------------------------------------------*/
  2199.     U16 IdleScreenDigits[MAX_IDLE_SCREEN_DIGITS] =
  2200.         {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_STAR, KEY_POUND};
  2201.     /*----------------------------------------------------------------*/
  2202.     /* Code Body                                                      */
  2203.     /*----------------------------------------------------------------*/
  2204.     if (!g_keylock_context.gKeyPadLockFlag)
  2205.     {
  2206.         /* diamond, 2005/07/22 240x320 sync searching screen style with idle screen style */
  2207.     #ifdef __MMI_MAINLCD_240X320__
  2208.         IdleRefreshServiceIndicationArea();
  2209.         
  2210. #ifdef __MMI_SWFLASH__
  2211.      if (dispchar_iswp_swflash())
  2212. {
  2213. ShowCategory34Screen(IDLE_SCREEN_LSK_TEXT, IDLE_SCREEN_LSK_ICON, idleLRStringtID, IDLE_SCREEN_RSK_ICON, PhnsetGetCurWallPaperIdx(), idle_screen_wallpaper_name, NULL);
  2214. }
  2215. else
  2216. #endif /* _MMI_SWFLASH__ */
  2217.     #ifdef __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__
  2218.         ShowCategory33Screen(IDLE_SCREEN_RSK_TEXT, IDLE_SCREEN_RSK_ICON, idleLRStringtID, IDLE_SCREEN_LSK_ICON, 0,NULL);
  2219.     #else 
  2220.         ShowCategory33Screen(IDLE_SCREEN_LSK_TEXT, IDLE_SCREEN_LSK_ICON, idleLRStringtID, IDLE_SCREEN_RSK_ICON, 0,NULL);
  2221.     #endif 
  2222.     #else /* __MMI_MAINLCD_240X320__ */ /* not defined __MMI_MAINLCD_240X320__ */
  2223.     #ifdef __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__
  2224.         ShowCategory120Screen(
  2225.             IDLE_SCREEN_RSK_TEXT,
  2226.             0,
  2227.             IDLE_SCREEN_LSK_TEXT,
  2228.             0,
  2229.             STR_IDLE_NETWORK_SRCH_SCR,
  2230.             IMG_IDLE_NETWORK_SRCH_SCR,
  2231.             NULL);
  2232.     #else /* __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__ */ 
  2233.         ShowCategory120Screen(
  2234.             IDLE_SCREEN_LSK_TEXT,
  2235.             0,
  2236.             IDLE_SCREEN_RSK_TEXT,
  2237.             0,
  2238.             STR_IDLE_NETWORK_SRCH_SCR,
  2239.             IMG_IDLE_NETWORK_SRCH_SCR,
  2240.             NULL);
  2241.     #endif /* __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__ */ 
  2242.     #endif /* __MMI_MAINLCD_240X320__ */ 
  2243.         /* end, diamond */
  2244.         SetGroupKeyHandler(HandleIdleScreenDigitEntry, IdleScreenDigits, MAX_IDLE_SCREEN_DIGITS - 1, KEY_EVENT_DOWN);
  2245.         g_idle_context.LongPressEnable = 0;
  2246.     #ifdef __MMI_TOUCH_DIAL_SCREEN__
  2247.         memset((U8*) g_idle_context.DialPadCallBuffer, 0, sizeof((U8*) g_idle_context.DialPadCallBuffer));
  2248.     #endif 
  2249.     #ifdef __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__
  2250.         SetRightSoftkeyFunction(EntryMainMenuFromIdleScreen, KEY_EVENT_UP);
  2251.         SetLeftSoftkeyFunction(mmi_phb_idle_enter_phb_list, KEY_EVENT_UP);
  2252.     #else /* __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__ */ 
  2253.         SetLeftSoftkeyFunction(EntryMainMenuFromIdleScreen, KEY_EVENT_UP);
  2254.         SetRightSoftkeyFunction(mmi_phb_idle_enter_phb_list, KEY_EVENT_UP);
  2255.     #endif /* __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__ */ 
  2256.         /* Voice Recognition */
  2257.     #if defined(__MMI_VRSD__)
  2258.         SetRightSoftkeyFunction(mmi_vrsd_rcg_pre_entry, KEY_LONG_PRESS);
  2259.     #endif 
  2260.     #if defined(__MMI_VRSI__)
  2261.         SetRightSoftkeyFunction(mmi_vrsi_rcg_pre_entry, KEY_LONG_PRESS);
  2262.     #endif 
  2263.     #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__)
  2264.         RegisterDedicatedKeyHandlers();
  2265.     #elif !defined(__DISABLE_SHORTCUTS_MENU__)
  2266.         SetKeyHandler(EntryShctInIdle, KEY_UP_ARROW, KEY_EVENT_DOWN);
  2267.     #endif 
  2268.     #ifdef __MMI_UI_CALL_LOG_IN_TAB_PANE__
  2269.         SetKeyHandler(EntryCHISTTabPaneIdleScreen, KEY_SEND, KEY_EVENT_DOWN);   /* diamond, 2005/09/13 key event DOWN to UP */
  2270.     #else 
  2271.         SetKeyHandler(CHISTGetCallLogBySENDKey, KEY_SEND, KEY_EVENT_DOWN);      /* diamond, 2005/09/13 key event DOWN to UP */
  2272.     #endif 
  2273.     #if defined(WAP_SUPPORT) && defined(__MMI_WITH_WAP_KEY__)
  2274.         SetKeyHandler(wap_internet_key_hdlr, KEY_WAP, KEY_LONG_PRESS);
  2275.     #endif 
  2276.     #ifdef __MMI_TOUCH_SCREEN__
  2277.         wgui_register_status_icon_pen_event_hdlr(
  2278.             STATUS_ICON_KEYPAD_LOCK,
  2279.             WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON,
  2280.             IdleSetKeyPadLockFlag);
  2281.     #endif /* __MMI_TOUCH_SCREEN__ */
  2282.         ForceSubLCDScreen(ShowIdleAppSubLcd);
  2283.     }
  2284.     else
  2285.     {
  2286.         /* diamond, 2005/07/22 240x320 sync searching screen style with idle screen style */
  2287.         mmi_idle_set_keypad_lock_string();
  2288.     #ifdef __MMI_MAINLCD_240X320__
  2289.         IdleRefreshServiceIndicationArea();
  2290. #ifdef __MMI_SWFLASH__
  2291.      if (dispchar_iswp_swflash())
  2292. {
  2293. ShowCategory34Screen(
  2294.                 g_keylock_context.KeyLockLSKStringID,
  2295.                 g_keylock_context.KeyLockLSKIconID,
  2296.                 g_keylock_context.KeyLockRSKStringID,
  2297.                 g_keylock_context.KeyLockRSKIconID,
  2298.     PhnsetGetCurWallPaperIdx(), idle_screen_wallpaper_name, NULL);
  2299. }
  2300. else
  2301. #endif /* _MMI_SWFLASH__ */        
  2302.         ShowCategory33Screen(
  2303.             g_keylock_context.KeyLockLSKStringID,
  2304.             g_keylock_context.KeyLockLSKIconID,
  2305.             g_keylock_context.KeyLockRSKStringID,
  2306.             g_keylock_context.KeyLockRSKIconID,
  2307. 0,
  2308.             NULL);
  2309.     #else /* __MMI_MAINLCD_240X320__ */ 
  2310.         ShowCategory120Screen(
  2311.             g_keylock_context.KeyLockLSKStringID,
  2312.             g_keylock_context.KeyLockLSKIconID,
  2313.             g_keylock_context.KeyLockRSKStringID,
  2314.             g_keylock_context.KeyLockRSKIconID,
  2315.             STR_IDLE_NETWORK_SRCH_SCR,
  2316.             IMG_IDLE_NETWORK_SRCH_SCR,
  2317.             NULL);
  2318.     #endif /* __MMI_MAINLCD_240X320__ */ 
  2319.         /* end, diamond */
  2320.         /* diamond, 2006/06/09 Generic exit function for keypad lock callback screens */
  2321.         g_keylock_context.keypad_lock_screen_exit = GetCurrExitFuncPtr();
  2322.         SetCurrExitFuncPtr(mmi_idle_generic_keypad_lock_screen_exit_hdlr);
  2323.     #ifdef __MMI_TOUCH_SCREEN__
  2324.         mmi_idle_pen_block();
  2325.         SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  2326.     #else /* __MMI_TOUCH_SCREEN__ */ 
  2327.         SetRightSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  2328.     #endif /* __MMI_TOUCH_SCREEN__ */ 
  2329.     }
  2330. }
  2331. /*****************************************************************************
  2332.  * FUNCTION
  2333.  *  mmi_idle_key_event_backlight_check
  2334.  * DESCRIPTION
  2335.  *  Check backlight when key event occurs
  2336.  * PARAMETERS
  2337.  *  void
  2338.  * RETURNS
  2339.  *  void
  2340.  *****************************************************************************/
  2341. void mmi_idle_key_event_backlight_check(void)
  2342. {
  2343. #ifdef MMI_ON_HARDWARE_P
  2344.     /*----------------------------------------------------------------*/
  2345.     /* Local Variables                                                */
  2346.     /*----------------------------------------------------------------*/
  2347.     /*----------------------------------------------------------------*/
  2348.     /* Code Body                                                      */
  2349.     /*----------------------------------------------------------------*/
  2350.     if ((g_keylock_context.gKeyPadLockFlag && g_idle_context.IsOnIdleScreen)
  2351.         || (g_keylock_context.gKeyPadLockFlag && g_idle_context.ScreenSaverRunFlag))
  2352.     {
  2353.         HalfModeBacklight();
  2354.     }
  2355.     else
  2356.     {
  2357.         TurnOnBacklight(1);
  2358.     }
  2359. #else /* MMI_ON_HARDWARE_P */ 
  2360.     if (g_idle_context.IsOnIdleScreen)
  2361.     {
  2362.         TurnOnBacklight(1);
  2363.     }
  2364. #endif /* MMI_ON_HARDWARE_P */ 
  2365. }
  2366. /*****************************************************************************
  2367.  * FUNCTION
  2368.  *  mmi_idle_key_event_keypad_lock_check
  2369.  * DESCRIPTION
  2370.  *  Handle the case of keypad timer is running in idle screen but the key event is not POUND key
  2371.  * PARAMETERS
  2372.  *  eventKey                [?]         
  2373.  *  KEYBRD_MESSAGE(?)       [IN]        *eventKey
  2374.  * RETURNS
  2375.  *  void
  2376.  *****************************************************************************/
  2377. void mmi_idle_key_event_keypad_lock_check(KEYBRD_MESSAGE *eventKey)
  2378. {
  2379.     /*----------------------------------------------------------------*/
  2380.     /* Local Variables                                                */
  2381.     /*----------------------------------------------------------------*/
  2382.     /*----------------------------------------------------------------*/
  2383.     /* Code Body                                                      */
  2384.     /*----------------------------------------------------------------*/
  2385.     if (IsMyTimerExist(KEYPAD_LOCK_TIMER) == MMI_TRUE)
  2386.     {
  2387.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_1__
  2388.         if ((S16) eventKey->nKeyCode != KEY_POUND)
  2389.         {
  2390.             IdleHandleKeypadLockProcess();
  2391.         }
  2392.     #endif /* __MMI_KEYPAD_LOCK_PATTERN_1__ */ 
  2393.     #if defined(__MMI_KEYPAD_LOCK_PATTERN_2__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  2394.         if ((S16) eventKey->nKeyCode != KEY_STAR)
  2395.         {
  2396.             IdleHandleKeypadLockProcess();
  2397.         }
  2398.     #endif /* __MMI_KEYPAD_LOCK_PATTERN_2__  || __MMI_KEYPAD_LOCK_PATTERN_3__ */     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27 
  2399.     }
  2400.     //KP Jerry add on 2007-4-23 start
  2401.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_4__
  2402.         if ((S16) eventKey->nKeyCode != KEY_CAMERA)
  2403.         {
  2404.             IdleHandleKeypadLockProcess();
  2405.         }
  2406.     #endif /* __MMI_KEYPAD_LOCK_PATTERN_4__ */ 
  2407.     //KP Jerry add on 2007-4-23 end
  2408. }
  2409. /*****************************************************************************
  2410.  * FUNCTION
  2411.  *  DeInitSpecialMode
  2412.  * DESCRIPTION
  2413.  *  DeInit Special Mode
  2414.  * PARAMETERS
  2415.  *  void
  2416.  * RETURNS
  2417.  *  void
  2418.  *****************************************************************************/
  2419. #if (defined(__MMI_ENGINEER_MODE__) || defined(__MMI_FACTORY_MODE__))
  2420. U8 gCurrentMode = NORMAL_MODE;
  2421. #endif 
  2422. /* Reset special function for special mode */
  2423. void DeInitSpecialMode(void)
  2424. {
  2425. #ifdef __MMI_ENGINEER_MODE__
  2426.     /*----------------------------------------------------------------*/
  2427.     /* Local Variables                                                */
  2428.     /*----------------------------------------------------------------*/
  2429.     /*----------------------------------------------------------------*/
  2430.     /* Code Body                                                      */
  2431.     /*----------------------------------------------------------------*/
  2432.     if (gCurrentMode == ENGINEERING_MODE)
  2433.     {
  2434.         gCurrentMode = NORMAL_MODE;
  2435.         mdi_audio_resume_background_play();
  2436.         StartLEDPatternBackGround();
  2437.     }
  2438. #endif /* __MMI_ENGINEER_MODE__ */ 
  2439. }
  2440. /*****************************************************************************
  2441.  * FUNCTION
  2442.  *  SearchingSrceenTimeOutHandler
  2443.  * DESCRIPTION
  2444.  *  This function is a call back for searching screen expire
  2445.  * PARAMETERS
  2446.  *  void
  2447.  * RETURNS
  2448.  *  void
  2449.  *****************************************************************************/
  2450. void SearchingSrceenTimeOutHandler(void)
  2451. {
  2452.     /*----------------------------------------------------------------*/
  2453.     /* Local Variables                                                */