22 #include <apgtask.h> |
22 #include <apgtask.h> |
23 #include <s32mem.h> |
23 #include <s32mem.h> |
24 #include <w32std.h> |
24 #include <w32std.h> |
25 |
25 |
26 #include "com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator.h" |
26 #include "com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator.h" |
|
27 #include "com_nokia_mj_impl_utils_InstallerErrorMessage.h" |
27 #include "javacommonutils.h" |
28 #include "javacommonutils.h" |
28 #include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL |
29 #include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL |
29 #include "logger.h" |
30 #include "logger.h" |
30 |
31 |
31 // SCR usage is enabled if this macro has been defined. |
32 // SCR usage is enabled if this macro has been defined. |
32 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
33 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
33 |
34 |
34 #include <usif/scr/scr.h> |
35 #include <usif/scr/scr.h> |
35 #include <usif/scr/screntries.h> |
36 #include <usif/scr/screntries.h> |
36 #ifdef RD_JAVA_USIF_APP_REG |
|
37 #include <usif/scr/appreginfo.h> |
37 #include <usif/scr/appreginfo.h> |
38 #endif // RD_JAVA_USIF_APP_REG |
38 #include <usif/usiferror.h> |
39 #include <xqappmgr.h> |
39 #include <xqappmgr.h> |
40 |
40 |
41 // Helper macro for logging a TDesC. |
41 // Helper macro for logging a TDesC. |
42 #define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \ |
42 #define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \ |
43 { \ |
43 { \ |
44 HBufC8* tdescBuf = HBufC8::NewLC(tdescParam.Length() + 1); \ |
44 std::wstring ws((wchar_t*)tdescParam.Ptr(), tdescParam.Length()); \ |
45 TPtr8 tdescPtr(tdescBuf->Des()); \ |
45 LOG1(compIdParam, logLevelParam, msgParam, ws.c_str()); \ |
46 tdescPtr.Append(tdescParam); \ |
|
47 LOG1(compIdParam, logLevelParam, msgParam, tdescPtr.PtrZ());\ |
|
48 CleanupStack::PopAndDestroy(tdescBuf); \ |
|
49 } |
46 } |
50 |
47 |
51 // NAMESPACE DECLARATION |
48 // NAMESPACE DECLARATION |
52 using namespace java; |
49 using namespace java; |
53 using namespace Usif; |
50 using namespace Usif; |
54 |
51 |
55 IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString); |
52 IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString); |
56 |
53 |
57 // Properties registered to SCR. |
54 // Properties registered to SCR. |
58 _LIT(KMIDletName, "MIDlet-Name"); |
|
59 _LIT(KUid, "Uid"); |
55 _LIT(KUid, "Uid"); |
60 _LIT(KMediaId, "Media-Id"); |
56 _LIT(KMediaId, "Media-Id"); |
61 _LIT(KMIDletInfoURL, "MIDlet-Info-URL"); |
57 _LIT(KMIDletInfoURL, "MIDlet-Info-URL"); |
62 _LIT(KMIDletDescription, "MIDlet-Description"); |
58 _LIT(KMIDletDescription, "MIDlet-Description"); |
63 _LIT(KDownloadURL, "Download-URL"); |
59 _LIT(KDownloadURL, "Download-URL"); |
|
60 _LIT(KUpdateURL, "Update-URL"); |
64 _LIT(KSettingsPlugin, "SettingsName"); |
61 _LIT(KSettingsPlugin, "SettingsName"); |
65 _LIT(KSettingsPluginValue, "javaapplicationsettingsview"); |
62 _LIT(KSettingsPluginValue, "javaapplicationsettingsview"); |
66 |
63 |
67 #ifdef RD_JAVA_USIF_APP_REG |
|
68 // Symbian file path separator. |
64 // Symbian file path separator. |
69 _LIT(KPathSeperator, "\\"); |
65 _LIT(KPathSeperator, "\\"); |
70 // Postfix for the fake application name generated for AppArc. |
66 // Postfix for the fake application name generated for AppArc. |
71 _LIT(KAppPostfix, ".fakeapp"); |
67 _LIT(KAppPostfix, ".fakeapp"); |
72 #endif // RD_JAVA_USIF_APP_REG |
|
73 |
68 |
74 /** |
69 /** |
75 * Internal helper method for checking if specified application |
70 * Internal helper method for checking if specified application |
76 * is already running. |
71 * is already running. |
77 * |
72 * |
210 CleanupStack::PopAndDestroy(&appUpdateInfos); |
204 CleanupStack::PopAndDestroy(&appUpdateInfos); |
211 |
205 |
212 CleanupStack::PopAndDestroy(&apaSession); |
206 CleanupStack::PopAndDestroy(&apaSession); |
213 LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed"); |
207 LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed"); |
214 } |
208 } |
215 #else |
|
216 void NotifyAppChangeL(JNIEnv *, jintArray, jint) |
|
217 { |
|
218 } |
|
219 #endif // RD_JAVA_USIF_NOTIFY_APP_ARC |
|
220 |
209 |
221 /* |
210 /* |
222 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
211 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
223 * Method: _notifyAppChange |
212 * Method: _notifyAppChange |
224 * Signature: ([II)I |
213 * Signature: ([II)I |
225 */ |
214 */ |
226 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1notifyAppChange |
215 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1notifyAppChange |
227 (JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange) |
216 (JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange) |
228 { |
217 { |
229 TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange)); |
218 TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange)); |
230 if (KErrNone != err) |
|
231 { |
|
232 ELOG1(EJavaInstaller, |
|
233 "notifyAppChange: notifying AppArc failed, error %d", |
|
234 err); |
|
235 } |
|
236 return err; |
219 return err; |
237 } |
220 } |
238 |
221 |
239 /* |
222 /* |
240 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
223 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
255 } |
238 } |
256 |
239 |
257 QUrl openRecentView("appto://20022F35?activityname=AppLibRecentView"); |
240 QUrl openRecentView("appto://20022F35?activityname=AppLibRecentView"); |
258 XQApplicationManager applicationManager; |
241 XQApplicationManager applicationManager; |
259 XQAiwRequest *request = applicationManager.create(openRecentView); |
242 XQAiwRequest *request = applicationManager.create(openRecentView); |
260 if (request) { |
243 if (request) |
|
244 { |
|
245 LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib"); |
261 bool result = request->send(); |
246 bool result = request->send(); |
262 if (!result) { |
247 if (!result) |
|
248 { |
263 int error = request->lastError(); |
249 int error = request->lastError(); |
264 ELOG1(EJavaInstaller, |
250 ELOG1(EJavaInstaller, |
265 "launchAppView: launching AppLib failed, error %d", error); |
251 "launchAppView: launching AppLib failed, error %d", error); |
266 err = KErrGeneral; |
252 err = KErrGeneral; |
|
253 } |
|
254 else |
|
255 { |
|
256 LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib succeeded"); |
267 } |
257 } |
268 delete request; |
258 delete request; |
269 } |
259 } |
270 |
260 |
271 if (newScheduler) |
261 if (newScheduler) |
387 if (NULL != aValue) |
371 if (NULL != aValue) |
388 { |
372 { |
389 HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue); |
373 HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue); |
390 aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf); |
374 aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf); |
391 //LOG_TDESC_L(EJavaInstaller, EInfo, |
375 //LOG_TDESC_L(EJavaInstaller, EInfo, |
392 // "SetComponentPropertyL: name %s", aName); |
376 // "SetComponentPropertyL: name %S", aName); |
393 //LOG_TDESC_L(EJavaInstaller, EInfo, |
377 //LOG_TDESC_L(EJavaInstaller, EInfo, |
394 // "SetComponentPropertyL: value %s", valueBuf->Des()); |
378 // "SetComponentPropertyL: value %S", valueBuf->Des()); |
395 CleanupStack::PopAndDestroy(valueBuf); |
379 CleanupStack::PopAndDestroy(valueBuf); |
396 } |
380 } |
397 } |
381 } |
398 |
382 |
399 /** |
383 /** |
400 * See JNI method __1registerComponent. |
384 * See JNI method __1registerComponent. |
401 * This method makes calls that may leave (the actual registering). |
385 * This method makes calls that may leave (the actual registering). |
402 */ |
386 */ |
403 TComponentId RegisterComponentL( |
387 TComponentId RegisterComponentL( |
404 JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid, |
388 JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid, |
405 jstring aSuiteName, jstring aVendor, jstring aVersion, |
389 jstring aSuiteName, jstring aVendor, jstring aVersion, jstring aGlobalId, |
406 jstring aName, jstring aGlobalId, |
|
407 jobjectArray aComponentFiles, TInt64 aComponentSize, |
390 jobjectArray aComponentFiles, TInt64 aComponentSize, |
408 TBool aIsRemovable, TBool aIsDrmProtected, |
391 TBool aIsRemovable, TBool aIsDrmProtected, |
409 TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId, |
392 TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId, |
410 jstring aMidletInfoUrl, jstring aMidletDescription, jstring aDownloadUrl) |
393 jstring aMidletInfoUrl, jstring aMidletDescription, |
411 { |
394 jstring aDownloadUrl, jstring aUpdateUrl) |
412 HBufC *name = NULL; |
395 { |
413 if (NULL == aName) |
396 HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName); |
414 { |
|
415 // If name is not specified, use suite name. |
|
416 name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName); |
|
417 } |
|
418 else |
|
419 { |
|
420 name = CreateHBufCFromJavaStringLC(aEnv, aName); |
|
421 } |
|
422 HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); |
397 HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); |
423 HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion); |
398 HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion); |
424 HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId); |
399 HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId); |
425 |
400 |
426 TComponentId componentId = aScr->AddComponentL( |
401 TComponentId componentId = aScr->AddComponentL( |
443 aScr->SetComponentPropertyL(componentId, KMediaId(), aMediaId); |
418 aScr->SetComponentPropertyL(componentId, KMediaId(), aMediaId); |
444 //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Media-Id property set"); |
419 //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Media-Id property set"); |
445 aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue()); |
420 aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue()); |
446 //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set"); |
421 //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set"); |
447 |
422 |
448 if (NULL != aName) |
|
449 { |
|
450 // If name is specified, store suite name as property. |
|
451 SetComponentPropertyL(aEnv, aScr, componentId, KMIDletName(), aSuiteName); |
|
452 } |
|
453 SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl); |
423 SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl); |
454 SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription); |
424 SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription); |
455 SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl); |
425 SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl); |
|
426 SetComponentPropertyL(aEnv, aScr, componentId, KUpdateURL(), aUpdateUrl); |
456 |
427 |
457 CleanupStack::PopAndDestroy(globalId); |
428 CleanupStack::PopAndDestroy(globalId); |
458 CleanupStack::PopAndDestroy(version); |
429 CleanupStack::PopAndDestroy(version); |
459 CleanupStack::PopAndDestroy(vendor); |
430 CleanupStack::PopAndDestroy(vendor); |
460 CleanupStack::PopAndDestroy(name); |
431 CleanupStack::PopAndDestroy(name); |
476 * Method: _registerComponent |
447 * Method: _registerComponent |
477 * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
448 * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
478 */ |
449 */ |
479 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent |
450 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent |
480 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName, |
451 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName, |
481 jstring aVendor, jstring aVersion, jstring aName, jstring aGlobalId, |
452 jstring aVendor, jstring aVersion, jstring aGlobalId, |
482 jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, |
453 jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, |
483 jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, |
454 jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, |
484 jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, |
455 jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, |
485 jstring aDownloadUrl, jobject aComponentId) |
456 jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId) |
486 { |
457 { |
487 __UHEAP_MARK; |
458 __UHEAP_MARK; |
488 RSoftwareComponentRegistry *pScr = |
459 RSoftwareComponentRegistry *pScr = |
489 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
460 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
490 TComponentId componentId = -1; |
461 TComponentId componentId = -1; |
491 TRAPD(err, componentId = RegisterComponentL( |
462 TRAPD(err, componentId = RegisterComponentL( |
492 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId, |
463 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId, |
493 aComponentFiles, aComponentSize, aIsRemovable, |
464 aComponentFiles, aComponentSize, aIsRemovable, |
494 aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, |
465 aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, |
495 aMidletInfoUrl, aMidletDescription, aDownloadUrl)); |
466 aMidletInfoUrl, aMidletDescription, |
|
467 aDownloadUrl, aUpdateUrl)); |
496 __UHEAP_MARKEND; |
468 __UHEAP_MARKEND; |
497 if (KErrNone == err) |
469 if (KErrNone == err) |
498 { |
470 { |
499 jclass clazz = aEnv->GetObjectClass(aComponentId); |
471 jclass clazz = aEnv->GetObjectClass(aComponentId); |
500 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
472 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
528 |
498 |
529 /** |
499 /** |
530 * See JNI method __1registerApplication. |
500 * See JNI method __1registerApplication. |
531 * This method makes calls that may leave. |
501 * This method makes calls that may leave. |
532 */ |
502 */ |
533 #ifdef RD_JAVA_USIF_APP_REG |
|
534 void RegisterApplicationL( |
503 void RegisterApplicationL( |
535 JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, |
504 JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, |
536 jint aComponentId, jint aAppUid, |
505 jint aComponentId, jint aAppUid, |
537 jstring aAppName, jstring aAppFilename, jstring aGroupName, |
506 jstring aAppName, jstring aAppFilename, jstring aGroupName, |
538 jstring aIconFilename, jint aNumberOfIcons, |
507 jstring aIconFilename, jint aNumberOfIcons, |
596 |
565 |
597 // Add localized application names (captions). |
566 // Add localized application names (captions). |
598 RPointerArray<HBufC> captionsArray; |
567 RPointerArray<HBufC> captionsArray; |
599 CleanupResetAndDestroyPushL(captionsArray); |
568 CleanupResetAndDestroyPushL(captionsArray); |
600 TInt langCount = aEnv->GetArrayLength(aLanguages); |
569 TInt langCount = aEnv->GetArrayLength(aLanguages); |
601 TInt captionCount = aEnv->GetArrayLength(aAppNames); |
570 jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL); |
602 if (langCount == captionCount) |
571 for (TInt i = 0; i < langCount; i++) |
603 { |
572 { |
604 jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL); |
573 TLanguage tmpLanguage = (TLanguage)languages[i]; |
605 for (TInt i = 0; i < langCount; i++) |
574 HBufC *tmpCaption = |
606 { |
575 CreateHBufCFromJavaStringLC( |
607 TLanguage tmpLanguage = (TLanguage)languages[i]; |
576 aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i)); |
608 HBufC *tmpCaption = |
577 captionsArray.AppendL(tmpCaption); |
609 CreateHBufCFromJavaStringLC( |
578 CleanupStack::Pop(tmpCaption); |
610 aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i)); |
579 //LOG1(EJavaInstaller, EInfo, |
611 captionsArray.AppendL(tmpCaption); |
580 // "RegisterApplicationL: language %d", tmpLanguage); |
612 CleanupStack::Pop(tmpCaption); |
581 //LOG_TDESC_L(EJavaInstaller, EInfo, |
613 //LOG1(EJavaInstaller, EInfo, |
582 // "RegisterApplicationL: caption %S", tmpCaption->Des()); |
614 // "RegisterApplicationL: language %d", tmpLanguage); |
583 CCaptionAndIconInfo *tmpCaptionAndIconInfo = |
615 //LOG_TDESC_L(EJavaInstaller, EInfo, |
584 CCaptionAndIconInfo::NewLC( |
616 // "RegisterApplicationL: caption %s", tmpCaption->Des()); |
585 /*aCaption=*/ *tmpCaption, |
617 CCaptionAndIconInfo *tmpCaptionAndIconInfo = |
586 /*aIconFileName=*/ KNullDesC, |
618 CCaptionAndIconInfo::NewLC( |
587 /*aNumOfAppIcons=*/ 0); |
619 /*aCaption=*/ *tmpCaption, |
588 CLocalizableAppInfo *tmpLocAppInfo = |
620 /*aIconFileName=*/ KNullDesC, |
589 CLocalizableAppInfo::NewLC( |
621 /*aNumOfAppIcons=*/ 0); |
590 /*aShortCaption=*/ KNullDesC, |
622 CLocalizableAppInfo *tmpLocAppInfo = |
591 /*aApplicationLanguage=*/ tmpLanguage, |
623 CLocalizableAppInfo::NewLC( |
592 /*aGroupName=*/ KNullDesC, |
624 /*aShortCaption=*/ KNullDesC, |
593 /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo, |
625 /*aApplicationLanguage=*/ tmpLanguage, |
594 /*aViewDataList=*/ viewDataList); |
626 /*aGroupName=*/ KNullDesC, |
595 localizableAppInfoList.AppendL(tmpLocAppInfo); |
627 /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo, |
596 CleanupStack::Pop(tmpLocAppInfo); |
628 /*aViewDataList=*/ viewDataList); |
597 CleanupStack::Pop(tmpCaptionAndIconInfo); |
629 localizableAppInfoList.AppendL(tmpLocAppInfo); |
598 } |
630 CleanupStack::Pop(tmpLocAppInfo); |
599 aEnv->ReleaseIntArrayElements(aLanguages, languages, 0); |
631 CleanupStack::Pop(tmpCaptionAndIconInfo); |
|
632 } |
|
633 aEnv->ReleaseIntArrayElements(aLanguages, languages, 0); |
|
634 } |
|
635 else |
|
636 { |
|
637 WLOG2(EJavaInstaller, |
|
638 "RegisterApplicationL: localisation not made because language " \ |
|
639 "count does not match to caption count (%d != %d)", |
|
640 langCount, captionCount); |
|
641 } |
|
642 |
600 |
643 // Create application registration data objects. |
601 // Create application registration data objects. |
644 TApplicationCharacteristics appCharacteristics; |
602 TApplicationCharacteristics appCharacteristics; |
645 appCharacteristics.iAttributes = TApaAppCapability::ENonNative; |
603 appCharacteristics.iAttributes = TApaAppCapability::ENonNative; |
646 appCharacteristics.iEmbeddability = TApplicationCharacteristics::ENotEmbeddable; |
604 appCharacteristics.iEmbeddability = TApplicationCharacteristics::ENotEmbeddable; |
672 CleanupStack::PopAndDestroy(groupName); |
630 CleanupStack::PopAndDestroy(groupName); |
673 CleanupStack::PopAndDestroy(appFilename); |
631 CleanupStack::PopAndDestroy(appFilename); |
674 CleanupStack::PopAndDestroy(caption); |
632 CleanupStack::PopAndDestroy(caption); |
675 __UHEAP_MARKEND; |
633 __UHEAP_MARKEND; |
676 } |
634 } |
677 #else |
|
678 void RegisterApplicationL( |
|
679 JNIEnv *, RSoftwareComponentRegistry *, jint, jint, jstring, |
|
680 jstring, jstring, jstring, jint, jintArray, jobjectArray) |
|
681 { |
|
682 } |
|
683 #endif // RD_JAVA_USIF_APP_REG |
|
684 |
635 |
685 /* |
636 /* |
686 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
637 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
687 * Method: _registerApplication |
638 * Method: _registerApplication |
688 * Signature: (IIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I[I[Ljava/lang/String;)I |
639 * Signature: (IIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I[I[Ljava/lang/String;)I |
708 */ |
659 */ |
709 void RegisterLocalizedComponentNameL( |
660 void RegisterLocalizedComponentNameL( |
710 JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId, |
661 JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId, |
711 jstring aName, jstring aVendor, jint aLanguage) |
662 jstring aName, jstring aVendor, jint aLanguage) |
712 { |
663 { |
713 if (NULL != aName) |
664 HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); |
714 { |
665 aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage); |
715 HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); |
666 CleanupStack::PopAndDestroy(name); |
716 aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage); |
667 |
717 CleanupStack::PopAndDestroy(name); |
668 HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); |
718 } |
669 aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage); |
719 |
670 CleanupStack::PopAndDestroy(vendor); |
720 if (NULL != aVendor) |
|
721 { |
|
722 HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); |
|
723 aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage); |
|
724 CleanupStack::PopAndDestroy(vendor); |
|
725 } |
|
726 } |
671 } |
727 |
672 |
728 /* |
673 /* |
729 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
674 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
730 * Method: _registerLocalizedComponentName |
675 * Method: _registerLocalizedComponentName |
864 // Create a new tmporary instance of RSoftwareComponentRegistry. |
801 // Create a new tmporary instance of RSoftwareComponentRegistry. |
865 RSoftwareComponentRegistry *pScr = CreateScrL(); |
802 RSoftwareComponentRegistry *pScr = CreateScrL(); |
866 CleanupClosePushL(*pScr); |
803 CleanupClosePushL(*pScr); |
867 TInt uid = 0; |
804 TInt uid = 0; |
868 CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid()); |
805 CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid()); |
869 if (NULL != property) |
806 uid = ((CIntPropertyEntry*)property)->IntValue(); |
870 { |
807 delete property; |
871 if (property->PropertyType() == CPropertyEntry::EIntProperty) |
|
872 { |
|
873 uid = ((CIntPropertyEntry*)property)->IntValue(); |
|
874 } |
|
875 else |
|
876 { |
|
877 ELOG2(EJavaInstaller, |
|
878 "GetUidL: Incorrect property type %d for cid %d", |
|
879 property->PropertyType(), aCid); |
|
880 } |
|
881 delete property; |
|
882 } |
|
883 // Close and delete the temporary RSoftwareComponentRegistry. |
808 // Close and delete the temporary RSoftwareComponentRegistry. |
884 CleanupStack::PopAndDestroy(pScr); |
809 CleanupStack::PopAndDestroy(pScr); |
885 delete pScr; // For some reason PopAndDestroy does not delete this. |
810 delete pScr; // For some reason PopAndDestroy does not delete this. |
886 return uid; |
811 return uid; |
887 } |
812 } |
914 void LogComponentL(JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jstring aGlobalId, TLanguage aLanguage) |
839 void LogComponentL(JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jstring aGlobalId, TLanguage aLanguage) |
915 { |
840 { |
916 HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId); |
841 HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId); |
917 CComponentEntry *componentEntry = |
842 CComponentEntry *componentEntry = |
918 aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage); |
843 aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage); |
919 if (NULL == componentEntry) |
|
920 { |
|
921 //LOG_TDESC_L(EJavaInstaller, EInfo, |
|
922 // "Component not found for GlobalId %s", globalId->Des()); |
|
923 CleanupStack::PopAndDestroy(globalId); |
|
924 return; |
|
925 } |
|
926 CleanupStack::PopAndDestroy(globalId); |
844 CleanupStack::PopAndDestroy(globalId); |
927 |
845 |
928 // Log component entry. |
846 // Log component entry. |
929 TComponentId componentId = componentEntry->ComponentId(); |
847 TComponentId componentId = componentEntry->ComponentId(); |
930 LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %s", componentEntry->GlobalId()); |
848 LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %S", componentEntry->GlobalId()); |
931 LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId); |
849 LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId); |
932 LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %s", componentEntry->SoftwareType()); |
850 LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %S", componentEntry->SoftwareType()); |
933 LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %s", componentEntry->Name()); |
851 LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %S", componentEntry->Name()); |
934 LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %s", componentEntry->Vendor()); |
852 LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %S", componentEntry->Vendor()); |
935 LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %s", componentEntry->Version()); |
853 LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %S", componentEntry->Version()); |
936 LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize()); |
854 LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize()); |
937 LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState()); |
855 LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState()); |
938 LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected()); |
856 LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected()); |
939 LOG1(EJavaInstaller, EInfo, "IsHidden: %d", componentEntry->IsHidden()); |
857 LOG1(EJavaInstaller, EInfo, "IsHidden: %d", componentEntry->IsHidden()); |
940 LOG1(EJavaInstaller, EInfo, "IsKnownRevoked: %d", componentEntry->IsKnownRevoked()); |
858 LOG1(EJavaInstaller, EInfo, "IsKnownRevoked: %d", componentEntry->IsKnownRevoked()); |
958 { |
876 { |
959 CPropertyEntry *propertyEntry = properties[i]; |
877 CPropertyEntry *propertyEntry = properties[i]; |
960 switch (propertyEntry->PropertyType()) |
878 switch (propertyEntry->PropertyType()) |
961 { |
879 { |
962 case CPropertyEntry::EBinaryProperty: |
880 case CPropertyEntry::EBinaryProperty: |
963 LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %s", |
881 LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %S", |
964 propertyEntry->PropertyName()); |
882 propertyEntry->PropertyName()); |
965 break; |
883 break; |
966 case CPropertyEntry::EIntProperty: |
884 case CPropertyEntry::EIntProperty: |
967 LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %s", |
885 LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %S", |
968 propertyEntry->PropertyName()); |
886 propertyEntry->PropertyName()); |
969 LOG2(EJavaInstaller, EInfo, " = 0x%x (%d)", |
887 LOG2(EJavaInstaller, EInfo, " = 0x%x (%d)", |
970 ((CIntPropertyEntry*)propertyEntry)->IntValue(), |
888 ((CIntPropertyEntry*)propertyEntry)->IntValue(), |
971 ((CIntPropertyEntry*)propertyEntry)->IntValue()); |
889 ((CIntPropertyEntry*)propertyEntry)->IntValue()); |
972 break; |
890 break; |
973 case CPropertyEntry::ELocalizedProperty: |
891 case CPropertyEntry::ELocalizedProperty: |
974 LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %s", |
892 LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %S", |
975 propertyEntry->PropertyName()); |
893 propertyEntry->PropertyName()); |
976 LOG_TDESC_L(EJavaInstaller, EInfo, " = %s", |
894 LOG_TDESC_L(EJavaInstaller, EInfo, " = %S", |
977 ((CLocalizablePropertyEntry*)propertyEntry)->StrValue()); |
895 ((CLocalizablePropertyEntry*)propertyEntry)->StrValue()); |
978 break; |
896 break; |
979 } |
897 } |
980 } |
898 } |
981 CleanupStack::PopAndDestroy(&properties); |
899 CleanupStack::PopAndDestroy(&properties); |
982 |
900 |
983 #ifdef RD_JAVA_USIF_APP_REG |
|
984 // Log uids of applications associated to component. |
901 // Log uids of applications associated to component. |
985 RArray<TUid> appUids; |
902 RArray<TUid> appUids; |
986 CleanupClosePushL(appUids); |
903 CleanupClosePushL(appUids); |
987 aScr->GetAppUidsForComponentL(componentId, appUids); |
904 aScr->GetAppUidsForComponentL(componentId, appUids); |
988 if (appUids.Count() == 0) |
905 LOG1(EJavaInstaller, EInfo, "Number of AppUids found: %d", appUids.Count()); |
989 { |
|
990 LOG(EJavaInstaller, EInfo, "No component appUids found from SCR"); |
|
991 } |
|
992 for (TInt i = 0; i < appUids.Count(); i++) |
906 for (TInt i = 0; i < appUids.Count(); i++) |
993 { |
907 { |
994 LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)", |
908 LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)", |
995 appUids[i].iUid, appUids[i].iUid); |
909 appUids[i].iUid, appUids[i].iUid); |
996 } |
910 } |
997 CleanupStack::PopAndDestroy(&appUids); |
911 CleanupStack::PopAndDestroy(&appUids); |
998 #endif // RD_JAVA_USIF_APP_REG |
|
999 } |
912 } |
1000 |
913 |
1001 /** |
914 /** |
1002 * See JNI method __1logComponent. |
915 * See JNI method __1logComponent. |
1003 * This method makes calls that may leave. |
916 * This method makes calls that may leave. |
1045 * Signature: ()I |
958 * Signature: ()I |
1046 */ |
959 */ |
1047 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUsifMode |
960 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUsifMode |
1048 (JNIEnv *, jclass) |
961 (JNIEnv *, jclass) |
1049 { |
962 { |
1050 #ifdef RD_JAVA_USIF_APP_REG |
|
1051 return 1; |
963 return 1; |
1052 #else |
964 } |
1053 return 0; |
965 |
1054 #endif // RD_JAVA_USIF_APP_REG |
966 /* |
|
967 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
|
968 * Method: _getErrorCategory |
|
969 * Signature: (I)I |
|
970 */ |
|
971 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory |
|
972 (JNIEnv *, jclass, jint aErrorId) |
|
973 { |
|
974 int errorCategory = Usif::EUnexpectedError; |
|
975 switch (aErrorId) |
|
976 { |
|
977 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_MEM: |
|
978 errorCategory = Usif::ELowDiskSpace; |
|
979 break; |
|
980 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_NET: |
|
981 errorCategory = Usif::ENetworkUnavailable; |
|
982 break; |
|
983 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CORRUPT_PKG: |
|
984 errorCategory = Usif::ECorruptedPackage; |
|
985 break; |
|
986 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_COMPAT_ERR: |
|
987 errorCategory = Usif::EApplicationNotCompatible; |
|
988 break; |
|
989 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHORIZATION_ERR: |
|
990 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHENTICATION_ERR: |
|
991 errorCategory = Usif::ESecurityError; |
|
992 break; |
|
993 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_PUSH_REG_ERR: |
|
994 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_UNEXPECTED_ERR: |
|
995 case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_UNEXPECTED_ERR: |
|
996 case com_nokia_mj_impl_utils_InstallerErrorMessage_OTHER_UNEXPECTED_ERR: |
|
997 errorCategory = Usif::EUnexpectedError; |
|
998 break; |
|
999 case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CANCEL: |
|
1000 case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_CANCEL: |
|
1001 errorCategory = Usif::EUserCancelled; |
|
1002 break; |
|
1003 case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_NOT_ALLOWED: |
|
1004 errorCategory = Usif::EUninstallationBlocked; |
|
1005 break; |
|
1006 } |
|
1007 return errorCategory; |
1055 } |
1008 } |
1056 |
1009 |
1057 #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1010 #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1058 |
1011 |
1059 /* |
1012 /* |
1125 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
1078 * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator |
1126 * Method: _registerComponent |
1079 * Method: _registerComponent |
1127 * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
1080 * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
1128 */ |
1081 */ |
1129 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent |
1082 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent |
1130 (JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, jstring, |
1083 (JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, |
1131 jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, jstring, |
1084 jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, |
1132 jstring, jstring, jobject) |
1085 jstring, jstring, jstring, jstring, jobject) |
1133 { |
1086 { |
1134 return KErrNone; |
1087 return KErrNone; |
1135 } |
1088 } |
1136 |
1089 |
1137 /* |
1090 /* |