70 |
75 |
71 RPointerArray<CSisRegistryPackage> packages; |
76 RPointerArray<CSisRegistryPackage> packages; |
72 CleanupResetAndDestroyPushL(packages); |
77 CleanupResetAndDestroyPushL(packages); |
73 entry.AugmentationsL(packages); |
78 entry.AugmentationsL(packages); |
74 |
79 |
|
80 TInt augmentationCount(packages.Count()); |
|
81 TInt augCount = augmentationCount; |
|
82 |
75 RBufWriteStream stream(*tempBuffer); |
83 RBufWriteStream stream(*tempBuffer); |
76 CleanupClosePushL(stream); |
84 CleanupClosePushL(stream); |
77 stream.WriteUint32L(drive); |
85 stream.WriteUint32L(drive); |
78 |
86 |
79 // backup the base package (except for PA and ROM stubs) plus partial upgrades and augmentations. |
87 if (entry.RemovableL()) //Cannot Backup non-removable (NR) packages |
80 entry.FilesL(aFilesArray); |
88 { |
81 |
89 // backup the base package (except for PA and ROM stubs) plus partial upgrades and augmentations. |
82 |
90 entry.FilesL(aFilesArray); |
83 // Filter out any files on the Z drive |
91 |
84 TInt fileIndex = aFilesArray.Count() - 1; |
92 // Filter out any files on the Z drive |
85 while (fileIndex >= 0) |
93 TInt fileIndex = aFilesArray.Count() - 1; |
86 { |
94 while (fileIndex >= 0) |
87 TChar driveCh = (*aFilesArray[fileIndex])[0]; |
95 { |
88 if (driveCh == 'z' || driveCh == 'Z') |
96 TChar driveCh = (*aFilesArray[fileIndex])[0]; |
89 { |
97 if (driveCh == 'z' || driveCh == 'Z') |
90 delete aFilesArray[fileIndex]; |
98 { |
91 aFilesArray.Remove(fileIndex); |
99 delete aFilesArray[fileIndex]; |
92 } |
100 aFilesArray.Remove(fileIndex); |
93 --fileIndex; |
101 } |
94 } |
102 --fileIndex; |
95 |
103 } |
96 TInt controllersCount = controllers.Count(); |
104 |
97 TInt firstController = 0; |
105 TInt controllersCount = controllers.Count(); |
98 if (entry.PreInstalledL() || entry.IsInRomL()) |
106 TInt firstController = 0; |
99 { |
107 if (entry.PreInstalledL() || entry.IsInRomL()) |
100 firstController = 1; // Don't backup the controller for the ROM stub |
108 { |
101 if (controllersCount <= 1) |
109 firstController = 1; // Don't backup the controller for the ROM stub |
102 { |
110 if (controllersCount <= 1) |
103 DEBUG_PRINTF(_L8("Base package is pre-installed or in ROM and has not been upgraded")); |
111 { |
104 stream.WriteInt32L(packages.Count()); |
112 DEBUG_PRINTF(_L8("Base package is pre-installed or in ROM and has not been upgraded")); |
105 if (entry.IsInRomL()) |
113 stream.WriteInt32L(packages.Count()); |
106 { |
114 if (entry.IsInRomL()) |
107 matchingSupportedLanguagesArray.Close(); |
115 { |
108 } |
116 matchingSupportedLanguagesArray.Close(); |
109 } |
117 } |
110 else |
118 } |
111 { |
119 else |
112 // Backup any PUs for the ROM stub. |
120 { |
113 DEBUG_PRINTF2(_L8("Found %d partial upgrades"), controllersCount - 1); |
121 // Backup any PUs for the ROM stub. |
114 stream.WriteInt32L(controllersCount - 1 + packages.Count()); |
122 DEBUG_PRINTF2(_L8("Found %d partial upgrades"), controllersCount - 1); |
115 } |
123 stream.WriteInt32L(controllersCount - 1 + packages.Count()); |
|
124 } |
|
125 } |
|
126 else |
|
127 { |
|
128 // Standard SA package |
|
129 DEBUG_PRINTF2(_L8("Found %d controllers"), controllersCount); |
|
130 stream.WriteInt32L(controllers.Count() + packages.Count()); |
|
131 } |
|
132 |
|
133 for (TInt i = firstController; i < controllersCount; ++i) |
|
134 { |
|
135 stream << *controllers[i]; |
|
136 } |
|
137 |
116 } |
138 } |
117 else |
139 else |
118 { |
140 { |
119 // Standard SA package |
141 if(!augmentationCount) |
120 DEBUG_PRINTF2(_L8("Found %d controllers"), controllersCount); |
142 { |
121 stream.WriteInt32L(controllers.Count() + packages.Count()); |
143 DEBUG_PRINTF2(_L("RBackupSession::GetMetaDataL - Cannot Backup non-removable application; Uid: '0x%08x'"),aPackageUid.iUid); |
122 } |
144 CleanupStack::PopAndDestroy(6, &entry); // stream, controllers, matchingSupportedLanguagesArray, tempBuffer, packages, entry |
123 |
145 User::Leave(KErrNotSupported); // cannot remove non-removable (NR) packages |
124 for (TInt i = firstController; i < controllersCount; ++i) |
146 } |
125 { |
147 else |
126 stream << *controllers[i]; |
148 { |
127 } |
149 for (TInt i = 0; i < augmentationCount; ++i) |
128 |
150 { |
129 TInt augmentationCount(packages.Count()); |
151 RSisRegistryEntry augmentation; |
|
152 augmentation.OpenL(iSession, *packages[i]); |
|
153 CleanupClosePushL(augmentation); |
|
154 |
|
155 if (!augmentation.RemovableL()) |
|
156 { |
|
157 augCount--; |
|
158 CleanupStack::PopAndDestroy(1, &augmentation); |
|
159 continue; |
|
160 } |
|
161 CleanupStack::PopAndDestroy(1, &augmentation); |
|
162 } |
|
163 if(!augCount) |
|
164 { |
|
165 DEBUG_PRINTF2(_L("RBackupSession::GetMetaDataL - Cannot Backup non-removable augmentation; Uid: '0x%08x'"),aPackageUid.iUid); |
|
166 CleanupStack::PopAndDestroy(6, &entry); // stream, controllers, matchingSupportedLanguagesArray, tempBuffer, packages, entry |
|
167 User::Leave(KErrNotSupported); // cannot remove non-removable (NR) packages |
|
168 } |
|
169 else |
|
170 { |
|
171 stream.WriteInt32L(augCount); // Writing removable augmentations controller count |
|
172 if (entry.IsInRomL()) |
|
173 { |
|
174 matchingSupportedLanguagesArray.Close(); |
|
175 } |
|
176 } |
|
177 } |
|
178 } |
|
179 |
130 RArray<TChar> augmentationDrives; |
180 RArray<TChar> augmentationDrives; |
131 CleanupClosePushL(augmentationDrives); |
181 CleanupClosePushL(augmentationDrives); |
|
182 |
|
183 TBool nonRemovableAugmentation = ETrue; |
132 |
184 |
133 for (TInt i = 0; i < augmentationCount; ++i) |
185 for (TInt i = 0; i < augmentationCount; ++i) |
134 { |
186 { |
135 RSisRegistryEntry augmentation; |
187 RSisRegistryEntry augmentation; |
136 augmentation.OpenL(iSession, *packages[i]); |
188 augmentation.OpenL(iSession, *packages[i]); |
137 CleanupClosePushL(augmentation); |
189 CleanupClosePushL(augmentation); |
138 |
190 |
|
191 if(augCount != augmentationCount) |
|
192 { |
|
193 if (!augmentation.RemovableL()) //if loops are not clubed to avoid augmentation.RemovableL() API Call |
|
194 { |
|
195 CleanupStack::PopAndDestroy(1, &augmentation); |
|
196 continue; |
|
197 } |
|
198 } |
|
199 nonRemovableAugmentation = EFalse; |
|
200 |
139 augmentation.FilesL(aFilesArray); |
201 augmentation.FilesL(aFilesArray); |
140 |
202 |
141 RPointerArray<HBufC8> augmentationControllers; |
203 RPointerArray<HBufC8> augmentationControllers; |
142 CleanupResetAndDestroyPushL(augmentationControllers); |
204 CleanupResetAndDestroyPushL(augmentationControllers); |
143 augmentation.ControllersL(augmentationControllers); |
205 augmentation.ControllersL(augmentationControllers); |
157 matchingSupportedLanguagesArray.Append(ELangNone); |
219 matchingSupportedLanguagesArray.Append(ELangNone); |
158 |
220 |
159 CleanupStack::PopAndDestroy(2, &augmentation); |
221 CleanupStack::PopAndDestroy(2, &augmentation); |
160 } |
222 } |
161 |
223 |
|
224 if(nonRemovableAugmentation && augmentationCount) |
|
225 { |
|
226 DEBUG_PRINTF2(_L("RBackupSession::GetMetaDataL - Cannot Backup non-removable Augmentation; Uid: '0x%08x'"),aPackageUid.iUid); |
|
227 CleanupStack::PopAndDestroy(7, &entry); // augmentationDrives, stream, controllers, matchingSupportedLanguagesArray, tempBuffer, packages |
|
228 User::Leave(KErrNotSupported); // cannot remove non-removable (NR) packages |
|
229 } |
|
230 |
162 // Write the number of files originally installed, |
231 // Write the number of files originally installed, |
163 // and their names to the backup metadata |
232 // and their names to the backup metadata |
164 TInt filesCount(aFilesArray.Count()); |
233 TInt filesCount(aFilesArray.Count()); |
165 DEBUG_PRINTF2(_L8("Files installed originally %d"), filesCount); |
234 DEBUG_PRINTF2(_L8("Files installed originally %d"), filesCount); |
166 stream.WriteInt32L(filesCount); |
235 stream.WriteInt32L(filesCount); |