ScrLockerLawmo.c
39.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2010
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* ScrLockerLawmo.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file implements the Lock and Wipe Management Object (LAWMO) screen
* locker.
*
* LAWMO lock is required by the operator. When the operator wants to lock the
* handset, it will send a message to the handset. After the Device Management
* (DM) parses the message, it will notify the screen locker to lock the
* handset.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
/*****************************************************************************
* Include
*****************************************************************************/
#include "MMI_features.h"
#if defined(__DM_LAWMO_SUPPORT__)
#include "IdleGprot.h"
#include "DialerGprot.h"
#include "GpioSrvGprot.h"
#include "GpioSrvGprot.h"
#include "UcmSrvGprot.h"
#include "dmuigprot.h"
#include "ScrSaverGprot.h"
#include "SimCtrlSrvGprot.h"
#include "MMIDataType.h"
#include "mmiapi_dm_struct.h"
#include "string.h"
#include "kal_public_api.h"
#include "DebugInitDef_Int.h"
#include "kal_general_types.h"
#include "ScrLockerMain.h"
#include "mmi_common_app_trc.h"
#include "MMI_common_app_trc.h"
#include "ScrLockerLawmo.h"
#include "AlertScreen.h"
#include "wgui_categories_util.h"
#include "mmi_frm_events_gprot.h"
#include "GlobalResDef.h"
#include "mmi_rp_app_scr_locker_def.h"
#include "ScrLockerGprot.h"
#include "DialerCuiGprot.h"
#include "mmi_frm_scenario_gprot.h"
#include "wgui_categories_list.h"
#include "wgui_categories.h"
#include "CustDataRes.h"
#include "GlobalConstants.h"
#include "ScrLockerObject.h"
#include "gui_typedef.h"
#include "mmi_frm_input_gprot.h"
#include "DmSrvGprot.h"
#include "UcmGProt.h"
/**********************************************************************
* Typedef
**********************************************************************/
/* LAWMO screen locker state. */
typedef enum
{
MMI_SLK_LAWMO_STATE_NULL,
MMI_SLK_LAWMO_STATE_LOCK,
MMI_SLK_LAWMO_STATE_LOCK_FOR_WIPE
} mmi_slk_lawmo_state_enum;
/* LAWMO screen locker context structure. */
typedef struct
{
U8 flag;
mmi_slk_lawmo_state_enum state;
mmi_slk_lawmo_state_enum prev_state;
} mmi_slk_lawmo_context_struct;
/**********************************************************************
* Global variables
**********************************************************************/
static mmi_slk_lawmo_context_struct g_mmi_slk_lawmo_cntx;
/**********************************************************************
* Prototype
**********************************************************************/
static void mmi_slk_lawmo_sync_state(void);
/****************************************************************************
* Unit Test
****************************************************************************/
//#define SCR_LOCKER_LAWMO_UNIT_TEST
#if defined(SCR_LOCKER_LAWMO_UNIT_TEST)
mmi_dmui_status_enum g_mmi_slk_lawmo_ut_status;
static void mmi_slk_lawmo_lock_cmd_hdlr(
mmi_dmui_app_id_enum app_id,
mmi_dmui_cmd_enum cmd);
#if !defined(__DM_LAWMO_SUPPORT__)
/*
* Adaptation if LAWMO is not turned on.
*/
/* Fake string ID: */
#define STR_ID_SLK_LAWMO_LOCKED STR_GLOBAL_NOT_AVAILABLE
#define STR_ID_SLK_LAWMO_WIPING STR_GLOBAL_BUSY_TRY_LATER
#define STR_ID_SLK_LAWMO_POPUP_WIPING STR_GLOBAL_ON
#define STR_ID_SLK_LAWMO_POPUP_WIPING_DONE STR_GLOBAL_OFF
#define STR_ID_SLK_LAWMO_POPUP_LOCKED STR_GLOBAL_YES
#define STR_ID_SLK_LAWMO_POPUP_UNLOCKED STR_GLOBAL_NO
#define STR_ID_SLK_LAWMO_DEVICE_MANAGEMENT STR_GLOBAL_LOGO
/* Fake callback type: */
typedef void(*mmi_dmui_lawmo_cb)(mmi_dmui_app_id_enum, mmi_dmui_cmd_enum);
/*****************************************************************************
* FUNCTION
* mmi_dmui_lawmo_report
* DESCRIPTION
* This function is the fake function for LAWMO locker UT.
* PARAMETERS
* result : [IN] Fake
* cmd : [IN] Fake
* app_id : [IN] Fake
* RETURNS
* void
*****************************************************************************/
void mmi_dmui_lawmo_report(
mmi_dmui_app_id_enum app_id,
mmi_dmui_cmd_enum cmd,
mmi_dmui_result_enum result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
}
/*****************************************************************************
* FUNCTION
* mmi_dmui_get_status
* DESCRIPTION
* This function is the fake function for LAWMO locker UT.
* PARAMETERS
* mo_type : [IN] Fake
* RETURNS
* Fake
*****************************************************************************/
mmi_dmui_status_enum mmi_dmui_get_status(mmi_dmui_mo_type_enum mo_type)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return g_mmi_slk_lawmo_ut_status;
}
/*****************************************************************************
* FUNCTION
* mmi_dmui_lawmo_register_notify
* DESCRIPTION
* This function is the fake function for LAWMO locker UT.
* PARAMETERS
* app_id : [IN] Fake
* mo_type : [IN] Fake
* lawmo_callback : [IN] Fake
* RETURNS
* Fake
*****************************************************************************/
mmi_dmui_result_enum mmi_dmui_lawmo_register_notify(
mmi_dmui_app_id_enum app_id,
mmi_dmui_mo_type_enum mo_type,
mmi_dmui_lawmo_cb lawmo_callback)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return MMI_DMUI_RESULT_SUCCESS;
}
#endif /* !defined(__DM_LAWMO_SUPPORT__) */
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_inject_msg_hdlr
* DESCRIPTION
* This function handles the inject message for LAWMO locker UT.
* PARAMETERS
* string : [IN] String
* index : [IN] Index
* RETURNS
* void
*****************************************************************************/
void mmi_slk_lawmo_inject_msg_hdlr(kal_uint8 *string, kal_uint8 index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_dmui_cmd_enum cmd;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (strcmp((S8 *)string, "lock") == 0)
{
g_mmi_slk_lawmo_ut_status = MMI_DMUI_STATUS_LAWMO_LOCK_PARTIALLYLOCK;
cmd = MMI_DMUI_CMD_LAWMO_PARTIALLYLOCK;
}
else if (strcmp((S8 *)string, "wipe") == 0)
{
g_mmi_slk_lawmo_ut_status = MMI_DMUI_STATUS_LAWMO_WIPE_WIPE;
cmd = MMI_DMUI_CMD_LAWMO_PARTIALLYLOCK;
}
else if (strcmp((S8 *)string, "unlock") == 0)
{
g_mmi_slk_lawmo_ut_status = MMI_DMUI_STATUS_IDLE;
cmd = MMI_DMUI_CMD_LAWMO_UNLOCK;
}
mmi_slk_lawmo_lock_cmd_hdlr(MMI_DMUI_APP_ID_IDLE, cmd);
}
#endif /* defined(SCR_LOCKER_LAWMO_UNIT_TEST) */
/****************************************************************************
* Function
****************************************************************************/
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_initialize
* DESCRIPTION
* This function initializes the idle application for the DM LAWMO feature.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_init(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Reset the context structure. */
memset(&g_mmi_slk_lawmo_cntx, 0, sizeof(mmi_slk_lawmo_context_struct));
/* Sync the state with DM. */
mmi_slk_lawmo_sync_state();
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_get_state
* DESCRIPTION
* This function gets the state of the LAWMO screen locker.
* PARAMETERS
* void
* RETURNS
* State.
*****************************************************************************/
static mmi_slk_lawmo_state_enum mmi_slk_lawmo_get_state(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_GET_STATE, g_mmi_slk_lawmo_cntx.state));
return g_mmi_slk_lawmo_cntx.state;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_set_state
* DESCRIPTION
* This function sets the state of the LAWMO screen locker.
* PARAMETERS
* state : [IN] State
* RETURNS
* If state is changed, return MMI_TRUE. Otherwise, return MMI_FALSE.
*****************************************************************************/
static MMI_BOOL mmi_slk_lawmo_set_state(mmi_slk_lawmo_state_enum state)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_SET_STATE, g_mmi_slk_lawmo_cntx.state, state));
if (g_mmi_slk_lawmo_cntx.state == state)
{
return MMI_FALSE;
}
else
{
g_mmi_slk_lawmo_cntx.state = state;
return MMI_TRUE;
}
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_sync_state
* DESCRIPTION
* This function synchronizes the state between Idle and DM after the handset
* re-boots.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_sync_state(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
//mmi_dmui_status_enum status;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_SYNC_STATE));
//status = mmi_dmui_get_status(MMI_DMUI_MO_TYPE_LAWMO_LOCK);
if (srv_dm_lawmo_is_locked())
{
mmi_slk_lawmo_set_state(MMI_SLK_LAWMO_STATE_LOCK);
}
else
{
mmi_slk_lawmo_set_state(MMI_SLK_LAWMO_STATE_NULL);
}
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_is_locked
* DESCRIPTION
* This function checks if the LAWMO lock happens.
* PARAMETERS
* void
* RETURNS
* On yes, return MMI_TRUE; otherwise, return MMI_FALSE.
*****************************************************************************/
static MMI_BOOL mmi_slk_lawmo_is_locked(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_slk_lawmo_state_enum state = mmi_slk_lawmo_get_state();
MMI_BOOL ret = MMI_FALSE;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (state != MMI_SLK_LAWMO_STATE_NULL)
{
ret = MMI_TRUE;
}
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_IS_LOCKED, ret));
return ret;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_is_in_puk
* DESCRIPTION
* This function checks if the handset is in the "Enter PUK:" screen.
* PARAMETERS
* void
* RETURNS
* On yes, return MMI_TRUE; otherwise, return MMI_FALSE.
*****************************************************************************/
static MMI_BOOL mmi_slk_lawmo_is_in_puk(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return srv_sim_ctrl_any_verifying_sim();
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_get_slk_hist
* DESCRIPTION
* This function check if the handset is in call.
* PARAMETERS
* void
* RETURNS
* On yes, return MMI_TRUE; otherwise, return MMI_FALSE.
*****************************************************************************/
static MMI_BOOL mmi_slk_lawmo_is_in_call(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return srv_ucm_is_any_call();
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_delete_non_puk_screen
* DESCRIPTION
* This function deletes all non-PUK screen in the history.
*
* Prepare the history to display after the popup finishes.
*
* History (left: buttom, right: top):
*
* {idle screen}, {UCM related screen}
*
* TODO: this solution is not good. After 10A, when all APP use the
* screen group, we should terminate all APP except UCM.
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_display_idle
* DESCRIPTION
* PARAMETERS
* popup_str_id : [IN] String ID for the popup
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_display_idle(U16 popup_str_id)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
srv_backlight_turn_on(SRV_BACKLIGHT_SHORT_TIME);
// framework supports that delete all screen in history
// except the screen which return -1 in their leave proc
mmi_idle_display();
// popup indication if screen is still active
if (mmi_slk_lawmo_is_in_call())
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_DISPLAY_IDLE, 201));
mmi_popup_display_simple(
(WCHAR *)get_string(popup_str_id),
MMI_EVENT_WARNING,
GRP_ID_ROOT,
NULL);
}
else if (mmi_slk_lawmo_is_in_puk())
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_DISPLAY_IDLE, 202));
mmi_popup_display_simple(
(WCHAR *)get_string(popup_str_id),
MMI_EVENT_WARNING,
GRP_ID_ROOT,
NULL);
}
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_DISPLAY_IDLE, 200));
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_proc_partial_lock
* DESCRIPTION
* This function processes the command of the LAWMO lock.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_proc_partial_lock(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
//mmi_dmui_status_enum status;
MMI_BOOL ret = MMI_FALSE;
U16 str_id = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* For the LAWMO WIPE, the handset will go to the idle screen and lock to
prevent from unwanted operations. Different strings are used to notify
the user about the lock event. */
//status = mmi_dmui_get_status(MMI_DMUI_MO_TYPE_LAWMO_WIPE);
if (srv_dm_lawmo_is_wiping())
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_PROC_PARTIAL_LOCK, 100));
ret = mmi_slk_lawmo_set_state(MMI_SLK_LAWMO_STATE_LOCK_FOR_WIPE);
str_id = STR_ID_SLK_LAWMO_POPUP_WIPING;
}
else if (srv_dm_lawmo_is_locked())
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_PROC_PARTIAL_LOCK, 101));
ret = mmi_slk_lawmo_set_state(MMI_SLK_LAWMO_STATE_LOCK);
str_id = STR_ID_SLK_LAWMO_POPUP_LOCKED;
}
if (ret)
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_PROC_PARTIAL_LOCK, 200));
mmi_slk_lawmo_display_idle(str_id);
mmi_scr_locker_close();
mmi_scr_locker_launch_ex(MMI_SCR_LOCKER_TYPE_LAWMO);
}
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_proc_unlock
* DESCRIPTION
* This function processes the command the LAWMO unlock.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_proc_unlock(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
MMI_BOOL ret;
U16 str_id;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* For the LAWMO WIPE, the handset will go to the idle screen and lock to
prevent from unwanted operations. Different strings are used to notify
the user about the unlock event. */
if (mmi_slk_lawmo_get_state() == MMI_SLK_LAWMO_STATE_LOCK_FOR_WIPE)
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_PROC_UNLOCK, 100));
str_id = STR_ID_SLK_LAWMO_POPUP_WIPING_DONE;
}
else
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_PROC_UNLOCK, 101));
str_id = STR_ID_SLK_LAWMO_POPUP_UNLOCKED;
}
ret = mmi_slk_lawmo_set_state(MMI_SLK_LAWMO_STATE_NULL);
if (ret)
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_PROC_UNLOCK, 200));
mmi_scr_locker_close();
mmi_slk_lawmo_display_idle(str_id);
}
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_handle_dm_lawmo_lock
* DESCRIPTION
* This function is the command handler for the MO type of LAWMO lock.
* PARAMETERS
*
* RETURNS
* mmi_ret
*****************************************************************************/
static mmi_ret mmi_slk_lawmo_handle_dm_lawmo_lock(mmi_event_struct *evt )
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
srv_dm_lawmo_lock_ind_evt_struct *lawmo_lock_ind = (srv_dm_lawmo_lock_ind_evt_struct*)evt;
switch (lawmo_lock_ind->cmd)
{
case SRV_DM_LAWMO_LOCK_CMD_LOCK:
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LOCK_CMD_HDLR, 200));
mmi_slk_lawmo_proc_partial_lock();
break;
case SRV_DM_LAWMO_LOCK_CMD_UNLOCK:
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LOCK_CMD_HDLR, 201));
mmi_slk_lawmo_proc_unlock();
break;
default:
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LOCK_CMD_HDLR, 400));
break;
}
return MMI_RET_OK;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_handle_dm_lawmo_wipe
* DESCRIPTION
* This function is the command handler for the MO type of LAWMO wipe.
* PARAMETERS
*
* RETURNS
* mmi_ret
*****************************************************************************/
static mmi_ret mmi_slk_lawmo_handle_dm_lawmo_wipe(mmi_event_struct *evt )
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_dm_lawmo_wipe_ind_evt_struct *lawmo_wipe_ind = (srv_dm_lawmo_wipe_ind_evt_struct*)evt;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (lawmo_wipe_ind->cmd)
{
case SRV_DM_LAWMO_WIPE_CMD_START:
g_mmi_slk_lawmo_cntx.prev_state = g_mmi_slk_lawmo_cntx.state;
mmi_slk_lawmo_proc_partial_lock();
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LOCK_CMD_HDLR, 400));
break;
case SRV_DM_LAWMO_WIPE_CMD_FINISH:
mmi_slk_lawmo_proc_unlock();
if (g_mmi_slk_lawmo_cntx.prev_state != MMI_SLK_LAWMO_STATE_NULL)
{
mmi_scr_locker_launch_ex(MMI_SCR_LOCKER_TYPE_LAWMO);
}
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LOCK_CMD_HDLR, 401)); // 401?
break;
default:
break;
}
return MMI_RET_OK;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_launch_sos_dialer
* DESCRIPTION
* This function launches the SOS dialer.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_launch_sos_dialer(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_dialer_launch_by_string_ex(CUI_DIALER_TYPE_SOS, L"112");
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_leave_proc
* DESCRIPTION
* This function is the leave proc.
* PARAMETERS
* event : [IN] Event
* RETURNS
* mmi_ret
*****************************************************************************/
static mmi_ret mmi_slk_lawmo_leave_proc(mmi_event_struct *event)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_ret ret = MMI_RET_OK;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_ASSERT(event);
switch (event->evt_id)
{
case EVT_ID_SCRN_GOBACK_IN_END_KEY: /* fall-throught */
case EVT_ID_SCRN_DELETE_REQ_IN_END_KEY:
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LEAVE_PROC, event->evt_id, 300));
ret = -1; /* Do not close me. */
break;
default:
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_LEAVE_PROC, event->evt_id, 200));
break;
}
return ret;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_entry_locked_screen
* DESCRIPTION
* This function enters the DM LAWMO lock screen.
* PARAMETERS
* param : [IN] Screen parameter
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_enter(mmi_scrn_essential_struct *param)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_slk_lawmo_state_enum state;
U16 str_id;
U16 img_id;
MMI_BOOL ret;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
ret = mmi_frm_scrn_enter(
param->group_id,
param->scrn_id,
NULL,
(FuncPtr)mmi_slk_lawmo_enter,
MMI_FRM_FULL_SCRN);
// set leave proc even the screen is not active
mmi_frm_scrn_set_leave_proc(
param->group_id,
param->scrn_id,
mmi_slk_lawmo_leave_proc);
if (!ret)
{
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_ENTER, 300));
return;
}
MMI_SLK_LOG((TRC_MMI_SLK_LAWMO_ENTER, 200));
/*
* Determine the string and image in the screen.
*/
state = mmi_slk_lawmo_get_state();
MMI_DBG_ASSERT(state != MMI_SLK_LAWMO_STATE_NULL);
if (state == MMI_SLK_LAWMO_STATE_LOCK_FOR_WIPE)
{
str_id = STR_ID_SLK_LAWMO_WIPING;
img_id = IMG_GLOBAL_PROGRESS;
}
else
{
str_id = STR_ID_SLK_LAWMO_LOCKED;
img_id = IMG_ID_SLK_LOCKED;
}
ShowCategory154Screen(
STR_ID_SLK_LAWMO_DEVICE_MANAGEMENT,
0,
0,
0,
STR_ID_SLK_SOS,
0,
(U8 *)GetString(str_id), /* message line 1 */
NULL, /* message line 2 */
img_id, /* image */
NULL);
SetRightSoftkeyFunction(mmi_slk_lawmo_launch_sos_dialer, KEY_EVENT_UP);
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_on_run
* DESCRIPTION
* This function runs the screen locker.
* PARAMETERS
* obj : [IN] Object
* RETURNS
* void
*****************************************************************************/
static void mmi_slk_lawmo_on_run(mmi_slk_obj_struct *obj)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_slk_obj_on_run(obj);
mmi_frm_group_enter(obj->this_gid, MMI_FRM_NODE_SMART_CLOSE_FLAG);
mmi_frm_scrn_first_enter(
obj->this_gid,
SCR_ID_SLK_MAIN,
(FuncPtr)mmi_slk_lawmo_enter,
obj);
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_on_suspend
* DESCRIPTION
* This function handles the suspend event.
* PARAMETERS
* obj : [IN] Object
* is_closed : [IN] Suspend because the lock is closed
* RETURNS
* void
*****************************************************************************/
void mmi_slk_lawmo_on_suspend(mmi_slk_obj_struct *obj, MMI_BOOL is_closed)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_ASSERT(obj);
wgui_status_icon_bar_hide_icon(STATUS_ICON_KEYPAD_LOCK);
mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_ENABLED);
/*
* For LAWMO, UE requires the lower priority events cannot be shown until
* the lock is closed by the operator. Thus, we never end the scenario until
* the lock is closed.
*/
if (is_closed && obj->scenario != MMI_SCENARIO_ID_INVALID)
{
mmi_frm_end_scenario(obj->scenario);
}
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_on_want_to_run
* DESCRIPTION
* This function checks if the locker wants to run.
* PARAMETERS
* void
* RETURNS
* On yes, return MMI_TRUE; otherwise, return MMI_FALSE.
*****************************************************************************/
MMI_BOOL mmi_slk_lawmo_on_want_to_run(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/*
* Ask parent.
*/
if (!mmi_slk_obj_on_want_to_run())
{
return MMI_FALSE;
}
return mmi_slk_lawmo_is_locked();
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_on_init
* DESCRIPTION
* This function initializes the object.
* PARAMETERS
* obj : [IN] Object
* RETURNS
* void
*****************************************************************************/
void mmi_slk_lawmo_on_init(void *obj)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_slk_lawmo_struct *p;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_slk_obj_on_init((mmi_slk_obj_struct *)obj);
p = (mmi_slk_lawmo_struct *)obj;
/* Member variable. */
p->type = MMI_SCR_LOCKER_TYPE_LAWMO;
p->scenario = MMI_SCENARIO_ID_HIGHEST_SCRN;
/* Member function. */
p->on_run = mmi_slk_lawmo_on_run;
p->on_suspend = mmi_slk_lawmo_on_suspend;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_handle_idle_launched
* DESCRIPTION
* This function handles the Idle launched event for LAWMO locker.
* PARAMETERS
* void
* RETURNS
* On handled, return -1 to stop the event routing; otherwise, return
* MMI_RET_OK;
*****************************************************************************/
mmi_ret mmi_slk_lawmo_handle_idle_launched(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_slk_lawmo_init();
if (mmi_slk_lawmo_is_locked())
{
mmi_scr_locker_launch_ex(MMI_SCR_LOCKER_TYPE_LAWMO);
return -1; /* Stop the event routing. */
}
return MMI_RET_OK;
}
/*****************************************************************************
* FUNCTION
* mmi_slk_lawmo_evt_hdlr
* DESCRIPTION
* This function is the main event handler of lawmo screen locker.
* PARAMETERS
* event : [IN] Event
* RETURNS
* mmi_ret
*****************************************************************************/
mmi_ret mmi_slk_lawmo_evt_hdlr(mmi_event_struct *event)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_ret ret;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_ASSERT(event);
switch (event->evt_id)
{
case EVT_ID_SRV_DM_LAWMO_LOCK_IND:
ret = mmi_slk_lawmo_handle_dm_lawmo_lock(event);
break;
case EVT_ID_SRV_DM_LAWMO_WIPE_EX_IND:
ret = mmi_slk_lawmo_handle_dm_lawmo_wipe(event);
break;
default:
ret = MMI_RET_OK;
break;
}
return ret;
}
#endif /* defined(__DM_LAWMO_SUPPORT__) */