javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp
branchRCL_3
changeset 60 6c158198356e
parent 25 9ac0a0a7da70
child 83 26b2b12093af
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    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 <qservicemanager.h>
       
    35 #include <qurl.h>
       
    36 #include <usif/scr/scr.h>
    35 #include <usif/scr/scr.h>
    37 #include <usif/scr/screntries.h>
    36 #include <usif/scr/screntries.h>
    38 #ifdef RD_JAVA_USIF_APP_REG
       
    39 #include <usif/scr/appreginfo.h>
    37 #include <usif/scr/appreginfo.h>
    40 #endif // RD_JAVA_USIF_APP_REG
    38 #include <usif/usiferror.h>
       
    39 #include <xqappmgr.h>
    41 
    40 
    42 // Helper macro for logging a TDesC.
    41 // Helper macro for logging a TDesC.
    43 #define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \
    42 #define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \
    44     {                                                               \
    43     {                                                                 \
    45         HBufC8* tdescBuf = HBufC8::NewLC(tdescParam.Length() + 1);  \
    44         std::wstring ws((wchar_t*)tdescParam.Ptr(), tdescParam.Length()); \
    46         TPtr8 tdescPtr(tdescBuf->Des());                            \
    45         LOG1(compIdParam, logLevelParam, msgParam, ws.c_str());       \
    47         tdescPtr.Append(tdescParam);                                \
       
    48         LOG1(compIdParam, logLevelParam, msgParam, tdescPtr.PtrZ());\
       
    49         CleanupStack::PopAndDestroy(tdescBuf);                      \
       
    50     }
    46     }
    51 
    47 
    52 // NAMESPACE DECLARATION
    48 // NAMESPACE DECLARATION
    53 QTM_USE_NAMESPACE
       
    54 using namespace java;
    49 using namespace java;
    55 using namespace Usif;
    50 using namespace Usif;
    56 
    51 
    57 IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
    52 IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
    58 
    53 
    59 // Java MIME types.
       
    60 _LIT(KMimeTypeAppDescriptor, "text/vnd.sun.j2me.app-descriptor");
       
    61 _LIT(KMimeTypeJava, "application/java");
       
    62 _LIT(KMimeTypeJavaArchive, "application/java-archive");
       
    63 _LIT(KMimeTypeXJavaArchive, "application/x-java-archive");
       
    64 
       
    65 // Properties registered to SCR.
    54 // Properties registered to SCR.
    66 _LIT(KMIDletName, "MIDlet-Name");
       
    67 _LIT(KUid, "Uid");
    55 _LIT(KUid, "Uid");
    68 _LIT(KMediaId, "Media-Id");
    56 _LIT(KMediaId, "Media-Id");
    69 _LIT(KMIDletInfoURL, "MIDlet-Info-URL");
    57 _LIT(KMIDletInfoURL, "MIDlet-Info-URL");
    70 _LIT(KMIDletDescription, "MIDlet-Description");
    58 _LIT(KMIDletDescription, "MIDlet-Description");
    71 _LIT(KDownloadURL, "Download-URL");
    59 _LIT(KDownloadURL, "Download-URL");
       
    60 _LIT(KUpdateURL, "Update-URL");
    72 _LIT(KSettingsPlugin, "SettingsName");
    61 _LIT(KSettingsPlugin, "SettingsName");
    73 _LIT(KSettingsPluginValue, "javaapplicationsettingsview");
    62 _LIT(KSettingsPluginValue, "javaapplicationsettingsview");
    74 
    63 
    75 #ifdef RD_JAVA_USIF_APP_REG
       
    76 // Symbian file path separator.
    64 // Symbian file path separator.
    77 _LIT(KPathSeperator, "\\");
    65 _LIT(KPathSeperator, "\\");
    78 // Postfix for the fake application name generated for AppArc.
    66 // Postfix for the fake application name generated for AppArc.
    79 _LIT(KAppPostfix, ".fakeapp");
    67 _LIT(KAppPostfix, ".fakeapp");
    80 #endif // RD_JAVA_USIF_APP_REG
       
    81 
    68 
    82 /**
    69 /**
    83  * Internal helper method for checking if specified application
    70  * Internal helper method for checking if specified application
    84  * is already running.
    71  * is already running.
    85  *
    72  *
   185 
   172 
   186 /**
   173 /**
   187  * See JNI method __1notifyAppChange.
   174  * See JNI method __1notifyAppChange.
   188  * This method makes calls that may leave (the actual registering).
   175  * This method makes calls that may leave (the actual registering).
   189  */
   176  */
   190 #ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
       
   191 void NotifyAppChangeL(JNIEnv *aEnv, jintArray aAppUids, jint aAppChange)
   177 void NotifyAppChangeL(JNIEnv *aEnv, jintArray aAppUids, jint aAppChange)
   192 {
   178 {
   193     RApaLsSession apaSession;
   179     RApaLsSession apaSession;
   194     TInt err = apaSession.Connect();
   180     TInt err = apaSession.Connect();
   195     if (KErrNone != err)
   181     if (KErrNone != err)
   218     CleanupStack::PopAndDestroy(&appUpdateInfos);
   204     CleanupStack::PopAndDestroy(&appUpdateInfos);
   219 
   205 
   220     CleanupStack::PopAndDestroy(&apaSession);
   206     CleanupStack::PopAndDestroy(&apaSession);
   221     LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed");
   207     LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed");
   222 }
   208 }
   223 #else
       
   224 void NotifyAppChangeL(JNIEnv *, jintArray, jint)
       
   225 {
       
   226 }
       
   227 #endif // RD_JAVA_USIF_NOTIFY_APP_ARC
       
   228 
   209 
   229 /*
   210 /*
   230  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   211  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   231  * Method:    _notifyAppChange
   212  * Method:    _notifyAppChange
   232  * Signature: ([II)I
   213  * Signature: ([II)I
   233  */
   214  */
   234 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
   235 (JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange)
   216 (JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange)
   236 {
   217 {
   237     TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange));
   218     TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange));
   238     if (KErrNone != err)
       
   239     {
       
   240         ELOG1(EJavaInstaller,
       
   241               "notifyAppChange: notifying AppArc failed, error %d",
       
   242               err);
       
   243     }
       
   244     return err;
   219     return err;
   245 }
   220 }
   246 
   221 
   247 /*
   222 /*
   248  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   223  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   252 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1launchAppView
   227 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1launchAppView
   253 (JNIEnv *, jclass)
   228 (JNIEnv *, jclass)
   254 {
   229 {
   255     TInt err = KErrNone;
   230     TInt err = KErrNone;
   256 
   231 
   257     QServiceManager serviceManager;
   232     CActiveScheduler* newScheduler = 0;
   258     QObject* activityManager =
   233     if (0 == CActiveScheduler::Current())
   259         serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager");
   234     {
   260     if (!activityManager)
   235         // Create ActiveScheduler as it does not yet exist.
   261     {
   236         newScheduler = new CActiveScheduler;
   262         err = serviceManager.error();
   237         CActiveScheduler::Install(newScheduler);
   263         ELOG1(EJavaInstaller,
   238     }
   264               "launchAppView: loading ActivityManager failed, error %d", err);
   239 
   265         return KErrCouldNotConnect;
   240     QUrl openRecentView("appto://20022F35?activityname=AppLibRecentView");
   266     }
   241     XQApplicationManager applicationManager;
   267     // URL for launching AppLib.
   242     XQAiwRequest *request = applicationManager.create(openRecentView);
   268     QUrl url(QString("appto://20022F35?activityname=AppLibRecentView"));
   243     if (request)
   269     QMetaObject::invokeMethod(activityManager, "launchActivity",
   244     {
   270                               Q_ARG(QString, url.toString()));
   245         LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib");
   271     err = serviceManager.error();
   246         bool result = request->send();
   272     delete activityManager;
   247         if (!result)
   273     if (QServiceManager::NoError != err)
   248         {
   274     {
   249             int error = request->lastError();
   275         ELOG1(EJavaInstaller,
   250             ELOG1(EJavaInstaller,
   276               "launchAppView: launching AppLib activity failed, error %d",
   251                   "launchAppView: launching AppLib failed, error %d", error);
   277               err);
   252             err = KErrGeneral;
   278         return KErrCouldNotConnect;
   253         }
   279     }
   254         else
   280 
   255         {
   281     // Start AppLib and bring it to foreground.
   256             LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib succeeded");
   282     const TUid KAppLibUid = { 0x20022F35 };
   257         }
   283     TRAP(err, StartAppL(KAppLibUid));
   258         delete request;
   284     return err;
   259     }
   285 }
   260 
   286 
   261     if (newScheduler)
   287 /**
   262     {
   288  * See JNI method __1registerJavaSoftwareType.
   263         delete newScheduler;
   289  * This method makes calls that may leave (the actual registering).
   264         newScheduler = 0;
   290  */
   265     }
   291 void RegisterJavaSoftwareTypeL(RSoftwareComponentRegistry *aScr, TBool aRegister = ETrue)
   266 
   292 {
   267     if (KErrNone == err)
   293     RPointerArray<HBufC> javaMimeTypes;
   268     {
   294     CleanupResetAndDestroyPushL(javaMimeTypes);
   269         // Start AppLib and bring it to foreground.
   295     javaMimeTypes.AppendL(KMimeTypeAppDescriptor().AllocL());
   270         const TUid KAppLibUid = { 0x20022F35 };
   296     javaMimeTypes.AppendL(KMimeTypeJava().AllocL());
   271         TRAP(err, StartAppL(KAppLibUid));
   297     javaMimeTypes.AppendL(KMimeTypeJavaArchive().AllocL());
   272     }
   298     javaMimeTypes.AppendL(KMimeTypeXJavaArchive().AllocL());
       
   299     if (aRegister)
       
   300     {
       
   301         TUid javaSifPluginUid = TUid::Uid(0x2002bc70);
       
   302         _LIT_SECURE_ID(KJavaInstallerSid, 0x102033E6);
       
   303         aScr->AddSoftwareTypeL(
       
   304             Usif::KSoftwareTypeJava, javaSifPluginUid,
       
   305             KJavaInstallerSid, KJavaInstallerSid, javaMimeTypes);
       
   306     }
       
   307     else
       
   308     {
       
   309         aScr->DeleteSoftwareTypeL(Usif::KSoftwareTypeJava, javaMimeTypes);
       
   310     }
       
   311     CleanupStack::PopAndDestroy(&javaMimeTypes);
       
   312 }
       
   313 
       
   314 /*
       
   315  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
       
   316  * Method:    _registerJavaSoftwareType
       
   317  * Signature: (Z)I
       
   318  */
       
   319 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerJavaSoftwareType
       
   320 (JNIEnv *, jclass, jboolean aRegister)
       
   321 {
       
   322     RSoftwareComponentRegistry *pScr = NULL;
       
   323     TRAPD(err, pScr = CreateScrL());
       
   324     if (KErrNone != err)
       
   325     {
       
   326         return err;
       
   327     }
       
   328     TRAP(err, RegisterJavaSoftwareTypeL(pScr, aRegister));
       
   329     if (KErrNone != err)
       
   330     {
       
   331         ELOG1(EJavaInstaller,
       
   332               "registerJavaSoftwareType: registration failed, error %d",
       
   333               err);
       
   334     }
       
   335     pScr->Close();
       
   336     delete pScr;
       
   337     return err;
   273     return err;
   338 }
   274 }
   339 
   275 
   340 /*
   276 /*
   341  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   277  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   406     RSoftwareComponentRegistry *pScr =
   342     RSoftwareComponentRegistry *pScr =
   407         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   343         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   408     TRAPD(err, pScr->RollbackTransactionL());
   344     TRAPD(err, pScr->RollbackTransactionL());
   409     pScr->Close();
   345     pScr->Close();
   410     delete pScr;
   346     delete pScr;
   411     if (KErrNone != err)
       
   412     {
       
   413         ELOG1(EJavaInstaller,
       
   414               "rollbackSession: Rolling back transaction failed, error %d",
       
   415               err);
       
   416     }
       
   417     return err;
   347     return err;
   418 }
   348 }
   419 
   349 
   420 /*
   350 /*
   421  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   351  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   441     if (NULL != aValue)
   371     if (NULL != aValue)
   442     {
   372     {
   443         HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue);
   373         HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue);
   444         aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf);
   374         aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf);
   445         //LOG_TDESC_L(EJavaInstaller, EInfo,
   375         //LOG_TDESC_L(EJavaInstaller, EInfo,
   446         //            "SetComponentPropertyL: name %s", aName);
   376         //            "SetComponentPropertyL: name %S", aName);
   447         //LOG_TDESC_L(EJavaInstaller, EInfo,
   377         //LOG_TDESC_L(EJavaInstaller, EInfo,
   448         //            "SetComponentPropertyL: value %s", valueBuf->Des());
   378         //            "SetComponentPropertyL: value %S", valueBuf->Des());
   449         CleanupStack::PopAndDestroy(valueBuf);
   379         CleanupStack::PopAndDestroy(valueBuf);
   450     }
   380     }
   451 }
   381 }
   452 
   382 
   453 /**
   383 /**
   454  * See JNI method __1registerComponent.
   384  * See JNI method __1registerComponent.
   455  * This method makes calls that may leave (the actual registering).
   385  * This method makes calls that may leave (the actual registering).
   456  */
   386  */
   457 TComponentId RegisterComponentL(
   387 TComponentId RegisterComponentL(
   458     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid,
   388     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid,
   459     jstring aSuiteName, jstring aVendor, jstring aVersion,
   389     jstring aSuiteName, jstring aVendor, jstring aVersion, jstring aGlobalId,
   460     jstring aName, jstring aGlobalId,
       
   461     jobjectArray aComponentFiles, TInt64 aComponentSize,
   390     jobjectArray aComponentFiles, TInt64 aComponentSize,
   462     TBool aIsRemovable, TBool aIsDrmProtected,
   391     TBool aIsRemovable, TBool aIsDrmProtected,
   463     TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId,
   392     TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId,
   464     jstring aMidletInfoUrl, jstring aMidletDescription, jstring aDownloadUrl)
   393     jstring aMidletInfoUrl, jstring aMidletDescription,
   465 {
   394     jstring aDownloadUrl, jstring aUpdateUrl)
   466     HBufC *name = NULL;
   395 {
   467     if (NULL == aName)
   396     HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName);
   468     {
       
   469         // If name is not specified, use suite name.
       
   470         name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName);
       
   471     }
       
   472     else
       
   473     {
       
   474         name = CreateHBufCFromJavaStringLC(aEnv, aName);
       
   475     }
       
   476     HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
   397     HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
   477     HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion);
   398     HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion);
   478     HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
   399     HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
   479 
   400 
   480     TComponentId componentId = aScr->AddComponentL(
   401     TComponentId componentId = aScr->AddComponentL(
   497     aScr->SetComponentPropertyL(componentId, KMediaId(), aMediaId);
   418     aScr->SetComponentPropertyL(componentId, KMediaId(), aMediaId);
   498     //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Media-Id property set");
   419     //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Media-Id property set");
   499     aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue());
   420     aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue());
   500     //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set");
   421     //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set");
   501 
   422 
   502     if (NULL != aName)
       
   503     {
       
   504         // If name is specified, store suite name as property.
       
   505         SetComponentPropertyL(aEnv, aScr, componentId, KMIDletName(), aSuiteName);
       
   506     }
       
   507     SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl);
   423     SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl);
   508     SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription);
   424     SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription);
   509     SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl);
   425     SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl);
       
   426     SetComponentPropertyL(aEnv, aScr, componentId, KUpdateURL(), aUpdateUrl);
   510 
   427 
   511     CleanupStack::PopAndDestroy(globalId);
   428     CleanupStack::PopAndDestroy(globalId);
   512     CleanupStack::PopAndDestroy(version);
   429     CleanupStack::PopAndDestroy(version);
   513     CleanupStack::PopAndDestroy(vendor);
   430     CleanupStack::PopAndDestroy(vendor);
   514     CleanupStack::PopAndDestroy(name);
   431     CleanupStack::PopAndDestroy(name);
   530  * Method:    _registerComponent
   447  * Method:    _registerComponent
   531  * 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
   532  */
   449  */
   533 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
   534 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName,
   451 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName,
   535  jstring aVendor, jstring aVersion, jstring aName, jstring aGlobalId,
   452  jstring aVendor, jstring aVersion, jstring aGlobalId,
   536  jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable,
   453  jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable,
   537  jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate,
   454  jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate,
   538  jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription,
   455  jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription,
   539  jstring aDownloadUrl, jobject aComponentId)
   456  jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId)
   540 {
   457 {
   541     //__UHEAP_MARK;
   458     __UHEAP_MARK;
   542     RSoftwareComponentRegistry *pScr =
   459     RSoftwareComponentRegistry *pScr =
   543         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   460         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   544     TComponentId componentId = -1;
   461     TComponentId componentId = -1;
   545     TRAPD(err, componentId = RegisterComponentL(
   462     TRAPD(err, componentId = RegisterComponentL(
   546                                  aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId,
   463                                  aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId,
   547                                  aComponentFiles, aComponentSize, aIsRemovable,
   464                                  aComponentFiles, aComponentSize, aIsRemovable,
   548                                  aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId,
   465                                  aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId,
   549                                  aMidletInfoUrl, aMidletDescription, aDownloadUrl));
   466                                  aMidletInfoUrl, aMidletDescription,
   550     //__UHEAP_MARKEND;
   467                                  aDownloadUrl, aUpdateUrl));
       
   468     __UHEAP_MARKEND;
   551     if (KErrNone == err)
   469     if (KErrNone == err)
   552     {
   470     {
   553         jclass clazz = aEnv->GetObjectClass(aComponentId);
   471         jclass clazz = aEnv->GetObjectClass(aComponentId);
   554         jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V");
   472         jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V");
   555         aEnv->CallVoidMethod(aComponentId, methodSetId, componentId);
   473         aEnv->CallVoidMethod(aComponentId, methodSetId, componentId);
   563  * Signature: (II)I
   481  * Signature: (II)I
   564  */
   482  */
   565 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
   566 (JNIEnv *, jclass, jint aSessionHandle, jint aComponentId)
   484 (JNIEnv *, jclass, jint aSessionHandle, jint aComponentId)
   567 {
   485 {
   568     //__UHEAP_MARK;
   486     __UHEAP_MARK;
   569     RSoftwareComponentRegistry *pScr =
   487     RSoftwareComponentRegistry *pScr =
   570         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   488         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   571     TInt err = KErrNone;
   489     TInt err = KErrNone;
   572 #ifdef RD_JAVA_USIF_APP_REG
       
   573     TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId));
   490     TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId));
   574 #endif // RD_JAVA_USIF_APP_REG
       
   575     if (KErrNone == err)
   491     if (KErrNone == err)
   576     {
   492     {
   577         TRAP(err, pScr->DeleteComponentL(aComponentId));
   493         TRAP(err, pScr->DeleteComponentL(aComponentId));
   578     }
   494     }
   579     //__UHEAP_MARKEND;
   495     __UHEAP_MARKEND;
   580     return err;
   496     return err;
   581 }
   497 }
   582 
   498 
   583 /**
   499 /**
   584  * See JNI method __1registerApplication.
   500  * See JNI method __1registerApplication.
   585  * This method makes calls that may leave.
   501  * This method makes calls that may leave.
   586  */
   502  */
   587 #ifdef RD_JAVA_USIF_APP_REG
       
   588 void RegisterApplicationL(
   503 void RegisterApplicationL(
   589     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr,
   504     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr,
   590     jint aComponentId, jint aAppUid,
   505     jint aComponentId, jint aAppUid,
   591     jstring aAppName, jstring aAppFilename, jstring aGroupName,
   506     jstring aAppName, jstring aAppFilename, jstring aGroupName,
   592     jstring aIconFilename, jint aNumberOfIcons,
   507     jstring aIconFilename, jint aNumberOfIcons,
   650 
   565 
   651     // Add localized application names (captions).
   566     // Add localized application names (captions).
   652     RPointerArray<HBufC> captionsArray;
   567     RPointerArray<HBufC> captionsArray;
   653     CleanupResetAndDestroyPushL(captionsArray);
   568     CleanupResetAndDestroyPushL(captionsArray);
   654     TInt langCount = aEnv->GetArrayLength(aLanguages);
   569     TInt langCount = aEnv->GetArrayLength(aLanguages);
   655     TInt captionCount = aEnv->GetArrayLength(aAppNames);
   570     jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL);
   656     if (langCount == captionCount)
   571     for (TInt i = 0; i < langCount; i++)
   657     {
   572     {
   658         jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL);
   573         TLanguage tmpLanguage = (TLanguage)languages[i];
   659         for (TInt i = 0; i < langCount; i++)
   574         HBufC *tmpCaption =
   660         {
   575             CreateHBufCFromJavaStringLC(
   661             TLanguage tmpLanguage = (TLanguage)languages[i];
   576                 aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
   662             HBufC *tmpCaption =
   577         captionsArray.AppendL(tmpCaption);
   663                 CreateHBufCFromJavaStringLC(
   578         CleanupStack::Pop(tmpCaption);
   664                     aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
   579         //LOG1(EJavaInstaller, EInfo,
   665             captionsArray.AppendL(tmpCaption);
   580         //     "RegisterApplicationL: language %d", tmpLanguage);
   666             CleanupStack::Pop(tmpCaption);
   581         //LOG_TDESC_L(EJavaInstaller, EInfo,
   667             //LOG1(EJavaInstaller, EInfo,
   582         //            "RegisterApplicationL: caption %S", tmpCaption->Des());
   668             //     "RegisterApplicationL: language %d", tmpLanguage);
   583         CCaptionAndIconInfo *tmpCaptionAndIconInfo =
   669             //LOG_TDESC_L(EJavaInstaller, EInfo,
   584             CCaptionAndIconInfo::NewLC(
   670             //            "RegisterApplicationL: caption %s", tmpCaption->Des());
   585                 /*aCaption=*/ *tmpCaption,
   671             CCaptionAndIconInfo *tmpCaptionAndIconInfo =
   586                 /*aIconFileName=*/ KNullDesC,
   672                 CCaptionAndIconInfo::NewLC(
   587                 /*aNumOfAppIcons=*/ 0);
   673                     /*aCaption=*/ *tmpCaption,
   588         CLocalizableAppInfo *tmpLocAppInfo =
   674                     /*aIconFileName=*/ KNullDesC,
   589             CLocalizableAppInfo::NewLC(
   675                     /*aNumOfAppIcons=*/ 0);
   590                 /*aShortCaption=*/ KNullDesC,
   676             CLocalizableAppInfo *tmpLocAppInfo =
   591                 /*aApplicationLanguage=*/ tmpLanguage,
   677                 CLocalizableAppInfo::NewLC(
   592                 /*aGroupName=*/ KNullDesC,
   678                     /*aShortCaption=*/ KNullDesC,
   593                 /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo,
   679                     /*aApplicationLanguage=*/ tmpLanguage,
   594                 /*aViewDataList=*/ viewDataList);
   680                     /*aGroupName=*/ KNullDesC,
   595         localizableAppInfoList.AppendL(tmpLocAppInfo);
   681                     /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo,
   596         CleanupStack::Pop(tmpLocAppInfo);
   682                     /*aViewDataList=*/ viewDataList);
   597         CleanupStack::Pop(tmpCaptionAndIconInfo);
   683             localizableAppInfoList.AppendL(tmpLocAppInfo);
   598     }
   684             CleanupStack::Pop(tmpLocAppInfo);
   599     aEnv->ReleaseIntArrayElements(aLanguages, languages, 0);
   685             CleanupStack::Pop(tmpCaptionAndIconInfo);
       
   686         }
       
   687         aEnv->ReleaseIntArrayElements(aLanguages, languages, 0);
       
   688     }
       
   689     else
       
   690     {
       
   691         WLOG2(EJavaInstaller,
       
   692               "RegisterApplicationL: localisation not made because language " \
       
   693               "count does not match to caption count (%d != %d)",
       
   694               langCount, captionCount);
       
   695     }
       
   696 
   600 
   697     // Create application registration data objects.
   601     // Create application registration data objects.
   698     TApplicationCharacteristics appCharacteristics;
   602     TApplicationCharacteristics appCharacteristics;
   699     appCharacteristics.iAttributes = TApaAppCapability::ENonNative;
   603     appCharacteristics.iAttributes = TApaAppCapability::ENonNative;
   700     appCharacteristics.iEmbeddability = TApplicationCharacteristics::ENotEmbeddable;
   604     appCharacteristics.iEmbeddability = TApplicationCharacteristics::ENotEmbeddable;
   726     CleanupStack::PopAndDestroy(groupName);
   630     CleanupStack::PopAndDestroy(groupName);
   727     CleanupStack::PopAndDestroy(appFilename);
   631     CleanupStack::PopAndDestroy(appFilename);
   728     CleanupStack::PopAndDestroy(caption);
   632     CleanupStack::PopAndDestroy(caption);
   729     __UHEAP_MARKEND;
   633     __UHEAP_MARKEND;
   730 }
   634 }
   731 #else
       
   732 void RegisterApplicationL(
       
   733     JNIEnv *, RSoftwareComponentRegistry *, jint, jint, jstring,
       
   734     jstring, jstring, jstring, jint, jintArray, jobjectArray)
       
   735 {
       
   736 }
       
   737 #endif // RD_JAVA_USIF_APP_REG
       
   738 
   635 
   739 /*
   636 /*
   740  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   637  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   741  * Method:    _registerApplication
   638  * Method:    _registerApplication
   742  * 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
   762  */
   659  */
   763 void RegisterLocalizedComponentNameL(
   660 void RegisterLocalizedComponentNameL(
   764     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId,
   661     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId,
   765     jstring aName, jstring aVendor, jint aLanguage)
   662     jstring aName, jstring aVendor, jint aLanguage)
   766 {
   663 {
   767     if (NULL != aName)
   664     HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
   768     {
   665     aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage);
   769         HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
   666     CleanupStack::PopAndDestroy(name);
   770         aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage);
   667 
   771         CleanupStack::PopAndDestroy(name);
   668     HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
   772     }
   669     aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage);
   773 
   670     CleanupStack::PopAndDestroy(vendor);
   774     if (NULL != aVendor)
       
   775     {
       
   776         HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
       
   777         aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage);
       
   778         CleanupStack::PopAndDestroy(vendor);
       
   779     }
       
   780 }
   671 }
   781 
   672 
   782 /*
   673 /*
   783  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   674  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   784  * Method:    _registerLocalizedComponentName
   675  * Method:    _registerLocalizedComponentName
   879 /*
   770 /*
   880  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   771  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   881  * Method:    _getComponentIdForApp
   772  * Method:    _getComponentIdForApp
   882  * Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I
   773  * Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I
   883  */
   774  */
   884 #ifdef RD_JAVA_USIF_APP_REG
       
   885 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
   775 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
   886 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId)
   776 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId)
   887 {
   777 {
   888     TInt err = KErrNone;
   778     TInt err = KErrNone;
   889     __UHEAP_MARK;
   779     __UHEAP_MARK;
   899         jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V");
   789         jmethodID methodSetId = aEnv->GetMethodID(clazz, "setId", "(I)V");
   900         aEnv->CallVoidMethod(aComponentId, methodSetId, componentId);
   790         aEnv->CallVoidMethod(aComponentId, methodSetId, componentId);
   901     }
   791     }
   902     return err;
   792     return err;
   903 }
   793 }
   904 #else
       
   905 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
       
   906 (JNIEnv *, jclass, jint, jint, jobject)
       
   907 {
       
   908     return KErrNone;
       
   909 }
       
   910 #endif // RD_JAVA_USIF_APP_REG
       
   911 
   794 
   912 /**
   795 /**
   913  * See JNI method __1getuid.
   796  * See JNI method __1getuid.
   914  * This method makes calls that may leave.
   797  * This method makes calls that may leave.
   915  */
   798  */
   918     // Create a new tmporary instance of RSoftwareComponentRegistry.
   801     // Create a new tmporary instance of RSoftwareComponentRegistry.
   919     RSoftwareComponentRegistry *pScr = CreateScrL();
   802     RSoftwareComponentRegistry *pScr = CreateScrL();
   920     CleanupClosePushL(*pScr);
   803     CleanupClosePushL(*pScr);
   921     TInt uid = 0;
   804     TInt uid = 0;
   922     CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid());
   805     CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid());
   923     if (NULL != property)
   806     uid = ((CIntPropertyEntry*)property)->IntValue();
   924     {
   807     delete property;
   925         if (property->PropertyType() == CPropertyEntry::EIntProperty)
       
   926         {
       
   927             uid = ((CIntPropertyEntry*)property)->IntValue();
       
   928         }
       
   929         else
       
   930         {
       
   931             ELOG2(EJavaInstaller,
       
   932                   "GetUidL: Incorrect property type %d for cid %d",
       
   933                   property->PropertyType(), aCid);
       
   934         }
       
   935         delete property;
       
   936     }
       
   937     // Close and delete the temporary RSoftwareComponentRegistry.
   808     // Close and delete the temporary RSoftwareComponentRegistry.
   938     CleanupStack::PopAndDestroy(pScr);
   809     CleanupStack::PopAndDestroy(pScr);
   939     delete pScr; // For some reason PopAndDestroy does not delete this.
   810     delete pScr; // For some reason PopAndDestroy does not delete this.
   940     return uid;
   811     return uid;
   941 }
   812 }
   968 void LogComponentL(JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jstring aGlobalId, TLanguage aLanguage)
   839 void LogComponentL(JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jstring aGlobalId, TLanguage aLanguage)
   969 {
   840 {
   970     HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
   841     HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
   971     CComponentEntry *componentEntry =
   842     CComponentEntry *componentEntry =
   972         aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage);
   843         aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage);
   973     if (NULL == componentEntry)
       
   974     {
       
   975         //LOG_TDESC_L(EJavaInstaller, EInfo,
       
   976         //            "Component not found for GlobalId %s", globalId->Des());
       
   977         CleanupStack::PopAndDestroy(globalId);
       
   978         return;
       
   979     }
       
   980     CleanupStack::PopAndDestroy(globalId);
   844     CleanupStack::PopAndDestroy(globalId);
   981 
   845 
   982     // Log component entry.
   846     // Log component entry.
   983     TComponentId componentId = componentEntry->ComponentId();
   847     TComponentId componentId = componentEntry->ComponentId();
   984     LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %s", componentEntry->GlobalId());
   848     LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %S", componentEntry->GlobalId());
   985     LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId);
   849     LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId);
   986     LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %s", componentEntry->SoftwareType());
   850     LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %S", componentEntry->SoftwareType());
   987     LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %s", componentEntry->Name());
   851     LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %S", componentEntry->Name());
   988     LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %s", componentEntry->Vendor());
   852     LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %S", componentEntry->Vendor());
   989     LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %s", componentEntry->Version());
   853     LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %S", componentEntry->Version());
   990     LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize());
   854     LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize());
   991     LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState());
   855     LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState());
   992     LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected());
   856     LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected());
   993     LOG1(EJavaInstaller, EInfo, "IsHidden: %d", componentEntry->IsHidden());
   857     LOG1(EJavaInstaller, EInfo, "IsHidden: %d", componentEntry->IsHidden());
   994     LOG1(EJavaInstaller, EInfo, "IsKnownRevoked: %d", componentEntry->IsKnownRevoked());
   858     LOG1(EJavaInstaller, EInfo, "IsKnownRevoked: %d", componentEntry->IsKnownRevoked());
  1012     {
   876     {
  1013         CPropertyEntry *propertyEntry = properties[i];
   877         CPropertyEntry *propertyEntry = properties[i];
  1014         switch (propertyEntry->PropertyType())
   878         switch (propertyEntry->PropertyType())
  1015         {
   879         {
  1016         case CPropertyEntry::EBinaryProperty:
   880         case CPropertyEntry::EBinaryProperty:
  1017             LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %s",
   881             LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %S",
  1018                         propertyEntry->PropertyName());
   882                         propertyEntry->PropertyName());
  1019             break;
   883             break;
  1020         case CPropertyEntry::EIntProperty:
   884         case CPropertyEntry::EIntProperty:
  1021             LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %s",
   885             LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %S",
  1022                         propertyEntry->PropertyName());
   886                         propertyEntry->PropertyName());
  1023             LOG2(EJavaInstaller, EInfo, "  = 0x%x (%d)",
   887             LOG2(EJavaInstaller, EInfo, "  = 0x%x (%d)",
  1024                  ((CIntPropertyEntry*)propertyEntry)->IntValue(),
   888                  ((CIntPropertyEntry*)propertyEntry)->IntValue(),
  1025                  ((CIntPropertyEntry*)propertyEntry)->IntValue());
   889                  ((CIntPropertyEntry*)propertyEntry)->IntValue());
  1026             break;
   890             break;
  1027         case CPropertyEntry::ELocalizedProperty:
   891         case CPropertyEntry::ELocalizedProperty:
  1028             LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %s",
   892             LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %S",
  1029                         propertyEntry->PropertyName());
   893                         propertyEntry->PropertyName());
  1030             LOG_TDESC_L(EJavaInstaller, EInfo, " = %s",
   894             LOG_TDESC_L(EJavaInstaller, EInfo, " = %S",
  1031                         ((CLocalizablePropertyEntry*)propertyEntry)->StrValue());
   895                         ((CLocalizablePropertyEntry*)propertyEntry)->StrValue());
  1032             break;
   896             break;
  1033         }
   897         }
  1034     }
   898     }
  1035     CleanupStack::PopAndDestroy(&properties);
   899     CleanupStack::PopAndDestroy(&properties);
  1036 
   900 
  1037 #ifdef RD_JAVA_USIF_APP_REG
       
  1038     // Log uids of applications associated to component.
   901     // Log uids of applications associated to component.
  1039     RArray<TUid> appUids;
   902     RArray<TUid> appUids;
  1040     CleanupClosePushL(appUids);
   903     CleanupClosePushL(appUids);
  1041     aScr->GetAppUidsForComponentL(componentId, appUids);
   904     aScr->GetAppUidsForComponentL(componentId, appUids);
  1042     if (appUids.Count() == 0)
   905     LOG1(EJavaInstaller, EInfo, "Number of AppUids found: %d", appUids.Count());
  1043     {
       
  1044         LOG(EJavaInstaller, EInfo, "No component appUids found from SCR");
       
  1045     }
       
  1046     for (TInt i = 0; i < appUids.Count(); i++)
   906     for (TInt i = 0; i < appUids.Count(); i++)
  1047     {
   907     {
  1048         LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)",
   908         LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)",
  1049              appUids[i].iUid, appUids[i].iUid);
   909              appUids[i].iUid, appUids[i].iUid);
  1050     }
   910     }
  1051     CleanupStack::PopAndDestroy(&appUids);
   911     CleanupStack::PopAndDestroy(&appUids);
  1052 #endif // RD_JAVA_USIF_APP_REG
       
  1053 }
   912 }
  1054 
   913 
  1055 /**
   914 /**
  1056  * See JNI method __1logComponent.
   915  * See JNI method __1logComponent.
  1057  * This method makes calls that may leave.
   916  * This method makes calls that may leave.
  1083  * Signature: (ILjava/lang/String;)I
   942  * Signature: (ILjava/lang/String;)I
  1084  */
   943  */
  1085 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1logComponent
   944 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1logComponent
  1086 (JNIEnv *aEnv, jclass, jint aSessionHandle, jstring aGlobalId)
   945 (JNIEnv *aEnv, jclass, jint aSessionHandle, jstring aGlobalId)
  1087 {
   946 {
  1088     __UHEAP_MARK;
   947     //__UHEAP_MARK;
  1089     RSoftwareComponentRegistry *pScr =
   948     RSoftwareComponentRegistry *pScr =
  1090         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
   949         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
  1091     TRAPD(err, LogComponentL(aEnv, pScr, aGlobalId));
   950     TRAPD(err, LogComponentL(aEnv, pScr, aGlobalId));
  1092     __UHEAP_MARKEND;
   951     //__UHEAP_MARKEND;
  1093     return err;
   952     return err;
  1094 }
   953 }
  1095 
   954 
  1096 /*
   955 /*
  1097  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
   956  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
  1099  * Signature: ()I
   958  * Signature: ()I
  1100  */
   959  */
  1101 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
  1102 (JNIEnv *, jclass)
   961 (JNIEnv *, jclass)
  1103 {
   962 {
  1104 #ifdef RD_JAVA_USIF_APP_REG
       
  1105     return 1;
   963     return 1;
  1106 #else
   964 }
  1107     return 0;
   965 
  1108 #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;
  1109 }
  1008 }
  1110 
  1009 
  1111 #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1010 #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1112 
  1011 
  1113 /*
  1012 /*
  1132     return KErrNone;
  1031     return KErrNone;
  1133 }
  1032 }
  1134 
  1033 
  1135 /*
  1034 /*
  1136  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
  1035  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
  1137  * Method:    _registerJavaSoftwareType
       
  1138  * Signature: (Z)I
       
  1139  */
       
  1140 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerJavaSoftwareType
       
  1141 (JNIEnv *, jclass, jboolean)
       
  1142 {
       
  1143     return KErrNone;
       
  1144 }
       
  1145 
       
  1146 /*
       
  1147  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
       
  1148  * Method:    _startSession
  1036  * Method:    _startSession
  1149  * Signature: ()I
  1037  * Signature: ()I
  1150  */
  1038  */
  1151 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1startSession
  1039 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1startSession
  1152 (JNIEnv *, jclass, jboolean)
  1040 (JNIEnv *, jclass, jboolean)
  1190  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
  1078  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
  1191  * Method:    _registerComponent
  1079  * Method:    _registerComponent
  1192  * 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
  1193  */
  1081  */
  1194 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
  1195 (JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, jstring,
  1083 (JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring,
  1196  jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, jstring,
  1084  jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint,
  1197  jstring, jstring, jobject)
  1085  jstring, jstring, jstring, jstring, jobject)
  1198 {
  1086 {
  1199     return KErrNone;
  1087     return KErrNone;
  1200 }
  1088 }
  1201 
  1089 
  1202 /*
  1090 /*
  1296 (JNIEnv *, jclass)
  1184 (JNIEnv *, jclass)
  1297 {
  1185 {
  1298     return 0;
  1186     return 0;
  1299 }
  1187 }
  1300 
  1188 
       
  1189 /*
       
  1190  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
       
  1191  * Method:    _getErrorCategory
       
  1192  * Signature: (I)I
       
  1193  */
       
  1194 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory
       
  1195 (JNIEnv *, jclass, jint)
       
  1196 {
       
  1197     return 0;
       
  1198 }
       
  1199 
  1301 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1200 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK