191 TBool CUninstallationProcessor::DoStateProcessSkipFilesL() |
192 TBool CUninstallationProcessor::DoStateProcessSkipFilesL() |
192 { |
193 { |
193 return ETrue; // Nothing to do |
194 return ETrue; // Nothing to do |
194 } |
195 } |
195 |
196 |
|
197 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
198 TBool CUninstallationProcessor::DoParseApplicationRegistrationFilesL() |
|
199 { |
|
200 return ETrue; // Nothing to do |
|
201 } |
|
202 #endif |
|
203 |
196 TBool CUninstallationProcessor::DoStateUpdateRegistryL() |
204 TBool CUninstallationProcessor::DoStateUpdateRegistryL() |
197 { |
205 { |
198 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
206 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
207 const CApplication& application = ApplicationL(); |
|
208 RArray<TAppUpdateInfo> affectedApps; |
|
209 CleanupClosePushL(affectedApps); |
|
210 RArray<Usif::TComponentId> componentIds; |
|
211 CleanupClosePushL(componentIds); |
|
212 RArray<TUid> existingAppUids; |
|
213 CleanupClosePushL(existingAppUids); |
|
214 RArray<TUid> newAppUids; |
|
215 CleanupClosePushL(newAppUids); |
|
216 |
|
217 TAppUpdateInfo existingAppInfo, newAppInfo; |
|
218 TUid packageUid = application.PackageL().Uid(); |
|
219 |
|
220 // Get all existing componentsIds for the package to to be uninstalled |
|
221 TRAPD(err,iRegistryWrapper.RegistrySession().GetComponentIdsForUidL(packageUid, componentIds)); |
|
222 TInt count = componentIds.Count(); |
|
223 if(0 == count) |
|
224 { |
|
225 DEBUG_PRINTF(_L("ComponentIDs not found for the base package")); |
|
226 User::Leave(KErrNotFound); |
|
227 } |
|
228 |
|
229 //Get the apps for CompIds and mark them as to be uninstalled |
|
230 for(TInt i = 0 ; i < count; i++) |
|
231 { |
|
232 existingAppUids.Reset(); |
|
233 TRAP(err,iRegistryWrapper.RegistrySession().GetAppUidsForComponentL(componentIds[i], existingAppUids)); |
|
234 |
|
235 for(TInt i = 0 ; i < existingAppUids.Count(); i++) |
|
236 { |
|
237 existingAppInfo = TAppUpdateInfo(existingAppUids[i], EAppUninstalled); |
|
238 affectedApps.Append(existingAppInfo); |
|
239 } |
|
240 } |
|
241 |
199 // Now that we are ready to make changes to the registry so we start a transaction |
242 // Now that we are ready to make changes to the registry so we start a transaction |
200 // Note that the commit/rollback action is subsequently taken by the later steps of the state machine |
243 // Note that the commit/rollback action is subsequently taken by the later steps of the state machine |
201 iRegistryWrapper.StartMutableOperationsL(); |
244 iRegistryWrapper.StartMutableOperationsL(); |
202 iRegistryWrapper.RegistrySession().DeleteEntryL(ApplicationL().PackageL(), TransactionSession().TransactionIdL()); |
245 iRegistryWrapper.RegistrySession().DeleteEntryL(ApplicationL().PackageL(), TransactionSession().TransactionIdL()); |
|
246 |
|
247 componentIds.Reset(); |
|
248 TRAP(err,iRegistryWrapper.RegistrySession().GetComponentIdsForUidL(packageUid, componentIds)); |
|
249 TInt currentComponentCount = componentIds.Count(); |
|
250 |
|
251 //If there is no component assosiated with this app in the scr and there are affected apps then mark all of them as deleted. |
|
252 RArray<TAppUpdateInfo> apps; |
|
253 CleanupClosePushL(apps); |
|
254 Plan().GetAffectedApps(apps); |
|
255 TInt appCount = apps.Count(); |
|
256 |
|
257 //If the there is no component assosiated with the package uid(ie it has been completely deleted) and we have affected apps |
|
258 //then compare the apps of the package currently being processed with the existing affected apps if alredy exists then |
|
259 //update else add it to the list. |
|
260 if(currentComponentCount == 0 && appCount) |
|
261 { |
|
262 TInt count = affectedApps.Count(); |
|
263 for(TInt i = 0 ; i < appCount; ++i) |
|
264 { |
|
265 TUid appUid = apps[i].iAppUid; |
|
266 TBool found = EFalse; |
|
267 for(TInt index = 0; index < count ; ++index) |
|
268 { |
|
269 if(appUid == affectedApps[index].iAppUid) |
|
270 { |
|
271 existingAppInfo = TAppUpdateInfo(appUid, EAppUninstalled); |
|
272 affectedApps.Remove(index); |
|
273 affectedApps.Append(existingAppInfo); |
|
274 found = ETrue; |
|
275 break; |
|
276 } |
|
277 } |
|
278 if(!found) |
|
279 { |
|
280 existingAppInfo = TAppUpdateInfo(appUid,EAppUninstalled); |
|
281 affectedApps.Append(existingAppInfo); |
|
282 } |
|
283 } |
|
284 } |
|
285 else |
|
286 { |
|
287 // mark the apps in the affected list as upgraded if they are still in scr |
|
288 for(TInt i = 0 ; i < currentComponentCount; i++) |
|
289 { |
|
290 newAppUids.Reset(); |
|
291 TRAP(err,iRegistryWrapper.RegistrySession().GetAppUidsForComponentL(componentIds[i], newAppUids)); |
|
292 for(TInt i = 0 ; i < newAppUids.Count(); i++) |
|
293 { |
|
294 existingAppInfo = TAppUpdateInfo(newAppUids[i], EAppUninstalled); |
|
295 TInt index = 0; |
|
296 index = affectedApps.Find(existingAppInfo); |
|
297 if(KErrNotFound != index) |
|
298 { |
|
299 affectedApps.Remove(index); |
|
300 existingAppInfo = TAppUpdateInfo(newAppUids[i],EAppInstalled); |
|
301 affectedApps.Append(existingAppInfo); |
|
302 } |
|
303 } |
|
304 } |
|
305 } |
|
306 CleanupStack::PopAndDestroy(&apps); |
|
307 for(TInt i = 0; i < affectedApps.Count(); i++) |
|
308 { |
|
309 DEBUG_PRINTF2(_L("AppUid is 0x%x"), affectedApps[i].iAppUid); |
|
310 DEBUG_PRINTF2(_L("Action is %d"), affectedApps[i].iAction); |
|
311 } |
|
312 |
|
313 const_cast<CPlan&>(Plan()).ResetAffectedApps(); |
|
314 const_cast<CPlan&>(Plan()).SetAffectedApps(affectedApps); |
|
315 |
|
316 CleanupStack::PopAndDestroy(4, &affectedApps); |
203 #else |
317 #else |
204 RSisRegistryWritableSession session; |
318 RSisRegistryWritableSession session; |
205 User::LeaveIfError(session.Connect()); |
319 User::LeaveIfError(session.Connect()); |
206 CleanupClosePushL(session); |
320 CleanupClosePushL(session); |
207 |
321 |