30 |
30 |
31 // SCR usage is enabled if this macro has been defined. |
31 // SCR usage is enabled if this macro has been defined. |
32 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
32 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
33 |
33 |
34 #include <qservicemanager.h> |
34 #include <qservicemanager.h> |
|
35 #include <qurl.h> |
35 #include <usif/scr/scr.h> |
36 #include <usif/scr/scr.h> |
36 #include <usif/scr/screntries.h> |
37 #include <usif/scr/screntries.h> |
37 #ifdef RD_JAVA_USIF_APP_REG |
38 #ifdef RD_JAVA_USIF_APP_REG |
38 #include <usif/scr/appreginfo.h> |
39 #include <usif/scr/appreginfo.h> |
39 #endif // RD_JAVA_USIF_APP_REG |
40 #endif // RD_JAVA_USIF_APP_REG |
250 */ |
251 */ |
251 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1launchAppView |
252 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1launchAppView |
252 (JNIEnv *, jclass) |
253 (JNIEnv *, jclass) |
253 { |
254 { |
254 TInt err = KErrNone; |
255 TInt err = KErrNone; |
255 /* |
|
256 //Application Library UID. |
|
257 const TUid KAppLibUid = { 0x20022F35 }; |
|
258 |
256 |
259 QServiceManager serviceManager; |
257 QServiceManager serviceManager; |
260 QObject* activityManager = |
258 QObject* activityManager = |
261 serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"); |
259 serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"); |
262 if (!activityManager) |
260 if (!activityManager) |
264 err = serviceManager.error(); |
262 err = serviceManager.error(); |
265 ELOG1(EJavaInstaller, |
263 ELOG1(EJavaInstaller, |
266 "launchAppView: loading ActivityManager failed, error %d", err); |
264 "launchAppView: loading ActivityManager failed, error %d", err); |
267 return KErrCouldNotConnect; |
265 return KErrCouldNotConnect; |
268 } |
266 } |
|
267 // URL for launching AppLib. |
|
268 QUrl url(QString("appto://20022F35?activityname=AppLibRecentView")); |
269 QMetaObject::invokeMethod(activityManager, "launchActivity", |
269 QMetaObject::invokeMethod(activityManager, "launchActivity", |
270 Q_ARG(int, KAppLibUid.iUid), // AppLib uid |
270 Q_ARG(QString, url.toString())); |
271 Q_ARG(QString, "showInstalledApps")); |
|
272 err = serviceManager.error(); |
271 err = serviceManager.error(); |
273 delete activityManager; |
272 delete activityManager; |
274 if (QServiceManager::NoError != err) |
273 if (QServiceManager::NoError != err) |
275 { |
274 { |
276 ELOG1(EJavaInstaller, |
275 ELOG1(EJavaInstaller, |
537 jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, |
536 jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, |
538 jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, |
537 jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, |
539 jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, |
538 jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, |
540 jstring aDownloadUrl, jobject aComponentId) |
539 jstring aDownloadUrl, jobject aComponentId) |
541 { |
540 { |
542 __UHEAP_MARK; |
541 //__UHEAP_MARK; |
543 RSoftwareComponentRegistry *pScr = |
542 RSoftwareComponentRegistry *pScr = |
544 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
543 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
545 TComponentId componentId = -1; |
544 TComponentId componentId = -1; |
546 TRAPD(err, componentId = RegisterComponentL( |
545 TRAPD(err, componentId = RegisterComponentL( |
547 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId, |
546 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId, |
548 aComponentFiles, aComponentSize, aIsRemovable, |
547 aComponentFiles, aComponentSize, aIsRemovable, |
549 aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, |
548 aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, |
550 aMidletInfoUrl, aMidletDescription, aDownloadUrl)); |
549 aMidletInfoUrl, aMidletDescription, aDownloadUrl)); |
551 __UHEAP_MARKEND; |
550 //__UHEAP_MARKEND; |
552 if (KErrNone == err) |
551 if (KErrNone == err) |
553 { |
552 { |
554 jclass clazz = aEnv->GetObjectClass(aComponentId); |
553 jclass clazz = aEnv->GetObjectClass(aComponentId); |
555 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
554 jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V"); |
556 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
555 aEnv->CallVoidMethod(aComponentId, methodSetId, componentId); |
564 * Signature: (II)I |
563 * Signature: (II)I |
565 */ |
564 */ |
566 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1unregisterComponent |
565 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1unregisterComponent |
567 (JNIEnv *, jclass, jint aSessionHandle, jint aComponentId) |
566 (JNIEnv *, jclass, jint aSessionHandle, jint aComponentId) |
568 { |
567 { |
569 __UHEAP_MARK; |
568 //__UHEAP_MARK; |
570 RSoftwareComponentRegistry *pScr = |
569 RSoftwareComponentRegistry *pScr = |
571 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
570 reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2); |
572 TInt err = KErrNone; |
571 TInt err = KErrNone; |
573 #ifdef RD_JAVA_USIF_APP_REG |
572 #ifdef RD_JAVA_USIF_APP_REG |
574 TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId)); |
573 TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId)); |
575 #endif // RD_JAVA_USIF_APP_REG |
574 #endif // RD_JAVA_USIF_APP_REG |
576 if (KErrNone == err) |
575 if (KErrNone == err) |
577 { |
576 { |
578 TRAP(err, pScr->DeleteComponentL(aComponentId)); |
577 TRAP(err, pScr->DeleteComponentL(aComponentId)); |
579 } |
578 } |
580 __UHEAP_MARKEND; |
579 //__UHEAP_MARKEND; |
581 return err; |
580 return err; |
582 } |
581 } |
583 |
582 |
584 /** |
583 /** |
585 * See JNI method __1registerApplication. |
584 * See JNI method __1registerApplication. |
638 CCaptionAndIconInfo *captionAndIconInfo = |
637 CCaptionAndIconInfo *captionAndIconInfo = |
639 CCaptionAndIconInfo::NewLC( |
638 CCaptionAndIconInfo::NewLC( |
640 /*aCaption=*/ *caption, |
639 /*aCaption=*/ *caption, |
641 /*aIconFileName=*/ (NULL != aIconFilename? *iconFilename: KNullDesC()), |
640 /*aIconFileName=*/ (NULL != aIconFilename? *iconFilename: KNullDesC()), |
642 /*aNumOfAppIcons=*/ numberOfAppIcons); |
641 /*aNumOfAppIcons=*/ numberOfAppIcons); |
643 CLocalizableAppInfo *locAppInfo = |
642 CLocalizableAppInfo *locAppInfo = |
644 CLocalizableAppInfo::NewLC( |
643 CLocalizableAppInfo::NewLC( |
645 /*aShortCaption=*/ KNullDesC, /*aApplicationLanguage=*/ KNonLocalized, |
644 /*aShortCaption=*/ KNullDesC, /*aApplicationLanguage=*/ KNonLocalized, |
646 /*aGroupName=*/ KNullDesC, /*aCaptionAndIconInfo=*/ captionAndIconInfo, |
645 /*aGroupName=*/ KNullDesC, /*aCaptionAndIconInfo=*/ captionAndIconInfo, |
647 /*aViewDataList=*/ viewDataList); |
646 /*aViewDataList=*/ viewDataList); |
648 localizableAppInfoList.AppendL(locAppInfo); |
647 localizableAppInfoList.AppendL(locAppInfo); |
658 { |
657 { |
659 jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL); |
658 jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL); |
660 for (TInt i = 0; i < langCount; i++) |
659 for (TInt i = 0; i < langCount; i++) |
661 { |
660 { |
662 TLanguage tmpLanguage = (TLanguage)languages[i]; |
661 TLanguage tmpLanguage = (TLanguage)languages[i]; |
663 HBufC *tmpCaption = |
662 HBufC *tmpCaption = |
664 CreateHBufCFromJavaStringLC( |
663 CreateHBufCFromJavaStringLC( |
665 aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i)); |
664 aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i)); |
666 captionsArray.AppendL(tmpCaption); |
665 captionsArray.AppendL(tmpCaption); |
667 CleanupStack::Pop(tmpCaption); |
666 CleanupStack::Pop(tmpCaption); |
668 //LOG1(EJavaInstaller, EInfo, |
667 //LOG1(EJavaInstaller, EInfo, |