159 void NotifyEndL( |
159 void NotifyEndL( |
160 JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier, |
160 JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier, |
161 jstring aGlobalComponentId, jint aErrCategory, jint aErrCode, |
161 jstring aGlobalComponentId, jint aErrCategory, jint aErrCode, |
162 jstring aErrMsg, jstring aErrMsgDetails) |
162 jstring aErrMsg, jstring aErrMsgDetails) |
163 { |
163 { |
164 __UHEAP_MARK; |
164 //__UHEAP_MARK; |
165 HBufC *globalComponentId = CreateHBufCFromJavaStringLC(aEnv, aGlobalComponentId); |
165 HBufC *globalComponentId = CreateHBufCFromJavaStringLC(aEnv, aGlobalComponentId); |
166 HBufC *errMsg = NULL; |
166 HBufC *errMsg = NULL; |
167 if (NULL != aErrMsg) |
167 if (NULL != aErrMsg) |
168 { |
168 { |
169 errMsg = CreateHBufCFromJavaStringLC(aEnv, aErrMsg); |
169 errMsg = CreateHBufCFromJavaStringLC(aEnv, aErrMsg); |
172 if (NULL != aErrMsgDetails) |
172 if (NULL != aErrMsgDetails) |
173 { |
173 { |
174 errMsgDetails = CreateHBufCFromJavaStringLC(aEnv, aErrMsgDetails); |
174 errMsgDetails = CreateHBufCFromJavaStringLC(aEnv, aErrMsgDetails); |
175 } |
175 } |
176 |
176 |
177 CSifOperationEndData *endData = CSifOperationEndData::NewLC( |
177 CSifOperationEndData *endData = |
178 *globalComponentId, (TErrorCategory)aErrCategory, aErrCode, |
178 CSifOperationEndData::NewLC( |
179 *errMsg, *errMsgDetails); |
179 *globalComponentId, (TErrorCategory)aErrCategory, aErrCode, |
180 |
180 (NULL != errMsg? *errMsg: KNullDesC()), |
|
181 (NULL != errMsgDetails? *errMsgDetails: KNullDesC())); |
|
182 |
|
183 // Do not use UHEAP macros around PublishCompletionL() because it |
|
184 // creates a timer object which gets deleted only when the notifier |
|
185 // object is deleted. |
181 aNotifier->PublishCompletionL(*endData); |
186 aNotifier->PublishCompletionL(*endData); |
182 |
187 |
183 CleanupStack::PopAndDestroy(endData); |
188 CleanupStack::PopAndDestroy(endData); |
184 |
189 |
185 if (NULL != aErrMsg) |
190 if (NULL != errMsgDetails) |
|
191 { |
|
192 CleanupStack::PopAndDestroy(errMsgDetails); |
|
193 } |
|
194 if (NULL != errMsg) |
186 { |
195 { |
187 CleanupStack::PopAndDestroy(errMsg); |
196 CleanupStack::PopAndDestroy(errMsg); |
188 } |
197 } |
189 if (NULL != aErrMsgDetails) |
|
190 { |
|
191 CleanupStack::PopAndDestroy(errMsgDetails); |
|
192 } |
|
193 CleanupStack::PopAndDestroy(globalComponentId); |
198 CleanupStack::PopAndDestroy(globalComponentId); |
194 __UHEAP_MARKEND; |
199 //__UHEAP_MARKEND; |
195 } |
200 } |
196 |
201 |
197 /* |
202 /* |
198 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier |
203 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier |
199 * Method: _notifyEnd |
204 * Method: _notifyEnd |
201 */ |
206 */ |
202 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyEnd |
207 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyEnd |
203 (JNIEnv *aEnv, jclass, jint aHandle, jstring aGlobalComponentId, |
208 (JNIEnv *aEnv, jclass, jint aHandle, jstring aGlobalComponentId, |
204 jint aErrCategory, jint aErrCode, jstring aErrMsg, jstring aErrMsgDetails) |
209 jint aErrCategory, jint aErrCode, jstring aErrMsg, jstring aErrMsgDetails) |
205 { |
210 { |
|
211 CActiveScheduler* newScheduler = 0; |
|
212 if (0 == CActiveScheduler::Current()) |
|
213 { |
|
214 // Create ActiveScheduler as it does not yet exist. |
|
215 newScheduler = new CActiveScheduler; |
|
216 CActiveScheduler::Install(newScheduler); |
|
217 } |
|
218 |
206 CPublishSifOperationInfo *pNotifier = |
219 CPublishSifOperationInfo *pNotifier = |
207 reinterpret_cast<CPublishSifOperationInfo*>(aHandle<<2); |
220 reinterpret_cast<CPublishSifOperationInfo*>(aHandle<<2); |
208 TRAPD(err, NotifyEndL(aEnv, pNotifier, aGlobalComponentId, |
221 TRAPD(err, NotifyEndL(aEnv, pNotifier, aGlobalComponentId, |
209 aErrCategory, aErrCode, aErrMsg, aErrMsgDetails)); |
222 aErrCategory, aErrCode, aErrMsg, aErrMsgDetails)); |
|
223 |
|
224 if (newScheduler) |
|
225 { |
|
226 delete newScheduler; |
|
227 newScheduler = 0; |
|
228 } |
|
229 |
210 return err; |
230 return err; |
211 } |
231 } |
212 |
232 |
213 /** |
233 /** |
214 * See JNI method __1notifyProgress. |
234 * See JNI method __1notifyProgress. |