javamanager/javacaptain/extensionplugins/preinstallerstarter/src.s60/preinstallerstarter.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 60 6c158198356e
--- a/javamanager/javacaptain/extensionplugins/preinstallerstarter/src.s60/preinstallerstarter.cpp	Wed Sep 15 12:05:25 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/preinstallerstarter/src.s60/preinstallerstarter.cpp	Wed Oct 13 14:23:59 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 - 2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,9 +19,7 @@
 
 
 #include <e32base.h>
-#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 #include <apgcli.h> // for RApaLsSession
-#endif
 #include <hal_data.h>
 #include <hal.h>
 #include <sysutil.h>
@@ -33,7 +31,6 @@
 #include "coreinterface.h"
 #include "booteventprovidermessages.h"
 #include "mmceventprovidermessages.h"
-#include "preinstallerstartermessages.h"
 
 #include "preinstallerstarter.h"
 
@@ -55,19 +52,19 @@
 using java::fileutils::DriveListenerInterface;
 
 /**
- * Initialize member varaibles in constructor
+ * Empty contructor
  */
-PreinstallerStarter::PreinstallerStarter() :
-    CActive(EPriorityStandard), mCore(0), mPreinstaller(0)
+PreinstallerStarter::PreinstallerStarter() : mCore(0)
 {
+    JELOG2(EJavaCaptain);
 }
 
 /**
- * Destructor
+ * Empty destructor
  */
 PreinstallerStarter::~PreinstallerStarter()
 {
-    DoCancel();
+    JELOG2(EJavaCaptain);
 }
 
 /**
@@ -75,8 +72,8 @@
  */
 void PreinstallerStarter::startPlugin(CoreInterface* core)
 {
+    JELOG2(EJavaCaptain);
     mCore = core;
-    CActiveScheduler::Add(this);
 }
 
 /**
@@ -84,6 +81,7 @@
  */
 void PreinstallerStarter::stopPlugin()
 {
+    JELOG2(EJavaCaptain);
     mCore = 0;
 }
 
@@ -92,6 +90,7 @@
  */
 EventConsumerInterface* PreinstallerStarter::getEventConsumer()
 {
+    JELOG2(EJavaCaptain);
     return this;
 }
 
@@ -107,6 +106,7 @@
 void PreinstallerStarter::event(const std::string& eventProvider,
                                 java::comms::CommsMessage& aMsg)
 {
+    JELOG2(EJavaCaptain);
     if (eventProvider == BOOT_EVENT_PROVIDER)
     {
         int bootType = NORMAL_BOOT_C;
@@ -133,9 +133,7 @@
         case FIRST_DEVICE_BOOT_C:
         case NORMAL_BOOT_C:
         {
-#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
             registerMidletApplicationTypeHandler();
-#endif
 
             // Start preinstaller normally (without 'iad' option).
             startPreinstaller(EFalse);
@@ -185,6 +183,8 @@
  */
 void PreinstallerStarter::startPreinstaller(TBool aIadBoot)
 {
+    JELOG2(EJavaCaptain);
+
     // Check that the device has enough free memory (800kB) to start preinstaller process
     // and (if needed) also java installer
     TInt freeMemory = 0;
@@ -276,21 +276,17 @@
         }
 
         // start preinstaller
-        mPreinstaller = new RProcess();
+        RProcess preinstaller;
         TBuf<64> preinstallerProcess;  // Actual len of the process name is 9
         len = strlen(java::runtime::JAVA_PROCESS);
         TPtr8 ptr8Process((TUint8 *)java::runtime::JAVA_PROCESS, len, len);
         preinstallerProcess.Copy(ptr8Process);
-        TInt err = mPreinstaller->Create(preinstallerProcess, commandLine);
+        TInt err = preinstaller.Create(preinstallerProcess, commandLine);
         if (KErrNone == err)
         {
-            // Process has been created.
-
-            // This active object will be activated when preinstaller process exits
-            mPreinstaller->Logon(iStatus);
-
-            // Allow the process to run
-            mPreinstaller->Resume();
+            // process has been created, allow it to run
+            preinstaller.Resume();
+            preinstaller.Close();
             if (aIadBoot)
             {
                 LOG(
@@ -302,14 +298,9 @@
             {
                 LOG(EJavaCaptain, EInfo, "PreinstallerStarter: started preinstaller");
             }
-
-            SetActive();
         }
         else
         {
-            delete mPreinstaller;
-            mPreinstaller = 0;
-
             ELOG1(
                 EJavaCaptain,
                 "PreinstallerStarter: starting preinstaller failed, err %d",
@@ -322,7 +313,6 @@
  * Register 'javalauncher.exe' as the midlet application type handler
  * in AppArc. If necessary unregister old handler first.
  */
-#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 void PreinstallerStarter::registerMidletApplicationTypeHandler()
 {
     _LIT(KMidpAppArcPlugin, "javalauncher.exe");
@@ -384,37 +374,6 @@
               err);
     }
 }
-#endif
-
-void PreinstallerStarter::RunL()
-{
-    LOG(EJavaCaptain, EInfo, "PreinstallerStarter::RunL started");
-
-    // Send event to AutoStarter plugin, done only once
-    CommsMessage eventMsg;
-    setPreinstallerExitedMessageParams(eventMsg, iStatus.Int());
-    mCore->getEventDispatcher()->event(PREINSTALLER_EVENT_PROVIDER, eventMsg);
-
-    // process handle is no longer needed
-    mPreinstaller->Close();
-    delete mPreinstaller;
-    mPreinstaller = 0;
-}
-
-
-void PreinstallerStarter::DoCancel()
-{
-    if (mPreinstaller)
-    {
-        mPreinstaller->LogonCancel(iStatus);
-        // Because exit notification request has been canceled,
-        // there is no reason to keep the process handle open.
-        mPreinstaller->Close();
-        delete mPreinstaller;
-        mPreinstaller = 0;
-    }
-}
-
 
 } // namespace captain
 } // namespace java