19 #include <ecom/ecom.h> |
19 #include <ecom/ecom.h> |
20 #include <mmf/common/mmfcontrollerpluginresolver.h> |
20 #include <mmf/common/mmfcontrollerpluginresolver.h> |
21 #include <contentharvesterplugin.h> // harvesting plugin |
21 #include <contentharvesterplugin.h> // harvesting plugin |
22 #include "charvesterpluginvalidator.h" |
22 #include "charvesterpluginvalidator.h" |
23 #include "cblacklisthandler.h" |
23 #include "cblacklisthandler.h" |
|
24 #include "chplugindebug.h" |
24 |
25 |
25 const TUint32 KInProgressPropertyKey = |
26 const TUint32 KInProgressPropertyKey = |
26 { |
27 { |
27 0x1028000E |
28 0x1028000E |
28 }; |
29 }; |
89 // |
91 // |
90 void CHarvesterPluginValidator::ConstructL() |
92 void CHarvesterPluginValidator::ConstructL() |
91 { |
93 { |
92 iBlacklist = CBlacklistHandler::NewL(); |
94 iBlacklist = CBlacklistHandler::NewL(); |
93 iUpdateIdle = CIdle::NewL( CActive::EPriorityIdle ); |
95 iUpdateIdle = CIdle::NewL( CActive::EPriorityIdle ); |
94 iUpdateIdle->Start( TCallBack( UpdateCallback, this ) ); |
|
95 CPluginValidator::ConstructL(); |
96 CPluginValidator::ConstructL(); |
96 } |
97 } |
97 |
98 |
98 // ---------------------------------------------------------------------------- |
99 // ---------------------------------------------------------------------------- |
99 // |
100 // |
123 } |
124 } |
124 // copy blacklisted plugins to unoffical blacklist at startup |
125 // copy blacklisted plugins to unoffical blacklist at startup |
125 iBlacklist->CopyBlacklistL(ETrue); |
126 iBlacklist->CopyBlacklistL(ETrue); |
126 |
127 |
127 // set property value to 1 (which means "in progress") |
128 // set property value to 1 (which means "in progress") |
128 iInProgressProperty.Set(TUid::Uid(KHarvesterUid), KInProgressPropertyKey, |
129 iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), |
129 1); |
130 KInProgressPropertyKey, 1 ); |
130 CPluginValidator::ManagePluginsL(); |
131 CPluginValidator::ManagePluginsL(); |
|
132 if( !iUpdateIdle->IsActive() ) |
|
133 { |
|
134 iUpdateIdle->Start( TCallBack( UpdateCallback, this ) ); |
|
135 } |
131 // set property value to 0 (which means "finished") |
136 // set property value to 0 (which means "finished") |
132 iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), |
137 iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), |
133 KInProgressPropertyKey, 0 ); |
138 KInProgressPropertyKey, 0 ); |
134 } |
139 } |
135 |
140 |
143 { |
148 { |
144 //first we append UID to the blacklist |
149 //first we append UID to the blacklist |
145 iBlacklist->AppendL(aPluginInfo.iImplementationUid); |
150 iBlacklist->AppendL(aPluginInfo.iImplementationUid); |
146 TAny* plug(NULL); |
151 TAny* plug(NULL); |
147 TInt err(KErrNone); |
152 TInt err(KErrNone); |
|
153 CPSPERF( ("CHarvesterPluginValidator::LoadPluginL Uid: 0x%X - START", |
|
154 aPluginInfo.iImplementationUid.iUid) ); |
148 TRAP( err, plug = REComSession::CreateImplementationL( |
155 TRAP( err, plug = REComSession::CreateImplementationL( |
149 aPluginInfo.iImplementationUid, |
156 aPluginInfo.iImplementationUid, |
150 aPluginInfo.iDtor_ID_Key, iParameter ) ); |
157 aPluginInfo.iDtor_ID_Key, iParameter ) ); |
|
158 CPSPERF( ("CHarvesterPluginValidator::LoadPluginL - DONE") ); |
151 if (err == KErrNone && plug) |
159 if (err == KErrNone && plug) |
152 { |
160 { |
153 TRAP_IGNORE( |
161 TRAP_IGNORE( |
154 CleanupStack::PushL( plug ); |
162 CleanupStack::PushL( plug ); |
155 aPluginInfo.iPlugin = plug; |
163 aPluginInfo.iPlugin = plug; |
156 iPluginArray.AppendL( aPluginInfo ); |
164 iPluginArray.AppendL( aPluginInfo ); |
|
165 if( aPluginInfo.iImplementationUid.iUid |
|
166 == KADatFactorySettingsServerPluginUid) |
|
167 iUpdatePluginArray.Insert( aPluginInfo, 0); |
|
168 else |
|
169 iUpdatePluginArray.AppendL( aPluginInfo ); |
157 CleanupStack::Pop( plug ); |
170 CleanupStack::Pop( plug ); |
158 ); |
171 ); |
159 } |
172 } |
160 //no panic during load so we can remove UID from blacklist |
173 //no panic during load so we can remove UID from blacklist |
161 iBlacklist->RemoveL(aPluginInfo.iImplementationUid); |
174 iBlacklist->RemoveL(aPluginInfo.iImplementationUid); |
167 // ---------------------------------------------------------------------------- |
180 // ---------------------------------------------------------------------------- |
168 // |
181 // |
169 void CHarvesterPluginValidator::UpdatePluginsL() |
182 void CHarvesterPluginValidator::UpdatePluginsL() |
170 { |
183 { |
171 // set property value to 1 (which means "in progress") |
184 // set property value to 1 (which means "in progress") |
172 iInProgressProperty.Set(TUid::Uid(KHarvesterUid), KInProgressPropertyKey, 1); |
185 iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), |
|
186 KInProgressPropertyKey, 1 ); |
173 CContentHarvesterPlugin* plugin = NULL; |
187 CContentHarvesterPlugin* plugin = NULL; |
174 CContentHarvesterPlugin* fsplugin = |
188 |
175 static_cast<CContentHarvesterPlugin*> (GetImplementation( |
189 while( iUpdatePluginArray.Count() ) |
176 TUid::Uid(KADatFactorySettingsServerPluginUid))); |
190 { |
177 |
191 plugin = static_cast<CContentHarvesterPlugin*> ( iUpdatePluginArray[0].iPlugin ); |
178 if (fsplugin) |
192 //first we append UID to the blacklist |
179 { |
193 iBlacklist->AppendL( iUpdatePluginArray[0].iImplementationUid ); |
180 iBlacklist->AppendL(TUid::Uid(KADatFactorySettingsServerPluginUid)); |
194 CPSPERF( ("CHarvesterPluginValidator::UpdatePluginsL Uid: 0x%X - START", |
181 TRAP_IGNORE( fsplugin->UpdateL() ); |
195 iUpdatePluginArray[0].iImplementationUid) ); |
182 iBlacklist->RemoveL(TUid::Uid(KADatFactorySettingsServerPluginUid)); |
196 TRAP_IGNORE( plugin->UpdateL() ); |
183 } |
197 CPSPERF( ("CHarvesterPluginValidator::UpdatePluginsL - DONE") ); |
184 for (TInt i = 0; i < iPluginArray.Count(); i++) |
198 //no panic during update so we can remove UID from blacklist |
185 { |
199 iBlacklist->RemoveL( iUpdatePluginArray[0].iImplementationUid ); |
186 plugin |
200 // plugin was updated correctly so we remove it from update plugin array |
187 = static_cast<CContentHarvesterPlugin*> (iPluginArray[i].iPlugin); |
201 iUpdatePluginArray.Remove( 0 ); |
188 if (plugin != fsplugin) |
|
189 { |
|
190 //first we append UID to the blacklist |
|
191 iBlacklist->AppendL(iPluginArray[i].iImplementationUid); |
|
192 TRAP_IGNORE( plugin->UpdateL() ); |
|
193 //no panic during update so we can remove UID from blacklist |
|
194 iBlacklist->RemoveL(iPluginArray[i].iImplementationUid); |
|
195 } |
|
196 } |
202 } |
197 // set property value to 0 (which means "finished") |
203 // set property value to 0 (which means "finished") |
198 iInProgressProperty.Set(TUid::Uid(KHarvesterUid), KInProgressPropertyKey, |
204 iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), |
199 0); |
205 KInProgressPropertyKey, 0 ); |
200 } |
206 } |
201 |
207 |
202 // ----------------------------------------------------------------------------- |
208 // ----------------------------------------------------------------------------- |
203 // |
209 // |
204 // ----------------------------------------------------------------------------- |
210 // ----------------------------------------------------------------------------- |
205 // |
211 // |
206 TInt CHarvesterPluginValidator::UpdateCallback( TAny* aValidator ) |
212 TInt CHarvesterPluginValidator::UpdateCallback( TAny* aValidator ) |
207 { |
213 { |
208 if ( aValidator ) |
214 if ( aValidator ) |
209 { |
215 { |
210 TRAP_IGNORE( static_cast<CHarvesterPluginValidator*>(aValidator)-> |
216 TRAP_IGNORE( static_cast<CHarvesterPluginValidator*>(aValidator)-> |