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

MTK

开发平台:

C/C++

  1.  *  void
  2.  *****************************************************************************/
  3. void ExitSECSETChangePWOldPWD(void)
  4. {
  5.     /*----------------------------------------------------------------*/
  6.     /* Local Variables                                                */
  7.     /*----------------------------------------------------------------*/
  8.     history Scr;    /* Variable to hold the history data */
  9.     /*----------------------------------------------------------------*/
  10.     /* Code Body                                                      */
  11.     /*----------------------------------------------------------------*/
  12.     Scr.scrnID = SCR_ID_SECSET_CHANGEPW_OLD_PWD;
  13.     Scr.entryFuncPtr = EntrySECSETChangePWOldPWD;
  14.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.Password);
  15.     GetCategoryHistory(Scr.guiBuffer);
  16.     AddHistory(Scr);
  17. }
  18. /*****************************************************************************
  19.  * FUNCTION
  20.  *  EntrySECSETChangePWNewPWD
  21.  * DESCRIPTION
  22.  *  Entry screen to enter new pwd for all options.
  23.  * PARAMETERS
  24.  *  void
  25.  * RETURNS
  26.  *  void
  27.  *****************************************************************************/
  28. void EntrySECSETChangePWNewPWD(void)
  29. {
  30.     /*----------------------------------------------------------------*/
  31.     /* Local Variables                                                */
  32.     /*----------------------------------------------------------------*/
  33.     U8 *guiBuffer;
  34.     U8 *inputBuffer;
  35.     /*----------------------------------------------------------------*/
  36.     /* Code Body                                                      */
  37.     /*----------------------------------------------------------------*/
  38.     EntryNewScreen(SCR_ID_SECSET_CHANGEPW_NEW_PWD, ExitSECSETChangePWNewPWD, NULL, NULL);
  39.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  40.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  41.     if (inputBuffer == NULL)
  42.     {
  43.         memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  44.     }
  45.     else
  46.     {
  47.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.NewPassword, (S8*) inputBuffer);
  48.     }
  49.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  50.     switch (gSecuritySetupContext.CurrentPassword)
  51.     {
  52.         case 0:
  53.             ShowCategory111Screen(
  54.                 STR_GLOBAL_OK,
  55.                 IMG_GLOBAL_OK,
  56.                 STR_GLOBAL_BACK,
  57.                 IMG_GLOBAL_BACK,
  58.                 STR_SETTING_NEW_PIN,
  59.                 INPUT_TYPE_NUMERIC_PASSWORD,
  60.                 gSecuritySetupContext.NewPassword,
  61.                 (MAX_SIM_SETTING_PASSWD_LEN + 1),
  62.                 NULL,
  63.                 NULL);
  64.             break;
  65.         case 1:
  66.             ShowCategory111Screen(
  67.                 STR_GLOBAL_OK,
  68.                 IMG_GLOBAL_OK,
  69.                 STR_GLOBAL_BACK,
  70.                 IMG_GLOBAL_BACK,
  71.                 STR_SETTING_NEW_PIN2,
  72.                 INPUT_TYPE_NUMERIC_PASSWORD,
  73.                 gSecuritySetupContext.NewPassword,
  74.                 (MAX_SIM_SETTING_PASSWD_LEN + 1),
  75.                 NULL,
  76.                 guiBuffer);
  77.             break;
  78.         case 2:
  79.             ShowCategory111Screen(
  80.                 STR_GLOBAL_OK,
  81.                 IMG_GLOBAL_OK,
  82.                 STR_GLOBAL_BACK,
  83.                 IMG_GLOBAL_BACK,
  84.                 STR_SCR9030_NEW_PW_CAPTION,
  85.                 INPUT_TYPE_NUMERIC_PASSWORD,
  86.                 gSecuritySetupContext.NewPassword,
  87.                 (MAX_SIM_SETTING_PASSWD_LEN + 1),
  88.                 NULL,
  89.                 guiBuffer);
  90.             break;
  91.     }
  92.     SetLeftSoftkeyFunction(EntrySECSETChangePWCfmPWD, KEY_EVENT_UP);
  93.     SetKeyHandler(EntrySECSETChangePWCfmPWD, KEY_POUND, KEY_EVENT_UP);
  94.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  95.     /* micha0606 */
  96.     gSecuritySetupContext.PasswdLenCheckCallBack = EntrySECSETChangePWCfmPWD;
  97.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.NewPassword) < MIN_PASSWORD_LENGTH)
  98.     {
  99.         ChangeLeftSoftkey(0, 0);
  100.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  101.     }
  102. }
  103. /*****************************************************************************
  104.  * FUNCTION
  105.  *  ExitSECSETChangePWNewPWD
  106.  * DESCRIPTION
  107.  *  
  108.  * PARAMETERS
  109.  *  void
  110.  * RETURNS
  111.  *  void
  112.  *****************************************************************************/
  113. void ExitSECSETChangePWNewPWD(void)
  114. {
  115.     /*----------------------------------------------------------------*/
  116.     /* Local Variables                                                */
  117.     /*----------------------------------------------------------------*/
  118.     history Scr;    /* Variable to hold the history data */
  119.     /*----------------------------------------------------------------*/
  120.     /* Code Body                                                      */
  121.     /*----------------------------------------------------------------*/
  122.     Scr.scrnID = SCR_ID_SECSET_CHANGEPW_NEW_PWD;
  123.     Scr.entryFuncPtr = EntrySECSETChangePWNewPWD;
  124.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.NewPassword);
  125.     GetCategoryHistory(Scr.guiBuffer);
  126.     AddHistory(Scr);
  127. }
  128. /*****************************************************************************
  129.  * FUNCTION
  130.  *  EntrySECSETChangePWCfmPWD
  131.  * DESCRIPTION
  132.  *  Entry screen to confirm new pwd for all options.
  133.  * PARAMETERS
  134.  *  void
  135.  * RETURNS
  136.  *  void
  137.  *****************************************************************************/
  138. void EntrySECSETChangePWCfmPWD(void)
  139. {
  140.     /*----------------------------------------------------------------*/
  141.     /* Local Variables                                                */
  142.     /*----------------------------------------------------------------*/
  143.     U8 *guiBuffer;
  144.     U8 *inputBuffer;
  145.     /*----------------------------------------------------------------*/
  146.     /* Code Body                                                      */
  147.     /*----------------------------------------------------------------*/
  148.     EntryNewScreen(SCR_ID_SECSET_CHANGEPW_CFM_PWD, ExitSECSETChangePWCfmPWD, NULL, NULL);
  149.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_CHANGEPW_CFM_PWD);
  150.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_CHANGEPW_CFM_PWD);
  151.     if (inputBuffer == NULL)
  152.     {
  153.         memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  154.     }
  155.     else
  156.     {
  157.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.ConfirmPassword, (S8*) inputBuffer);
  158.     }
  159.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  160.     ShowCategory111Screen(
  161.         STR_GLOBAL_OK,
  162.         IMG_GLOBAL_OK,
  163.         STR_GLOBAL_BACK,
  164.         IMG_GLOBAL_BACK,
  165.         STR_SCR9031_CONFIRM_PW_CAPTION,
  166.         INPUT_TYPE_NUMERIC_PASSWORD,
  167.         gSecuritySetupContext.ConfirmPassword,
  168.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  169.         NULL,
  170.         guiBuffer);
  171.     SetLeftSoftkeyFunction(SendReqToChangePwd, KEY_EVENT_UP);
  172.     SetKeyHandler(SendReqToChangePwd, KEY_POUND, KEY_EVENT_UP);
  173.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  174.     /* micha0606 */
  175.     gSecuritySetupContext.PasswdLenCheckCallBack = SendReqToChangePwd;
  176.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.ConfirmPassword) < MIN_PASSWORD_LENGTH)
  177.     {
  178.         ChangeLeftSoftkey(0, 0);
  179.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  180.     }
  181. }
  182. /*****************************************************************************
  183.  * FUNCTION
  184.  *  ExitSECSETChangePWCfmPWD
  185.  * DESCRIPTION
  186.  *  
  187.  * PARAMETERS
  188.  *  void
  189.  * RETURNS
  190.  *  void
  191.  *****************************************************************************/
  192. void ExitSECSETChangePWCfmPWD(void)
  193. {
  194.     /*----------------------------------------------------------------*/
  195.     /* Local Variables                                                */
  196.     /*----------------------------------------------------------------*/
  197.     history Scr;    /* Variable to hold the history data */
  198.     /*----------------------------------------------------------------*/
  199.     /* Code Body                                                      */
  200.     /*----------------------------------------------------------------*/
  201.     Scr.scrnID = SCR_ID_SECSET_CHANGEPW_CFM_PWD;
  202.     Scr.entryFuncPtr = EntrySECSETChangePWCfmPWD;
  203.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.ConfirmPassword);
  204.     GetCategoryHistory(Scr.guiBuffer);
  205.     AddHistory(Scr);
  206. }
  207. /*****************************************************************************
  208.  * FUNCTION
  209.  *  SendReqToChangePwd
  210.  * DESCRIPTION
  211.  *  Make the req to L4 for change pwd of Phonelock,Pin1/Pin2.
  212.  * PARAMETERS
  213.  *  void
  214.  * RETURNS
  215.  *  void
  216.  *****************************************************************************/
  217. void SendReqToChangePwd(void)
  218. {
  219.     /*----------------------------------------------------------------*/
  220.     /* Local Variables                                                */
  221.     /*----------------------------------------------------------------*/
  222.     MYQUEUE msgStruct;
  223.     PASSWORDREQ *passWord;
  224.     historyNode *History;
  225.     S8 pOutBuffer[(MAX_SIM_SETTING_PASSWD_LEN + 1) + 1];
  226.     /*----------------------------------------------------------------*/
  227.     /* Code Body                                                      */
  228.     /*----------------------------------------------------------------*/
  229.     memset(pOutBuffer, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) + 1);
  230.     //micha0716
  231.     //      passWord = OslConstructDataPtr(sizeof (PASSWORDREQ));
  232.     if ((pfnUnicodeStrcmp((PS8) gSecuritySetupContext.NewPassword, (PS8) gSecuritySetupContext.ConfirmPassword) == 0))
  233.     {
  234.         /* micha0716 */
  235.         passWord = OslConstructDataPtr(sizeof(PASSWORDREQ));
  236.         UnicodeToAnsii(pOutBuffer, (PS8) gSecuritySetupContext.Password);
  237.         memcpy(passWord->old, pOutBuffer, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  238.         memset(pOutBuffer, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) + 1);
  239.         UnicodeToAnsii(pOutBuffer, (PS8) gSecuritySetupContext.NewPassword);
  240.         memcpy(passWord->new1, pOutBuffer, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  241.         memset(pOutBuffer, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) + 1);
  242.         UnicodeToAnsii(pOutBuffer, (PS8) gSecuritySetupContext.ConfirmPassword);
  243.         memcpy(passWord->new2, pOutBuffer, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  244.         switch (gSecuritySetupContext.CurrentPassword)
  245.         {
  246.             case 0:
  247.                 passWord->type = MMI_SETTING_TYPE_CHV1;
  248.                 SetProtocolEventHandler(SECSETChangePasswordPIN1Rsp, PRT_MMI_SMU_CHANGE_PASSWORD_RSP);
  249.                 break;
  250.             case 1:
  251.                 passWord->type = MMI_SETTING_TYPE_CHV2;
  252.                 SetProtocolEventHandler(SECSETChangePasswordPIN2Rsp, PRT_MMI_SMU_CHANGE_PASSWORD_RSP);
  253.                 break;
  254.             case 2:
  255.                 passWord->type = MMI_SETTING_TYPE_PHONELOCK;
  256.                 SetProtocolEventHandler(SECSETChangePasswordPhoneRsp, PRT_MMI_SMU_CHANGE_PASSWORD_RSP);
  257.                 break;
  258.             default:
  259.                 break;
  260.         }
  261.         ClearInputEventHandler(MMI_DEVICE_ALL);
  262.         msgStruct.oslSrcId = MOD_MMI;
  263.         msgStruct.oslDestId = MOD_L4C;
  264.         /* micha1229 */
  265.         msgStruct.oslMsgId = PRT_MMI_SMU_CHANGE_PASSWORD_REQ;
  266.         msgStruct.oslSapId = INVALID_SAP;
  267.         msgStruct.oslDataPtr = (oslParaType*) passWord;
  268.         msgStruct.oslPeerBuffPtr = NULL;
  269.         OslMsgSendExtQueue(&msgStruct);
  270.     }
  271.     else
  272.     {
  273.         memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  274.         memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  275.         switch (gSecuritySetupContext.CurrentPassword)
  276.         {
  277.             case 0:
  278.                 DisplayPopup(
  279.                     (PU8) GetString(STR_DIFF_PIN),
  280.                     IMG_GLOBAL_ERROR,
  281.                     0,
  282.                     ST_NOTIFYDURATION,
  283.                     ERROR_TONE);
  284.                 DeleteUptoScrID(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  285.                 if (GetHistoryScrID(SCR_ID_SECSET_CHANGEPW_NEW_PWD, &History) == ST_SUCCESS)
  286.                 {
  287.                     if (History->inputBuffer != NULL)
  288.                     {
  289.                         memset(History->inputBuffer, 0, ENCODING_LENGTH);
  290.                     }
  291.                     if (History->guiBuffer != NULL)
  292.                     {
  293.                         memset(History->guiBuffer, 0, 2);
  294.                     }
  295.                 }
  296.                 break;
  297.             case 1:
  298.                 DisplayPopup((PU8) GetString(STR_DIFF_PIN2), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  299.                 DeleteUptoScrID(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  300.                 if (GetHistoryScrID(SCR_ID_SECSET_CHANGEPW_NEW_PWD, &History) == ST_SUCCESS)
  301.                 {
  302.                     if (History->inputBuffer != NULL)
  303.                     {
  304.                         memset(History->inputBuffer, 0, ENCODING_LENGTH);
  305.                     }
  306.                     if (History->guiBuffer != NULL)
  307.                     {
  308.                         memset(History->guiBuffer, 0, 2);
  309.                     }
  310.                 }
  311.                 break;
  312.             case 2:
  313.                 DisplayPopup((PU8) GetString(STR_DIFF_PHONE), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  314.                 DeleteUptoScrID(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  315.                 if (GetHistoryScrID(SCR_ID_SECSET_CHANGEPW_NEW_PWD, &History) == ST_SUCCESS)
  316.                 {
  317.                     if (History->inputBuffer != NULL)
  318.                     {
  319.                         memset(History->inputBuffer, 0, ENCODING_LENGTH);
  320.                     }
  321.                     if (History->guiBuffer != NULL)
  322.                     {
  323.                         memset(History->guiBuffer, 0, 2);
  324.                     }
  325.                 }
  326.                 break;
  327.         }
  328.     }
  329. }
  330. /*****************************************************************************
  331.  * FUNCTION
  332.  *  SECSETChangePasswordPhoneRsp
  333.  * DESCRIPTION
  334.  *  Response handler of change phonelock password req.
  335.  * PARAMETERS
  336.  *  info        [?]     
  337.  * RETURNS
  338.  *  void
  339.  *****************************************************************************/
  340. void SECSETChangePasswordPhoneRsp(void *info)
  341. {
  342.     /*----------------------------------------------------------------*/
  343.     /* Local Variables                                                */
  344.     /*----------------------------------------------------------------*/
  345.     RESULTSTRUCT *resp;
  346.     historyNode *History;
  347.     /*----------------------------------------------------------------*/
  348.     /* Code Body                                                      */
  349.     /*----------------------------------------------------------------*/
  350.     resp = (RESULTSTRUCT*) (info);
  351.     memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  352.     memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  353.     memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  354.     if (resp->result == 1)
  355.     {
  356.         DisplayPopup((PU8) GetString(STR_PHONE_CHANGE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  357.         DeleteUptoScrID(SCR_ID_SECSET_CHANGE_PASSWORD);
  358.     }
  359.     else
  360.     {
  361.         DisplayPopup((PU8) GetString(STR_SETTING_WRONG), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  362.         DeleteUptoScrID(SCR_ID_SECSET_CHANGEPW_OLD_PWD);
  363.         if (GetHistoryScrID(SCR_ID_SECSET_CHANGEPW_OLD_PWD, &History) == ST_SUCCESS)
  364.         {
  365.             if (History->inputBuffer != NULL)
  366.             {
  367.                 memset(History->inputBuffer, 0, ENCODING_LENGTH);
  368.             }
  369.             if (History->guiBuffer != NULL)
  370.             {
  371.                 memset(History->guiBuffer, 0, 2);
  372.             }
  373.         }
  374.     }
  375. }
  376. /*****************************************************************************
  377.  * FUNCTION
  378.  *  SECSETChangePasswordPIN1Rsp
  379.  * DESCRIPTION
  380.  *  Response handler of change PIN1 password req.
  381.  * PARAMETERS
  382.  *  info        [?]     
  383.  * RETURNS
  384.  *  void
  385.  *****************************************************************************/
  386. void SECSETChangePasswordPIN1Rsp(void *info)
  387. {
  388.     /*----------------------------------------------------------------*/
  389.     /* Local Variables                                                */
  390.     /*----------------------------------------------------------------*/
  391.     mmi_smu_change_password_rsp_struct *resp;
  392.     historyNode *History;
  393.     /*----------------------------------------------------------------*/
  394.     /* Code Body                                                      */
  395.     /*----------------------------------------------------------------*/
  396.     resp = (mmi_smu_change_password_rsp_struct*) (info);
  397.     FillCountDownNumber(resp->chv_info);
  398.     memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  399.     memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  400.     memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  401.     if (resp->result == 1)
  402.     {
  403.         DisplayPopup((PU8) GetString(STR_PIN_CHANGE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  404.         if (IsScreenPresent(SCR_ID_SECSET_CHANGE_PASSWORD))
  405.         {
  406.             DeleteScreenIfPresent(SCR_ID_SECSET_CHANGEPW_OLD_PWD);
  407.             DeleteScreenIfPresent(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  408.             DeleteScreenIfPresent(SCR_ID_SECSET_CHANGEPW_CFM_PWD);
  409.         }
  410.         else
  411.         {
  412.             DeleteUptoScrID(IDLE_SCREEN_ID);
  413.         }
  414.     }
  415.     else if (resp->result == 0 && resp->cause == MMI_SETTING_TYPE_UBCHV1)
  416.     {
  417.         ExitSECSETPUK1();
  418.         /* micha0519, modify all in this file */
  419.         gSecuritySetupContext.PINBlocked = 1;
  420.         g_pwr_context.PowerOnSIMStatus |= MMI_SIM_STATUS_INVALID;       /* 0x01: Invalid SIM */
  421.         DisplayPopup((PU8) GetString(STR_SETTING_PIN_BLK), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  422.         if (GetHistoryScrID(SCR_ID_SECSET_PUK1, &History) == ST_SUCCESS)
  423.         {
  424.             if (History->inputBuffer != NULL)
  425.             {
  426.                 memset(History->inputBuffer, 0, ENCODING_LENGTH);
  427.             }
  428.             if (History->guiBuffer != NULL)
  429.             {
  430.                 memset(History->guiBuffer, 0, 2);
  431.             }
  432.         }
  433.         DeleteUptoScrID(SCR_ID_SECSET_PUK1);
  434.     }
  435.     else
  436.     {
  437.         DisplayPopup((PU8) GetString(STR_WRONG_PIN), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  438.         if (IsScreenPresent(SCR_ID_SECSET_CHANGEPW_OLD_PWD))
  439.         {
  440.             DeleteUptoScrID(SCR_ID_SECSET_CHANGEPW_OLD_PWD);
  441.             if (GetHistoryScrID(SCR_ID_SECSET_CHANGEPW_OLD_PWD, &History) == ST_SUCCESS)
  442.             {
  443.                 if (History->inputBuffer != NULL)
  444.                 {
  445.                     memset(History->inputBuffer, 0, ENCODING_LENGTH);
  446.                 }
  447.                 if (History->guiBuffer != NULL)
  448.                 {
  449.                     memset(History->guiBuffer, 0, 2);
  450.                 }
  451.             }
  452.         }
  453.         else
  454.         {
  455.             DeleteUptoScrID(IDLE_SCREEN_ID);
  456.         }
  457.     }
  458. }
  459. /*****************************************************************************
  460.  * FUNCTION
  461.  *  SECSETChangePasswordPIN2Rsp
  462.  * DESCRIPTION
  463.  *  Response handler of change Pin2 password req.
  464.  * PARAMETERS
  465.  *  info        [?]     
  466.  * RETURNS
  467.  *  void
  468.  *****************************************************************************/
  469. void SECSETChangePasswordPIN2Rsp(void *info)
  470. {
  471.     /*----------------------------------------------------------------*/
  472.     /* Local Variables                                                */
  473.     /*----------------------------------------------------------------*/
  474.     mmi_smu_change_password_rsp_struct *resp;
  475.     historyNode *History;
  476.     /*----------------------------------------------------------------*/
  477.     /* Code Body                                                      */
  478.     /*----------------------------------------------------------------*/
  479.     resp = (mmi_smu_change_password_rsp_struct*) (info);
  480.     FillCountDownNumber(resp->chv_info);
  481.     memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  482.     memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  483.     memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  484.     if (resp->result == 1)
  485.     {
  486.         DisplayPopup((PU8) GetString(STR_PIN2_CHANGE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  487.         if (IsScreenPresent(SCR_ID_SECSET_CHANGE_PASSWORD))
  488.         {
  489.             DeleteScreenIfPresent(SCR_ID_SECSET_CHANGEPW_OLD_PWD);
  490.             DeleteScreenIfPresent(SCR_ID_SECSET_CHANGEPW_NEW_PWD);
  491.             DeleteScreenIfPresent(SCR_ID_SECSET_CHANGEPW_CFM_PWD);
  492.         }
  493.         else
  494.         {
  495.             DeleteUptoScrID(IDLE_SCREEN_ID);
  496.         }
  497.     }
  498.     else if (resp->result == 0 && resp->cause == MMI_SETTING_TYPE_UBCHV2)
  499.     {
  500.         ExitSECSETPUK2();
  501.         DisplayPopup((PU8) GetString(STR_SETTING_PIN2_BLK), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  502.         if (GetHistoryScrID(SCR_ID_SECSET_PUK2, &History) == ST_SUCCESS)
  503.         {
  504.             if (History->inputBuffer != NULL)
  505.             {
  506.                 memset(History->inputBuffer, 0, ENCODING_LENGTH);
  507.             }
  508.             if (History->guiBuffer != NULL)
  509.             {
  510.                 memset(History->guiBuffer, 0, 2);
  511.             }
  512.         }
  513.         DeleteUptoScrID(SCR_ID_SECSET_PUK2);
  514.     }
  515.     else
  516.     {
  517.         DisplayPopup((PU8) GetString(STR_WRONG_PIN2), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  518.         if (IsScreenPresent(SCR_ID_SECSET_CHANGEPW_OLD_PWD))
  519.         {
  520.             DeleteUptoScrID(SCR_ID_SECSET_CHANGEPW_OLD_PWD);
  521.             if (GetHistoryScrID(SCR_ID_SECSET_CHANGEPW_OLD_PWD, &History) == ST_SUCCESS)
  522.             {
  523.                 if (History->inputBuffer != NULL)
  524.                 {
  525.                     memset(History->inputBuffer, 0, ENCODING_LENGTH);
  526.                 }
  527.                 if (History->guiBuffer != NULL)
  528.                 {
  529.                     memset(History->guiBuffer, 0, 2);
  530.                 }
  531.             }
  532.         }
  533.         else
  534.         {
  535.             DeleteUptoScrID(IDLE_SCREEN_ID);
  536.         }
  537.     }
  538. }
  539. /*****************************************************************************
  540.  * FUNCTION
  541.  *  GetPhoneLock
  542.  * DESCRIPTION
  543.  *  Get the status of phonelock from NVRAM.
  544.  * PARAMETERS
  545.  *  void
  546.  * RETURNS
  547.  *  pBOOL
  548.  *  
  549.  *  Author            : Vanita Jain
  550.  *****************************************************************************/
  551. U8 GetPhoneLock(void)
  552. {
  553. #ifdef MMI_ON_HARDWARE_P
  554.     /*----------------------------------------------------------------*/
  555.     /* Local Variables                                                */
  556.     /*----------------------------------------------------------------*/
  557.     /*----------------------------------------------------------------*/
  558.     /* Code Body                                                      */
  559.     /*----------------------------------------------------------------*/
  560.     gSecuritySetupContext.PhoneLockStatus = smu_query_phone_lock_enabled();
  561.     if (gSecuritySetupContext.PhoneLockStatus == 1)
  562.     {
  563.         return MMI_TRUE;
  564.     }
  565.     else
  566.     {
  567.         return MMI_FALSE;
  568.     }
  569. #else /* MMI_ON_HARDWARE_P */ 
  570.     U8 data = 0;
  571.     S16 error;
  572.     ReadValue(NVRAM_SETTING_PHONELOCK, &data, DS_BYTE, &error);
  573.     gSecuritySetupContext.PhoneLockStatus = data;
  574.     if (gSecuritySetupContext.PhoneLockStatus == 1)
  575.     {
  576.         return MMI_TRUE;
  577.     }
  578.     else if (gSecuritySetupContext.PhoneLockStatus == 0xff)
  579.     {
  580.         data = 0;
  581.         WriteValue(NVRAM_SETTING_PHONELOCK, &data, DS_BYTE, &error);
  582.         return MMI_FALSE;
  583.     }
  584.     else
  585.     {
  586.         return MMI_FALSE;
  587.     }
  588. #endif /* MMI_ON_HARDWARE_P */ 
  589. }
  590. /*****************************************************************************
  591.  * FUNCTION
  592.  *  GetAutoKeypadLockTime
  593.  * DESCRIPTION
  594.  *  API to return the Autokeypadlock time.
  595.  * PARAMETERS
  596.  *  void
  597.  * RETURNS
  598.  *  pBOOL
  599.  *  
  600.  *  Author            : Vanita Jain
  601.  *****************************************************************************/
  602. SETTING_AKPL_TIME GetAutoKeypadLockTime(void)
  603. {
  604.     /*----------------------------------------------------------------*/
  605.     /* Local Variables                                                */
  606.     /*----------------------------------------------------------------*/
  607.     U8 data = 0;
  608.     S16 error;
  609.     /*----------------------------------------------------------------*/
  610.     /* Code Body                                                      */
  611.     /*----------------------------------------------------------------*/
  612.     ReadValue(NVRAM_SETTING_AUTOKEYPADLOCK_TIME, &data, DS_BYTE, &error);
  613.     if (data == 0xff)
  614.     {
  615.         data = 0;
  616.         WriteValue(NVRAM_SETTING_AUTOKEYPADLOCK_TIME, &data, DS_BYTE, &error);
  617.     }
  618.     return (SETTING_AKPL_TIME) (data);
  619. }
  620. /*****************************************************************************
  621.  * FUNCTION
  622.  *  SettingChangePasswdPuk
  623.  * DESCRIPTION
  624.  *  Displays popup that Pin1/Pin2 changed.
  625.  * PARAMETERS
  626.  *  void
  627.  * RETURNS
  628.  *  pBOOL(?)
  629.  *  
  630.  *  Author            : Vanita Jain(?)
  631.  *****************************************************************************/
  632. void SettingChangePasswdPuk(void)
  633. {
  634.     /*----------------------------------------------------------------*/
  635.     /* Local Variables                                                */
  636.     /*----------------------------------------------------------------*/
  637.     /*----------------------------------------------------------------*/
  638.     /* Code Body                                                      */
  639.     /*----------------------------------------------------------------*/
  640.     if (gSecuritySetupContext.CurrentPassword == 0)
  641.     {
  642.         DisplayPopup((PU8) GetString(STR_PIN_CHANGE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  643.         GoBackToPasswordScr();
  644.     }
  645.     else
  646.     {
  647.         DisplayPopup((PU8) GetString(STR_PIN2_CHANGE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  648.         GoBackToPasswordScr();
  649.     }
  650. }
  651. /*****************************************************************************
  652.  * FUNCTION
  653.  *  GoBackToPasswordScr
  654.  * DESCRIPTION
  655.  *  Delete history upto Changepassword screen.
  656.  * PARAMETERS
  657.  *  void
  658.  * RETURNS
  659.  *  void
  660.  *  
  661.  *  Author            : Vanita Jain(?)
  662.  *****************************************************************************/
  663. void GoBackToPasswordScr(void)
  664. {
  665.     /*----------------------------------------------------------------*/
  666.     /* Local Variables                                                */
  667.     /*----------------------------------------------------------------*/
  668.     /*----------------------------------------------------------------*/
  669.     /* Code Body                                                      */
  670.     /*----------------------------------------------------------------*/
  671.     DeleteUptoScrID(SCR_ID_SECSET_CHANGE_PASSWORD);
  672. }
  673. /*****************************************************************************
  674.  * FUNCTION
  675.  *  DialSoSPUK1
  676.  * DESCRIPTION
  677.  *  Function takes care that from which buffer DialPadBuffer should be filled up.
  678.  * PARAMETERS
  679.  *  void
  680.  * RETURNS
  681.  *  void
  682.  *****************************************************************************/
  683. void DialSoSPUK1(void)
  684. {
  685.     /*----------------------------------------------------------------*/
  686.     /* Local Variables                                                */
  687.     /*----------------------------------------------------------------*/
  688.     /*----------------------------------------------------------------*/
  689.     /* Code Body                                                      */
  690.     /*----------------------------------------------------------------*/
  691.     pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gSecuritySetupContext.NewPassword);
  692.     EntryScrEmergencyCallDialing();
  693. }
  694. /*****************************************************************************
  695.  * FUNCTION
  696.  *  DialSoSNewPIN1
  697.  * DESCRIPTION
  698.  *  Function takes care that from which buffer DialPadBuffer should be filled up.
  699.  * PARAMETERS
  700.  *  void
  701.  * RETURNS
  702.  *  void
  703.  *****************************************************************************/
  704. void DialSoSNewPIN1(void)
  705. {
  706.     /*----------------------------------------------------------------*/
  707.     /* Local Variables                                                */
  708.     /*----------------------------------------------------------------*/
  709.     /*----------------------------------------------------------------*/
  710.     /* Code Body                                                      */
  711.     /*----------------------------------------------------------------*/
  712.     pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gSecuritySetupContext.Password);
  713.     EntryScrEmergencyCallDialing();
  714. }
  715. /*****************************************************************************
  716.  * FUNCTION
  717.  *  DialSoSNewPIN1Conf
  718.  * DESCRIPTION
  719.  *  Function takes care that from which buffer DialPadBuffer should be filled up.
  720.  * PARAMETERS
  721.  *  void
  722.  * RETURNS
  723.  *  void
  724.  *****************************************************************************/
  725. void DialSoSNewPIN1Conf(void)
  726. {
  727.     /*----------------------------------------------------------------*/
  728.     /* Local Variables                                                */
  729.     /*----------------------------------------------------------------*/
  730.     /*----------------------------------------------------------------*/
  731.     /* Code Body                                                      */
  732.     /*----------------------------------------------------------------*/
  733.     pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, (S8*) gSecuritySetupContext.ConfirmPassword);
  734.     EntryScrEmergencyCallDialing();
  735. }
  736. /*****************************************************************************
  737.  * FUNCTION
  738.  *  EntrySECSETPUK1
  739.  * DESCRIPTION
  740.  *  Entry fn for PUK.
  741.  * PARAMETERS
  742.  *  void
  743.  * RETURNS
  744.  *  void
  745.  *****************************************************************************/
  746. void EntrySECSETPUK1(void)
  747. {
  748.     /*----------------------------------------------------------------*/
  749.     /* Local Variables                                                */
  750.     /*----------------------------------------------------------------*/
  751.     U8 *guiBuffer;
  752.     U8 *inputBuffer;
  753.     U8 PassCountdownDisp[MAX_PASS_COUNTDOWN_DISP];
  754.     /*----------------------------------------------------------------*/
  755.     /* Code Body                                                      */
  756.     /*----------------------------------------------------------------*/
  757.     EntryNewScreen(SCR_ID_SECSET_PUK1, ExitSECSETPUK1, NULL, NULL);
  758.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_PUK1);
  759.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_PUK1);
  760.     if (inputBuffer == NULL)
  761.     {
  762.         memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  763.     }
  764.     else
  765.     {
  766.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.NewPassword, (S8*) inputBuffer);
  767.     }
  768.     g_pwr_context.PowerOnSIMStatus |= MMI_SIM_STATUS_INVALID;   /* 0x01: Invalid SIM */
  769.     gSecuritySetupContext.PINBlocked = 1;
  770.     RegisterInputBoxValidationFunction(ScrSettingPukValidation);
  771.     FillCountDownString(MMI_SETTING_TYPE_UBCHV1, PassCountdownDisp);
  772.     sprintf(g_idle_context.DialPadCallBuffer, ""); /* reset dial pad for input * to start ssc */
  773.     ShowCategory111Screen(
  774.         STR_GLOBAL_OK,  /* OK */
  775.         IMG_GLOBAL_OK,
  776.         STR_SETTING_SOS,
  777.         0,
  778.         STR_SETTING_PUK,
  779.         INPUT_TYPE_NUMERIC_PASSWORD,
  780.         gSecuritySetupContext.NewPassword,
  781.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  782.         PassCountdownDisp,
  783.         guiBuffer);
  784.     SetCategory111RightSoftkeyFunction(ShowMakeSOSCallScr, KEY_EVENT_UP);
  785.     SetKeyHandler(DialSoSPUK1, KEY_SEND, KEY_EVENT_UP);
  786.     SetKeyHandler(SSCHandleEnterPUK, KEY_STAR, KEY_EVENT_DOWN);
  787.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  788.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  789.     SetLeftSoftkeyFunction(EntrySECSETPUKNewPIN1, KEY_EVENT_UP);
  790.     SetKeyHandler(EntrySECSETPUKNewPIN1, KEY_POUND, KEY_EVENT_UP);
  791.     /* micha0606 */
  792.     gSecuritySetupContext.PasswdLenCheckCallBack = EntrySECSETPUKNewPIN1;
  793.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.NewPassword) < MMI_MIN_PUK_LENGTH)
  794.     {
  795.         ChangeLeftSoftkey(0, 0);
  796.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  797.     }
  798. }
  799. /*****************************************************************************
  800.  * FUNCTION
  801.  *  ExitSECSETPUK1
  802.  * DESCRIPTION
  803.  *  
  804.  * PARAMETERS
  805.  *  void
  806.  * RETURNS
  807.  *  void
  808.  *****************************************************************************/
  809. void ExitSECSETPUK1(void)
  810. {
  811.     /*----------------------------------------------------------------*/
  812.     /* Local Variables                                                */
  813.     /*----------------------------------------------------------------*/
  814.     history Scr;    /* Variable to hold the history data */
  815.     /*----------------------------------------------------------------*/
  816.     /* Code Body                                                      */
  817.     /*----------------------------------------------------------------*/
  818.     Scr.scrnID = SCR_ID_SECSET_PUK1;
  819.     Scr.entryFuncPtr = EntrySECSETPUK1;
  820.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.NewPassword);
  821.     GetCategoryHistory(Scr.guiBuffer);
  822.     AddHistory(Scr);
  823. }
  824. /*****************************************************************************
  825.  * FUNCTION
  826.  *  EntrySECSETPUKNewPIN1
  827.  * DESCRIPTION
  828.  *  Entry fn to enter new PIN
  829.  * PARAMETERS
  830.  *  void
  831.  * RETURNS
  832.  *  void
  833.  *****************************************************************************/
  834. void EntrySECSETPUKNewPIN1(void)
  835. {
  836.     /*----------------------------------------------------------------*/
  837.     /* Local Variables                                                */
  838.     /*----------------------------------------------------------------*/
  839.     U8 *guiBuffer;  /* Buffer holding history data */
  840.     U8 *inputBuffer;
  841.     /*----------------------------------------------------------------*/
  842.     /* Code Body                                                      */
  843.     /*----------------------------------------------------------------*/
  844.     EntryNewScreen(SCR_ID_SECSET_PUK_NEW_PIN1, ExitSECSETNewPIN1, NULL, NULL);
  845.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_PUK_NEW_PIN1);
  846.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_PUK_NEW_PIN1);
  847.     if (inputBuffer == NULL)
  848.     {
  849.         memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  850.     }
  851.     else
  852.     {
  853.         memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  854.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.Password, (S8*) inputBuffer);
  855.     }
  856.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  857.     ShowCategory111Screen(
  858.         STR_GLOBAL_OK,  /* OK */
  859.         IMG_GLOBAL_OK,
  860.         STR_GLOBAL_BACK,
  861.         IMG_GLOBAL_BACK,
  862.         STR_NEW_PIN1,
  863.         INPUT_TYPE_NUMERIC_PASSWORD,
  864.         gSecuritySetupContext.Password,
  865.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  866.         NULL,
  867.         guiBuffer);
  868.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  869.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  870.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  871.     SetLeftSoftkeyFunction(EntrySECSETPUKConfirmPIN1, KEY_EVENT_UP);
  872.     SetKeyHandler(EntrySECSETPUKConfirmPIN1, KEY_POUND, KEY_EVENT_UP);
  873.     SetKeyHandler(DialSoSNewPIN1, KEY_SEND, KEY_EVENT_UP);
  874.     /* micha0606 */
  875.     gSecuritySetupContext.PasswdLenCheckCallBack = EntrySECSETPUKConfirmPIN1;
  876.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.Password) < MIN_PASSWORD_LENGTH)
  877.     {
  878.         ChangeLeftSoftkey(0, 0);
  879.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  880.     }
  881. }
  882. /*****************************************************************************
  883.  * FUNCTION
  884.  *  ExitSECSETNewPIN1
  885.  * DESCRIPTION
  886.  *  
  887.  * PARAMETERS
  888.  *  void
  889.  * RETURNS
  890.  *  void
  891.  *****************************************************************************/
  892. void ExitSECSETNewPIN1(void)
  893. {
  894.     /*----------------------------------------------------------------*/
  895.     /* Local Variables                                                */
  896.     /*----------------------------------------------------------------*/
  897.     history Scr;    /* Variable to hold the history data */
  898.     /*----------------------------------------------------------------*/
  899.     /* Code Body                                                      */
  900.     /*----------------------------------------------------------------*/
  901.     Scr.scrnID = SCR_ID_SECSET_PUK_NEW_PIN1;
  902.     Scr.entryFuncPtr = EntrySECSETPUKNewPIN1;
  903.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.Password);
  904.     GetCategoryHistory(Scr.guiBuffer);
  905.     AddHistory(Scr);
  906. }
  907. /*****************************************************************************
  908.  * FUNCTION
  909.  *  EntrySECSETPUKConfirmPIN1
  910.  * DESCRIPTION
  911.  *  ENtry fn for confirm PIN.
  912.  * PARAMETERS
  913.  *  void
  914.  * RETURNS
  915.  *  void
  916.  *****************************************************************************/
  917. void EntrySECSETPUKConfirmPIN1(void)
  918. {
  919.     /*----------------------------------------------------------------*/
  920.     /* Local Variables                                                */
  921.     /*----------------------------------------------------------------*/
  922.     U8 *guiBuffer;  /* Buffer holding history data */
  923.     U8 *inputBuffer;
  924.     /*----------------------------------------------------------------*/
  925.     /* Code Body                                                      */
  926.     /*----------------------------------------------------------------*/
  927.     EntryNewScreen(SCR_ID_SECSET_PUK_CONFIRM_PIN1, ExitSECSETNewPIN1Confirm, NULL, NULL);
  928.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_PUK_CONFIRM_PIN1);
  929.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_PUK_CONFIRM_PIN1);
  930.     if (inputBuffer == NULL)
  931.     {
  932.         memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  933.     }
  934.     else
  935.     {
  936.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.ConfirmPassword, (S8*) inputBuffer);
  937.     }
  938.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  939.     ShowCategory111Screen(
  940.         STR_GLOBAL_OK,  /* OK */
  941.         IMG_GLOBAL_OK,
  942.         STR_GLOBAL_BACK,
  943.         IMG_GLOBAL_BACK,
  944.         STR_SCR9031_CONFIRM_PW_CAPTION,
  945.         INPUT_TYPE_NUMERIC_PASSWORD,
  946.         gSecuritySetupContext.ConfirmPassword,
  947.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  948.         NULL,
  949.         guiBuffer);
  950.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  951.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  952.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  953.     SetKeyHandler(ValidateNewPin1, KEY_POUND, KEY_EVENT_UP);
  954.     SetLeftSoftkeyFunction(ValidateNewPin1, KEY_EVENT_UP);
  955.     SetKeyHandler(DialSoSNewPIN1Conf, KEY_SEND, KEY_EVENT_UP);
  956.     /* micha0606 */
  957.     gSecuritySetupContext.PasswdLenCheckCallBack = ValidateNewPin1;
  958.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.ConfirmPassword) < MIN_PASSWORD_LENGTH)
  959.     {
  960.         ChangeLeftSoftkey(0, 0);
  961.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  962.     }
  963. }
  964. /*****************************************************************************
  965.  * FUNCTION
  966.  *  ExitSECSETNewPIN1Confirm
  967.  * DESCRIPTION
  968.  *  
  969.  * PARAMETERS
  970.  *  void
  971.  * RETURNS
  972.  *  void
  973.  *****************************************************************************/
  974. void ExitSECSETNewPIN1Confirm(void)
  975. {
  976.     /*----------------------------------------------------------------*/
  977.     /* Local Variables                                                */
  978.     /*----------------------------------------------------------------*/
  979.     history Scr;    /* Variable to hold the history data */
  980.     /*----------------------------------------------------------------*/
  981.     /* Code Body                                                      */
  982.     /*----------------------------------------------------------------*/
  983.     Scr.scrnID = SCR_ID_SECSET_PUK_CONFIRM_PIN1;
  984.     Scr.entryFuncPtr = EntrySECSETPUKConfirmPIN1;
  985.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.ConfirmPassword);
  986.     GetCategoryHistory(Scr.guiBuffer);
  987.     AddHistory(Scr);
  988. }
  989. /*****************************************************************************
  990.  * FUNCTION
  991.  *  ValidateNewPin1
  992.  * DESCRIPTION
  993.  *  validates the length of Both new pin and confirm pin and also
  994.  *  Check if both Pin matches.
  995.  * PARAMETERS
  996.  *  void
  997.  * RETURNS
  998.  *  void
  999.  *****************************************************************************/
  1000. void ValidateNewPin1(void)
  1001. {
  1002.     /*----------------------------------------------------------------*/
  1003.     /* Local Variables                                                */
  1004.     /*----------------------------------------------------------------*/
  1005.     historyNode *History;
  1006.     /*----------------------------------------------------------------*/
  1007.     /* Code Body                                                      */
  1008.     /*----------------------------------------------------------------*/
  1009.     if (memcmp
  1010.         (gSecuritySetupContext.Password, gSecuritySetupContext.ConfirmPassword,
  1011.          ((MAX_SIM_SETTING_PASSWD_LEN + 1) - 1) * ENCODING_LENGTH) == 0)
  1012.     {
  1013.         SECSETVerifyPINReq(
  1014.             MMI_SETTING_TYPE_UBCHV1,
  1015.             gSecuritySetupContext.NewPassword,
  1016.             gSecuritySetupContext.Password,
  1017.             ValidateNewPin1Success);
  1018.     }
  1019.     else
  1020.     {
  1021.         DisplayPopup(
  1022.             (PU8) GetString(STR_DIFF_PIN),
  1023.             IMG_GLOBAL_ERROR,
  1024.             0,
  1025.             ST_NOTIFYDURATION,
  1026.             ERROR_TONE);
  1027.         DeleteUptoScrID(SCR_ID_SECSET_PUK_NEW_PIN1);
  1028.         if (GetHistoryScrID(SCR_ID_SECSET_PUK_NEW_PIN1, &History) == ST_SUCCESS)
  1029.         {
  1030.             if (History->inputBuffer != NULL)
  1031.             {
  1032.                 memset(History->inputBuffer, 0, ENCODING_LENGTH);
  1033.             }
  1034.             if (History->guiBuffer != NULL)
  1035.             {
  1036.                 memset(History->guiBuffer, 0, 2);
  1037.             }
  1038.         }
  1039.     }
  1040. }
  1041. /*****************************************************************************
  1042.  * FUNCTION
  1043.  *  ValidateNewPin1Success
  1044.  * DESCRIPTION
  1045.  *  validates the length of Both new pin and confirm pin and also
  1046.  *  Check if both Pin matches.
  1047.  * PARAMETERS
  1048.  *  void
  1049.  * RETURNS
  1050.  *  void
  1051.  *****************************************************************************/
  1052. void ValidateNewPin1Success(void)
  1053. {
  1054.     /*----------------------------------------------------------------*/
  1055.     /* Local Variables                                                */
  1056.     /*----------------------------------------------------------------*/
  1057.     /*----------------------------------------------------------------*/
  1058.     /* Code Body                                                      */
  1059.     /*----------------------------------------------------------------*/
  1060.     SECSETGetPIN1StatusReq();
  1061.     DisplayPopup((PU8) GetString(STR_SETTING_CODE_VERIFIED), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  1062.     DeleteUptoScrID(IDLE_SCREEN_ID);
  1063. }
  1064. /*****************************************************************************
  1065.  * FUNCTION
  1066.  *  EntrySECSETPUK2
  1067.  * DESCRIPTION
  1068.  *  Entry fn for PUK.
  1069.  * PARAMETERS
  1070.  *  void
  1071.  * RETURNS
  1072.  *  void
  1073.  *****************************************************************************/
  1074. void EntrySECSETPUK2(void)
  1075. {
  1076.     /*----------------------------------------------------------------*/
  1077.     /* Local Variables                                                */
  1078.     /*----------------------------------------------------------------*/
  1079.     U8 *guiBuffer;
  1080.     U8 *inputBuffer;
  1081.     U8 PassCountdownDisp[MAX_PASS_COUNTDOWN_DISP];
  1082.     /*----------------------------------------------------------------*/
  1083.     /* Code Body                                                      */
  1084.     /*----------------------------------------------------------------*/
  1085.     EntryNewScreen(SCR_ID_SECSET_PUK2, ExitSECSETPUK2, NULL, NULL);
  1086.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_PUK2);
  1087.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_PUK2);
  1088.     if (inputBuffer == NULL)
  1089.     {
  1090.         memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  1091.     }
  1092.     else
  1093.     {
  1094.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.NewPassword, (S8*) inputBuffer);
  1095.     }
  1096.     RegisterInputBoxValidationFunction(ScrSettingPukValidation);
  1097.     FillCountDownString(MMI_SETTING_TYPE_UBCHV2, PassCountdownDisp);
  1098.     ShowCategory111Screen(
  1099.         STR_GLOBAL_OK,  /* OK */
  1100.         IMG_GLOBAL_OK,
  1101.         STR_GLOBAL_BACK,
  1102.         IMG_GLOBAL_BACK,
  1103.         STR_SETTING_ENTER_PUK2,
  1104.         INPUT_TYPE_NUMERIC_PASSWORD,
  1105.         gSecuritySetupContext.NewPassword,
  1106.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  1107.         PassCountdownDisp,
  1108.         guiBuffer);
  1109.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1110.     SetLeftSoftkeyFunction(EntrySECSETPUK2NewPIN2, KEY_EVENT_UP);
  1111.     SetKeyHandler(EntrySECSETPUK2NewPIN2, KEY_POUND, KEY_EVENT_UP);
  1112.     /* micha0606 */
  1113.     gSecuritySetupContext.PasswdLenCheckCallBack = EntrySECSETPUK2NewPIN2;
  1114.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.NewPassword) < MMI_MIN_PUK_LENGTH)
  1115.     {
  1116.         ChangeLeftSoftkey(0, 0);
  1117.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1118.     }
  1119. }
  1120. /*****************************************************************************
  1121.  * FUNCTION
  1122.  *  ExitSECSETPUK2
  1123.  * DESCRIPTION
  1124.  *  
  1125.  * PARAMETERS
  1126.  *  void
  1127.  * RETURNS
  1128.  *  void
  1129.  *****************************************************************************/
  1130. void ExitSECSETPUK2(void)
  1131. {
  1132.     /*----------------------------------------------------------------*/
  1133.     /* Local Variables                                                */
  1134.     /*----------------------------------------------------------------*/
  1135.     history Scr;    /* Variable to hold the history data */
  1136.     /*----------------------------------------------------------------*/
  1137.     /* Code Body                                                      */
  1138.     /*----------------------------------------------------------------*/
  1139.     Scr.scrnID = SCR_ID_SECSET_PUK2;
  1140.     Scr.entryFuncPtr = EntrySECSETPUK2;
  1141.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.NewPassword);
  1142.     GetCategoryHistory(Scr.guiBuffer);
  1143.     AddHistory(Scr);
  1144. }
  1145. /*****************************************************************************
  1146.  * FUNCTION
  1147.  *  EntrySECSETPUK2NewPIN2
  1148.  * DESCRIPTION
  1149.  *  Entry fn to enter new PIN
  1150.  * PARAMETERS
  1151.  *  void
  1152.  * RETURNS
  1153.  *  void
  1154.  *****************************************************************************/
  1155. void EntrySECSETPUK2NewPIN2(void)
  1156. {
  1157.     /*----------------------------------------------------------------*/
  1158.     /* Local Variables                                                */
  1159.     /*----------------------------------------------------------------*/
  1160.     U8 *guiBuffer;  /* Buffer holding history data */
  1161.     U8 *inputBuffer;
  1162.     /*----------------------------------------------------------------*/
  1163.     /* Code Body                                                      */
  1164.     /*----------------------------------------------------------------*/
  1165.     EntryNewScreen(SCR_ID_SECSET_PUK2_NEW_PIN2, ExitSECSETNewPIN2, NULL, NULL);
  1166.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_PUK2_NEW_PIN2);
  1167.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_PUK2_NEW_PIN2);
  1168.     if (inputBuffer == NULL)
  1169.     {
  1170.         memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  1171.     }
  1172.     else
  1173.     {
  1174.         memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  1175.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.Password, (S8*) inputBuffer);
  1176.     }
  1177.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  1178.     ShowCategory111Screen(
  1179.         STR_GLOBAL_OK,  /* OK */
  1180.         IMG_GLOBAL_OK,
  1181.         STR_GLOBAL_BACK,
  1182.         IMG_GLOBAL_BACK,
  1183.         STR_SETTING_ENTER_NEW_PIN2,
  1184.         INPUT_TYPE_NUMERIC_PASSWORD,
  1185.         gSecuritySetupContext.Password,
  1186.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  1187.         NULL,
  1188.         guiBuffer);
  1189.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1190.     SetLeftSoftkeyFunction(EntrySECSETPUK2ConfirmPIN2, KEY_EVENT_UP);
  1191.     SetKeyHandler(EntrySECSETPUK2ConfirmPIN2, KEY_POUND, KEY_EVENT_UP);
  1192.     /* micha0606 */
  1193.     gSecuritySetupContext.PasswdLenCheckCallBack = EntrySECSETPUK2ConfirmPIN2;
  1194.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.Password) < MIN_PASSWORD_LENGTH)
  1195.     {
  1196.         ChangeLeftSoftkey(0, 0);
  1197.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1198.     }
  1199. }
  1200. /*****************************************************************************
  1201.  * FUNCTION
  1202.  *  ExitSECSETNewPIN2
  1203.  * DESCRIPTION
  1204.  *  
  1205.  * PARAMETERS
  1206.  *  void
  1207.  * RETURNS
  1208.  *  void
  1209.  *****************************************************************************/
  1210. void ExitSECSETNewPIN2(void)
  1211. {
  1212.     /*----------------------------------------------------------------*/
  1213.     /* Local Variables                                                */
  1214.     /*----------------------------------------------------------------*/
  1215.     history Scr;    /* Variable to hold the history data */
  1216.     /*----------------------------------------------------------------*/
  1217.     /* Code Body                                                      */
  1218.     /*----------------------------------------------------------------*/
  1219.     Scr.scrnID = SCR_ID_SECSET_PUK2_NEW_PIN2;
  1220.     Scr.entryFuncPtr = EntrySECSETPUK2NewPIN2;
  1221.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.Password);
  1222.     GetCategoryHistory(Scr.guiBuffer);
  1223.     AddHistory(Scr);
  1224. }
  1225. /*****************************************************************************
  1226.  * FUNCTION
  1227.  *  EntrySECSETPUK2ConfirmPIN2
  1228.  * DESCRIPTION
  1229.  *  ENtry fn for confirm PIN.
  1230.  * PARAMETERS
  1231.  *  void
  1232.  * RETURNS
  1233.  *  void
  1234.  *****************************************************************************/
  1235. void EntrySECSETPUK2ConfirmPIN2(void)
  1236. {
  1237.     /*----------------------------------------------------------------*/
  1238.     /* Local Variables                                                */
  1239.     /*----------------------------------------------------------------*/
  1240.     U8 *guiBuffer;  /* Buffer holding history data */
  1241.     U8 *inputBuffer;
  1242.     /*----------------------------------------------------------------*/
  1243.     /* Code Body                                                      */
  1244.     /*----------------------------------------------------------------*/
  1245.     EntryNewScreen(SCR_ID_SECSET_PUK2_CONFIRM_PIN2, ExitSECSETNewPIN2Confirm, NULL, NULL);
  1246.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_PUK2_CONFIRM_PIN2);
  1247.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_PUK2_CONFIRM_PIN2);
  1248.     if (inputBuffer == NULL)
  1249.     {
  1250.         memset(gSecuritySetupContext.ConfirmPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  1251.     }
  1252.     else
  1253.     {
  1254.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.ConfirmPassword, (S8*) inputBuffer);
  1255.     }
  1256.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  1257.     ShowCategory111Screen(
  1258.         STR_GLOBAL_OK,  /* OK */
  1259.         IMG_GLOBAL_OK,
  1260.         STR_GLOBAL_BACK,
  1261.         IMG_GLOBAL_BACK,
  1262.         STR_SCR9031_CONFIRM_PW_CAPTION,
  1263.         INPUT_TYPE_NUMERIC_PASSWORD,
  1264.         gSecuritySetupContext.ConfirmPassword,
  1265.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  1266.         NULL,
  1267.         guiBuffer);
  1268.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1269.     SetKeyHandler(ValidateNewPin2, KEY_POUND, KEY_EVENT_UP);
  1270.     SetLeftSoftkeyFunction(ValidateNewPin2, KEY_EVENT_UP);
  1271.     /* micha0606 */
  1272.     gSecuritySetupContext.PasswdLenCheckCallBack = ValidateNewPin2;
  1273.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.ConfirmPassword) < MIN_PASSWORD_LENGTH)
  1274.     {
  1275.         ChangeLeftSoftkey(0, 0);
  1276.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1277.     }
  1278. }
  1279. /*****************************************************************************
  1280.  * FUNCTION
  1281.  *  ExitSECSETNewPIN2Confirm
  1282.  * DESCRIPTION
  1283.  *  
  1284.  * PARAMETERS
  1285.  *  void
  1286.  * RETURNS
  1287.  *  void
  1288.  *****************************************************************************/
  1289. void ExitSECSETNewPIN2Confirm(void)
  1290. {
  1291.     /*----------------------------------------------------------------*/
  1292.     /* Local Variables                                                */
  1293.     /*----------------------------------------------------------------*/
  1294.     history Scr;    /* Variable to hold the history data */
  1295.     /*----------------------------------------------------------------*/
  1296.     /* Code Body                                                      */
  1297.     /*----------------------------------------------------------------*/
  1298.     Scr.scrnID = SCR_ID_SECSET_PUK2_CONFIRM_PIN2;
  1299.     Scr.entryFuncPtr = EntrySECSETPUK2ConfirmPIN2;
  1300.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.ConfirmPassword);
  1301.     GetCategoryHistory(Scr.guiBuffer);
  1302.     AddHistory(Scr);
  1303. }
  1304. /*****************************************************************************
  1305.  * FUNCTION
  1306.  *  ValidateNewPin2
  1307.  * DESCRIPTION
  1308.  *  validates the length of Both new pin and confirm pin and also
  1309.  *  Check if both Pin matches.
  1310.  * PARAMETERS
  1311.  *  void
  1312.  * RETURNS
  1313.  *  void
  1314.  *****************************************************************************/
  1315. void ValidateNewPin2(void)
  1316. {
  1317.     /*----------------------------------------------------------------*/
  1318.     /* Local Variables                                                */
  1319.     /*----------------------------------------------------------------*/
  1320.     historyNode *History;
  1321.     /*----------------------------------------------------------------*/
  1322.     /* Code Body                                                      */
  1323.     /*----------------------------------------------------------------*/
  1324.     if (memcmp
  1325.         (gSecuritySetupContext.Password, gSecuritySetupContext.ConfirmPassword,
  1326.          ((MAX_SIM_SETTING_PASSWD_LEN + 1) - 1) * ENCODING_LENGTH) == 0)
  1327.     {
  1328.         SECSETVerifyPINReq(
  1329.             MMI_SETTING_TYPE_UBCHV2,
  1330.             gSecuritySetupContext.NewPassword,
  1331.             gSecuritySetupContext.Password,
  1332.             NULL);
  1333.     }
  1334.     else
  1335.     {
  1336.         /* micha0702 */
  1337.         DisplayPopup((PU8) GetString(STR_DIFF_PIN2), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1338.         DeleteUptoScrID(SCR_ID_SECSET_PUK2_NEW_PIN2);
  1339.         if (GetHistoryScrID(SCR_ID_SECSET_PUK2_NEW_PIN2, &History) == ST_SUCCESS)
  1340.         {
  1341.             if (History->inputBuffer != NULL)
  1342.             {
  1343.                 memset(History->inputBuffer, 0, ENCODING_LENGTH);
  1344.             }
  1345.             if (History->guiBuffer != NULL)
  1346.             {
  1347.                 memset(History->guiBuffer, 0, 2);
  1348.             }
  1349.         }
  1350.     }
  1351. }
  1352. /*****************************************************************************
  1353.  * FUNCTION
  1354.  *  SECSETVerifyPINReq
  1355.  * DESCRIPTION
  1356.  *  Send PUK to L4 for verification.
  1357.  * PARAMETERS
  1358.  *  pin_type                [IN]        
  1359.  *  ucs2_pin                [?]         
  1360.  *  ucs2_new_pin            [?]         
  1361.  *  success_callback        [IN]        
  1362.  * RETURNS
  1363.  *  void
  1364.  *****************************************************************************/
  1365. void SECSETVerifyPINReq(U8 pin_type, U8 *ucs2_pin, U8 *ucs2_new_pin, FuncPtr success_callback)
  1366. {
  1367.     /*----------------------------------------------------------------*/
  1368.     /* Local Variables                                                */
  1369.     /*----------------------------------------------------------------*/
  1370.     U8 tempBuffer[(MAX_SIM_SETTING_PASSWD_LEN + 1)];
  1371.     MYQUEUE Message;
  1372.     MMIPHONEVERIFYREQ *local_data;
  1373.     /*----------------------------------------------------------------*/
  1374.     /* Code Body                                                      */
  1375.     /*----------------------------------------------------------------*/
  1376.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1377.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);   /* So that user can't go to idle screen. */
  1378.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  1379. #ifdef __MMI_TOUCH_SCREEN__
  1380.     wgui_clear_pen_handlers();
  1381. #endif 
  1382.     Message.oslSrcId = MOD_MMI;
  1383.     Message.oslDestId = MOD_L4C;
  1384.     Message.oslMsgId = PRT_MMI_SMU_VERIFY_PIN_REQ;
  1385.     local_data = (MMIPHONEVERIFYREQ*) OslConstructDataPtr(sizeof(MMIPHONEVERIFYREQ));
  1386.     memset(local_data->pin, '', (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1387.     memset(local_data->new_pin, '', (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1388.     local_data->pin_type = pin_type;    /* _smu_security_type_enum */
  1389.     memset(tempBuffer, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1390.     UnicodeNToAnsii((S8*) tempBuffer, (S8*) ucs2_pin, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1391.     memcpy(local_data->pin, tempBuffer, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1392.     memset(tempBuffer, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1393.     UnicodeNToAnsii((S8*) tempBuffer, (S8*) ucs2_new_pin, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1394.     memcpy(local_data->new_pin, tempBuffer, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1395.     if (success_callback != NULL)
  1396.     {
  1397.         gSecuritySetupContext.VerifyPassSuccessCallBack = success_callback;
  1398.     }
  1399.     SetProtocolEventHandler(SECSETVerifyPINRsp, PRT_MMI_SMU_VERIFY_PIN_RSP);
  1400.     Message.oslDataPtr = (oslParaType*) local_data;
  1401.     Message.oslPeerBuffPtr = NULL;
  1402.     OslMsgSendExtQueue(&Message);
  1403. }
  1404. /*****************************************************************************
  1405.  * FUNCTION
  1406.  *  SECSETVerifyPINRsp
  1407.  * DESCRIPTION
  1408.  *  
  1409.  * PARAMETERS
  1410.  *  info        [?]     
  1411.  * RETURNS
  1412.  *  void
  1413.  *****************************************************************************/
  1414. void SECSETVerifyPINRsp(void *info)
  1415. {
  1416.     /*----------------------------------------------------------------*/
  1417.     /* Local Variables                                                */
  1418.     /*----------------------------------------------------------------*/
  1419.     mmi_smu_verify_pin_rsp_struct *local_data = (mmi_smu_verify_pin_rsp_struct*) info;
  1420.     historyNode *History;
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Code Body                                                      */
  1423.     /*----------------------------------------------------------------*/
  1424.     FillCountDownNumber(local_data->chv_info);
  1425.     gSecuritySetupContext.PINBlocked = 0;
  1426.     /* diamond, 2006/04/17 Not reset invalid sim flag because verify pin request may be used in no sim case */
  1427.     if (mmi_bootup_is_sim_removed() == MMI_FALSE)
  1428.     {
  1429.         g_pwr_context.PowerOnSIMStatus &= ~MMI_SIM_STATUS_INVALID;      /* 0x01: Invalid SIM reset */
  1430.     }
  1431.     switch (local_data->next_type)
  1432.     {
  1433.         case MMI_SETTING_TYPE_NO_REQUIRED:
  1434.             if (gSecuritySetupContext.VerifyPassSuccessCallBack != NULL)
  1435.             {
  1436.                 (*gSecuritySetupContext.VerifyPassSuccessCallBack) ();
  1437.                 gSecuritySetupContext.VerifyPassSuccessCallBack = NULL;
  1438.             }
  1439.             else
  1440.             {
  1441.                 PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "[SecuritySetup.c] SECSETVerifyPINRsp ABNORMAL"));
  1442.                 DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  1443.                 DeleteUptoScrID(IDLE_SCREEN_ID);
  1444.             }
  1445.             break;
  1446.         case MMI_SETTING_TYPE_PHONELOCK:
  1447.             DisplayPopup((PU8) GetString(STR_SETTING_WRONG), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1448.             if (GetHistoryScrID(SCR_RESTORE, &History) == ST_SUCCESS)
  1449.             {
  1450.                 if (History->inputBuffer != NULL)
  1451.                 {
  1452.                     memset(History->inputBuffer, 0, ENCODING_LENGTH);
  1453.                 }
  1454.                 if (History->guiBuffer != NULL)
  1455.                 {
  1456.                     memset(History->guiBuffer, 0, 2);
  1457.                 }
  1458.             }
  1459.             memset(gPhonePassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1460.             break;
  1461.         case MMI_SETTING_TYPE_CHV1:
  1462.             DisplayPopup((PU8) GetString(STR_WRONG_PIN), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1463.             break;
  1464.         case MMI_SETTING_TYPE_CHV2:
  1465.             DisplayPopup((PU8) GetString(STR_WRONG_PIN2), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1466.             if (GetHistoryScrID(SCR_ID_SECSET_PIN2, &History) == ST_SUCCESS)
  1467.             {
  1468.                 if (History->inputBuffer != NULL)
  1469.                 {
  1470.                     memset(History->inputBuffer, 0, ENCODING_LENGTH);
  1471.                 }
  1472.                 if (History->guiBuffer != NULL)
  1473.                 {
  1474.                     memset(History->guiBuffer, 0, 2);
  1475.                 }
  1476.             }
  1477.             DeleteUptoScrID(SCR_ID_SECSET_PIN2);
  1478.             break;
  1479.         case MMI_SETTING_TYPE_UBCHV1:
  1480.             DisplayPopup((PU8) GetString(STR_SETTING_WRONG_PUK), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1481.             if (GetHistoryScrID(SCR_ID_SECSET_PUK1, &History) == ST_SUCCESS)
  1482.             {
  1483.                 if (History->inputBuffer != NULL)
  1484.                 {
  1485.                     memset(History->inputBuffer, 0, ENCODING_LENGTH);
  1486.                 }
  1487.                 if (History->guiBuffer != NULL)
  1488.                 {
  1489.                     memset(History->guiBuffer, 0, 2);
  1490.                 }
  1491.             }
  1492.             DeleteUptoScrID(SCR_ID_SECSET_PUK1);
  1493.             /* micha0915 */
  1494.             RemoveSSReqScr();
  1495.             break;
  1496.         case MMI_SETTING_TYPE_UBCHV2:
  1497.             if (GetExitScrnID() == SCR_ID_SECSET_PIN2)
  1498.             {
  1499.                 ClearExitHandler();
  1500.                 ExitSECSETPUK2();
  1501.                 DisplayPopup((PU8) GetString(STR_SETTING_PIN2_BLK), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1502.             }
  1503.             else
  1504.             {
  1505.                 DisplayPopup(
  1506.                     (PU8) GetString(STR_SETTING_WRONG_PUK2),
  1507.                     IMG_GLOBAL_ERROR,
  1508.                     0,
  1509.                     ST_NOTIFYDURATION,
  1510.                     ERROR_TONE);
  1511.                 DeleteUptoScrID(SCR_ID_SECSET_PUK2);
  1512.                 /* micha0915 */
  1513.                 RemoveSSReqScr();
  1514.             }
  1515.             if (GetHistoryScrID(SCR_ID_SECSET_PUK2, &History) == ST_SUCCESS)
  1516.             {
  1517.                 if (History->inputBuffer != NULL)
  1518.                 {
  1519.                     memset(History->inputBuffer, 0, ENCODING_LENGTH);
  1520.                 }
  1521.                 if (History->guiBuffer != NULL)
  1522.                 {
  1523.                     memset(History->guiBuffer, 0, 2);
  1524.                 }
  1525.             }
  1526.             break;
  1527.         case MMI_SETTING_TYPE_CHV1_BLOCKED:
  1528.             break;
  1529.         case MMI_SETTING_TYPE_CHV2_BLOCKED:
  1530.             DisplayPopup(
  1531.                 (PU8) GetString(STR_SETTING_PIN2_BLOCK_MSG),
  1532.                 IMG_GLOBAL_ERROR,
  1533.                 0,
  1534.                 ST_NOTIFYDURATION,
  1535.                 ERROR_TONE);
  1536.             DeleteNScrId(SCR_ID_SECSET_MAIN);
  1537.             break;
  1538.         case MMI_SETTING_TYPE_SIM_CARD_BLOCKED:
  1539.             EntryScrnSimBlockRsp();
  1540.             break;
  1541.         case MMI_SETTING_TYPE_UBCHV2_BLOCKED:
  1542.             DisplayPopup(
  1543.                 (PU8) GetString(STR_ID_PIN2_NOT_SUPPORT),
  1544.                 IMG_GLOBAL_ERROR,
  1545.                 0,
  1546.                 ST_NOTIFYDURATION,
  1547.                 ERROR_TONE);
  1548.             DeleteNScrId(SCR_ID_SECSET_PUK2);
  1549.             break;
  1550.         case MMI_SETTING_TYPE_UBCHV1_CHV1_NOT_LOCK:
  1551.             break;
  1552.         case MMI_SETTING_TYPE_UNSPECIFIED:
  1553.             DisplayPopup((PU8) GetString(STR_ID_SECSET_UNSPECIFIED_ERROR), IMG_GLOBAL_UNFINISHED, 1, ST_NOTIFYDURATION, ERROR_TONE);
  1554.             break;
  1555.         default:
  1556.             break;
  1557.     }
  1558. }
  1559. /*****************************************************************************
  1560.  * FUNCTION
  1561.  *  EntrySECSETSIMLockPIN1
  1562.  * DESCRIPTION
  1563.  *  Entry fn to get SIM lock pwd from user.
  1564.  * PARAMETERS
  1565.  *  void
  1566.  * RETURNS
  1567.  *  void
  1568.  *****************************************************************************/
  1569. void EntrySECSETSIMLockPIN1(void)
  1570. {
  1571.     /*----------------------------------------------------------------*/
  1572.     /* Local Variables                                                */
  1573.     /*----------------------------------------------------------------*/
  1574.     U8 *guiBuffer;  /* Buffer holding history data */
  1575.     U8 *inputBuffer;
  1576.     U8 PassCountdownDisp[MAX_PASS_COUNTDOWN_DISP];
  1577.     /*----------------------------------------------------------------*/
  1578.     /* Code Body                                                      */
  1579.     /*----------------------------------------------------------------*/
  1580.     EntryNewScreen(SCR_ID_SECSET_SIM_LOCK_PIN1, ExitSECSETSIMLockPIN1, NULL, NULL);
  1581.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_SIM_LOCK_PIN1);
  1582.     inputBuffer = GetCurrInputBuffer(SCR_ID_SECSET_SIM_LOCK_PIN1);
  1583.     if (inputBuffer == NULL)
  1584.     {
  1585.         memset(gSecuritySetupContext.Password, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  1586.     }
  1587.     else
  1588.     {
  1589.         pfnUnicodeStrcpy((S8*) gSecuritySetupContext.Password, (S8*) inputBuffer);
  1590.     }
  1591.     RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
  1592.     FillCountDownString(MMI_SETTING_TYPE_CHV1, PassCountdownDisp);
  1593.     /* START VIJAY PMT 20060103 */
  1594. #if defined UI_SMALL_PIN_EDITOR_SCREEN
  1595.     enable_resized_small_screen();
  1596. #endif 
  1597.     /* END VIJAY PMT 20060103 */
  1598.     ShowCategory111Screen(
  1599.         STR_GLOBAL_OK,
  1600.         IMG_GLOBAL_OK,
  1601.         STR_GLOBAL_BACK,
  1602.         IMG_GLOBAL_BACK,
  1603.         STR_SCR9028_PIN1_CAPTION,
  1604.         INPUT_TYPE_NUMERIC_PASSWORD,
  1605.         gSecuritySetupContext.Password,
  1606.         (MAX_SIM_SETTING_PASSWD_LEN + 1),
  1607.         PassCountdownDisp,
  1608.         guiBuffer);
  1609.     SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1610.     SetLeftSoftkeyFunction(SECSETSetSIMLockReq, KEY_EVENT_UP);
  1611.     SetKeyHandler(SECSETSetSIMLockReq, KEY_POUND, KEY_EVENT_UP);
  1612.     /* micha0606 */
  1613.     gSecuritySetupContext.PasswdLenCheckCallBack = SECSETSetSIMLockReq;
  1614.     if (pfnUnicodeStrlen((S8*) gSecuritySetupContext.Password) < MIN_PASSWORD_LENGTH)
  1615.     {
  1616.         ChangeLeftSoftkey(0, 0);
  1617.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1618.     }
  1619. }
  1620. /*****************************************************************************
  1621.  * FUNCTION
  1622.  *  ExitSECSETSIMLockPIN1
  1623.  * DESCRIPTION
  1624.  *  
  1625.  * PARAMETERS
  1626.  *  void
  1627.  * RETURNS
  1628.  *  void
  1629.  *****************************************************************************/
  1630. void ExitSECSETSIMLockPIN1(void)
  1631. {
  1632.     /*----------------------------------------------------------------*/
  1633.     /* Local Variables                                                */
  1634.     /*----------------------------------------------------------------*/
  1635.     history Scr;    /* Variable to hold the history data */
  1636.     /*----------------------------------------------------------------*/
  1637.     /* Code Body                                                      */
  1638.     /*----------------------------------------------------------------*/
  1639.     Scr.scrnID = SCR_ID_SECSET_SIM_LOCK_PIN1;
  1640.     Scr.entryFuncPtr = EntrySECSETSIMLockPIN1;
  1641.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) gSecuritySetupContext.Password);
  1642.     GetCategoryHistory(Scr.guiBuffer);
  1643.     AddHistory(Scr);
  1644. }
  1645. /*****************************************************************************
  1646.  * FUNCTION
  1647.  *  SECSETSetFdlModeReq
  1648.  * DESCRIPTION
  1649.  *  
  1650.  * PARAMETERS
  1651.  *  void
  1652.  * RETURNS
  1653.  *  void
  1654.  *****************************************************************************/
  1655. void SECSETSetFdlModeReq(void)
  1656. {
  1657.     /*----------------------------------------------------------------*/
  1658.     /* Local Variables                                                */
  1659.     /*----------------------------------------------------------------*/
  1660.     MYQUEUE msgStruct;
  1661.     MMISMUDIALMODEREQSTRUCT *dailStruct;
  1662.     /*----------------------------------------------------------------*/
  1663.     /* Code Body                                                      */
  1664.     /*----------------------------------------------------------------*/
  1665.     dailStruct = OslConstructDataPtr(sizeof(MMISMUDIALMODEREQSTRUCT));
  1666.     if (gSecuritySetupContext.FdlStatus)
  1667.     {
  1668.         dailStruct->on_off = (U8) MMI_OFF_OPTION;
  1669.     }
  1670.     else
  1671.     {
  1672.         dailStruct->on_off = (U8) MMI_ON_OPTION;
  1673.     }
  1674.     dailStruct->type = MMI_TYPE_FDN;
  1675.     memset(dailStruct->pin, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1676.     SetProtocolEventHandler(SECSETSetFdlModeRsp, PRT_MMI_SMU_SET_DIAL_MODE_RSP);
  1677.     msgStruct.oslSrcId = MOD_MMI;
  1678.     msgStruct.oslDestId = MOD_L4C;
  1679.     /* micha1229 */
  1680.     msgStruct.oslMsgId = PRT_MMI_SMU_SET_DIAL_MODE_REQ;
  1681.     msgStruct.oslSapId = INVALID_SAP;
  1682.     msgStruct.oslDataPtr = (oslParaType*) dailStruct;
  1683.     msgStruct.oslPeerBuffPtr = NULL;
  1684.     OslMsgSendExtQueue(&msgStruct);
  1685. }
  1686. /*****************************************************************************
  1687.  * FUNCTION
  1688.  *  SECSETSetFdlModeRsp
  1689.  * DESCRIPTION
  1690.  *  
  1691.  * PARAMETERS
  1692.  *  info        [?]     
  1693.  * RETURNS
  1694.  *  void
  1695.  *****************************************************************************/
  1696. void SECSETSetFdlModeRsp(void *info)
  1697. {
  1698.     /*----------------------------------------------------------------*/
  1699.     /* Local Variables                                                */
  1700.     /*----------------------------------------------------------------*/
  1701.     mmi_smu_set_dial_mode_rsp_struct *resp;
  1702.     U16 index;
  1703.     /*----------------------------------------------------------------*/
  1704.     /* Code Body                                                      */
  1705.     /*----------------------------------------------------------------*/
  1706.     index = GetCurrHiliteID();
  1707.     memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
  1708.     resp = (mmi_smu_set_dial_mode_rsp_struct*) (info);
  1709.     if (resp->result == 1)
  1710.     {
  1711.         gSecuritySetupContext.FdlStatus = !gSecuritySetupContext.FdlStatus;
  1712.         g_phb_cntx.phb_ready = FALSE;
  1713.         if (gSecuritySetupContext.FdlStatus)
  1714.         {
  1715.             pfnUnicodeStrncpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON), MAX_SUBMENU_CHARACTERS);
  1716.             Category52ChangeItemDescription(0, hintData[index]);
  1717.             change_left_softkey(STR_GLOBAL_OFF, 0);
  1718.             DisplayPopup((PU8) GetString(STR_FDL_IS_ON), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  1719.         }
  1720.         else
  1721.         {
  1722.             pfnUnicodeStrncpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF), MAX_SUBMENU_CHARACTERS);
  1723.             Category52ChangeItemDescription(0, hintData[index]);
  1724.             change_left_softkey(STR_GLOBAL_ON, 0);
  1725.             DisplayPopup((PU8) GetString(STR_FDL_IS_OFF), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  1726.         }
  1727.     }
  1728.     else
  1729.     {
  1730.         DisplayPopup((PU8) GetString(STR_GLOBAL_UNFINISHED), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1731.     }
  1732.     DeleteScreenIfPresent(SCR_ID_SECSET_PIN2);
  1733.     DeleteScreenIfPresent(SCR_ID_SECSET_PUK2);
  1734.     DeleteScreenIfPresent(SCR_ID_SECSET_PUK2_NEW_PIN2);
  1735.     DeleteScreenIfPresent(SCR_ID_SECSET_PUK2_CONFIRM_PIN2);
  1736. }
  1737. /*****************************************************************************
  1738.  * FUNCTION
  1739.  *  SECSETSetBdlModeReq
  1740.  * DESCRIPTION
  1741.  *  
  1742.  * PARAMETERS
  1743.  *  void
  1744.  * RETURNS
  1745.  *  void
  1746.  *****************************************************************************/
  1747. void SECSETSetBdlModeReq(void)
  1748. {
  1749.     /*----------------------------------------------------------------*/
  1750.     /* Local Variables                                                */
  1751.     /*----------------------------------------------------------------*/
  1752.     MYQUEUE msgStruct;
  1753.     MMISMUDIALMODEREQSTRUCT *dailStruct;
  1754.     /*----------------------------------------------------------------*/
  1755.     /* Code Body                                                      */
  1756.     /*----------------------------------------------------------------*/
  1757.     dailStruct = OslConstructDataPtr(sizeof(MMISMUDIALMODEREQSTRUCT));
  1758.     if (gSecuritySetupContext.BdlStatus)
  1759.     {
  1760.         dailStruct->on_off = (U8) MMI_OFF_OPTION;
  1761.     }
  1762.     else
  1763.     {
  1764.         dailStruct->on_off = (U8) MMI_ON_OPTION;
  1765.     }
  1766.     dailStruct->type = MMI_TYPE_BDN;
  1767.     memset(dailStruct->pin, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1768.     SetProtocolEventHandler(SECSETSetBdlModeRsp, PRT_MMI_SMU_SET_DIAL_MODE_RSP);
  1769.     msgStruct.oslSrcId = MOD_MMI;
  1770.     msgStruct.oslDestId = MOD_L4C;
  1771.     /* micha1229 */
  1772.     msgStruct.oslMsgId = PRT_MMI_SMU_SET_DIAL_MODE_REQ;
  1773.     msgStruct.oslSapId = INVALID_SAP;
  1774.     msgStruct.oslDataPtr = (oslParaType*) dailStruct;
  1775.     msgStruct.oslPeerBuffPtr = NULL;
  1776.     OslMsgSendExtQueue(&msgStruct);
  1777. }
  1778. /*****************************************************************************
  1779.  * FUNCTION
  1780.  *  SECSETSetBdlModeRsp
  1781.  * DESCRIPTION
  1782.  *  
  1783.  * PARAMETERS
  1784.  *  info        [?]     
  1785.  * RETURNS
  1786.  *  void
  1787.  *****************************************************************************/
  1788. void SECSETSetBdlModeRsp(void *info)
  1789. {
  1790.     /*----------------------------------------------------------------*/
  1791.     /* Local Variables                                                */
  1792.     /*----------------------------------------------------------------*/
  1793.     mmi_smu_set_dial_mode_rsp_struct *resp;
  1794.     U16 index;
  1795.     /*----------------------------------------------------------------*/
  1796.     /* Code Body                                                      */
  1797.     /*----------------------------------------------------------------*/
  1798.     index = GetCurrHiliteID();
  1799.     memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
  1800.     resp = (mmi_smu_set_dial_mode_rsp_struct*) (info);
  1801.     if (resp->result == 1)
  1802.     {
  1803.         gSecuritySetupContext.BdlStatus = !gSecuritySetupContext.BdlStatus;
  1804.         g_phb_cntx.phb_ready = FALSE;
  1805.         if (gSecuritySetupContext.BdlStatus)
  1806.         {
  1807.             pfnUnicodeStrncpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON), MAX_SUBMENU_CHARACTERS);
  1808.             Category52ChangeItemDescription(0, hintData[index]);
  1809.             change_left_softkey(STR_GLOBAL_OFF, 0);
  1810.             DisplayPopup((PU8) GetString(STR_FDL_IS_ON), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  1811.         }
  1812.         else
  1813.         {
  1814.             pfnUnicodeStrncpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF), MAX_SUBMENU_CHARACTERS);
  1815.             Category52ChangeItemDescription(0, hintData[index]);
  1816.             change_left_softkey(STR_GLOBAL_ON, 0);
  1817.             DisplayPopup((PU8) GetString(STR_FDL_IS_OFF), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  1818.         }
  1819.     }
  1820.     else
  1821.     {
  1822.         DisplayPopup((PU8) GetString(STR_GLOBAL_UNFINISHED), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  1823.     }
  1824.     DeleteScreenIfPresent(SCR_ID_SECSET_PIN2);
  1825.     DeleteScreenIfPresent(SCR_ID_SECSET_PUK2);
  1826.     DeleteScreenIfPresent(SCR_ID_SECSET_PUK2_NEW_PIN2);
  1827.     DeleteScreenIfPresent(SCR_ID_SECSET_PUK2_CONFIRM_PIN2);
  1828. }
  1829. /*****************************************************************************
  1830.  * FUNCTION
  1831.  *  ScrSettingPukValidation
  1832.  * DESCRIPTION
  1833.  *  Fn for length validation at PUk screen
  1834.  * PARAMETERS
  1835.  *  text        [?]         
  1836.  *  cursor      [?]         
  1837.  *  length      [IN]        
  1838.  * RETURNS
  1839.  *  void
  1840.  *****************************************************************************/
  1841. void ScrSettingPukValidation(U8 *text, U8 *cursor, S32 length)
  1842. {
  1843.     /*----------------------------------------------------------------*/
  1844.     /* Local Variables                                                */
  1845.     /*----------------------------------------------------------------*/
  1846.     /*----------------------------------------------------------------*/
  1847.     /* Code Body                                                      */
  1848.     /*----------------------------------------------------------------*/
  1849.     /* micha0606 */
  1850.     if ((length) < MMI_MIN_PUK_LENGTH)
  1851.     {
  1852.         ChangeLeftSoftkey(0, 0);
  1853.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1854.     }
  1855.     else
  1856.     {
  1857.         EnableLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1858.         SetKeyHandler(gSecuritySetupContext.PasswdLenCheckCallBack, KEY_POUND, KEY_EVENT_UP);
  1859.     }
  1860. }
  1861. /*****************************************************************************
  1862.  * FUNCTION
  1863.  *  SECSETGetFdlBdlModeReq
  1864.  * DESCRIPTION
  1865.  *  Send req to L4 to know the status of FDL mode.
  1866.  * PARAMETERS
  1867.  *  void
  1868.  * RETURNS
  1869.  *  void
  1870.  *****************************************************************************/
  1871. void SECSETGetFdlBdlModeReq(void)
  1872. {
  1873.     /*----------------------------------------------------------------*/
  1874.     /* Local Variables                                                */
  1875.     /*----------------------------------------------------------------*/
  1876.     MYQUEUE msgStruct;
  1877.     /*----------------------------------------------------------------*/
  1878.     /* Code Body                                                      */
  1879.     /*----------------------------------------------------------------*/
  1880.     SetProtocolEventHandler(SECSETGetFdlBdlModeRsp, PRT_MMI_SMU_GET_DIAL_MODE_RSP);
  1881.     msgStruct.oslSrcId = MOD_MMI;
  1882.     msgStruct.oslDestId = MOD_L4C;
  1883.     /* micha1229 */
  1884.     msgStruct.oslMsgId = PRT_MMI_SMU_GET_DIAL_MODE_REQ;
  1885.     msgStruct.oslSapId = INVALID_SAP;
  1886.     msgStruct.oslDataPtr = NULL;
  1887.     msgStruct.oslPeerBuffPtr = NULL;
  1888.     OslMsgSendExtQueue(&msgStruct);
  1889. }
  1890. /*****************************************************************************
  1891.  * FUNCTION
  1892.  *  SECSETGetFdlBdlModeRsp
  1893.  * DESCRIPTION
  1894.  *  Response handler for req to know the status of FDL mode.
  1895.  * PARAMETERS
  1896.  *  info        [?]     
  1897.  * RETURNS
  1898.  *  void
  1899.  *****************************************************************************/
  1900. void SECSETGetFdlBdlModeRsp(void *info)
  1901. {
  1902.     /*----------------------------------------------------------------*/
  1903.     /* Local Variables                                                */
  1904.     /*----------------------------------------------------------------*/
  1905.     DIALMODESTATUSRSPSTRUCT *resp;
  1906.     /*----------------------------------------------------------------*/
  1907.     /* Code Body                                                      */
  1908.     /*----------------------------------------------------------------*/
  1909.     resp = (DIALMODESTATUSRSPSTRUCT*) (info);
  1910.     switch (resp->dial_mode)
  1911.     {
  1912.         case MMI_TYPE_ADN:
  1913.             gSecuritySetupContext.BdlStatus = 0;
  1914.             gSecuritySetupContext.FdlStatus = 0;
  1915.             break;
  1916.         case MMI_TYPE_FDN:
  1917.             gSecuritySetupContext.FdlStatus = 1;
  1918.             gSecuritySetupContext.BdlStatus = 0;
  1919.             break;
  1920.         case MMI_TYPE_BDN:
  1921.             gSecuritySetupContext.FdlStatus = 0;
  1922.             gSecuritySetupContext.BdlStatus = 1;
  1923.             break;
  1924.         case MMI_TYPE_FDN_BDN:
  1925.             gSecuritySetupContext.BdlStatus = 1;
  1926.             gSecuritySetupContext.FdlStatus = 1;
  1927.             break;
  1928.         default:
  1929.             break;
  1930.     }
  1931. }
  1932. /*****************************************************************************
  1933.  * FUNCTION
  1934.  *  FillCountDownNumber
  1935.  * DESCRIPTION
  1936.  *  
  1937.  * PARAMETERS
  1938.  *  chv_info        [IN]        
  1939.  * RETURNS
  1940.  *  void
  1941.  *****************************************************************************/
  1942. void FillCountDownNumber(sim_chv_info_struct chv_info)
  1943. {
  1944.     /*----------------------------------------------------------------*/
  1945.     /* Local Variables                                                */
  1946.     /*----------------------------------------------------------------*/
  1947.     /*----------------------------------------------------------------*/
  1948.     /* Code Body                                                      */
  1949.     /*----------------------------------------------------------------*/
  1950.     gSecuritySetupContext.CHV1Count = chv_info.chv1_count;
  1951.     gSecuritySetupContext.CHV2Count = chv_info.chv2_count;
  1952.     gSecuritySetupContext.UBCHV1Count = chv_info.ubchv1_count;
  1953.     gSecuritySetupContext.UBCHV2Count = chv_info.ubchv2_count;
  1954. }
  1955. /*****************************************************************************
  1956.  * FUNCTION
  1957.  *  FillCountDownString
  1958.  * DESCRIPTION
  1959.  *  
  1960.  * PARAMETERS
  1961.  *  TypeOfPass              [IN]        
  1962.  *  PassCountdownDisp       [?]         
  1963.  * RETURNS
  1964.  *  void
  1965.  *****************************************************************************/
  1966. void FillCountDownString(U8 TypeOfPass, U8 *PassCountdownDisp)
  1967. {
  1968.     /*----------------------------------------------------------------*/
  1969.     /* Local Variables                                                */
  1970.     /*----------------------------------------------------------------*/
  1971.     S8 temp1[10];
  1972.     S8 temp2[20];
  1973.     /*----------------------------------------------------------------*/
  1974.     /* Code Body                                                      */
  1975.     /*----------------------------------------------------------------*/
  1976.     switch (TypeOfPass)
  1977.     {
  1978.         case MMI_SETTING_TYPE_CHV1:
  1979.             sprintf(temp1, "%d", gSecuritySetupContext.CHV1Count);
  1980.             break;
  1981.         case MMI_SETTING_TYPE_CHV2:
  1982.             sprintf(temp1, "%d", gSecuritySetupContext.CHV2Count);
  1983.             break;
  1984.         case MMI_SETTING_TYPE_UBCHV1:
  1985.             sprintf(temp1, "%d", gSecuritySetupContext.UBCHV1Count);
  1986.             break;
  1987.         case MMI_SETTING_TYPE_UBCHV2:
  1988.             sprintf(temp1, "%d", gSecuritySetupContext.UBCHV2Count);
  1989.             break;
  1990.     }
  1991.     AnsiiToUnicodeString(temp2, temp1);
  1992.     pfnUnicodeStrcpy((S8*) PassCountdownDisp, (S8*) GetString(STR_PASS_TRIALS_REMAIN));
  1993.     pfnUnicodeStrcat((S8*) PassCountdownDisp, (S8*) temp2);
  1994. }
  1995. /*****************************************************************************
  1996.  * FUNCTION
  1997.  *  SECSETGetFdlStatusReq
  1998.  * DESCRIPTION
  1999.  *  Send req to L4 to know the status of FDL or BDL.
  2000.  * PARAMETERS
  2001.  *  void
  2002.  * RETURNS
  2003.  *  void
  2004.  *  
  2005.  *  Author            : Vanita Jain(?)
  2006.  *****************************************************************************/
  2007. void SECSETGetFdlStatusReq(void)
  2008. {
  2009. #ifdef MMI_ON_HARDWARE_P
  2010.     /*----------------------------------------------------------------*/
  2011.     /* Local Variables                                                */
  2012.     /*----------------------------------------------------------------*/
  2013.     MYQUEUE msgStruct;
  2014.     mmi_smu_read_file_info_req_struct *fdlstatus;
  2015.     /*----------------------------------------------------------------*/
  2016.     /* Code Body                                                      */
  2017.     /*----------------------------------------------------------------*/
  2018.     ClearInputEventHandler(MMI_DEVICE_ALL);
  2019.     fdlstatus = OslConstructDataPtr(sizeof(mmi_smu_read_file_info_req_struct));
  2020.     fdlstatus->file_idx = FILE_FDN_IDX;
  2021.     SetProtocolEventHandler(SECSETGetFdlStatusRsp, PRT_MMI_SMU_READ_FILE_INFO_RSP);
  2022.     msgStruct.oslSrcId = MOD_MMI;
  2023.     msgStruct.oslDestId = MOD_L4C;
  2024.     /* micha1229 */
  2025.     msgStruct.oslMsgId = PRT_MMI_SMU_READ_FILE_INFO_REQ;
  2026.     msgStruct.oslSapId = INVALID_SAP;
  2027.     msgStruct.oslDataPtr = (oslParaType*) fdlstatus;
  2028.     msgStruct.oslPeerBuffPtr = NULL;
  2029.     OslMsgSendExtQueue(&msgStruct);
  2030. #else /* MMI_ON_HARDWARE_P */ 
  2031.     PopupNoSupport();               /* PC simulator doesn't support to access FDN from SIM card */
  2032. #endif /* MMI_ON_HARDWARE_P */ 
  2033. }
  2034. /*****************************************************************************
  2035.  * FUNCTION
  2036.  *  SECSETGetFdlStatusRsp
  2037.  * DESCRIPTION
  2038.  *  Response for the request to get the status of FDL or BDL.
  2039.  * PARAMETERS
  2040.  *  info        [?]     
  2041.  * RETURNS
  2042.  *  void
  2043.  *  
  2044.  *  Author            : Vanita Jain(?)
  2045.  *****************************************************************************/
  2046. void SECSETGetFdlStatusRsp(void *info)
  2047. {
  2048.     /*----------------------------------------------------------------*/
  2049.     /* Local Variables                                                */
  2050.     /*----------------------------------------------------------------*/
  2051.     mmi_smu_read_file_info_rsp_struct *resp;
  2052.     /*----------------------------------------------------------------*/
  2053.     /* Code Body                                                      */
  2054.     /*----------------------------------------------------------------*/
  2055.     resp = (mmi_smu_read_file_info_rsp_struct*) (info);
  2056.     if (resp->result.flag == 0  /* ok */
  2057. #ifdef MMI_ON_HARDWARE_P
  2058.         && (sim_service_table_query(SERVICE_FDN) == SERVICE_SUPPORT || sim_service_table_query(SERVICE_FDN) == SERVICE_ALLOCATE)
  2059. #endif 
  2060.         )                       /* diamond, 2006/01/26 Need to check both FDN file and SIM service table */
  2061.     {
  2062.         gFDLBDLContext.MaxFDL = resp->num_of_rec;
  2063.         EntrySECSETFixDial();
  2064.     }
  2065.     else
  2066.     {
  2067.         DisplayPopup((PU8) GetString(STR_NO_FDL), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  2068.     }
  2069. }
  2070. /*****************************************************************************
  2071.  * FUNCTION
  2072.  *  SECSETGetBdlStatusReq
  2073.  * DESCRIPTION
  2074.  *  Send req to L4 to know the status of FDL or BDL.
  2075.  * PARAMETERS
  2076.  *  void
  2077.  * RETURNS
  2078.  *  void
  2079.  *  
  2080.  *  Author            : Vanita Jain(?)
  2081.  *****************************************************************************/
  2082. void SECSETGetBdlStatusReq(void)
  2083. {
  2084. #ifdef MMI_ON_HARDWARE_P
  2085.     /*----------------------------------------------------------------*/
  2086.     /* Local Variables                                                */
  2087.     /*----------------------------------------------------------------*/
  2088.     MYQUEUE msgStruct;
  2089.     mmi_smu_read_file_info_req_struct *fdlstatus;
  2090.     /*----------------------------------------------------------------*/
  2091.     /* Code Body                                                      */
  2092.     /*----------------------------------------------------------------*/
  2093.     ClearInputEventHandler(MMI_DEVICE_ALL);
  2094.     fdlstatus = OslConstructDataPtr(sizeof(mmi_smu_read_file_info_req_struct));
  2095.     fdlstatus->file_idx = FILE_BDN_IDX;
  2096.     SetProtocolEventHandler(SECSETGetBdlStatusRsp, PRT_MMI_SMU_READ_FILE_INFO_RSP);
  2097.     msgStruct.oslSrcId = MOD_MMI;
  2098.     msgStruct.oslDestId = MOD_L4C;
  2099.     /* micha1229 */
  2100.     msgStruct.oslMsgId = PRT_MMI_SMU_READ_FILE_INFO_REQ;
  2101.     msgStruct.oslSapId = INVALID_SAP;
  2102.     msgStruct.oslDataPtr = (oslParaType*) fdlstatus;
  2103.     msgStruct.oslPeerBuffPtr = NULL;
  2104.     OslMsgSendExtQueue(&msgStruct);
  2105. #else /* MMI_ON_HARDWARE_P */ 
  2106.     PopupNoSupport();               /* PC simulator doesn't support to access BDN from SIM card */
  2107. #endif /* MMI_ON_HARDWARE_P */ 
  2108. }
  2109. /*****************************************************************************
  2110.  * FUNCTION
  2111.  *  SECSETGetBdlStatusRsp
  2112.  * DESCRIPTION
  2113.  *  Response for the request to get the status of FDL or BDL.
  2114.  * PARAMETERS
  2115.  *  info        [?]     
  2116.  * RETURNS
  2117.  *  void
  2118.  *  
  2119.  *  Author            : Vanita Jain(?)
  2120.  *****************************************************************************/
  2121. void SECSETGetBdlStatusRsp(void *info)
  2122. {
  2123.     /*----------------------------------------------------------------*/
  2124.     /* Local Variables                                                */
  2125.     /*----------------------------------------------------------------*/
  2126.     mmi_smu_read_file_info_rsp_struct *resp;
  2127.     /*----------------------------------------------------------------*/
  2128.     /* Code Body                                                      */
  2129.     /*----------------------------------------------------------------*/
  2130.     resp = (mmi_smu_read_file_info_rsp_struct*) (info);
  2131.     if (resp->result.flag == 0  /* ok */
  2132. #ifdef MMI_ON_HARDWARE_P
  2133.         && (sim_service_table_query(SERVICE_BDN) == SERVICE_SUPPORT || sim_service_table_query(SERVICE_BDN) == SERVICE_ALLOCATE)
  2134. #endif 
  2135.         )                       /* diamond, 2006/01/26 Need to check both BDN file and SIM service table */
  2136.     {
  2137.         gFDLBDLContext.MaxBDL = resp->num_of_rec;
  2138.         EntrySECSETBarDial();
  2139.     }
  2140.     else
  2141.     {
  2142.         DisplayPopup((PU8) GetString(STR_NO_FDL), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  2143.     }
  2144. }
  2145. /*****************************************************************************
  2146.  * FUNCTION
  2147.  *  mmi_secset_set_fixed_dial_mode
  2148.  * DESCRIPTION
  2149.  *  Entry function of set FDN mode
  2150.  * PARAMETERS
  2151.  *  void
  2152.  * RETURNS
  2153.  *  void
  2154.  *****************************************************************************/
  2155. void mmi_secset_set_fixed_dial_mode(void)
  2156. {
  2157.     /*----------------------------------------------------------------*/
  2158.     /* Local Variables                                                */
  2159.     /*----------------------------------------------------------------*/
  2160.     /*----------------------------------------------------------------*/
  2161.     /* Code Body                                                      */
  2162.     /*----------------------------------------------------------------*/
  2163.     gSecuritySetupContext.VerifyPassSuccessCallBack = SECSETSetFdlModeReq;
  2164.     SECSETGetPIN2StatusReq();
  2165. }
  2166. /*****************************************************************************
  2167.  * FUNCTION
  2168.  *  mmi_secset_set_barred_dial_mode
  2169.  * DESCRIPTION
  2170.  *  Entry function of set BDN mode
  2171.  * PARAMETERS
  2172.  *  void
  2173.  * RETURNS
  2174.  *  void
  2175.  *****************************************************************************/
  2176. void mmi_secset_set_barred_dial_mode(void)
  2177. {
  2178.     /*----------------------------------------------------------------*/
  2179.     /* Local Variables                                                */
  2180.     /*----------------------------------------------------------------*/
  2181.     /*----------------------------------------------------------------*/
  2182.     /* Code Body                                                      */
  2183.     /*----------------------------------------------------------------*/
  2184.     gSecuritySetupContext.VerifyPassSuccessCallBack = SECSETSetBdlModeReq;
  2185.     SECSETGetPIN2StatusReq();
  2186. }
  2187. /*****************************************************************************
  2188.  * FUNCTION
  2189.  *  mmi_secset_at_cmd_update_chv
  2190.  * DESCRIPTION
  2191.  *  Message handler for AT verify PIN
  2192.  * PARAMETERS
  2193.  *  info        [IN]     
  2194.  * RETURNS
  2195.  *  void
  2196.  *****************************************************************************/
  2197. void mmi_secset_at_cmd_update_chv(void *info)
  2198. {
  2199.     /*----------------------------------------------------------------*/
  2200.     /* Local Variables                                                */
  2201.     /*----------------------------------------------------------------*/
  2202.     mmi_smu_verify_pin_result_ind_struct *at_verify_pin_ind = (mmi_smu_verify_pin_result_ind_struct *)info;
  2203.     historyNode *History;
  2204.     /*----------------------------------------------------------------*/
  2205.     /* Code Body                                                      */
  2206.     /*----------------------------------------------------------------*/
  2207.     FillCountDownNumber(at_verify_pin_ind->chv_info);
  2208.     switch (at_verify_pin_ind->next_type)
  2209.     {
  2210.         case MMI_SETTING_TYPE_NO_REQUIRED:
  2211.             if (gSecuritySetupContext.PINBlocked)
  2212.             {
  2213.                 gSecuritySetupContext.PINBlocked = 0;
  2214.                 g_pwr_context.PowerOnSIMStatus &= ~MMI_SIM_STATUS_INVALID;  /* 0x01: Invalid SIM */
  2215.                 DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, 0);
  2216.                 DeleteScreenIfPresent(SCR_ID_SECSET_PUK1);
  2217.                 DeleteScreenIfPresent(SCR_ID_SECSET_PUK_NEW_PIN1);
  2218.                 DeleteScreenIfPresent(SCR_ID_SECSET_PUK_CONFIRM_PIN1);
  2219.             }
  2220.             break;
  2221.         case MMI_SETTING_TYPE_UBCHV1:
  2222.             if (gSecuritySetupContext.PINBlocked)
  2223.             {
  2224.                 DisplayPopup((PU8) GetString(STR_SETTING_WRONG_PUK), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  2225.                 if (GetHistoryScrID(SCR_ID_SECSET_PUK1, &History) == ST_SUCCESS)
  2226.                 {
  2227.                     if (History->inputBuffer != NULL)
  2228.                     {
  2229.                         memset(History->inputBuffer, 0, ENCODING_LENGTH);
  2230.                     }
  2231.                     if (History->guiBuffer != NULL)
  2232.                     {
  2233.                         memset(History->guiBuffer, 0, 2);
  2234.                     }
  2235.                 }
  2236.                 DeleteUptoScrID(SCR_ID_SECSET_PUK1);
  2237.             }
  2238.             else
  2239.             {
  2240.                 DisplayPopup((PU8) GetString(STR_SETTING_PIN_BLK), IMG_GLOBAL_ERROR, 0, ST_NOTIFYDURATION, ERROR_TONE);
  2241.                 memset(gSecuritySetupContext.NewPassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1) * ENCODING_LENGTH);
  2242.                 gSecuritySetupContext.PINBlocked = 1;
  2243.                 g_pwr_context.PowerOnSIMStatus |= MMI_SIM_STATUS_INVALID;       /* 0x01: Invalid SIM */
  2244.                 if (IsScreenPresent(CM_SCR_MARKER))
  2245.                 {
  2246.                     mmi_frm_add_history_before_cm_marker(SCR_ID_SECSET_PUK1, EntrySECSETPUK1);
  2247.                 }
  2248.                 else
  2249.                 {
  2250.                     ExitSECSETPUK1();
  2251.                     DeleteUptoScrID(SCR_ID_SECSET_PUK1);
  2252.                 }
  2253.             }
  2254.             break;
  2255.         case MMI_SETTING_TYPE_SIM_CARD_BLOCKED:
  2256.             EntryScrnSimBlockRsp();
  2257.             break;
  2258.         default:
  2259.             break;
  2260.     }
  2261. }