|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Implementation of CSsmUiSpecific class. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <ctsydomainpskeys.h> |
|
20 #include <f32file.h> |
|
21 #include <mmtsy_names.h> |
|
22 #include <pathinfo.h> |
|
23 #include <securitynotification.h> |
|
24 #include <ssm/ssmstate.h> |
|
25 #include <startupdomainpskeys.h> |
|
26 |
|
27 #include "ssmuispecific.h" |
|
28 #include "ssmmapperutilitystatic.h" |
|
29 #include "ssmmapperutilityinternalpskeys.h" |
|
30 #include "ssmsubstateext.hrh" |
|
31 #include "ssmswp.hrh" |
|
32 #include "trace.h" |
|
33 |
|
34 /** Channel used to communicate with Security Notifier. */ |
|
35 static const TUid KSecurityNotifierChannel = { 0x1000598F }; |
|
36 |
|
37 // Type definitions for a buffer containing a drive id (drive letter + :). |
|
38 const TInt KDriveIdLength = 2; |
|
39 typedef TBuf<KDriveIdLength> TDriveId; |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CSsmUiSpecific::~CSsmUiSpecific |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C CSsmUiSpecific::~CSsmUiSpecific() |
|
48 { |
|
49 FUNC_LOG; |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CSsmUiSpecific::InstanceL |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CSsmUiSpecific* CSsmUiSpecific::InstanceL() |
|
58 { |
|
59 FUNC_LOG; |
|
60 |
|
61 CSsmUiSpecific* self( NULL ); |
|
62 if ( Dll::Tls() ) |
|
63 { |
|
64 self = static_cast<CSsmUiSpecific*>( Dll::Tls() ); |
|
65 self->iReferenceCount++; |
|
66 } |
|
67 else |
|
68 { |
|
69 self = new ( ELeave ) CSsmUiSpecific; |
|
70 CleanupStack::PushL( self ); |
|
71 User::LeaveIfError( Dll::SetTls( self ) ); |
|
72 CleanupStack::Pop( self ); |
|
73 } |
|
74 |
|
75 return self; |
|
76 } |
|
77 |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CSsmUiSpecific::Release |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C void CSsmUiSpecific::Release() |
|
84 { |
|
85 FUNC_LOG; |
|
86 |
|
87 TAny* tlsPtr = Dll::Tls(); |
|
88 ASSERT_TRACE( tlsPtr ); |
|
89 |
|
90 CSsmUiSpecific* self = static_cast<CSsmUiSpecific*>( tlsPtr ); |
|
91 if ( --self->iReferenceCount == 0 ) |
|
92 { |
|
93 Dll::FreeTls(); |
|
94 delete self; |
|
95 } |
|
96 } |
|
97 |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CSsmUiSpecific::StartupPSUid |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C TUid CSsmUiSpecific::StartupPSUid() |
|
104 { |
|
105 FUNC_LOG; |
|
106 |
|
107 return KPSUidStartup; |
|
108 } |
|
109 |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // CSsmUiSpecific::StarterPSUid |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C TUid CSsmUiSpecific::StarterPSUid() |
|
116 { |
|
117 FUNC_LOG; |
|
118 |
|
119 return KPSStarterUid; |
|
120 } |
|
121 |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // CSsmUiSpecific::EmergencyCallPropertyCategory |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C TUid CSsmUiSpecific::EmergencyCallPropertyCategory() |
|
128 { |
|
129 FUNC_LOG; |
|
130 |
|
131 return KPSUidCtsyCallInformation; |
|
132 } |
|
133 |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // CSsmUiSpecific::SecurityPinNotifierUid |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 EXPORT_C TUid CSsmUiSpecific::SecurityPinNotifierUid() |
|
140 { |
|
141 FUNC_LOG; |
|
142 |
|
143 return KSecurityNotifierUid; |
|
144 } |
|
145 |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CSsmUiSpecific::ScreenOutputChannelUid |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 EXPORT_C TUid CSsmUiSpecific::ScreenOutputChannelUid() |
|
152 { |
|
153 FUNC_LOG; |
|
154 |
|
155 return KSecurityNotifierChannel; |
|
156 } |
|
157 |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // CSsmUiSpecific::RFStatusPropertyCategory |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C TUid CSsmUiSpecific::RFStatusPropertyCategory() |
|
164 { |
|
165 FUNC_LOG; |
|
166 |
|
167 return TUid::Uid( SWP_UID_SSM_RF_STATUS ); |
|
168 } |
|
169 |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CSsmUiSpecific::EmergencyCallPropertyKey |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 EXPORT_C TUint CSsmUiSpecific::EmergencyCallPropertyKey() |
|
176 { |
|
177 FUNC_LOG; |
|
178 |
|
179 return KCTsyCallState; |
|
180 } |
|
181 |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CSsmUiSpecific::SimStatusPropertyKey |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 EXPORT_C TUint CSsmUiSpecific::SimStatusPropertyKey() |
|
188 { |
|
189 FUNC_LOG; |
|
190 |
|
191 return KPSSimStatus; |
|
192 } |
|
193 |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // CSsmUiSpecific::RFStatusPropertyKey |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C TUint CSsmUiSpecific::RFStatusPropertyKey() |
|
200 { |
|
201 FUNC_LOG; |
|
202 |
|
203 return SWP_UID_SSM_RF_STATUS; |
|
204 } |
|
205 |
|
206 |
|
207 // --------------------------------------------------------------------------- |
|
208 // CSsmUiSpecific::GetTsyModuleNameL |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 EXPORT_C HBufC* CSsmUiSpecific::GetTsyModuleNameL() |
|
212 { |
|
213 FUNC_LOG; |
|
214 |
|
215 /***************************************************** |
|
216 * Series 60 Customer / TSY |
|
217 * Needs customer TSY implementation |
|
218 *****************************************************/ |
|
219 |
|
220 HBufC* name = KMmTsyModuleName().AllocL(); |
|
221 INFO_1( "TSY name: %S", name ); |
|
222 return name; |
|
223 } |
|
224 |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // CSsmUiSpecific::PhoneTsyNameL |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C HBufC* CSsmUiSpecific::PhoneTsyNameL() |
|
231 { |
|
232 FUNC_LOG; |
|
233 |
|
234 /***************************************************** |
|
235 * Series 60 Customer / TSY |
|
236 * Needs customer TSY implementation |
|
237 *****************************************************/ |
|
238 |
|
239 HBufC* name = KMmTsyPhoneName().AllocL(); |
|
240 INFO_1( "Phone name: %S", name ); |
|
241 return name; |
|
242 } |
|
243 |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CSsmUiSpecific::SetSecurityStatus |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 EXPORT_C void CSsmUiSpecific::SetSecurityStatus( |
|
250 const TStrtSecurityStatus& aSecurityStatus ) |
|
251 { |
|
252 FUNC_LOG; |
|
253 |
|
254 iStrtSecurityStatus = aSecurityStatus; |
|
255 } |
|
256 |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // CSsmUiSpecific::SecurityStatus |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 EXPORT_C TStrtSecurityStatus CSsmUiSpecific::SecurityStatus() const |
|
263 { |
|
264 FUNC_LOG; |
|
265 |
|
266 return iStrtSecurityStatus; |
|
267 } |
|
268 |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // CSsmUiSpecific::IsAmaStarterSupported |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 EXPORT_C TBool CSsmUiSpecific::IsAmaStarterSupported() |
|
275 { |
|
276 FUNC_LOG; |
|
277 |
|
278 return SsmMapperUtility::FeatureStatus( TUid::Uid( KFeatureIdExtendedStartup ) ); |
|
279 } |
|
280 |
|
281 |
|
282 // --------------------------------------------------------------------------- |
|
283 // CSsmUiSpecific::IsSimSupported |
|
284 // --------------------------------------------------------------------------- |
|
285 // |
|
286 EXPORT_C TBool CSsmUiSpecific::IsSimSupported() |
|
287 { |
|
288 FUNC_LOG; |
|
289 |
|
290 return SsmMapperUtility::FeatureStatus( TUid::Uid( KFeatureIdSimCard ) ); |
|
291 } |
|
292 |
|
293 |
|
294 // --------------------------------------------------------------------------- |
|
295 // CSsmUiSpecific::IsSimlessOfflineSupported |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 EXPORT_C TBool CSsmUiSpecific::IsSimlessOfflineSupported() |
|
299 { |
|
300 FUNC_LOG; |
|
301 |
|
302 return SsmMapperUtility::FeatureStatus( |
|
303 TUid::Uid( KFeatureIdFfSimlessOfflineSupport ) ); |
|
304 } |
|
305 |
|
306 |
|
307 // --------------------------------------------------------------------------- |
|
308 // CSsmUiSpecific::IsSimPresent |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 EXPORT_C TBool CSsmUiSpecific::IsSimPresent() |
|
312 { |
|
313 FUNC_LOG; |
|
314 |
|
315 TInt value( 0 ); |
|
316 TInt err = RProperty::Get( SsmMapperUtility::PsUid( KPSUidStartup ), KPSSimStatus, value ); |
|
317 ERROR( err, "Failed to get value of KPSUidStartup::KPSSimStatus" ); |
|
318 return ( err == KErrNone && |
|
319 ( value == ESimUsable || |
|
320 value == ESimReadable || |
|
321 value == ESimNotReady ) ); |
|
322 } |
|
323 |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CSsmUiSpecific::IsSimStateChangeAllowed |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 EXPORT_C TBool CSsmUiSpecific::IsSimStateChangeAllowed() |
|
330 { |
|
331 FUNC_LOG; |
|
332 |
|
333 TSsmState state; |
|
334 TInt err = SsmMapperUtility::GetCurrentState( state ); |
|
335 ERROR( err, "Failed to get current state" ); |
|
336 return ( err == KErrNone && |
|
337 ( state.MainState() == ESsmStartup && state.SubState() == ESsmStateSecurityCheck ) || |
|
338 ( state.MainState() == ESsmStartup && state.SubState() == ESsmStateNonCritical ) || |
|
339 state.MainState() == ESsmNormal ); |
|
340 } |
|
341 |
|
342 |
|
343 // --------------------------------------------------------------------------- |
|
344 // CSsmUiSpecific::IsNormalBoot |
|
345 // --------------------------------------------------------------------------- |
|
346 // |
|
347 EXPORT_C TBool CSsmUiSpecific::IsNormalBoot() |
|
348 { |
|
349 FUNC_LOG; |
|
350 |
|
351 TInt value( 0 ); |
|
352 TInt errorCode = RProperty::Get( SsmMapperUtility::PsUid( KPSUidStartup ), KPSStartupReason, value ); |
|
353 ERROR( errorCode, "Failed to get value of KPSUidStartup::KPSStartupReason" ); |
|
354 |
|
355 TBool ret = ( errorCode == KErrNone && value == ENormalStartup ); |
|
356 INFO_1( "Is normal boot = %d", ret ); |
|
357 return ret; |
|
358 } |
|
359 |
|
360 |
|
361 // --------------------------------------------------------------------------- |
|
362 // CSsmUiSpecific::IsSimChangedReset |
|
363 // --------------------------------------------------------------------------- |
|
364 // |
|
365 EXPORT_C TBool CSsmUiSpecific::IsSimChangedReset() |
|
366 { |
|
367 FUNC_LOG; |
|
368 |
|
369 TUid startupPsUid( SsmMapperUtility::PsUid( KPSUidStartup ) ); |
|
370 TInt value( 0 ); |
|
371 TInt errorCode = RProperty::Get( startupPsUid, KPSStartupReason, value ); |
|
372 ERROR( errorCode, "Failed to get value of KPSUidStartup::KPSStartupReason" ); |
|
373 |
|
374 TBool ret( EFalse ); |
|
375 if ( errorCode == KErrNone && value == ESIMStatusChangeReset ) |
|
376 { |
|
377 errorCode = RProperty::Get( startupPsUid, KPSSimChanged, value ); |
|
378 ret = ( errorCode == KErrNone && value == ESimChanged ); |
|
379 } |
|
380 |
|
381 INFO_1( "Is SIM changed reset = %d", ret ); |
|
382 return ret; |
|
383 } |
|
384 |
|
385 |
|
386 // --------------------------------------------------------------------------- |
|
387 // CSsmUiSpecific::ValidateRTCPropertyKey |
|
388 // --------------------------------------------------------------------------- |
|
389 // |
|
390 EXPORT_C TUint CSsmUiSpecific::ValidateRTCPropertyKey() |
|
391 { |
|
392 FUNC_LOG; |
|
393 |
|
394 return KRTCPropertyKey; |
|
395 } |
|
396 |
|
397 |
|
398 // --------------------------------------------------------------------------- |
|
399 // CSsmUiSpecific::ValidateRTCPropertyCategory |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 EXPORT_C TUid CSsmUiSpecific::ValidateRTCPropertyCategory() |
|
403 { |
|
404 FUNC_LOG; |
|
405 |
|
406 return KPSStarterUid; |
|
407 } |
|
408 |
|
409 |
|
410 // --------------------------------------------------------------------------- |
|
411 // CSsmUiSpecific::PhoneMemoryRootDriveId |
|
412 // --------------------------------------------------------------------------- |
|
413 // |
|
414 EXPORT_C TInt CSsmUiSpecific::PhoneMemoryRootDriveId() |
|
415 { |
|
416 FUNC_LOG; |
|
417 |
|
418 TInt driveId = EDriveC; |
|
419 TDriveId driveIdBuf = PathInfo::PhoneMemoryRootPath().Left( KDriveIdLength ); |
|
420 if ( driveIdBuf.Length() > 0 ) |
|
421 { |
|
422 RFs::CharToDrive( driveIdBuf[0], driveId ) ; |
|
423 } |
|
424 |
|
425 INFO_1( "Phone memory root path ID: %d", driveId ); |
|
426 return driveId; |
|
427 } |
|
428 |
|
429 |
|
430 // --------------------------------------------------------------------------- |
|
431 // CSsmUiSpecific::CSsmUiSpecific |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 CSsmUiSpecific::CSsmUiSpecific() : iReferenceCount( 1 ) |
|
435 { |
|
436 FUNC_LOG; |
|
437 } |