453 jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, |
453 jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, |
454 jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, |
454 jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, |
455 jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, |
455 jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, |
456 jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId) |
456 jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId) |
457 { |
457 { |
458 __UHEAP_MARK; |
458 //__UHEAP_MARK; |
459 RSoftwareComponentRegistry *pScr = |
459 RSoftwareComponentRegistry *pScr = |
460 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
460 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
461 TComponentId componentId = -1; |
461 TComponentId componentId = -1; |
462 TRAPD(err, componentId = RegisterComponentL( |
462 TRAPD(err, componentId = RegisterComponentL( |
463 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId, |
463 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId, |
464 aComponentFiles, aComponentSize, aIsRemovable, |
464 aComponentFiles, aComponentSize, aIsRemovable, |
465 aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, |
465 aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, |
466 aMidletInfoUrl, aMidletDescription, |
466 aMidletInfoUrl, aMidletDescription, |
467 aDownloadUrl, aUpdateUrl)); |
467 aDownloadUrl, aUpdateUrl)); |
468 __UHEAP_MARKEND; |
468 //__UHEAP_MARKEND; |
469 if (KErrNone == err) |
469 if (KErrNone == err) |
470 { |
470 { |
471 jclass clazz = aEnv->GetObjectClass(aComponentId); |
471 jclass clazz = aEnv->GetObjectClass(aComponentId); |
472 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
472 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
473 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
473 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
481 * Signature: (II)I |
481 * Signature: (II)I |
482 */ |
482 */ |
483 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1unregisterComponent |
483 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1unregisterComponent |
484 (JNIEnv *, jclass, jint aSessionHandle, jint aComponentId) |
484 (JNIEnv *, jclass, jint aSessionHandle, jint aComponentId) |
485 { |
485 { |
486 __UHEAP_MARK; |
486 //__UHEAP_MARK; |
487 RSoftwareComponentRegistry *pScr = |
487 RSoftwareComponentRegistry *pScr = |
488 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
488 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
489 TInt err = KErrNone; |
489 TInt err = KErrNone; |
490 TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId)); |
490 TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId)); |
491 if (KErrNone == err) |
491 if (KErrNone == err) |
492 { |
492 { |
493 TRAP(err, pScr->DeleteComponentL(aComponentId)); |
493 TRAP(err, pScr->DeleteComponentL(aComponentId)); |
494 } |
494 } |
495 __UHEAP_MARKEND; |
495 //__UHEAP_MARKEND; |
496 return err; |
496 return err; |
497 } |
497 } |
498 |
498 |
499 /** |
499 /** |
500 * See JNI method __1registerApplication. |
500 * See JNI method __1registerApplication. |
505 jint aComponentId, jint aAppUid, |
505 jint aComponentId, jint aAppUid, |
506 jstring aAppName, jstring aAppFilename, jstring aGroupName, |
506 jstring aAppName, jstring aAppFilename, jstring aGroupName, |
507 jstring aIconFilename, jint aNumberOfIcons, |
507 jstring aIconFilename, jint aNumberOfIcons, |
508 jintArray aLanguages, jobjectArray aAppNames) |
508 jintArray aLanguages, jobjectArray aAppNames) |
509 { |
509 { |
510 __UHEAP_MARK; |
510 //__UHEAP_MARK; |
511 // Application Uid. |
511 // Application Uid. |
512 TUid appUid = TUid::Uid(aAppUid); |
512 TUid appUid = TUid::Uid(aAppUid); |
513 |
513 |
514 // Generate the executable name using the same algorithm as used |
514 // Generate the executable name using the same algorithm as used |
515 // earlier in S60 platform in case some external S60 application |
515 // earlier in S60 platform in case some external S60 application |
676 * Signature: (IILjava/lang/String;I)I |
676 * Signature: (IILjava/lang/String;I)I |
677 */ |
677 */ |
678 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerLocalizedComponentName |
678 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerLocalizedComponentName |
679 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aComponentId, jstring aName, jstring aVendor, jint aLanguage) |
679 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aComponentId, jstring aName, jstring aVendor, jint aLanguage) |
680 { |
680 { |
681 __UHEAP_MARK; |
681 //__UHEAP_MARK; |
682 RSoftwareComponentRegistry *pScr = |
682 RSoftwareComponentRegistry *pScr = |
683 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
683 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
684 TRAPD(err, RegisterLocalizedComponentNameL( |
684 TRAPD(err, RegisterLocalizedComponentNameL( |
685 aEnv, pScr, aComponentId, aName, aVendor, aLanguage)); |
685 aEnv, pScr, aComponentId, aName, aVendor, aLanguage)); |
686 __UHEAP_MARKEND; |
686 //__UHEAP_MARKEND; |
687 return err; |
687 return err; |
688 } |
688 } |
689 |
689 |
690 /** |
690 /** |
691 * See JNI method __1setLocalizedComponentProperty. |
691 * See JNI method __1setLocalizedComponentProperty. |
699 { |
699 { |
700 HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); |
700 HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); |
701 HBufC *value = CreateHBufCFromJavaStringLC(aEnv, aValue); |
701 HBufC *value = CreateHBufCFromJavaStringLC(aEnv, aValue); |
702 if (KUnspecifiedLocale == aLanguage) |
702 if (KUnspecifiedLocale == aLanguage) |
703 { |
703 { |
704 __UHEAP_MARK; |
704 //__UHEAP_MARK; |
705 aScr->SetComponentPropertyL(aComponentId, *name, *value); |
705 aScr->SetComponentPropertyL(aComponentId, *name, *value); |
706 __UHEAP_MARKEND; |
706 //__UHEAP_MARKEND; |
707 } |
707 } |
708 else |
708 else |
709 { |
709 { |
710 __UHEAP_MARK; |
710 //__UHEAP_MARK; |
711 aScr->SetComponentPropertyL( |
711 aScr->SetComponentPropertyL( |
712 aComponentId, *name, *value, (TLanguage)aLanguage); |
712 aComponentId, *name, *value, (TLanguage)aLanguage); |
713 __UHEAP_MARKEND; |
713 //__UHEAP_MARKEND; |
714 } |
714 } |
715 CleanupStack::PopAndDestroy(value); |
715 CleanupStack::PopAndDestroy(value); |
716 CleanupStack::PopAndDestroy(name); |
716 CleanupStack::PopAndDestroy(name); |
717 } |
717 } |
718 } |
718 } |
723 * Signature: (IILjava/lang/String;Ljava/lang/String;I)I |
723 * Signature: (IILjava/lang/String;Ljava/lang/String;I)I |
724 */ |
724 */ |
725 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1setLocalizedComponentProperty |
725 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1setLocalizedComponentProperty |
726 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aComponentId, jstring aName, jstring aValue, jint aLanguage) |
726 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aComponentId, jstring aName, jstring aValue, jint aLanguage) |
727 { |
727 { |
728 __UHEAP_MARK; |
728 //__UHEAP_MARK; |
729 RSoftwareComponentRegistry *pScr = |
729 RSoftwareComponentRegistry *pScr = |
730 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
730 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
731 TRAPD(err, SetLocalizedComponentPropertyL( |
731 TRAPD(err, SetLocalizedComponentPropertyL( |
732 aEnv, pScr, aComponentId, aName, aValue, aLanguage)); |
732 aEnv, pScr, aComponentId, aName, aValue, aLanguage)); |
733 __UHEAP_MARKEND; |
733 //__UHEAP_MARKEND; |
734 return err; |
734 return err; |
735 } |
735 } |
736 |
736 |
737 /** |
737 /** |
738 * See JNI method __1getComponentId. |
738 * See JNI method __1getComponentId. |
754 * Signature: (ILjava/lang/String;Lcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
754 * Signature: (ILjava/lang/String;Lcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
755 */ |
755 */ |
756 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentId |
756 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentId |
757 (JNIEnv *aEnv, jclass, jint aSessionHandle, jstring aGlobalId, jobject aComponentId) |
757 (JNIEnv *aEnv, jclass, jint aSessionHandle, jstring aGlobalId, jobject aComponentId) |
758 { |
758 { |
759 __UHEAP_MARK; |
759 //__UHEAP_MARK; |
760 RSoftwareComponentRegistry *pScr = |
760 RSoftwareComponentRegistry *pScr = |
761 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
761 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
762 TComponentId componentId = -1; |
762 TComponentId componentId = -1; |
763 TRAPD(err, componentId = GetComponentIdL(aEnv, pScr, aGlobalId)); |
763 TRAPD(err, componentId = GetComponentIdL(aEnv, pScr, aGlobalId)); |
764 __UHEAP_MARKEND; |
764 //__UHEAP_MARKEND; |
765 if (KErrNone == err) |
765 if (KErrNone == err) |
766 { |
766 { |
767 jclass clazz = aEnv->GetObjectClass(aComponentId); |
767 jclass clazz = aEnv->GetObjectClass(aComponentId); |
768 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
768 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
769 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
769 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
778 */ |
778 */ |
779 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp |
779 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp |
780 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId) |
780 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId) |
781 { |
781 { |
782 TInt err = KErrNone; |
782 TInt err = KErrNone; |
783 __UHEAP_MARK; |
783 //__UHEAP_MARK; |
784 RSoftwareComponentRegistry *pScr = |
784 RSoftwareComponentRegistry *pScr = |
785 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
785 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
786 TUid appUid = TUid::Uid(aAppUid); |
786 TUid appUid = TUid::Uid(aAppUid); |
787 TComponentId componentId = -1; |
787 TComponentId componentId = -1; |
788 TRAP(err, componentId = pScr->GetComponentIdForAppL(appUid)); |
788 TRAP(err, componentId = pScr->GetComponentIdForAppL(appUid)); |
789 __UHEAP_MARKEND; |
789 //__UHEAP_MARKEND; |
790 if (KErrNone == err) |
790 if (KErrNone == err) |
791 { |
791 { |
792 jclass clazz = aEnv->GetObjectClass(aComponentId); |
792 jclass clazz = aEnv->GetObjectClass(aComponentId); |
793 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
793 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
794 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
794 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
821 * Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
821 * Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I |
822 */ |
822 */ |
823 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUid |
823 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUid |
824 (JNIEnv *aEnv, jclass, jint aCid, jobject aComponentId) |
824 (JNIEnv *aEnv, jclass, jint aCid, jobject aComponentId) |
825 { |
825 { |
826 __UHEAP_MARK; |
826 //__UHEAP_MARK; |
827 TInt uid = 0; |
827 TInt uid = 0; |
828 TRAPD(err, uid = GetUidL(aCid)); |
828 TRAPD(err, uid = GetUidL(aCid)); |
829 __UHEAP_MARKEND; |
829 //__UHEAP_MARKEND; |
830 if (KErrNone == err) |
830 if (KErrNone == err) |
831 { |
831 { |
832 jclass clazz = aEnv->GetObjectClass(aComponentId); |
832 jclass clazz = aEnv->GetObjectClass(aComponentId); |
833 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
833 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
834 aEnv->CallVoidMethod(aComponentId, methodSetId, uid); |
834 aEnv->CallVoidMethod(aComponentId, methodSetId, uid); |