13 * |
13 * |
14 * Description: Main AI framework class |
14 * Description: Main AI framework class |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 // System includes |
19 #include <bautils.h> |
|
20 #include <coemain.h> |
|
21 #include <ConeResLoader.h> |
|
22 #include <e32property.h> |
|
23 #include <startupdomainpskeys.h> |
19 #include <startupdomainpskeys.h> |
|
20 #include <centralrepository.h> |
|
21 #include <cenrepnotifyhandler.h> |
|
22 |
|
23 // User includes |
|
24 #include "aiuicontrollermanager.h" |
|
25 #include "aiuicontroller.h" |
|
26 #include "aieventhandler.h" |
|
27 #include "aistatemanager.h" |
|
28 #include "aistateprovider.h" |
|
29 #include "aipluginfactory.h" |
|
30 #include "aiwspluginmanager.h" |
|
31 #include "aiidleappregister.h" |
|
32 |
|
33 #include <activeidle2domaincrkeys.h> |
24 #include <activeidle2domainpskeys.h> |
34 #include <activeidle2domainpskeys.h> |
25 #include <activeidle2internalpskeys.h> |
35 #include <activeidle2internalpskeys.h> |
26 #include <cenrepnotifyhandler.h> |
|
27 #include <aipspropertyobserver.h> |
36 #include <aipspropertyobserver.h> |
28 #include <aisystemuids.hrh> |
37 #include <aisystemuids.hrh> |
29 |
38 |
30 #include <AknWaitDialog.h> |
39 #include "aiutility.h" |
31 #include <AknGlobalNote.h> |
40 #include "aifwpanic.h" |
32 #include <StringLoader.h> |
|
33 |
|
34 |
|
35 #include <e32cmn.h> |
|
36 #include <e32def.h> |
|
37 |
41 |
38 #include "aifw.h" |
42 #include "aifw.h" |
39 #include "aifwpanic.h" |
43 |
40 #include "aiutility.h" |
|
41 #include "aiuicontrollermanager.h" |
|
42 #include "aiuicontroller.h" |
|
43 #include "aicontentmodel.h" |
|
44 #include "aicontentpluginmanager.h" |
|
45 #include "aiwspluginmanager.h" |
|
46 #include "aipluginstatemanager.h" |
|
47 #include "aiidleappregister.h" |
|
48 #include "debug.h" |
44 #include "debug.h" |
49 |
45 |
50 #include <centralrepository.h> |
46 // Constants |
51 #include <activeidle2domaincrkeys.h> |
47 |
52 #include "ainetworklistener.h" |
|
53 |
|
54 |
|
55 #include <data_caging_path_literals.hrh> |
|
56 |
48 |
57 // ======== MEMBER FUNCTIONS ======== |
49 // ======== MEMBER FUNCTIONS ======== |
58 |
50 |
59 // ---------------------------------------------------------------------------- |
51 // ---------------------------------------------------------------------------- |
60 // CAiFw::NewL() |
52 // CAiFw::CAiFw() |
|
53 // |
61 // ---------------------------------------------------------------------------- |
54 // ---------------------------------------------------------------------------- |
62 // |
55 // |
63 CAiFw::CAiFw() |
56 CAiFw::CAiFw() |
64 { |
57 { |
65 } |
58 } |
66 |
59 |
67 // ---------------------------------------------------------------------------- |
60 // ---------------------------------------------------------------------------- |
68 // CAiFw::ConstructL() |
61 // CAiFw::ConstructL() |
|
62 // |
69 // ---------------------------------------------------------------------------- |
63 // ---------------------------------------------------------------------------- |
70 // |
64 // |
71 void CAiFw::ConstructL() |
65 void CAiFw::ConstructL() |
72 { |
66 { |
73 #if 0 |
67 #if 0 |
76 // 0x102750F0 in AI3, 0x2001CB4F in AI3_Test |
70 // 0x102750F0 in AI3, 0x2001CB4F in AI3_Test |
77 TSecureId secId( proc.SecureId() ); |
71 TSecureId secId( proc.SecureId() ); |
78 |
72 |
79 if( secId == 0x2001CB4F ) |
73 if( secId == 0x2001CB4F ) |
80 { |
74 { |
81 iAIRepository = CRepository::NewL( TUid::Uid( 0x2001952B ) ); |
75 iRepository = CRepository::NewL( TUid::Uid( 0x2001952B ) ); |
82 } |
76 } |
83 else |
77 else |
84 { |
78 { |
85 iAIRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) ); |
79 iRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) ); |
86 } |
80 } |
87 #else |
81 #else |
88 iAIRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) ); |
82 iRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) ); |
89 #endif |
83 #endif |
90 |
84 |
91 TInt value( 0 ); |
85 TInt value( 0 ); |
92 |
86 |
93 iAIRepository->Get( KAiMainUIController, value ); |
87 iRepository->Get( KAiMainUIController, value ); |
94 |
88 |
95 if( !( value == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
89 if ( !( value == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
96 value == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE || |
90 value == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE || |
97 value == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
91 value == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
98 value == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ) ) |
92 value == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ) ) |
99 { |
93 { |
100 // Someone wrote an invalid configuration! Reset repository. |
94 // Someone wrote an invalid configuration! Reset repository. |
101 iAIRepository->Reset( KAiMainUIController ); |
95 iRepository->Reset( KAiMainUIController ); |
102 iAIRepository->Reset( KAiFirstUIController ); |
96 iRepository->Reset( KAiFirstUIController ); |
103 iAIRepository->Delete( KAiFirstUIController + 1 ); |
97 iRepository->Delete( KAiFirstUIController + 1 ); |
104 } |
98 } |
105 |
99 |
106 iUiControllerManager = CAiUiControllerManager::NewL(); |
100 iUiControllerManager = CAiUiControllerManager::NewL( this ); |
107 |
101 |
108 iPluginManager = CAiContentPluginManager::NewL(); |
102 iFactory = CAiPluginFactory::NewL( *iUiControllerManager ); |
109 |
103 |
110 // Hook framework as UI event observer |
104 iStateManager = CAiStateManager::NewL( *iFactory ); |
111 iUiControllerManager->SetEventHandler( *this ); |
105 |
|
106 iEventHandler = CAiEventHandler::NewL( *iFactory ); |
112 } |
107 } |
113 |
108 |
114 // ---------------------------------------------------------------------------- |
109 // ---------------------------------------------------------------------------- |
115 // CAiFw::NewLC() |
110 // CAiFw::NewLC() |
|
111 // |
116 // ---------------------------------------------------------------------------- |
112 // ---------------------------------------------------------------------------- |
117 // |
113 // |
118 EXPORT_C CAiFw* CAiFw::NewLC() |
114 EXPORT_C CAiFw* CAiFw::NewLC() |
119 { |
115 { |
120 CAiFw* self = new ( ELeave ) CAiFw; |
116 CAiFw* self = new ( ELeave ) CAiFw; |
121 CleanupStack::PushL( self ); |
117 CleanupStack::PushL( self ); |
|
118 |
122 self->ConstructL(); |
119 self->ConstructL(); |
123 |
120 |
124 __TICK( "FW: Core FW constructed" ); |
121 __TICK( "FW: Core FW constructed" ); |
125 __HEAP( "FW: Core FW constructed" ); |
122 __HEAP( "FW: Core FW constructed" ); |
126 |
123 |
127 return self; |
124 return self; |
128 } |
125 } |
129 |
126 |
130 // ---------------------------------------------------------------------------- |
127 // ---------------------------------------------------------------------------- |
131 // CAiFw::~CAiFw() |
128 // CAiFw::~CAiFw() |
|
129 // |
132 // ---------------------------------------------------------------------------- |
130 // ---------------------------------------------------------------------------- |
133 // |
131 // |
134 CAiFw::~CAiFw() |
132 CAiFw::~CAiFw() |
135 { |
133 { |
136 if( iPluginManager ) |
134 if ( iNotifyHandler ) |
137 { |
|
138 delete iPluginManager; |
|
139 iPluginManager = NULL; |
|
140 } |
|
141 |
|
142 if( iIdleRestartObserver ) |
|
143 { |
|
144 Release( iIdleRestartObserver ); |
|
145 iIdleRestartObserver = NULL; |
|
146 } |
|
147 |
|
148 if( iWsPluginManager ) |
|
149 { |
|
150 delete iWsPluginManager; |
|
151 iWsPluginManager = NULL; |
|
152 } |
|
153 |
|
154 if( iUiControllerManager ) |
|
155 { |
|
156 delete iUiControllerManager; |
|
157 iUiControllerManager = NULL; |
|
158 } |
|
159 |
|
160 if( iNotifyHandler ) |
|
161 { |
135 { |
162 iNotifyHandler->StopListening(); |
136 iNotifyHandler->StopListening(); |
163 delete iNotifyHandler; |
137 } |
164 iNotifyHandler = NULL; |
138 |
165 } |
139 delete iNotifyHandler; |
166 |
140 iNotifyHandler = NULL; |
167 if( iNotifyHandlerESS ) |
141 |
|
142 if ( iNotifyHandlerESS ) |
168 { |
143 { |
169 iNotifyHandlerESS->StopListening(); |
144 iNotifyHandlerESS->StopListening(); |
170 delete iNotifyHandlerESS; |
145 } |
171 iNotifyHandlerESS = NULL; |
146 |
172 } |
147 delete iNotifyHandlerESS; |
173 |
148 iNotifyHandlerESS = NULL; |
174 if( iAIRepository ) |
149 |
175 { |
150 Release( iIdleRestartObserver ); |
176 delete iAIRepository; |
151 iIdleRestartObserver = NULL; |
177 iAIRepository = NULL; |
152 |
178 } |
153 delete iWsPluginManager; |
179 |
154 iWsPluginManager = NULL; |
|
155 |
|
156 delete iEventHandler; |
|
157 iEventHandler = NULL; |
|
158 |
|
159 delete iStateProvider; |
|
160 iStateProvider = NULL; |
|
161 |
|
162 delete iStateManager; |
|
163 iStateManager = NULL; |
|
164 |
|
165 delete iFactory; |
|
166 iFactory = NULL; |
|
167 |
|
168 delete iUiControllerManager; |
|
169 iUiControllerManager = NULL; |
|
170 |
|
171 delete iRepository; |
|
172 iRepository = NULL; |
|
173 |
180 iLibrary1.Close(); |
174 iLibrary1.Close(); |
181 iLibrary2.Close(); |
175 iLibrary2.Close(); |
182 iLibrary3.Close(); |
176 iLibrary3.Close(); |
183 } |
177 } |
184 |
178 |
185 // ---------------------------------------------------------------------------- |
179 // ---------------------------------------------------------------------------- |
186 // CAiFw::RunL() |
180 // CAiFw::RunL() |
|
181 // |
187 // ---------------------------------------------------------------------------- |
182 // ---------------------------------------------------------------------------- |
188 // |
183 // |
189 EXPORT_C void CAiFw::RunL() |
184 EXPORT_C void CAiFw::RunL() |
190 { |
185 { |
191 CAiIdleAppRegister* idleReg = CAiIdleAppRegister::NewLC(); |
186 CAiIdleAppRegister* idleReg = CAiIdleAppRegister::NewLC(); |
198 iUiControllerManager->RunApplicationL(); |
193 iUiControllerManager->RunApplicationL(); |
199 } |
194 } |
200 |
195 |
201 // ---------------------------------------------------------------------------- |
196 // ---------------------------------------------------------------------------- |
202 // CAiFw::AppEnvReadyL() |
197 // CAiFw::AppEnvReadyL() |
|
198 // |
203 // ---------------------------------------------------------------------------- |
199 // ---------------------------------------------------------------------------- |
204 // |
200 // |
205 void CAiFw::AppEnvReadyL() |
201 void CAiFw::AppEnvReadyL() |
206 { |
202 { |
207 // Initialize members which need to be connected to the app environment's |
203 // Initialize members which need to be connected to the app environment's |
208 // active scheduler or depend on the app environment being initialized. |
204 // active scheduler or depend on the app environment being initialized. |
209 |
205 |
210 // Create state managers system state observers |
206 CCoeEnv& env( iUiControllerManager->CoeEnv() ); |
211 CAiPluginStateManager& stateManager( iPluginManager->StateManager() ); |
|
212 |
|
213 stateManager.CreateSystemStateObserversL(); |
|
214 |
|
215 // Connect state managers UI observer to UI controllers |
|
216 MAiUiFrameworkObserver* fwObserver( stateManager.UiFwObserver() ); |
|
217 |
|
218 if ( fwObserver ) |
|
219 { |
|
220 iUiControllerManager->AddObserverL( *fwObserver ); |
|
221 } |
|
222 |
207 |
223 // Create WS pluign manager |
208 // Create WS pluign manager |
224 iWsPluginManager = CAiWsPluginManager::NewL |
209 iWsPluginManager = CAiWsPluginManager::NewL( env ); |
225 ( iUiControllerManager->CoeEnv() ); |
210 |
226 |
211 iStateProvider = CAiStateProvider::NewL( *iStateManager, env ); |
227 // CenRep notifier to listen key changes in cenrep. Application is restarted |
212 |
228 // if key value is changed. |
213 iUiControllerManager->SetStateHandler( *iStateProvider ); |
229 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, |
214 |
230 *iAIRepository, |
215 // CenRep notifier to listen key changes in cenrep. |
231 CCenRepNotifyHandler::EIntKey, |
216 // Application is restarted if key value is changed. |
232 KAiMainUIController ); |
217 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iRepository, |
|
218 CCenRepNotifyHandler::EIntKey, KAiMainUIController ); |
|
219 |
233 iNotifyHandler->StartListeningL(); |
220 iNotifyHandler->StartListeningL(); |
234 |
221 |
235 // Cenrep notifier to listen ESS changes in cenrep |
222 // Cenrep notifier to listen ESS changes in cenrep |
236 // |
223 iNotifyHandlerESS = CCenRepNotifyHandler::NewL( *this, *iRepository, |
237 iNotifyHandlerESS = CCenRepNotifyHandler::NewL( *this, |
224 CCenRepNotifyHandler::EIntKey, KAIExternalStatusScreen ); |
238 *iAIRepository, |
225 |
239 CCenRepNotifyHandler::EIntKey, |
|
240 KAIExternalStatusScreen ); |
|
241 iNotifyHandlerESS->StartListeningL(); |
226 iNotifyHandlerESS->StartListeningL(); |
242 |
227 |
243 iIdleRestartObserver = AiUtility::CreatePSPropertyObserverL( |
228 iIdleRestartObserver = AiUtility::CreatePSPropertyObserverL( |
244 TCallBack( HandleRestartEvent, this ), |
229 TCallBack( HandleRestartEvent, this ), |
245 KPSUidAiInformation, |
230 KPSUidAiInformation, KActiveIdleRestartAI2 ); |
246 KActiveIdleRestartAI2 ); |
|
247 |
|
248 stateManager.ReportStateChange( ESMAISystemBoot ); |
|
249 } |
231 } |
250 |
232 |
251 // ---------------------------------------------------------------------------- |
233 // ---------------------------------------------------------------------------- |
252 // CAiFw::HandleUiReadyEventL() |
234 // CAiFw::HandleUiReadyEventL() |
|
235 // |
253 // ---------------------------------------------------------------------------- |
236 // ---------------------------------------------------------------------------- |
254 // |
237 // |
255 void CAiFw::HandleUiReadyEventL( CAiUiController& aUiController ) |
238 void CAiFw::HandleUiReadyEventL( CAiUiController& aUiController ) |
256 { |
239 { |
257 if( iUiControllerManager->IsMainUiController( aUiController ) ) |
240 if ( iUiControllerManager->IsMainUiController( aUiController ) ) |
258 { |
241 { |
259 iUiControllerManager->LoadUIDefinition(); |
|
260 |
|
261 TInt value( EIdlePhase1Ok ); |
242 TInt value( EIdlePhase1Ok ); |
262 |
243 |
263 RProperty::Get( KPSUidStartup, |
244 RProperty::Get( KPSUidStartup, |
264 KPSIdlePhase1Ok, |
245 KPSIdlePhase1Ok, |
265 value ); |
246 value ); |
266 |
247 |
267 if( value == EIdlePhase1NOK ) |
248 if ( value == EIdlePhase1NOK ) |
268 { |
249 { |
269 RProperty::Set( KPSUidStartup, |
250 RProperty::Set( KPSUidStartup, |
270 KPSIdlePhase1Ok, |
251 KPSIdlePhase1Ok, |
271 EIdlePhase1Ok ); |
252 EIdlePhase1Ok ); |
272 } |
253 } |
273 |
254 |
274 if( !iLibrariesLoaded ) |
255 if ( !iLibrariesLoaded ) |
275 { |
256 { |
276 _LIT( KAIVoiceUIDialer, "VoiceUiNameDialer.dll" ); |
257 _LIT( KAIVoiceUIDialer, "VoiceUiNameDialer.dll" ); |
277 _LIT( KAIVoiceUIRecog, "VoiceUiRecognition.dll" ); |
258 _LIT( KAIVoiceUIRecog, "VoiceUiRecognition.dll" ); |
278 _LIT( KAIVCommandHandler, "vcommandhandler.dll" ); |
259 _LIT( KAIVCommandHandler, "vcommandhandler.dll" ); |
279 |
260 |
282 iLibrary3.Load( KAIVCommandHandler ); |
263 iLibrary3.Load( KAIVCommandHandler ); |
283 |
264 |
284 iLibrariesLoaded = ETrue; |
265 iLibrariesLoaded = ETrue; |
285 } |
266 } |
286 |
267 |
|
268 iUiControllerManager->LoadUIDefinition(); |
287 } |
269 } |
288 } |
270 } |
289 |
271 |
290 // --------------------------------------------------------------------------- |
272 // --------------------------------------------------------------------------- |
291 // CAiFw::HandleActivateUI() |
273 // CAiFw::HandleActivateUI() |
|
274 // |
292 // ---------------------------------------------------------------------------- |
275 // ---------------------------------------------------------------------------- |
293 // |
276 // |
294 void CAiFw::HandleActivateUI() |
277 void CAiFw::HandleActivateUI() |
295 { |
278 { |
296 iUiControllerManager->ActivateUI(); |
279 iUiControllerManager->ActivateUI(); |
297 } |
280 } |
298 |
281 |
299 // --------------------------------------------------------------------------- |
282 // --------------------------------------------------------------------------- |
300 // CAiFw::HandleUiShutdown() |
283 // CAiFw::HandleUiShutdown() |
|
284 // |
301 // ---------------------------------------------------------------------------- |
285 // ---------------------------------------------------------------------------- |
302 // |
286 // |
303 void CAiFw::HandleUiShutdown( CAiUiController& aUiController ) |
287 void CAiFw::HandleUiShutdown( CAiUiController& aUiController ) |
304 { |
288 { |
305 if( iUiControllerManager->IsMainUiController( aUiController ) ) |
289 if ( iUiControllerManager->IsMainUiController( aUiController ) ) |
306 { |
290 { |
307 if( iNotifyHandler ) |
291 if ( iNotifyHandler ) |
308 { |
292 { |
309 iNotifyHandler->StopListening(); |
293 iNotifyHandler->StopListening(); |
310 delete iNotifyHandler; |
|
311 iNotifyHandler = NULL; |
|
312 } |
294 } |
313 |
295 |
314 if( iNotifyHandlerESS ) |
296 delete iNotifyHandler; |
|
297 iNotifyHandler = NULL; |
|
298 |
|
299 if ( iNotifyHandlerESS ) |
315 { |
300 { |
316 iNotifyHandlerESS->StopListening(); |
301 iNotifyHandlerESS->StopListening(); |
317 delete iNotifyHandlerESS; |
|
318 iNotifyHandlerESS = NULL; |
|
319 } |
302 } |
320 |
303 |
321 iPluginManager->PluginFactory().DestroyPlugins(); |
304 delete iNotifyHandlerESS; |
322 |
305 iNotifyHandlerESS = NULL; |
323 iPluginManager->StateManager().DestroySystemStateObservers(); |
306 |
324 |
|
325 iUiControllerManager->DestroySecondaryUiControllers(); |
307 iUiControllerManager->DestroySecondaryUiControllers(); |
326 |
308 |
327 iUiControllerManager->RemoveObserver( |
309 delete iWsPluginManager; |
328 *iPluginManager->StateManager().UiFwObserver() ); |
310 iWsPluginManager = NULL; |
329 |
311 |
330 if( iWsPluginManager ) |
312 Release( iIdleRestartObserver ); |
331 { |
313 iIdleRestartObserver = NULL; |
332 delete iWsPluginManager; |
314 |
333 iWsPluginManager = NULL; |
315 delete iStateProvider; |
334 } |
316 iStateProvider = NULL; |
335 |
317 } |
336 if( iIdleRestartObserver ) |
|
337 { |
|
338 Release( iIdleRestartObserver ); |
|
339 iIdleRestartObserver = NULL; |
|
340 } |
|
341 } |
|
342 } |
|
343 |
|
344 // ---------------------------------------------------------------------------- |
|
345 // CAiFw::HandleLoadPluginL() |
|
346 // ---------------------------------------------------------------------------- |
|
347 // |
|
348 void CAiFw::HandleLoadPluginL( const TAiPublisherInfo& aPublisherInfo ) |
|
349 { |
|
350 iPluginManager->PluginFactory().CreatePluginL( |
|
351 aPublisherInfo, iUiControllerManager->UiControllers() ); |
|
352 } |
|
353 |
|
354 // ---------------------------------------------------------------------------- |
|
355 // CAiFw::HandleDestroyPluginL() |
|
356 // ---------------------------------------------------------------------------- |
|
357 // |
|
358 void CAiFw::HandleDestroyPluginL( const TAiPublisherInfo& aPublisherInfo ) |
|
359 { |
|
360 iPluginManager->PluginFactory().DestroyPluginL( |
|
361 aPublisherInfo, iUiControllerManager->UiControllers() ); |
|
362 } |
318 } |
363 |
319 |
364 // ---------------------------------------------------------------------------- |
320 // ---------------------------------------------------------------------------- |
365 // CAiFw::HandlePluginEvent() |
321 // CAiFw::HandlePluginEvent() |
|
322 // |
366 // ---------------------------------------------------------------------------- |
323 // ---------------------------------------------------------------------------- |
367 // |
324 // |
368 void CAiFw::HandlePluginEvent( const TDesC& aParam ) |
325 void CAiFw::HandlePluginEvent( const TDesC& aParam ) |
369 { |
326 { |
370 iPluginManager->HandlePluginEvent( aParam ); |
327 iEventHandler->HandlePluginEvent( aParam ); |
371 } |
328 } |
372 |
329 |
373 // ---------------------------------------------------------------------------- |
330 // ---------------------------------------------------------------------------- |
374 // CAiFw::HandlePluginEventL() |
331 // CAiFw::HandlePluginEventL() |
375 // ---------------------------------------------------------------------------- |
332 // |
376 // |
333 // ---------------------------------------------------------------------------- |
377 void CAiFw::HandlePluginEventL( const TAiPublisherInfo& aPublisherInfo, |
334 // |
|
335 void CAiFw::HandlePluginEventL( const THsPublisherInfo& aPublisherInfo, |
378 const TDesC& aParam ) |
336 const TDesC& aParam ) |
379 { |
337 { |
380 iPluginManager->HandlePluginEventL( aPublisherInfo, aParam ); |
338 iEventHandler->HandlePluginEventL( aPublisherInfo, aParam ); |
381 } |
339 } |
382 |
340 |
383 // ---------------------------------------------------------------------------- |
341 // ---------------------------------------------------------------------------- |
384 // CAiFw::HasMenuItemL() |
342 // CAiFw::HasMenuItemL() |
385 // ---------------------------------------------------------------------------- |
343 // |
386 // |
344 // ---------------------------------------------------------------------------- |
387 TBool CAiFw::HasMenuItemL( const TAiPublisherInfo& aPublisherInfo, |
345 // |
|
346 TBool CAiFw::HasMenuItemL( const THsPublisherInfo& aPublisherInfo, |
388 const TDesC& aMenuItem ) |
347 const TDesC& aMenuItem ) |
389 { |
348 { |
390 return iPluginManager->HasMenuItemL( aPublisherInfo, aMenuItem ); |
349 return iEventHandler->HasMenuItemL( aPublisherInfo, aMenuItem ); |
391 } |
350 } |
392 |
351 |
393 // ---------------------------------------------------------------------------- |
352 // ---------------------------------------------------------------------------- |
394 // CAiFw::RefreshContent() |
353 // CAiFw::RefreshContent() |
|
354 // |
395 // ---------------------------------------------------------------------------- |
355 // ---------------------------------------------------------------------------- |
396 // |
356 // |
397 TBool CAiFw::RefreshContent( const TDesC& aContentCid ) |
357 TBool CAiFw::RefreshContent( const TDesC& aContentCid ) |
398 { |
358 { |
399 return iPluginManager->RefreshContent( aContentCid ); |
359 return iEventHandler->RefreshContent( aContentCid ); |
400 } |
360 } |
401 |
361 |
402 // ---------------------------------------------------------------------------- |
362 // ---------------------------------------------------------------------------- |
403 // CAiFw::ProcessStateChange() |
363 // CAiFw::RefreshContent() |
404 // ---------------------------------------------------------------------------- |
364 // |
405 // |
365 // ---------------------------------------------------------------------------- |
406 void CAiFw::ProcessStateChange( TAifwStates aState ) |
366 // |
407 { |
367 TBool CAiFw::RefreshContent( const THsPublisherInfo& aPublisherInfo, |
408 switch ( aState ) |
368 const TDesC& aContentCid ) |
409 { |
369 { |
410 case EAifwOnline : |
370 return iEventHandler->RefreshContent( aPublisherInfo, aContentCid ); |
411 { |
371 } |
412 iPluginManager->ProcessOnlineState( ETrue ); |
372 |
413 } |
373 // ---------------------------------------------------------------------------- |
414 break; |
374 // CAiFw::SuspendContent() |
415 case EAifwOffline : |
375 // |
416 { |
376 // ---------------------------------------------------------------------------- |
417 iPluginManager->ProcessOnlineState( EFalse ); |
377 // |
418 } |
378 TBool CAiFw::SuspendContent( const THsPublisherInfo& aPublisherInfo, |
419 break; |
379 const TDesC& aContentCid ) |
420 case EAifwPageSwitch: |
380 { |
421 { |
381 return iEventHandler->SuspendContent( aPublisherInfo, aContentCid ); |
422 iPluginManager->StateManager().ReportStateChange( ESMAIPageSwitch ); |
|
423 } |
|
424 break; |
|
425 default : |
|
426 break; |
|
427 } |
|
428 |
|
429 } |
382 } |
430 |
383 |
431 // ---------------------------------------------------------------------------- |
384 // ---------------------------------------------------------------------------- |
432 // CAiFw::QueryIsMenuOpen() |
385 // CAiFw::QueryIsMenuOpen() |
|
386 // |
433 // ---------------------------------------------------------------------------- |
387 // ---------------------------------------------------------------------------- |
434 // |
388 // |
435 TBool CAiFw::QueryIsMenuOpen() |
389 TBool CAiFw::QueryIsMenuOpen() |
436 { |
390 { |
437 return iUiControllerManager->MainUiController().IsMenuOpen(); |
391 return iUiControllerManager->MainUiController().IsMenuOpen(); |
438 } |
392 } |
439 |
393 |
440 // ---------------------------------------------------------------------------- |
394 // ---------------------------------------------------------------------------- |
441 // CAiFw::HandleNotifyInt() |
395 // CAiFw::HandleNotifyInt() |
|
396 // |
442 // ---------------------------------------------------------------------------- |
397 // ---------------------------------------------------------------------------- |
443 // |
398 // |
444 void CAiFw::HandleNotifyInt( TUint32 aId, TInt aNewValue ) |
399 void CAiFw::HandleNotifyInt( TUint32 aId, TInt aNewValue ) |
445 { |
400 { |
446 switch( aId ) |
401 switch ( aId ) |
447 { |
402 { |
448 case KAiMainUIController: |
403 case KAiMainUIController: |
449 if( aNewValue == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
404 if ( aNewValue == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
450 aNewValue == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE || |
405 aNewValue == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE || |
451 aNewValue == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
406 aNewValue == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML || |
452 aNewValue == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ) |
407 aNewValue == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ) |
453 { |
408 { |
454 iUiControllerManager->ExitMainController(); |
409 iUiControllerManager->ExitMainController(); |
455 } |
410 } |
456 else |
411 else |
457 { |
412 { |
458 // Someone wrote an invalid configuration! Reset repository. |
413 // Someone wrote an invalid configuration! Reset repository. |
459 if( iAIRepository ) |
414 iRepository->Reset( KAiMainUIController ); |
460 { |
415 iRepository->Reset( KAiFirstUIController ); |
461 iAIRepository->Reset( KAiMainUIController ); |
416 iRepository->Delete( KAiFirstUIController + 1 ); |
462 iAIRepository->Reset( KAiFirstUIController ); |
|
463 iAIRepository->Delete( KAiFirstUIController + 1 ); |
|
464 } |
|
465 } |
417 } |
466 break; |
418 break; |
467 case KAIExternalStatusScreen: |
419 case KAIExternalStatusScreen: |
468 if( ( aNewValue & 0x7FFFFFFF ) != 0 ) |
420 if ( ( aNewValue & 0x7FFFFFFF ) != 0 ) |
469 { |
421 { |
470 TRAP_IGNORE( SwapUiControllerL( EFalse ) ); |
422 TRAP_IGNORE( SwapUiControllerL( EFalse ) ); |
471 } |
423 } |
472 else |
424 else |
473 { |
425 { |
479 } |
431 } |
480 } |
432 } |
481 |
433 |
482 // ---------------------------------------------------------------------------- |
434 // ---------------------------------------------------------------------------- |
483 // CAiFw::SwapUiControllerL() |
435 // CAiFw::SwapUiControllerL() |
|
436 // |
484 // ---------------------------------------------------------------------------- |
437 // ---------------------------------------------------------------------------- |
485 // |
438 // |
486 void CAiFw::SwapUiControllerL( TBool aToExtHS ) |
439 void CAiFw::SwapUiControllerL( TBool aToExtHS ) |
487 { |
440 { |
488 TUid uid = { KCRUidActiveIdleLV }; |
|
489 CRepository* cenRep = CRepository::NewL( uid ); |
|
490 |
|
491 if( !aToExtHS ) // Switch to XML UI |
441 if( !aToExtHS ) // Switch to XML UI |
492 { |
442 { |
493 cenRep->Create( KAiFirstUIController, |
443 iRepository->Create( KAiFirstUIController, |
494 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ); |
444 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ); |
495 |
445 |
496 cenRep->Set( KAiFirstUIController, |
446 iRepository->Set( KAiFirstUIController, |
497 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ); |
447 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ); |
498 cenRep->Delete( KAiFirstUIController + 1 ); |
448 |
499 |
449 iRepository->Delete( KAiFirstUIController + 1 ); |
500 cenRep->Set( KAiMainUIController, |
450 |
|
451 iRepository->Set( KAiMainUIController, |
501 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML ); |
452 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML ); |
502 } |
453 } |
503 else // Switch to ExtHS |
454 else // Switch to ExtHS |
504 { |
455 { |
505 cenRep->Delete( KAiFirstUIController ); |
456 iRepository->Delete( KAiFirstUIController ); |
506 cenRep->Delete( KAiFirstUIController + 1 ); |
457 |
507 cenRep->Set( KAiMainUIController, |
458 iRepository->Delete( KAiFirstUIController + 1 ); |
508 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ); |
459 |
509 } |
460 iRepository->Set( KAiMainUIController, |
510 |
461 AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE ); |
511 delete cenRep; |
462 } |
512 |
463 |
513 // Restart |
464 // Restart |
514 iUiControllerManager->ExitMainController(); |
465 iUiControllerManager->ExitMainController(); |
515 } |
466 } |
516 |
467 |
517 // ---------------------------------------------------------------------------- |
468 // ---------------------------------------------------------------------------- |
518 // CAiFw::HandleRestartEvent() |
469 // CAiFw::HandleRestartEvent() |
|
470 // |
519 // ---------------------------------------------------------------------------- |
471 // ---------------------------------------------------------------------------- |
520 // |
472 // |
521 TInt CAiFw::HandleRestartEvent( TAny* aSelf ) |
473 TInt CAiFw::HandleRestartEvent( TAny* aSelf ) |
522 { |
474 { |
523 CAiFw* self = static_cast<CAiFw*>( aSelf ); |
475 CAiFw* self = static_cast<CAiFw*>( aSelf ); |
524 |
476 |
525 TInt value( 0 ); |
477 TInt value( 0 ); |
526 |
478 |
527 if( self->iIdleRestartObserver ) |
479 if ( self->iIdleRestartObserver ) |
528 { |
480 { |
529 TInt err( self->iIdleRestartObserver->Get( value ) ); |
481 TInt err( self->iIdleRestartObserver->Get( value ) ); |
530 |
482 |
531 // Check the PS keys value and call manager with approriate parameter. |
483 if ( err == KErrNone && value == KActiveIdleRestartCode ) |
532 // Report either "idle foreground" or "idle background" |
|
533 if( value == KActiveIdleRestartCode ) |
|
534 { |
484 { |
535 self->iUiControllerManager->ExitMainController(); |
485 self->iUiControllerManager->ExitMainController(); |
536 } |
486 } |
537 } |
487 } |
538 |
488 |
539 return KErrNone; |
489 return KErrNone; |
540 } |
490 } |
541 |
491 |
|
492 // ---------------------------------------------------------------------------- |
|
493 // CAiFw::Repository() |
|
494 // |
|
495 // ---------------------------------------------------------------------------- |
|
496 // |
|
497 CRepository& CAiFw::Repository() const |
|
498 { |
|
499 return *iRepository; |
|
500 } |
|
501 |
542 // End of file |
502 // End of file |