1 /* |
1 /* |
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
31 #include "siscontroller.h" |
31 #include "siscontroller.h" |
32 #include "sisinfo.h" |
32 #include "sisinfo.h" |
33 #include "sisuid.h" |
33 #include "sisuid.h" |
34 #include "cleanuputils.h" |
34 #include "cleanuputils.h" |
35 #include "arrayutils.h" |
35 #include "arrayutils.h" |
|
36 #include "installtypes.h" |
36 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
37 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
37 #include "swtypereginfo.h" |
38 #include "swtypereginfo.h" |
|
39 #include "ipcutil.h" |
|
40 #include "sisregistrypackage.h" |
38 #endif |
41 #endif |
39 |
42 |
40 using namespace Swi; |
43 using namespace Swi; |
41 |
44 |
42 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
45 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
101 } |
104 } |
102 |
105 |
103 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
106 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
104 EXPORT_C void RSisRegistryWritableSession::AddEntryL(const CApplication& aApplication, |
107 EXPORT_C void RSisRegistryWritableSession::AddEntryL(const CApplication& aApplication, |
105 const TDesC8& aController, |
108 const TDesC8& aController, |
106 const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, |
109 const RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, |
107 TInt64 aTransactionID) |
110 TInt64 aTransactionID) |
108 { |
111 { |
109 RBuf8 serializedArray; |
112 RBuf8 serializedArray; |
110 serializedArray.CleanupClosePushL(); |
113 serializedArray.CleanupClosePushL(); |
111 SoftwareTypeRegInfoUtils::SerializeArrayL(aSwTypeRegInfoArray, serializedArray); |
114 SoftwareTypeRegInfoUtils::SerializeArrayL(aSwTypeRegInfoArray, serializedArray); |
114 |
117 |
115 AddEntryImplL(EAddSoftwareTypeEntry, aApplication, aController, aTransactionID, ipcArgs); |
118 AddEntryImplL(EAddSoftwareTypeEntry, aApplication, aController, aTransactionID, ipcArgs); |
116 |
119 |
117 CleanupStack::PopAndDestroy(&serializedArray); |
120 CleanupStack::PopAndDestroy(&serializedArray); |
118 } |
121 } |
|
122 |
|
123 EXPORT_C void RSisRegistryWritableSession::AddEntryL(const Usif::CApplicationRegistrationData& aApparcRegFileData, |
|
124 const CSisRegistryPackage& aSisRegistryPackage) |
|
125 { |
|
126 TIpcArgs ipcArgs; |
|
127 |
|
128 Usif::TComponentId componentUid = GetComponentIdForPackageL(aSisRegistryPackage.Name(),aSisRegistryPackage.Vendor()); |
|
129 ipcArgs.Set(0, componentUid); |
|
130 |
|
131 TInt objectSize = 0; |
|
132 objectSize = GetObjectSizeL(&aApparcRegFileData); |
|
133 |
|
134 HBufC8* appRegData = HBufC8::NewMaxLC(objectSize); |
|
135 TPtr8 appRegDataDes = appRegData->Des(); |
|
136 |
|
137 RDesWriteStream ipcstream(appRegDataDes); |
|
138 CleanupClosePushL(ipcstream); |
|
139 |
|
140 ipcstream << aApparcRegFileData; |
|
141 ipcstream.CommitL(); |
|
142 ipcArgs.Set(1, &appRegDataDes); |
|
143 |
|
144 User::LeaveIfError(SendReceive(EAddAppRegEntry, ipcArgs)); |
|
145 CleanupStack::PopAndDestroy(2, appRegData); |
|
146 } |
119 #endif |
147 #endif |
120 |
148 |
121 void RSisRegistryWritableSession::UpdateEntryImplL(TInt aMessage, |
149 void RSisRegistryWritableSession::UpdateEntryImplL(TInt aMessage, |
122 const CApplication& aApplication, |
150 const CApplication& aApplication, |
123 const TDesC8& aController, |
151 const TDesC8& aController, |
193 } |
221 } |
194 |
222 |
195 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
223 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
196 EXPORT_C void RSisRegistryWritableSession::UpdateEntryL(const CApplication& aApplication, |
224 EXPORT_C void RSisRegistryWritableSession::UpdateEntryL(const CApplication& aApplication, |
197 const TDesC8& aController, |
225 const TDesC8& aController, |
198 const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, |
226 const RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, |
199 TInt64 aTransactionID) |
227 TInt64 aTransactionID) |
200 { |
228 { |
201 RBuf8 serializedArray; |
229 RBuf8 serializedArray; |
202 serializedArray.CleanupClosePushL(); |
230 serializedArray.CleanupClosePushL(); |
203 SoftwareTypeRegInfoUtils::SerializeArrayL(aSwTypeRegInfoArray, serializedArray); |
231 SoftwareTypeRegInfoUtils::SerializeArrayL(aSwTypeRegInfoArray, serializedArray); |
206 |
234 |
207 UpdateEntryImplL(EUpdateSoftwareTypeEntry, aApplication, aController, aTransactionID, ipcArgs); |
235 UpdateEntryImplL(EUpdateSoftwareTypeEntry, aApplication, aController, aTransactionID, ipcArgs); |
208 |
236 |
209 CleanupStack::PopAndDestroy(&serializedArray); |
237 CleanupStack::PopAndDestroy(&serializedArray); |
210 } |
238 } |
|
239 |
|
240 EXPORT_C void RSisRegistryWritableSession::UpdateEntryL(const CApplication& aApplication, |
|
241 const Usif::CApplicationRegistrationData& aApparcRegFileData, |
|
242 const CSisRegistryPackage& aSisRegistryPackage) |
|
243 { |
|
244 TIpcArgs ipcArgs; |
|
245 Usif::TComponentId componentUid = 0; |
|
246 |
|
247 TRAPD(err,componentUid = GetComponentIdForPackageL(aSisRegistryPackage.Name(),aSisRegistryPackage.Vendor());) |
|
248 |
|
249 if (err != KErrNone && err != KErrNotFound) |
|
250 { |
|
251 User::Leave(err); |
|
252 } |
|
253 else if (err == KErrNotFound) // Possible only in PU and SA. |
|
254 { |
|
255 componentUid = GetComponentIdForUidL(aApplication.ControllerL().Info().Uid().Uid()); |
|
256 } |
|
257 |
|
258 ipcArgs.Set(0, componentUid); |
|
259 |
|
260 TInt objectSize = 0; |
|
261 objectSize = GetObjectSizeL(&aApparcRegFileData); |
|
262 HBufC8* appRegData=HBufC8::NewMaxLC(objectSize); |
|
263 TPtr8 appRegDataDes = appRegData->Des(); |
|
264 |
|
265 RDesWriteStream ipcstream(appRegDataDes); |
|
266 CleanupClosePushL(ipcstream); |
|
267 |
|
268 ipcstream << aApparcRegFileData; |
|
269 ipcstream.CommitL(); |
|
270 ipcArgs.Set(1, &appRegDataDes); |
|
271 User::LeaveIfError(SendReceive(EUpdateAppRegEntry, ipcArgs)); |
|
272 CleanupStack::PopAndDestroy(2, appRegData); |
|
273 } |
211 #endif |
274 #endif |
212 |
275 |
213 EXPORT_C void RSisRegistryWritableSession::DeleteEntryL(const CSisRegistryPackage& aPackage, TInt64 aTransactionID) |
276 EXPORT_C void RSisRegistryWritableSession::DeleteEntryL(const CSisRegistryPackage& aPackage, TInt64 aTransactionID) |
214 { |
277 { |
215 TPckgC<TUid> packageUid(aPackage.Uid()); |
278 TPckgC<TUid> packageUid(aPackage.Uid()); |
330 TPckgC<TComponentId> packageComponentId(aComponentId); |
393 TPckgC<TComponentId> packageComponentId(aComponentId); |
331 TPckgC<TScomoState> packageState(aState); |
394 TPckgC<TScomoState> packageState(aState); |
332 TInt returnCode = SendReceive(ESetComponentState, TIpcArgs(&packageComponentId, &packageState)); |
395 TInt returnCode = SendReceive(ESetComponentState, TIpcArgs(&packageComponentId, &packageState)); |
333 User::LeaveIfError(returnCode); |
396 User::LeaveIfError(returnCode); |
334 } |
397 } |
335 #endif |
398 |
|
399 EXPORT_C void RSisRegistryWritableSession::SetComponentPresenceL(TComponentId aComponentId, TBool aState) |
|
400 { |
|
401 TPckgC<TComponentId> componentId(aComponentId); |
|
402 TPckgC<TBool> componentPresence(aState); |
|
403 User::LeaveIfError(SendReceive(ESetComponentPresence, TIpcArgs(&componentId, &componentPresence))); |
|
404 } |
|
405 #endif |