javamanager/preinstaller/src.s60/silentmidletinstall.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
--- a/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Wed Sep 15 12:05:25 2010 +0300
+++ b/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Wed Oct 13 14:23:59 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  OMJ Symbian preinstaller process
+* Description:  OMJ S60 preinstaller process
 *
 */
 
@@ -26,8 +26,6 @@
 
 #include "silentmidletinstall.h"
 #include "javacommonutils.h"
-#include "javauid.h"
-#include "javauids.h"
 #include "logger.h"
 #include "javaprocessconstants.h"
 #include "javasymbianoslayer.h"
@@ -53,7 +51,6 @@
 _LIT(KMidletName, "MIDlet-Name");
 _LIT(KMidletVendor, "MIDlet-Vendor");
 _LIT(KMidletVersion, "MIDlet-Version");
-_LIT(KMidletUid, "Nokia-MIDlet-UID-1");
 
 _LIT(KJadExtension, "*.jad");
 
@@ -99,9 +96,9 @@
  */
 void CSilentMIDletInstall::ConstructL()
 {
+    JELOG2(EJavaPreinstaller);
     iMIDletName = HBufC::NewL(KMaxBufferSize);
     iMIDletVendor = HBufC::NewL(KMaxBufferSize);
-    iMIDletUid = HBufC::NewL(KMaxBufferSize);
     iPreinstallServer = new(ELeave) PreinstallCommsServer();
 
     iNumberOfAppsToInstall = 0;
@@ -114,6 +111,7 @@
  */
 CSilentMIDletInstall::~CSilentMIDletInstall()
 {
+    JELOG2(EJavaPreinstaller);
     iJadFiles.ResetAndDestroy();
     iJadFiles.Close();
 
@@ -126,9 +124,6 @@
     delete iMIDletVendor;
     iMIDletVendor = NULL;
 
-    delete iMIDletUid;
-    iMIDletUid = NULL;
-
     delete iPreinstallServer;
     iPreinstallServer = NULL;
 }
@@ -138,6 +133,7 @@
  */
 void CSilentMIDletInstall::Start()
 {
+    JELOG2(EJavaPreinstaller);
     iState = EFindOutDeviceDrives;
 
     // Check if an explicit roll-back of a previous installation is needed
@@ -192,6 +188,8 @@
  */
 void CSilentMIDletInstall::CompleteRequest()
 {
+    JELOG2(EJavaPreinstaller);
+
     TRequestStatus *status = &iStatus;
     User::RequestComplete(status, KErrNone);
     if (!IsActive())
@@ -244,6 +242,8 @@
  */
 void CSilentMIDletInstall::RunL()
 {
+    JELOG2(EJavaPreinstaller);
+
     switch (iState)
     {
     case EFindOutDeviceDrives:
@@ -450,7 +450,7 @@
         LOG1WSTR(EJavaPreinstaller, EInfo,
                  "CSilentMIDletInstall::GetDirEntriesL Adding file %s",
                  (wchar_t *)(pathPtr.PtrZ()));
-        aVector.AppendL(path);
+        aVector.Append(path);
         CleanupStack::Pop(path);
     }
 
@@ -581,12 +581,13 @@
 /**
  * Parse MIDlet-Name, MIDlet-Vendor and MIDlet-Version parameters from JAD file.
  * Parameters are used to determine whether to pre-install MIDlet or not.
- * Parse also optional Nokia-MIDlet-UID-1 in case it is needed.
  *
  * @param ETrue if parsing succeeds otherwise EFalse.
  */
 TBool CSilentMIDletInstall::ParseJadL(const TDesC& aJadFileName)
 {
+    JELOG2(EJavaPreinstaller);
+
     HBufC *jadContent = NULL;
     // Trap leave thrown if reading jad content fails
     TRAPD(err, jadContent = GetJadContentL(aJadFileName));
@@ -647,23 +648,6 @@
          "CSilentMIDletInstall::ParseJadL MIDlet-Version is %d.%d.%d",
          iMIDletVersion.iMajor, iMIDletVersion.iMinor, iMIDletVersion.iBuild);
 
-    HBufC *midletUid = ParseAttribute(jadContent, KMidletUid);
-    if (NULL == midletUid)
-    {
-        // Ok, all MIDlets do not predefine Symbian Uid
-        iMIDletUid->Des().Zero();
-    }
-    else
-    {
-        // store midlet Uid to member variable and log it
-        TPtr uidPtr(iMIDletUid->Des());
-        uidPtr.Copy(*midletUid);
-        LOG1WSTR(EJavaPreinstaller, EInfo,
-            "CSilentMIDletInstall::ParseJadL Nokia-MIDlet-UID-1 %s",
-            (wchar_t *)(uidPtr.PtrZ()));
-        delete midletUid;
-    }
-
     CleanupStack::PopAndDestroy(jadContent);
     return ETrue;
 }
@@ -744,17 +728,10 @@
     // Do not preinstall application if it is found from this table
     // and the version number of the application is the same or less
     // than the version number in the table.
-    // If the application has been removed by javaupgradeupp or it has
-    // not yet been installed, the application is not in the table at all.
-    // Do not preinstall the application if there is a native application
-    // with the same Uid as the predefined Uid of the first Java
-    // application in the application suite.
 
-    TBool            apaSessionConnected(EFalse);
-    RApaLsSession    apaSession;
     JavaStorageEntry attribute;
     JavaStorageApplicationEntry_t findPattern;
-    JavaStorageApplicationList_t  foundEntries;
+    JavaStorageApplicationList_t foundEntries;
 
     for (TInt i = 0; i < iJadFiles.Count(); i++)
     {
@@ -802,8 +779,8 @@
                 {
                     // This application must not be preinstalled
                     LOG1WSTR(EJavaPreinstaller, EInfo,
-                        "CheckWhichAppsShouldBeInstalledL: User has removed application %s "
-                        "It must not be preinstalled again.", desToWstring(namePtr));
+                             "CheckWhichAppsShouldBeInstalledL: User has removed application %s "
+                             "It must not be preinstalled again.", desToWstring(namePtr));
                 }
                 else
                 {
@@ -841,34 +818,9 @@
             else
             {
                 skipInstall = EFalse;
-
                 LOG(EJavaPreinstaller, EInfo,
                     "CheckWhichAppsShouldBeInstalledL: Application has not "
                     "been installed previously");
-
-                // Check whether there is a native application installed
-                // with the same Uid as the predefined Uid of the first
-                // Java application in the suite.
-
-                // The string value of attribute Nokia-MIDlet-UID-1 from
-                // Jad file is in iMIDletUid if it was defined.
-                TInt err = KErrNone;
-                if (iMIDletUid->Length() > 0)
-                {
-                    if (!apaSessionConnected)
-                    {
-                        err = apaSession.Connect();
-                        apaSessionConnected = ETrue;
-                    }
-
-                    // If the presence of a possible native app cannot be
-                    // determined, let Java Installer try to install
-                    // the Java application
-                    if (KErrNone == err)
-                    {
-                        skipInstall = IsNativeAppPresent(apaSession);
-                    }
-                }
             }
 
             foundEntries.clear();
@@ -879,8 +831,8 @@
             skipInstall = ETrue;
             TPtr16 ptrJadName = iJadFiles[i]->Des();
             ELOG1WSTR(EJavaPreinstaller,
-                "CheckWhichAppsShouldBeInstalledL: Parsing JAD %s failed",
-                desToWstring(ptrJadName));
+                      "CheckWhichAppsShouldBeInstalledL: Parsing JAD %s failed",
+                      desToWstring(ptrJadName));
         }
 
         if (skipInstall)
@@ -894,11 +846,6 @@
         }
     }
 
-    if (apaSessionConnected)
-    {
-        apaSession.Close();
-    }
-
     js->close();
 }
 
@@ -1219,53 +1166,3 @@
 
     return midletVersion;
 } // DesToAppVersion
-
-
-/**
- * Parses the Uid in iMIDletUid and returns ETrue if there is a native
- * application with the same Uid installed into the device.
- * Returns EFalse in case of any error.
- *
- * @param[in] aApaSession open AppArc session
- * @return EFalse if no native application with Uid in iMIDletUid
- */
-TBool CSilentMIDletInstall::IsNativeAppPresent(const RApaLsSession& aApaSession)
-{
-    std::wstring uidValue((wchar_t *)(iMIDletUid->Ptr()), iMIDletUid->Length());
-    TUid appUid;
-    Uid javaUid(uidValue);
-    TInt err = uidToTUid(javaUid, appUid);
-
-    if (KErrNone != err)
-    {
-        WLOG1(EJavaPreinstaller,
-            "CSilentMIDletInstall::IsNativeAppPresent: Cannot convert %S to TUid",
-            uidValue.c_str());
-        return EFalse;
-    }
-
-    TUid appTypeUid;
-    err = aApaSession.GetAppType(appTypeUid, appUid);
-    if (KErrNone != err)
-    {
-        if (KErrNotFound == err)
-        {
-            // No such application in device
-            return EFalse;
-        }
-
-        // Cannot check presence from AppArc
-        ELOG1(EJavaPreinstaller,
-            "CSilentMIDletInstall::IsNativeAppPresent: RApaLsSession GetAppType error %d", err);
-        return EFalse;
-    }
-
-    if (appTypeUid.iUid != KMidletApplicationTypeUid)
-    {
-        // The application is present and it is not a MIDlet
-        return ETrue;
-    }
-
-    return EFalse;
-} // IsNativeAppPresent
-