v2.2.3_1
authorhgs
Tue, 06 Jul 2010 20:36:19 +0300
changeset 49 35baca0e7a2e
parent 35 85266cc22c7f
child 50 023eef975703
v2.2.3_1
build/loc/resources_qt.jar
build/makefile.javaversion
build/omj.pri
build/sis/java_2_0.pkg
build/sis/java_3_1.pkg
build/symbian_uids.pri
inc/java.txt
javacommons/comms/tsrc/Makefile
javacommons/comms/tsrc/javaapi/Makefile
javacommons/comms/tsrc/javaapi/build/build.xml
javacommons/comms/tsrc/javaapi/build/javacaptain_ext_ondemand_101.pro
javacommons/comms/tsrc/javaapi/subsystem.mk
javacommons/comms/tsrc/subsystem.mk
javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/build/testapnsettings.mmp
javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/AllTests.h
javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/testapnsettings.cpp
javacommons/fileutils/src/fileutilities.cpp
javacommons/fileutils/src/nativefileiohandler.cpp
javacommons/gcfprotocols/http/build/javahttp.pro
javacommons/gcfprotocols/http/inc.s60/javauseragent.h
javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java
javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp
javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp
javacommons/gcfprotocols/http/src.s60/javauseragent.cpp
javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp
javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp
javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp
javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/ssl/SecureConnectionImpl.java
javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def
javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def
javacommons/gcfprotocols/socket/socket/build/exports.inf
javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h
javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java
javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp
javacommons/javaenv/tsrc/build/alltests.mmp
javacommons/security/build/build.xml
javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java
javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationException.java
javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModule.java
javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java
javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettingsImpl.java
javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java
javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java
javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPermissionTexts.java
javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPromptMessage.java
javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.mmp
javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/build/MIDP2SecurityPolicyV2Dll.mmp
javacommons/security/src/midpauthenticationmoduleimpl.cpp
javacommons/utils/build/bwins/javautilsu.def
javacommons/utils/build/eabi/javautilsu.def
javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh
javacommons/utils/inc/javacommonutils.h
javacommons/utils/javasrc/com/nokia/mj/impl/rt/support/ApplicationUtils.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/Id.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/LocalizedTextProvider.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java
javacommons/utils/src.s60/formatternative.cpp
javacommons/utils/src/javacommonutils.cpp
javacommons/utils/src/logger.cpp
javaextensions/datagram/datagram/build/javadatagram.pro
javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/datagram/UDPDatagramConnectionImpl.java
javaextensions/datagram/datagram/src/datagramconnectionjni.cpp
javaextensions/datagram/datagram/src/nativedatagramconnection.cpp
javaextensions/location/position/src/cpositioner.cpp
javaextensions/wma/mms/pushplugin/build/eabi/javammsscpluginu.def
javaextensions/wma/mms/pushplugin/src.s60/s60mmsserverconnection.cpp
javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java
javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp
javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp
javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp
javamanager/javabackup/midp2backup/src.s60/mediaidupdater.cpp
javamanager/javabackup/midp2backup/src.s60/mediaidupdater.h
javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp
javamanager/javabackup/midp2backup_usif/build/bld.inf
javamanager/javabackup/midp2backup_usif/build/bwins/backupu.def
javamanager/javabackup/midp2backup_usif/build/eabi/backupu.def
javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp
javamanager/javabackup/midp2backup_usif/data/10282474.rss
javamanager/javabackup/midp2backup_usif/src.s60/apparcbackuputil.cpp
javamanager/javabackup/midp2backup_usif/src.s60/apparcbackuputil.h
javamanager/javabackup/midp2backup_usif/src.s60/javaapparcutil.h
javamanager/javabackup/midp2backup_usif/src.s60/javaapparcutil.inl
javamanager/javabackup/midp2backup_usif/src.s60/javascrbackuputil.cpp
javamanager/javabackup/midp2backup_usif/src.s60/javascrbackuputil.h
javamanager/javabackup/midp2backup_usif/src.s60/javastoragebackuputil.cpp
javamanager/javabackup/midp2backup_usif/src.s60/javastoragebackuputil.h
javamanager/javabackup/midp2backup_usif/src.s60/javaversionbackuputil.cpp
javamanager/javabackup/midp2backup_usif/src.s60/javaversionbackuputil.h
javamanager/javabackup/midp2backup_usif/src.s60/midp2backupdataids.h
javamanager/javabackup/midp2backup_usif/src.s60/midp2backupplugin.cpp
javamanager/javabackup/midp2backup_usif/src.s60/midp2backupplugin.h
javamanager/javabackup/midp2backup_usif/src.s60/midp2backuppluginusif.cpp
javamanager/javabackup/midp2backup_usif/src.s60/midp2backuppluginusif.h
javamanager/javabackup/midp2backup_usif/src.s60/proxy.cpp
javamanager/javacaptain/extensionplugins/autostarter/build/javacaptain_ext_autostarter.pro
javamanager/javacaptain/extensionplugins/autostarter/inc/autostarter.h
javamanager/javacaptain/extensionplugins/autostarter/src.s60/autostarter.cpp
javamanager/javacaptain/extensionplugins/boot/src/booteventprovider.cpp
javamanager/javacaptain/extensionplugins/config/src/configextensionplugin.cpp
javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/build/javasmartcardcertsunittests.mmp
javamanager/javacaptain/extensionplugins/scrupdater/src/lookup.cpp
javamanager/javacaptain/extensionplugins/scrupdater/src/scrupdater.cpp
javamanager/javacaptain/extensionplugins/scrupdater/src/scrupdater.h
javamanager/javacaptain/extensionplugins/settingslistener/build/bwins/javacaptain_ext_settingslisteneru.def
javamanager/javacaptain/extensionplugins/settingslistener/build/eabi/javacaptain_ext_settingslisteneru.def
javamanager/javacaptain/extensionplugins/settingslistener/build/exports.inf
javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro
javamanager/javacaptain/extensionplugins/settingslistener/inc/settingschangeeventsprovidermessages.h
javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerextension.h
javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerinterface.h
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.cpp
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.h
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/lookup.cpp
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.cpp
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.h
javamanager/javacaptain/extensionplugins/settingslistener/src/settingslistenerextension.cpp
javamanager/javacaptain/inc/settingschangeeventsprovidermessages.h
javamanager/javacaptain/javacaptain.pro
javamanager/javacaptain/src/rtc.cpp
javamanager/javacaptain/subsystem.mk
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/StartProgressNotifications.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/UninstallBall.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandler.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/Args.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java
javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp
javamanager/javainstaller/installerui/build/build.xml
javamanager/javainstaller/installerui/data/java_3_trusted.png
javamanager/javainstaller/installerui/data/java_3_untrusted.png
javamanager/javainstaller/installerui/data/javaapplicationinstaller.css
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/CertificateDetailsView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorDetailsView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallConfirmationView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/RuntimeConfirmationView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java
javamanager/javainstaller/javasifplugin/inc/javasifplugin.h
javamanager/javainstaller/javasifplugin/inc/resultsserver.h
javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp
javamanager/javainstaller/javasifplugin/src/proxy.cpp
javamanager/javainstaller/javasifplugin/src/resultsserver.cpp
javamanager/javainstaller/javasifplugin/tsrc/build/testsifapi.pro
javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp
javamanager/javamanager.pro
javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp
javamanager/javaregistry/legacy/tsrc/build/testlegacyregistry.mmp
javamanager/javaregistry/legacy/tsrc/src/AllTests.cpp
javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistry.cpp
javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistryentry.cpp
javamanager/javaregistry/legacy/tsrc/src/testlegacyregistry.cpp
javamanager/javaregistry/legacy/tsrc/src/testmidletentry.cpp
javamanager/javaregistry/legacy/tsrc/src/testsuiteentry.cpp
javamanager/javaregistry/tsrc/build/alltests.mmp
javamanager/javaregistry/tsrc/src/AllTests.cpp
javamanager/javaregistry/tsrc/src/AllTests.h
javamanager/javaregistry/tsrc/src/testregistry.cpp
javamanager/javaregistry/tsrc/src/testregistryapplicationentry.cpp
javamanager/javaregistry/tsrc/src/testregistryentry.cpp
javamanager/javaregistry/tsrc/src/testregistrypackageentry.cpp
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp
javamanager/javaupgradeapp/src.s60/javaupgradeapp.cpp
javamanager/preinstaller/build/javapreinstaller.pro
javamanager/preinstaller/src.s60/silentmidletinstall.cpp
javamanager/preinstaller/src.s60/silentmidletinstall.h
javamanager/subsystem.mk
javaruntimes/installer/starterdll/src/main.cpp
javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java
javatools/javacontrolpanel/controlpanel/src/javacaptain.cpp
javauis/amms_qt/build/javaamms.pro
javauis/amms_qt/mmacontrol/inc.emc/cammspancontrol.h
javauis/amms_qt/mmacontrol/inc.mmf/cammspancontrol.h
javauis/amms_qt/mmacontrol/inc/cammscustomcommandutility.h
javauis/amms_qt/mmacontrol/src.emc/cammsprioritycontrol.cpp
javauis/amms_qt/mmacontrol/src.mmf/cammsprioritycontrol.cpp
javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Shell.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eventcallback.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/graphicscontextimpl.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/imageloaderimpl.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/surfaceimpl.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java
javauis/lcdui_qt/build.linux.j2se/build.xml
javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java
javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java
javauis/lcdui_qt/src/javax/microedition/lcdui/SystemPropertyUtil.java
javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreammetadatacontrol.h
javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudioplayer.h
javauis/mmapi_qt/baseline/inc/cmmaaudiometadatacontrol.h
javauis/mmapi_qt/baseline/inc/cmmaframepositioningcontrol.h
javauis/mmapi_qt/baseline/inc/cmmamidimetadatacontrol.h
javauis/mmapi_qt/baseline/inc/mmmadisplay.h
javauis/mmapi_qt/baseline/inc/tmmaparametervalidator.h
javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationObserver.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/ESWTinitializeListener.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/FramePositioningControl.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/StopTimeControl.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoItem.java
javauis/mmapi_qt/baseline/javasrc/org/eclipse/swt/widgets/ProxyControl.java
javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp
javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp
javauis/mmapi_qt/baseline/src/cmmaplayer.cpp
javauis/mmapi_qt/baseline/src/cmmasnapshot.cpp
javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp
javauis/mmapi_qt/baseline/src/tmmaparametervalidator.cpp
javauis/mmapi_qt/baseline/src/videocontrol.cpp
javauis/mmapi_qt/build/javamobilemedia.pro
javauis/mmapi_qt/directcontent/src/cmmadcdisplay.cpp
javauis/mmapi_qt/src_drmv2/inc/cmmadrmmetadatacontrol.h
javauis/tsrc/fute/lcdui/Midp_Alert_01/src/AlertTests.java
rom/java_2_2.iby
rom/java_3_1.iby
Binary file build/loc/resources_qt.jar has changed
--- a/build/makefile.javaversion	Fri Jun 11 13:33:44 2010 +0300
+++ b/build/makefile.javaversion	Tue Jul 06 20:36:19 2010 +0300
@@ -1,2 +1,2 @@
 # Set Java version (must be dot separated, without spaces)
-JAVA_VERSION = 2.2.1
+JAVA_VERSION = 2.2.3
--- a/build/omj.pri	Fri Jun 11 13:33:44 2010 +0300
+++ b/build/omj.pri	Tue Jul 06 20:36:19 2010 +0300
@@ -73,7 +73,7 @@
       include(symbian_uids.pri)
 
       DEFINES += __SYMBIAN32__
-      DEFINES += J9EPOC32 RD_JAVA_OMJ_FSERVER
+      DEFINES += J9EPOC32
 
       LIBS += -llibpthread
 
--- a/build/sis/java_2_0.pkg	Fri Jun 11 13:33:44 2010 +0300
+++ b/build/sis/java_2_0.pkg	Tue Jul 06 20:36:19 2010 +0300
@@ -43,6 +43,17 @@
   ; Popup error on Non-S60 v 5.0 platforms. Do not allow continuing.
   "incompatible_platform.txt"-"", FILETEXT, FORCEABORT
 ENDIF
+
+; Check OpenC versions
+; 0x10282872 = Standard C++ library
+; 0x10281F34 = Open C LIBSSL
+; 0x20009a80 = Symbian OS PIPS
+IF( version(0x10282872, <, 1, 5, 0) ) OR
+  ( version(0x10281F34, <, 1, 5, 0) ) OR
+  ( version(0x20009a80, <, 1, 5, 0) )
+    "incompatible_openc.txt"-"", FT, TA
+ENDIF
+
 #endif // RD_JAVA_S60_RELEASE_5_0_IAD
 
 
@@ -95,6 +106,7 @@
 
 "\epoc32\release\armv5\urel\javacaptain.exe"-"c:\sys\bin\javacaptain.exe"
 "\epoc32\release\armv5\urel\javalauncher.exe"-"c:\sys\bin\javalauncher.exe"
+"\epoc32\release\armv5\urel\javaupgradeapp.exe"-"c:\sys\bin\javaupgradeapp.exe"
 
 
 
@@ -493,6 +505,7 @@
 "\epoc32\release\armv5\urel\javacaptain_ext_storageserverplugin.dll"    -"c:\sys\bin\javacaptain_ext_storageserverplugin.dll"
 "\epoc32\release\armv5\urel\javacaptain_ext_btdeviceclassmanager.dll"   -"c:\sys\bin\javacaptain_ext_btdeviceclassmanager.dll"
 "\epoc32\release\armv5\urel\javacaptain_ext_autostarter.dll"            -"c:\sys\bin\javacaptain_ext_autostarter.dll"
+"\epoc32\release\armv5\urel\javacaptain_ext_settingslistener.dll"       -"c:\sys\bin\javacaptain_ext_settingslistener.dll"
 ; PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C = 7
 "\epoc32\release\armv5\urel\javacaptain_ext_ondemand_7.dll"             -"c:\sys\bin\javacaptain_ext_ondemand_7.dll"
 #ifdef RD_JAVA_MIDPRMS_DB
--- a/build/sis/java_3_1.pkg	Fri Jun 11 13:33:44 2010 +0300
+++ b/build/sis/java_3_1.pkg	Tue Jul 06 20:36:19 2010 +0300
@@ -50,6 +50,7 @@
 "\epoc32\release\armv5\urel\javabackup.exe"-"c:\sys\bin\javabackup.exe"
 "\epoc32\release\armv5\urel\javacaptain.exe"-"c:\sys\bin\javacaptain.exe"
 "\epoc32\release\armv5\urel\javalauncher.exe"-"c:\sys\bin\javalauncher.exe"
+"\epoc32\release\armv5\urel\javaupgradeapp.exe"-"c:\sys\bin\javaupgradeapp.exe"
 
 ;Odc file lists
 "\epoc32\data\z\resource\java\midpodclist"-"c:\resource\java\midpodclist"
@@ -180,7 +181,6 @@
 "\epoc32\release\armv5\urel\javapushcontroller.dll"-"c:\sys\bin\javapushcontroller.dll"
 "\epoc32\release\armv5\urel\javaregistryclient.dll"-"c:\sys\bin\javaregistryclient.dll"
 "\epoc32\release\armv5\urel\javaruntimestarterutils.dll"-"c:\sys\bin\javaruntimestarterutils.dll"
-"\epoc32\release\armv5\urel\javasidchecker.dll"-"c:\sys\bin\javasidchecker.dll"
 "\epoc32\release\armv5\urel\javasizehelperclient.dll"-"c:\sys\bin\javasizehelperclient.dll"
 "\epoc32\release\armv5\urel\javasizehelperserver.dll"-"c:\sys\bin\javasizehelperserver.dll"
 "\epoc32\release\armv5\urel\javasocketscplugin.dll"-"c:\sys\bin\javasocketscplugin.dll"
@@ -204,6 +204,7 @@
 "\epoc32\release\armv5\urel\javacaptain_ext_storageserverplugin.dll"    -"c:\sys\bin\javacaptain_ext_storageserverplugin.dll"
 "\epoc32\release\armv5\urel\javacaptain_ext_btdeviceclassmanager.dll"   -"c:\sys\bin\javacaptain_ext_btdeviceclassmanager.dll"
 "\epoc32\release\armv5\urel\javacaptain_ext_autostarter.dll"            -"c:\sys\bin\javacaptain_ext_autostarter.dll"
+"\epoc32\release\armv5\urel\javacaptain_ext_settingslistener.dll"       -"c:\sys\bin\javacaptain_ext_settingslistener.dll"
 ; PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C = 7
 "\epoc32\release\armv5\urel\javacaptain_ext_ondemand_7.dll"             -"c:\sys\bin\javacaptain_ext_ondemand_7.dll"
 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
@@ -221,9 +222,9 @@
 "\epoc32\data\z\private\10003a3f\apps\javainstaller_reg.rsc"-"c:\private\10003a3f\import\apps\javainstaller_reg.rsc"
 "\epoc32\data\z\resource\apps\javainstaller_loc.rsc"-"c:\resource\apps\javainstaller_loc.rsc"
 "\epoc32\data\z\resource\apps\javainstaller_icon.mif"-"c:\resource\apps\javainstaller_icon.mif"
-"\epoc32\data\z\resource\java\java_trusted.png"-"c:\resource\java\java_trusted.png"
-"\epoc32\data\z\resource\java\java_untrusted.png"-"c:\resource\java\java_untrusted.png"
-"\epoc32\data\z\resource\plugins\javasidchecker.rsc"   -"c:\resource\plugins\javasidchecker.rsc"
+"\epoc32\data\z\resource\java\java_3_trusted.png"-"c:\resource\java\java_3_trusted.png"
+"\epoc32\data\z\resource\java\java_3_untrusted.png"-"c:\resource\java\java_3_untrusted.png"
+"\epoc32\data\z\resource\java\javaapplicationinstaller.css"-"c:\resource\java\javaapplicationinstaller.css"
 "\epoc32\data\z\resource\plugins\javaunicertstoreplugin.rsc" -"c:\resource\plugins\javaunicertstoreplugin.rsc"
 "\epoc32\data\z\resource\plugins\midp2backupplugin.rsc"-"c:\resource\plugins\midp2backupplugin.rsc"
 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
@@ -317,14 +318,16 @@
 ;"\epoc32\release\armv5\urel\javacoreui.dll"-"c:\sys\bin\javacoreui.dll"
 ;"\epoc32\data\z\resource\apps\javastartscreen.mif"-"c:\resource\apps\javastartscreen.mif"
 
-;"\epoc32\release\armv5\urel\javaamms.dll"-"c:\sys\bin\javaamms.dll"
-;"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javaamms.odc"-"c:\resource\java\jvm\lib\jrt\javaamms.odc"
+"\epoc32\release\armv5\urel\javaamms.dll"-"c:\sys\bin\javaamms.dll"
+"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javaamms.odc"-"c:\resource\java\jvm\lib\jrt\javaamms.odc"
 
 ;"\epoc32\release\armv5\urel\javalegacyutils.dll"-"c:\sys\bin\javalegacyutils.dll"
 ;"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javalegacyutils.odc"-"c:\resource\java\jvm\lib\jrt\javalegacyutils.odc"
 
-;"\epoc32\release\armv5\urel\javamobilemedia.dll"-"c:\sys\bin\javamobilemedia.dll"
-;"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javamobilemedia.odc"-"c:\resource\java\jvm\lib\jrt\javamobilemedia.odc"
+"\epoc32\release\armv5\urel\javamobilemedia.dll"-"c:\sys\bin\javamobilemedia.dll"
+"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javamobilemedia.odc"-"c:\resource\java\jvm\lib\jrt\javamobilemedia.odc"
+"\epoc32\release\armv5\urel\z\system\sounds\digital\CamcorderJavaCapture.wav"-"c:\System\Sounds\Digital\CamcorderJavaCapture.wav"
+"\epoc32\release\armv5\urel\z\system\sounds\digital\CamcorderJavaStart.wav"-"c:\System\Sounds\Digital\CamcorderJavaStart.wav"
 
 ;"\epoc32\release\armv5\urel\javam2g.dll"-"c:\sys\bin\javam2g.dll"
 ;"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javam2g.odc"-"c:\resource\java\jvm\lib\jrt\javam2g.odc"
@@ -339,9 +342,11 @@
 ;"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javasoftnotification.odc"-"c:\resource\java\jvm\lib\jrt\javasoftnotification.odc"
 
 "\epoc32\release\armv5\urel\eswtqt.dll"-"c:\sys\bin\eswtqt.dll"
+"\epoc32\release\armv5\urel\eswtqtwebkit.dll"-"c:\sys\bin\eswtqtwebkit.dll"
 "\epoc32\release\armv5\urel\openlcdui.dll"-"c:\sys\bin\openlcdui.dll"
 "\epoc32\release\armv5\urel\javanokiaui.dll"-"c:\sys\bin\javanokiaui.dll"
 "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\eswtqt.odc"-"c:\resource\java\jvm\lib\jrt\eswtqt.odc"
+"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\eswtqtwebkit.odc"-"c:\resource\java\jvm\lib\jrt\eswtqtwebkit.odc"
 "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\openlcdui.odc"-"c:\resource\java\jvm\lib\jrt\openlcdui.odc"
 "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javanokiaui.odc"-"c:\resource\java\jvm\lib\jrt\javanokiaui.odc"
 
--- a/build/symbian_uids.pri	Fri Jun 11 13:33:44 2010 +0300
+++ b/build/symbian_uids.pri	Tue Jul 06 20:36:19 2010 +0300
@@ -116,6 +116,7 @@
 
 contains(TARGET, openlcdui): TARGET.UID3 = 0x2002DCE2
 contains(TARGET, tckrunner): TARGET.UID3 = 0x2002DCE3
+contains(TARGET, javacaptain_ext_settingslistener): TARGET.UID3 = 0x200315D8
 contains(TARGET, javacaptain_ext_scrupdater): TARGET.UID3 = 0x2002DD10
 contains(TARGET, javacaptain_ext_ondemand_2): TARGET.UID3 = 0x2002DD01
 contains(TARGET, javanokiaui): TARGET.UID3 = 0x2002E697
--- a/inc/java.txt	Fri Jun 11 13:33:44 2010 +0300
+++ b/inc/java.txt	Tue Jul 06 20:36:19 2010 +0300
@@ -1,1 +1,1 @@
-2.2.1
+2.2.3
--- a/javacommons/comms/tsrc/Makefile	Fri Jun 11 13:33:44 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#
-# Copyright (c) 2009 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"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-include $(JAVA_SRC_ROOT)/build/Makefile.defs
-
-COMPONENTS = build
-SUBSYSTEMS = javaapi
-
-include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
--- a/javacommons/comms/tsrc/javaapi/Makefile	Fri Jun 11 13:33:44 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2009 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"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
-include $(JAVA_SRC_ROOT)/build/Makefile.defs
-
-COMPONENTS = \
-    build
-
-include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
-
-run: default_target
--- a/javacommons/comms/tsrc/javaapi/build/build.xml	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/comms/tsrc/javaapi/build/build.xml	Tue Jul 06 20:36:19 2010 +0300
@@ -27,7 +27,6 @@
   <property name="src.dir" location="../javasrc"/>
   <property name="build.dir" location="../build"/>
   <property name="classes.dir" location="${build.dir}/javabuild"/>
-  <property name="dist" location="${java.bin.root}/jsr/classes"/>
 
   <property name="commstest.jar.filename" value="commstest.jar"/>
   <property name="junit.jar.dir" location="${java.src.root}/tools/junit"/>
@@ -41,9 +40,9 @@
 
   <target name="clean" depends="init.properties">
     <delete dir="${classes.dir}"/>
-    <delete file="${dist}/${commstest.jar.filename}"/>
-    <delete file="${dist}/${junit.jar.filename}"/>
-    <delete file="${dist}/${junit.omj.jar.filename}"/>
+    <delete file="${vm.extension.directory}/${commstest.jar.filename}"/>
+    <delete file="${vm.extension.directory}/${junit.jar.filename}"/>
+    <delete file="${vm.extension.directory}/${junit.omj.jar.filename}"/>
   </target>
 
   <target name="compile.ut" depends="init.properties">
@@ -64,7 +63,7 @@
   </target>
 
   <target name="deploy.ut" depends="compile.ut">
-      <mkdir dir="${dist}"/>
+      <mkdir dir="${vm.extension.directory}"/>
       <jar destfile="${vm.extension.directory}/${commstest.jar.filename}" basedir="${classes.dir}"/>
       <copy file="${junit.jar.dir}/${junit.jar.filename}"
             tofile="${vm.extension.directory}/${junit.jar.filename}"/>
--- a/javacommons/comms/tsrc/javaapi/build/javacaptain_ext_ondemand_101.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/comms/tsrc/javaapi/build/javacaptain_ext_ondemand_101.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -25,5 +25,6 @@
 
 symbian {
     SOURCES += ../src.s60/lookup.cpp
+    TARGET.UID3 = 0xE0000055
 }
 include(../../../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/comms/tsrc/javaapi/subsystem.mk	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2009 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"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+include $(JAVA_SRC_ROOT)/build/Makefile.defs
+
+COMPONENTS = \
+    build
+
+include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
+
+run: default_target
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/comms/tsrc/subsystem.mk	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2009 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"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include $(JAVA_SRC_ROOT)/build/Makefile.defs
+
+COMPONENTS = build
+SUBSYSTEMS = javaapi
+
+include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
--- a/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/build/testapnsettings.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/build/testapnsettings.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -22,7 +22,9 @@
 #include <../../../../../../inc/java_stdcpp_support_for_exe.hrh>
 #include <platform_paths.hrh>
 
-USERINCLUDE /epoc32/include/cpputest
+USERINCLUDE /epoc32/include/cpputest    // Due to TestHarness.h
+
+USERINCLUDE ../../inc.s60
 USERINCLUDE ../../../../../../inc
 
 // Using main() as entry point
--- a/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/AllTests.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/AllTests.h	Tue Jul 06 20:36:19 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include "Utest.h"
+#include "cpputest/Utest.h"
 
 //Include this in the test main to execute these tests
 IMPORT_TEST_GROUP(TestAPNSettings);
--- a/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/testapnsettings.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/testapnsettings.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -16,11 +16,9 @@
 */
 
 #include <memory>
-
-#include "TestHarness.h"
+#include <cpputest/TestHarness.h>
 
-#include "../../inc.s60/mapnsettings.h"
-
+#include "mapnsettings.h"
 #include "javastorage.h"
 #include "javastorageexception.h"
 #include "javastoragenames.h"
--- a/javacommons/fileutils/src/fileutilities.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/fileutils/src/fileutilities.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,6 +18,7 @@
 
 #include <dirent.h>
 #include <errno.h>
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stack>
--- a/javacommons/fileutils/src/nativefileiohandler.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/fileutils/src/nativefileiohandler.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,6 +18,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <locale.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <string>
 
--- a/javacommons/gcfprotocols/http/build/javahttp.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/build/javahttp.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -13,16 +13,31 @@
 #
 # Description: 
 #
+include(../../../../inc/build_defines.pri)
 
 TARGET=javahttp
 TEMPLATE=lib
 CONFIG += omj java stl
-CONFIG -= qt
 
 symbian {
-    LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository -lwebutils
+
+    LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository
+
+    contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+        QT += webkit
+        QT -= gui
+        LIBS += -lQtWebKit -lplatformEnv -ljavaenvinfo
+    }
+    else {
+        LIBS += -lwebutils
+    }
+
+    contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
+        LIBS += -lcommdb
+    }
+    contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2_ONWARDS) {
+        LIBS += -lextendedconnpref -lnetmeta
+    }
 }
 
-
-
 include(../../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/gcfprotocols/http/inc.s60/javauseragent.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef GETUSERAGENT_H
+#define GETUSERAGENT_H
+
+#include <e32base.h>
+
+class JavaUserAgent
+{
+
+public:
+    static HBufC*  GetUserAgentL();
+
+};
+
+#endif /* GETUSERAGENT_H */
--- a/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java	Tue Jul 06 20:36:19 2010 +0300
@@ -194,7 +194,7 @@
         iTransactionBlock = new BlockingOperation();
         iNativeDataReadyForRead = new BlockingOperation();
         iNativeDataReadyForRead.setResult(BlockingOperation.BLOCKED);
-        iFinalizer = registerForFinalization();        
+        iFinalizer = registerForFinalization();
         Logger.LOG(Logger.ESOCKET, Logger.EInfo, "- HttpConnectionNative new ");
 
         ApplicationInfo appInfo = ApplicationInfo.getInstance();
@@ -253,9 +253,9 @@
         {
             close();
         }
-        catch(Exception e)
+        catch (Exception e)
         {
- 	
+
         }
         Logger.LOG(Logger.ESOCKET, Logger.EInfo,
                    "--HttpConnectionNative::doFinalize ");
--- a/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -22,7 +22,13 @@
 #include <httpstringconstants.h>
 #include <e32svr.h>
 #include "logger.h"
+
+#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+#include <extendedconnpref.h> // extended connection preference
+#include <connpref.h>
+#else
 #include <commdbconnpref.h>
+#endif
 
 #include <http/cecomfilter.h>
 #include <httpfilterproxyinterface.h>
@@ -146,10 +152,19 @@
                 *apnerr = ret;
                 return;
             }
-
+#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+            TConnPrefList prefList;
+            TExtendedConnPref prefs;
+            prefs.SetSnapId(aAPNId);
+            prefList.AppendL(&prefs);
+            ret = iConnection.Start(prefList);
+#else
             TCommSnapPref connPref;
             connPref.SetSnap(aAPNId);
             ret = iConnection.Start(connPref);
+#endif
+
+            LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce in snap case");
             LOG1(ESOCKET,EInfo,"iConnection.Start returned %d",ret);
             if (ret < 0)
             {
@@ -172,6 +187,7 @@
     {
         if (aType == 3) // IAP Id
         {
+            LOG(ESOCKET,EInfo,"+HttpSessionClient:: in iap case");
             if (aAPNId != -1)
             {
                 // Creates connection with selected IAP ID
@@ -189,18 +205,35 @@
                     *apnerr = ret;
                     return;
                 }
+
+#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+                // Create connection preferences
+                TConnPrefList prefList;
+                TExtendedConnPref prefs;
+                prefs.SetIapId(aAPNId);
+                prefList.AppendL(&prefs);
+                ret = iConnection.Start(prefList);
+                LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce in iap case");
+#else
                 TCommDbConnPref pref;
                 pref.SetIapId(aAPNId);
                 pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
                 ret = iConnection.Start(pref);
+#endif
+
                 if (ret < 0)
                 {
                     *apnerr = ret;
                     //return;
                 }
                 RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
+                //connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
+                //                          HttpFilterCommonStringsExt::EAccessPointID, HttpFilterCommonStringsExt::GetTable()), aAPNId);
                 connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
-                                          HttpFilterCommonStringsExt::EAccessPointID, HttpFilterCommonStringsExt::GetTable()), aAPNId);
+                                          HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
+                TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
+                connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
+                                          HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
             } // end of if ( aAPNId != -1)
         } // end of if(aType == 4)
         else
@@ -210,7 +243,7 @@
 
     } // end of else
 
-    LOG1(ESOCKET,EInfo,"apnerr = ",*apnerr);
+    LOG1(ESOCKET,EInfo,"apnerr = %d",*apnerr);
 
     // This is special case when that IAP/SNAP is not found
     // Override the http stack's feaute of using device default
@@ -219,9 +252,19 @@
         LOG(ESOCKET,EInfo,"ECommDbDialogPrefPrompt set for the http session");
         int ret = iSocketServ.Connect();
         ret = iConnection.Open(iSocketServ);
+#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+        TConnPrefList prefList;
+        TExtendedConnPref prefs;
+        prefs.SetConnSelectionDialog(ETrue);
+        prefList.AppendL(&prefs);
+        ret = iConnection.Start(prefList);
+        LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce - error case ");
+#else
         TCommDbConnPref pref;
         pref.SetDialogPreference(ECommDbDialogPrefPrompt);
         ret = iConnection.Start(pref);
+        LOG(ESOCKET,EInfo,"+HttpSessionClient:: using commdb con pref - error case ");
+#endif
 
         RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
         connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
@@ -296,10 +339,25 @@
     iConnection.Close();
     TInt ret = iConnection.Open(iSocketServ);
 
+    //TCommSnapPref connPref;
+#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+    TConnPrefList prefList;
+    TExtendedConnPref prefs;
+
+    if (iApnId!=-1)
+        prefs.SetSnapId(iApnId);
+    TRAPD(err,prefList.AppendL(&prefs));
+    if (err == KErrNone)
+        ret = iConnection.Start(prefList);
+    else
+        ret = iConnection.Start();
+#else
     TCommSnapPref connPref;
     if (iApnId!=-1)
         connPref.SetSnap(iApnId);
     ret = iConnection.Start(connPref);
+
+#endif
     LOG(ESOCKET,EInfo,"+HttpSessionClient::RestartConnection + ");
 
 }
--- a/javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -626,14 +626,14 @@
             iStatus = CHttpTransactionClient::ERequestNextBodayData;
             break;
         }
-        
+
         case THTTPEvent::EReceiveTimeOut:
         {
-        	  ELOG(ESOCKET,"MHFRunL EReceiveTimeOut");
-        	  NotifyErrorL(KErrTimedOut);  // send timeout error to java
-        	  break;
-        	
-        }        
+            ELOG(ESOCKET,"MHFRunL EReceiveTimeOut");
+            NotifyErrorL(KErrTimedOut);  // send timeout error to java
+            break;
+
+        }
         /*
         * -j2me expects the http stack to be able to post body data with no content type
         *   the native stack default validation filter does not allow this.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/gcfprotocols/http/src.s60/javauseragent.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "javauseragent.h"
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <QWebpage.h>
+#include "javaenvinfo.h"
+#else
+#include <cuseragent.h>
+#endif
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+class Page: public QWebPage
+{
+public:
+    QString  userAgentForUrl ( const QUrl & url ) const;
+
+};
+
+QString  Page::userAgentForUrl ( const QUrl & url ) const
+{
+    return url.toString();
+}
+#endif
+
+HBufC*  JavaUserAgent::GetUserAgentL()
+{
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+    /*QApplication app();
+    QUrl uri;
+    Page page;
+    QString webUserAgent = page.userAgentForUrl(uri);
+    HBufC* agent = HBufC::NewMaxLC(webUserAgent.length());
+    agent->Des().Copy(webUserAgent.utf16());
+    agent->Des().Append(*(Java::JavaEnvInfo::GetUserAgentHeaderL()));
+    return agent;
+    */
+    _LIT(KString,"null");
+    HBufC* agent = HBufC::NewLC(5);
+    *agent = KString;
+    CleanupStack::Pop(agent);
+    return agent;
+
+#else
+
+    CUserAgent* userAgent = CUserAgent::NewL();
+    CleanupStack::PushL(userAgent);
+
+    HBufC8* agent8 = userAgent->UserAgentL();
+    CleanupStack::PushL(agent8);
+
+    HBufC* agent = HBufC::NewMaxLC(agent8->Length());
+    agent->Des().Copy(*agent8);
+
+    CleanupStack::Pop(agent);
+    CleanupStack::PopAndDestroy(agent8);
+    CleanupStack::PopAndDestroy(userAgent);
+   	return agent;
+#endif
+}
--- a/javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -49,10 +49,10 @@
 TInt NativeHttpSession::NewL(JNIEnv& aJni, jobject aPeer,/* TJavaEventServer aServer,*/ TInt aType, TInt aAPNId, TInt * aErr, TInt * apnerr)
 {
     NativeHttpSession* self =   new(ELeave) NativeHttpSession();
-    
+
     *aErr = self->ConstructL(aJni, aPeer  /* aServer*/, aType, aAPNId, apnerr);
     LOG1(ESOCKET,EInfo,"NativeHttpSession::NewL - aErr : %d",*aErr);
-   
+
     self->attachToVm(aJni,aPeer);
     // Pop the cleanup of the object and create a handle:
     return reinterpret_cast<TInt>(self); //selfCleanup.GetHandle();
@@ -119,17 +119,17 @@
 
 void NativeHttpSession::doSubmitCallback(TInt aStatus,jobject &aPeer)
 {
-    LOG(ESOCKET,EInfo,"+doSubmitCallback1");    
+    LOG(ESOCKET,EInfo,"+doSubmitCallback1");
     jobject localPeerObject = mJniEnv->NewLocalRef(aPeer);
-    if(localPeerObject)
+    if (localPeerObject)
     {
-    		// java side peer object may be GC'ed when this call is being made. 
-    		mJniEnv->CallVoidMethod(aPeer,iSubmitCallbackMethodID,aStatus);
+        // java side peer object may be GC'ed when this call is being made.
+        mJniEnv->CallVoidMethod(aPeer,iSubmitCallbackMethodID,aStatus);
     }
     else
     {
-    		ELOG(ESOCKET,"NativeHttpSession::doSubmitCallback: Error!! java peer object not found ");
-  	}	
+        ELOG(ESOCKET,"NativeHttpSession::doSubmitCallback: Error!! java peer object not found ");
+    }
     LOG(ESOCKET,EInfo,"-doSubmitCallback1");
 }
 
@@ -137,14 +137,14 @@
 {
     LOG(ESOCKET,EInfo,"+doReadCallback1");
     jobject localPeerObject = mJniEnv->NewLocalRef(aPeer);
-    if(localPeerObject)
+    if (localPeerObject)
     {
-    		mJniEnv->CallVoidMethod(aPeer,iReadCallbackMethodID,aStatus);
+        mJniEnv->CallVoidMethod(aPeer,iReadCallbackMethodID,aStatus);
     }
     else
     {
-    		ELOG(ESOCKET,"NativeHttpSession::doReadCallback: Error!! java peer object not found ");
-  	}    
+        ELOG(ESOCKET,"NativeHttpSession::doReadCallback: Error!! java peer object not found ");
+    }
     LOG(ESOCKET,EInfo,"-doReadCallback1");
 }
 
--- a/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -57,7 +57,7 @@
 NativeHttpTransaction::NativeHttpTransaction(HttpSessionClient& aSession, FunctionServer* aFuncServer)
         :iSessionClient(aSession) //, java::util::FunctionServer("MyhttpServer2")
 {
-  
+
     iFuncServer = aFuncServer;
 }
 
@@ -72,7 +72,7 @@
 {
     NativeHttpTransaction* self =   new(ELeave) NativeHttpTransaction(aSession,aFuncServer);
 
-    
+
     self->ConstructL(aJni, aPeer, /*aServer, */ aUri, aRequestMethod);
 
 
@@ -93,9 +93,9 @@
     int urihandle = reinterpret_cast<int>(aUri);
     int methodhandle = reinterpret_cast<int>(aRequestMethod);
     //open the transaction
-    
+
     CallMethodL(this, &NativeHttpTransaction::ExecuteCreateTransactionL,handle,urihandle , methodhandle, iFuncServer);
-    
+
 }
 
 void NativeHttpTransaction::ExecuteCreateTransactionL(int aSelfhandle, int aUrihandle, int aMethodhandle)
@@ -115,7 +115,7 @@
     RPointerArray<HBufC8> rawHeaderArray;
     CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy,&rawHeaderArray));
     iJniObject = aJni;
-    
+
 
     if (aHeaders!=NULL)
     {
@@ -173,7 +173,7 @@
 
 void NativeHttpTransaction::ExecuteSubmitL(int aSelfhandle , int aRawHeadershandle , int aPostBufhandle, int aResponseTimeout)
 {
-    
+
     NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle);
     RPointerArray<HBufC8>* aRawHeaders = reinterpret_cast<RPointerArray<HBufC8>*>(aRawHeadershandle);
     HBufC8* aPostBuf = reinterpret_cast<HBufC8*>(aPostBufhandle);
@@ -186,12 +186,12 @@
     jobjectArray objArray=NULL;
     RPointerArray<HBufC8> rawHeaders(KResponseGranularity);
     CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy,&rawHeaders));
-    
+
     int handle = reinterpret_cast<int>(this);
 
     int arrayhandle = reinterpret_cast<int>(&rawHeaders);
     CallMethodL(this, &NativeHttpTransaction::ExecuteGetResponseL,handle,arrayhandle , iFuncServer);
-    
+
     const TInt headerCount = rawHeaders.Count();
     if (headerCount>KErrNone)
     {
@@ -232,7 +232,7 @@
 */
 TInt NativeHttpTransaction::ReadBytes(TUint8* aBytes, TInt aLength)
 {
-    
+
     int handle = reinterpret_cast<int>(this);
     int uinthandle = reinterpret_cast<int>(aBytes);
 
@@ -240,7 +240,7 @@
     CallMethod(ret,this, &NativeHttpTransaction::ExecuteReadBytes,handle,uinthandle,aLength,iFuncServer);
 
     return ret;
-    
+
 }
 
 TInt NativeHttpTransaction::ExecuteReadBytes(int aSelfhandle, int aByteshandle, TInt aLength)
--- a/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -19,18 +19,13 @@
 #include <e32def.h>
 #include <centralrepository.h>
 
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <CUserAgent.h>
-#else
-#include <cuseragent.h>
-#endif
-
 #include "com_nokia_mj_impl_http_HttpConnectionNative.h"
 #include "nativehttptransaction.h"
 #include "nativehttpsession.h"
 #include "monitor.h"
 #include "logger.h"
 #include "s60commonutils.h"
+#include "javauseragent.h"
 
 using namespace java::util;
 
@@ -69,15 +64,15 @@
     NativeHttpTransaction* tran = reinterpret_cast<NativeHttpTransaction*>(aNativeHttpTransaction);
     tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer);
     try
-		{
+    {
         tran->Dispose();
-   	}
-   	catch(...)
-   	{
-   		  // function server usage may throw an exception.   		
-   		  // ignore, called when transcation is closed
-   	    ELOG(ESOCKET,"Http JNI Error, exception caught!: _closeTransaction");    	
-   	}
+    }
+    catch (...)
+    {
+        // function server usage may throw an exception.
+        // ignore, called when transcation is closed
+        ELOG(ESOCKET,"Http JNI Error, exception caught!: _closeTransaction");
+    }
     delete tran;
 }
 
@@ -88,7 +83,7 @@
     jstring aUri,
     jstring aRequestMethod)
 {
-		LOG(ESOCKET,EInfo,"http jni _createNativeTransaction()");
+    LOG(ESOCKET,EInfo,"http jni _createNativeTransaction()");
     NativeHttpSession* session = reinterpret_cast<NativeHttpSession*>(aNativeHttpSession);
     //tran->iJniPeer = aJni->NewGlobalRef(aPeer);
     try
@@ -96,13 +91,13 @@
         TRAPD(handle,   handle = session->CreateTransactionL(aJni, aPeer , aUri, aRequestMethod););
         return handle;
     }
-    catch(...)
+    catch (...)
     {
-        // function server usage may throw an exception.   	
-        ELOG(ESOCKET,"Http JNI Error, exception caught!: _createTransaction");    	
-        return -1;    	
+        // function server usage may throw an exception.
+        ELOG(ESOCKET,"Http JNI Error, exception caught!: _createTransaction");
+        return -1;
     }
-    
+
 }
 
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_http_HttpConnectionNative__1submitTransaction(
@@ -114,7 +109,7 @@
     jint aPostDataLength,
     jint aResponseTimeout)
 {
-		LOG(ESOCKET,EInfo,"http jni _submitTransaction");
+    LOG(ESOCKET,EInfo,"http jni _submitTransaction");
     NativeHttpTransaction* tran = reinterpret_cast<NativeHttpTransaction*>(aNativeHttpTransaction);
     int respTimeOut = aResponseTimeout;
     tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer);
@@ -123,11 +118,11 @@
         TRAPD(err,tran->SubmitL(aJni, &aPeer,aHeaders, aPostData, aPostDataLength, respTimeOut));
         return err;
     }
-    catch(...)
+    catch (...)
     {
-        ELOG(ESOCKET,"Http JNI Error, exception caught!: _submitTransaction");    	
-        return -1;	    	
-    }    
+        ELOG(ESOCKET,"Http JNI Error, exception caught!: _submitTransaction");
+        return -1;
+    }
 }
 
 JNIEXPORT jobjectArray JNICALL Java_com_nokia_mj_impl_http_HttpConnectionNative__1getResponse(
@@ -135,24 +130,24 @@
     jobject aPeer,
     jint aNativeHttpTransaction)
 {
-		LOG(ESOCKET,EInfo,"http jni _getResponse");
+    LOG(ESOCKET,EInfo,"http jni _getResponse");
     jobjectArray rawHeaders=NULL;
     NativeHttpTransaction* tran = reinterpret_cast<NativeHttpTransaction*>(aNativeHttpTransaction);
     tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer);
     try
     {
-		    TRAPD(err, rawHeaders =  tran->GetResponseL(aJni));
-		    if (err!=KErrNone)
-		    {
-		        rawHeaders=NULL;
-		    }
-		}
-		catch(...)
-		{
-				rawHeaders=NULL;
-				ELOG(ESOCKET,"Http JNI Error, exception caught!: _getResponse");    	
-			
-		}
+        TRAPD(err, rawHeaders =  tran->GetResponseL(aJni));
+        if (err!=KErrNone)
+        {
+            rawHeaders=NULL;
+        }
+    }
+    catch (...)
+    {
+        rawHeaders=NULL;
+        ELOG(ESOCKET,"Http JNI Error, exception caught!: _getResponse");
+
+    }
     return rawHeaders;
 }
 
@@ -164,27 +159,27 @@
     jbyteArray  aBytes,
     jint        aLength)
 {
-		LOG(ESOCKET,EInfo,"http jni _getBytes");
+    LOG(ESOCKET,EInfo,"http jni _getBytes");
     jbyte* bytes = aEnv->GetByteArrayElements(aBytes, NULL);
 
     if (bytes == NULL)
     {
         return -1;
     }
-		try
-		{
-		    NativeHttpTransaction* tran = reinterpret_cast<NativeHttpTransaction*>(aNativeHttpTransaction);
-		    tran->iJniPeer = aEnv->NewWeakGlobalRef(aPeer);
-		    TInt length = tran->ReadBytes(reinterpret_cast<TUint8*>(bytes), aLength);
-		
-		    aEnv->ReleaseByteArrayElements(aBytes, bytes, NULL);
-		    return length;
-		}
-		catch(...)
-		{
-				ELOG(ESOCKET,"Http JNI Error, exception caught!: _getBytes");    	
-				return -1;					
-		}
+    try
+    {
+        NativeHttpTransaction* tran = reinterpret_cast<NativeHttpTransaction*>(aNativeHttpTransaction);
+        tran->iJniPeer = aEnv->NewWeakGlobalRef(aPeer);
+        TInt length = tran->ReadBytes(reinterpret_cast<TUint8*>(bytes), aLength);
+
+        aEnv->ReleaseByteArrayElements(aBytes, bytes, NULL);
+        return length;
+    }
+    catch (...)
+    {
+        ELOG(ESOCKET,"Http JNI Error, exception caught!: _getBytes");
+        return -1;
+    }
 }
 
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_http_HttpConnectionNative__1available(
@@ -196,12 +191,12 @@
     tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer);
     try
     {
-    		return tran->Available();
+        return tran->Available();
     }
-    catch(...)
+    catch (...)
     {
-    		ELOG(ESOCKET,"Http JNI Error, exception caught!: _available");    	
-    		return -1;    	
+        ELOG(ESOCKET,"Http JNI Error, exception caught!: _available");
+        return -1;
     }
 }
 
@@ -220,24 +215,14 @@
 
 jstring GetUserAgentL(JNIEnv *aJni, jboolean aMidpRuntime)
 {
-
+    LOG(ESOCKET,EInfo,"GetUserAgentL() +");
     jstring header = NULL;
 
     if (aMidpRuntime == false)
     {
-        CUserAgent* userAgent = CUserAgent::NewL();
-        CleanupStack::PushL(userAgent);
-
-        HBufC8* agent8 = userAgent->UserAgentL();
-        CleanupStack::PushL(agent8);
-        HBufC* agent = HBufC::NewMaxLC(agent8->Length());
-        agent->Des().Copy(*agent8);
-        header = S60CommonUtils::NativeToJavaString(*aJni, agent->Des());
-
-        CleanupStack::PopAndDestroy(agent);
-        CleanupStack::PopAndDestroy(agent8);
-        CleanupStack::PopAndDestroy(userAgent);
-
+        HBufC* stringBufPtr  = JavaUserAgent::GetUserAgentL();
+        header = S60CommonUtils::NativeToJavaString(*aJni,stringBufPtr->Des());
+        delete stringBufPtr;
         return header;
     }
 
@@ -257,18 +242,9 @@
             {
             case KHTTPUserAgentBrowserHeader:
             {
-                CUserAgent* userAgent = CUserAgent::NewL();
-                CleanupStack::PushL(userAgent);
-
-                HBufC8* agent8 = userAgent->UserAgentL();
-                CleanupStack::PushL(agent8);
-                HBufC* agent = HBufC::NewMaxLC(agent8->Length());
-                agent->Des().Copy(*agent8);
-                header = S60CommonUtils::NativeToJavaString(*aJni, agent->Des());
-
-                CleanupStack::PopAndDestroy(agent);
-                CleanupStack::PopAndDestroy(agent8);
-                CleanupStack::PopAndDestroy(userAgent);
+                HBufC* stringBufPtr = (JavaUserAgent::GetUserAgentL());
+                header = S60CommonUtils::NativeToJavaString(*aJni, stringBufPtr->Des());
+                delete stringBufPtr;
             }
             break;
 
@@ -291,6 +267,6 @@
 
         CleanupStack::PopAndDestroy(repository);
     }
-
+    LOG(ESOCKET,EInfo,"GetUserAgentL() -");
     return header;
 }
--- a/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/ssl/SecureConnectionImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/ssl/SecureConnectionImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -35,6 +35,7 @@
 import com.nokia.mj.impl.rt.ui.ConfirmData;
 import com.nokia.mj.impl.connectionmanager.ConnectionManager;
 import com.nokia.mj.impl.connectionmanager.AccessPoint;
+import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.ResourceLoader;
 
 /**
@@ -74,7 +75,7 @@
 
     private static final String LOCALISED_STRING_ID = "qtn_ssl_prompt_";
 
-    private static final String UNTRUSTED_CERTIFICATE_WARNING = "untrusted_certificate";
+    private static final Id UNTRUSTED_CERTIFICATE_WARNING = new Id("untrusted_certificate", "N/A");
 
     /**
      * Constructs the SecureConnectionImpl.
--- a/javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 EXPORTS
-  ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *)
+	?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *)
 	?readBytes@NativeSocketConnection@java@@UAEHAAUJNIEnv_@@PAV_jbyteArray@@@Z @ 2 NONAME ; int java::NativeSocketConnection::readBytes(struct JNIEnv_ &, class _jbyteArray *)
 	?setSocketOption@NativeSocketConnection@java@@QAEHHH@Z @ 3 NONAME ; int java::NativeSocketConnection::setSocketOption(int, int)
 	?socketClose@NativeSocketConnection@java@@QAEHXZ @ 4 NONAME ; int java::NativeSocketConnection::socketClose(void)
@@ -16,5 +16,5 @@
 	?getLocalPort@NativeSocketConnection@java@@QAEHXZ @ 15 NONAME ; int java::NativeSocketConnection::getLocalPort(void)
 	?getPort@NativeSocketConnection@java@@QAEHXZ @ 16 NONAME ; int java::NativeSocketConnection::getPort(void)
 	?getSocketOption@NativeSocketConnection@java@@QAEHH@Z @ 17 NONAME ; int java::NativeSocketConnection::getSocketOption(int)
-	
+	?getLocalAddress@SocketLocalHostInfo@@SAHHPADHH@Z @ 18 NONAME ; int SocketLocalHostInfo::getLocalAddress(int, char *, int, int)
 
--- a/javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -20,4 +20,5 @@
 	_ZN4java22NativeSocketConnectionD2Ev @ 19 NONAME
 	_ZTIN4java22NativeSocketConnectionE @ 20 NONAME ; #<TI>#
 	_ZTVN4java22NativeSocketConnectionE @ 21 NONAME ; #<VT>#
+	_ZN19SocketLocalHostInfo15getLocalAddressEiPcii @ 22 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/gcfprotocols/socket/socket/build/exports.inf	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+PRJ_EXPORTS
+
+../inc/socketlocalhostinfo.h                         |../../../../../inc/socketlocalhostinfo.h
+
--- a/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h	Tue Jul 06 20:36:19 2010 +0300
@@ -19,12 +19,14 @@
 #ifndef SOCKETLOCALHOSTINFO_H
 #define SOCKETLOCALHOSTINFO_H
 
+#include "javaosheaders.h"
+
 class SocketLocalHostInfo
 {
 
 public:
 
-    static int getLocalAddress(int aSd, char *aLocalAddr, int aMidletIapId, int aApType);
+    OS_IMPORT static int getLocalAddress(int aSd, char *aLocalAddr, int aMidletIapId, int aApType);
 
 
 };
--- a/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -141,8 +141,7 @@
                     apId = -1;
                 }
                 Logger.LOG(Logger.ESOCKET, Logger.EInfo,
-                           "+SocketServerConnectionImpl:: getApplicationDefault returned,  \n"+apn.getNapId()+" type = "+apn.getType());
-                System.out.println(" type = "+apn.getType()+"  id = "+apId);
+                           "+SocketServerConnectionImpl:: getApplicationDefault returned,  \n"+apn.getNapId()+" type = "+apn.getType());                
             }
         }
         catch (Exception e)
--- a/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -24,7 +24,7 @@
 
 int GetlocalIPAdressL(char *localaddr, int aMidletIapId, int aApType);
 
-int SocketLocalHostInfo::getLocalAddress(int /* aSd */, char *aLocalAddr,
+OS_EXPORT int SocketLocalHostInfo::getLocalAddress(int /* aSd */, char *aLocalAddr,
         int aMidletIapId, int aApType)
 {
     TRAPD(err,GetlocalIPAdressL(aLocalAddr,aMidletIapId, aApType););
@@ -32,6 +32,77 @@
 
 }
 
+int getIPAddressL(const int aIapId, char *ipAddress)
+{
+    RSocketServ socketServ;
+    RSocket sock;
+    User::LeaveIfError(socketServ.Connect());
+    User::LeaveIfError(sock.Open(socketServ, KAfInet, KSockStream,
+                                 KProtocolInetTcp));
+
+    //  find the ip address of the active interface
+    TSoInetInterfaceInfo ifInfo;
+    TPckg<TSoInetInterfaceInfo> ifInfoPkg(ifInfo);
+    TSoInetIfQuery ifQuery;
+    TPckg<TSoInetIfQuery> ifQueryPkg(ifQuery);
+
+    // To find out which interfaces are using our current IAP, we must
+    // enumerate and go through all of them and make a query by name for each.
+    ILOG(ESOCKET, "Looping thru all the destinations and ap \n\n");
+    User::LeaveIfError(sock.SetOpt(KSoInetEnumInterfaces,
+                                   KSolInetIfCtrl));
+
+    while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifInfoPkg)
+            == KErrNone)
+    {
+        ifQuery.iName = ifInfo.iName;
+        TInt err = sock.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery,
+                               ifQueryPkg);
+        if ((err == KErrNone) && (ifQuery.iZone[1] == aIapId))
+        {
+            ILOG2(ESOCKET, "Network id = %d, IAP id = %d ",(TUint32)(ifQuery.iZone[15]),(TUint32)ifQuery.iZone[1]);
+
+            // IAP ID is index 1 of iZone
+            // We have found an interface using the IAP we are interested in.
+            if (ifInfo.iAddress.Address() > 0)
+            {
+                if (!ifInfo.iAddress.IsUnspecified()
+                        && !ifInfo.iAddress.IsLoopback()
+                        && !ifInfo.iAddress.IsLinkLocal())
+                {
+                    // found a IPv4 address
+                    TBuf8<20> aIP8;
+                    TBuf<20> aIP;
+                    TInetAddr aAddr;
+                    aAddr = ifInfo.iAddress;
+                    aAddr.ConvertToV4();
+                    aAddr.Output(aIP);
+                    aIP8.Copy(aIP);
+
+                    strncpy(ipAddress, (char*) aIP8.Ptr(),
+                            aIP8.Length());
+                    ipAddress[aIP8.Length()] = '\0';
+                    ILOG1(ESOCKET, "GetlocalIPAdressLLL , ip = %s",
+                          ipAddress);
+                    sock.Close();
+                    socketServ.Close();
+                    ILOG(ESOCKET, "returning from getIpAddr");
+                    return KErrNone;
+                }
+            }  // end if addr > 0
+            else if (err != KErrNone)
+            {
+                sock.Close();
+                return err; // return with error
+            }
+        }
+    }   // end while
+    sock.Close();
+    socketServ.Close();
+    return KErrNone;
+
+}
+
 /**
  *In Symbian, when a server connection is opened, it is not bound to any interface
  *so the openC calls returns "0.0.0.0" as the local address.
@@ -43,7 +114,7 @@
 int GetlocalIPAdressL(char *localaddr, int aMidletIapId, int aType)
 {
     JELOG2(ESOCKET);
-
+    int err = KErrNone;
     TUint32 activeIapId = 0;
     TConnectionInfoBuf connectionInfo;
     TUint count = 0;
@@ -103,66 +174,19 @@
                     continue; // go to the next active IAP
             }
 
-            //  find the ip address of the active interface
-
-            TSoInetInterfaceInfo ifInfo;
-            TPckg<TSoInetInterfaceInfo> ifInfoPkg(ifInfo);
-            TSoInetIfQuery ifQuery;
-            TPckg<TSoInetIfQuery> ifQueryPkg(ifQuery);
-            // To find out which interfaces are using our current IAP, we must
-            // enumerate and go through all of them and make a query by name for each.
-            ILOG(ESOCKET, "Looping thru all the destinations and ap \n\n");
-            User::LeaveIfError(sock.SetOpt(KSoInetEnumInterfaces,
-                                           KSolInetIfCtrl));
-            while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifInfoPkg)
-                    == KErrNone)
-            {
-                ifQuery.iName = ifInfo.iName;
-                TInt err = sock.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery,
-                                       ifQueryPkg);
+            // find the ip address of the active IAP
+            err = getIPAddressL(activeIapId,localaddr);
+            break;  // once we find the IP addr, return
 
-                if ((err == KErrNone) && (ifQuery.iZone[1] == activeIapId))
-                {
-                    //TUint32 t5 = (TUint32)(ifQuery.iZone[15]);                    
-                    ILOG2(ESOCKET, "Network id = %d, IAP id = %d ",(TUint32)(ifQuery.iZone[15]),(TUint32)ifQuery.iZone[1]);
-                    
-                    // IAP ID is index 1 of iZone
-                    // We have found an interface using the IAP we are interested in.
-                    if (ifInfo.iAddress.Address() > 0)
-                        if (!ifInfo.iAddress.IsUnspecified()
-                                && !ifInfo.iAddress.IsLoopback()
-                                && !ifInfo.iAddress.IsLinkLocal())
-                        {
-                            // found a IPv4 address
-                            TBuf8<20> aIP8;
-                            TBuf<20> aIP;
-                            TInetAddr aAddr;
-                            aAddr = ifInfo.iAddress;
-                            aAddr.ConvertToV4();
-                            aAddr.Output(aIP);
-                            aIP8.Copy(aIP);
-
-                            strncpy(localaddr, (char*) aIP8.Ptr(),
-                                    aIP8.Length());
-                            localaddr[aIP8.Length()] = '\0';
-                            ILOG1(ESOCKET, "GetlocalIPAdressL , ip = %s",
-                                  localaddr);
-                            sock.Close();
-                            return KErrNone;
-                        }
-                }
-                else if (err != KErrNone)
-                {
-                    sock.Close();
-                    return err; // return with error
-                }
-            } // end while
         } // end for loop
 
     } // end else active connection
-
+    ILOG(ESOCKET, "GetlocalIPAdressL , got ip ");
+    conn.Close();
     sock.Close();
-    return KErrNotFound; // return with KErrNotFound
+    socketServ.Close();
+
+    return err; // return with KErrNotFound
 
 
 }
--- a/javacommons/javaenv/tsrc/build/alltests.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/javaenv/tsrc/build/alltests.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -20,14 +20,12 @@
 CAPABILITY all -tcb -allfiles -drm
 
 #include <../../../../inc/java_stdcpp_support_for_exe.hrh>
-#include <domain/osextensions/platform_paths.hrh>
-
-//SYSTEMINCLUDE /epoc32/include 
+#include <platform_paths.hrh>
 
 USERINCLUDE ../../../inc
+USERINCLUDE ../../../../inc
 USERINCLUDE ../../../../tools/cpputest/include/cpputest
 USERINCLUDE ../../../../tools/cpputest/include/platforms/symbian
-USERINCLUDE ../../../../inc
 
 STATICLIBRARY cpputest.lib
 
--- a/javacommons/security/build/build.xml	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/build/build.xml	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 <!--
-    Copyright (c) 2008 Nokia.  All rights reserved.
+    Copyright (c) 2008-2010 Nokia.  All rights reserved.
 
     This material, including documentation and any related computer programs,
     is protected by copyright controlled by Nokia. All rights are reserved.
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java	Tue Jul 06 20:36:19 2010 +0300
@@ -17,6 +17,7 @@
 
 package com.nokia.mj.impl.security.midp.authorization;
 
+import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.Uid;
 import com.nokia.mj.impl.utils.exception.InvalidAttributeException;
 import com.nokia.mj.impl.security.midp.common.MIDPPermission;
@@ -359,7 +360,8 @@
                     ((PolicyBasedPermission)grantedPermissions.elementAt(i));
                 UserSecuritySettings settings =
                     permission.getUserSecuritySettings();
-                if (settings == null)
+                if (permission.getType() != PolicyBasedPermission.USER_TYPE 
+                    || settings == null)
                 {
                     // not a user permission -> move on to the next permission
                     Logger.log("Permission " + permission.getName() + " is not a user permission, therefore is is not returned as part of the group of blanket permissions");
@@ -456,7 +458,7 @@
             if (permissions_from_sensitive_combination_list_1
                     && permissions_from_sensitive_combination_list_2)
             {
-                String blanketPermissionsDetails = ( 
+                /*String blanketPermissionsDetails = ( 
                     ((call_control == true && multimedia == true)
                     || (call_control == true && read_user_data == true) 
                     || (net_access == true && multimedia == true)
@@ -464,7 +466,18 @@
                     || (messaging == true && multimedia == true)
                     || (messaging == true && read_user_data == true)) ? 
                     "settings_inst_query_perm_net" : 
-                    "settings_inst_query_perm_sec");
+                    "settings_inst_query_perm_sec");*/
+
+                Id blanketPermissionsDetails = ( 
+                    ((call_control == true && multimedia == true)
+                    || (call_control == true && read_user_data == true) 
+                    || (net_access == true && multimedia == true)
+                    || (net_access == true && read_user_data == true)
+                    || (messaging == true && multimedia == true)
+                    || (messaging == true && read_user_data == true)) ? 
+                    new Id("settings_inst_query_perm_net", "N/A") : 
+                    new Id("settings_inst_query_perm_sec", "N/A"));
+
                 iBlanketPermissionsDetails.put(msUidKey,
                                                UserSecuritySettingsImpl.getLocalizedString(
                                                    blanketPermissionsDetails));
@@ -586,7 +599,9 @@
                 for (int i=0; i<policyPermissions.length; i++)
                 {
                     if (policyPermissions[i].getType()
-                            == PolicyBasedPermission.ASSIGNED_TYPE)
+                            == PolicyBasedPermission.ASSIGNED_TYPE 
+                            || policyPermissions[i].getType() 
+                            == PolicyBasedPermission.USER_ASSIGNED_TYPE)
                     {
                         PolicyBasedPermissionImpl p1 = new PolicyBasedPermissionImpl(
                             policyPermissions[i]);
@@ -609,6 +624,7 @@
                                     policyPermissions[i].getName(),
                                     policyPermissions[i].getTarget(),
                                     policyPermissions[i].getActionList(),
+                                    policyPermissions[i].getType(),
                                     policyPermissions[i].getUserSecuritySettings()));
                         }
                     }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationException.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationException.java	Tue Jul 06 20:36:19 2010 +0300
@@ -37,6 +37,7 @@
     public static final int CERT_EXPIRED = 8;
     public static final int ROOT_CERT_IN_CHAIN = 9;
     public static final int UNKNOWN_EXT_KEY_USAGE = 10;
+    public static final int JAR_NOT_FOUND = 11;
 
     // the error code encapsulated in this exception
     private int errorCode;
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModule.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModule.java	Tue Jul 06 20:36:19 2010 +0300
@@ -277,7 +277,11 @@
         try
         {
             Vector allAuthCredentials = (Vector)iAuthCredentials.get(msUID);
-            String jarHash = _computeHash(appJARPath);
+            String jarHash = null;
+            try
+            {
+                jarHash = _computeHash(appJARPath);
+            }catch(AuthenticationException e) {}
             if (jarHash == null || jarHash.length() == 0)
             {
                 // could not compute hash for the given application
@@ -410,7 +414,11 @@
                 new String[] {"Unknown protection domain " + protectionDomain},
                 OtaStatusCode.INTERNAL_ERROR);
         }
-        String jarHash = _computeHash(appJARPath);
+        String jarHash = null;
+        try
+        {
+            jarHash = _computeHash(appJARPath);
+        }catch(AuthenticationException e) {}
         if (jarHash == null || jarHash.length() == 0)
         {
             // could not compute hash for the given application
@@ -825,7 +833,23 @@
                 && authStorageData.getJarHashValue().length() > 0)
         {
             Logger.log("  Doing tamper detection");
-            String computedJarHash = _computeHash(authStorageData.getJarPath());
+            String computedJarHash = null;            
+            try
+            {
+                computedJarHash = _computeHash(authStorageData.getJarPath());
+            }catch(AuthenticationException e) 
+            {
+                if (e.getErrorCode() 
+                    == AuthenticationException.JAR_NOT_FOUND)
+                {
+                    Logger.logWarning("    Jar not found while trying to compute hash");
+                    throw new RuntimeSecurityException(
+                        SecurityErrorMessage.JAR_NOT_FOUND,
+                        null, /* no params for short msg */
+                        SecurityDetailedErrorMessage.JAR_NOT_FOUND,
+                        null /* no params for detailed msg */);
+                }
+            }
             // do the tampering check: compute the hash and compare it with the stored hash
             if (computedJarHash == null || !computedJarHash.equals(
                         authStorageData.getJarHashValue()))
@@ -1120,6 +1144,7 @@
     private boolean isDriveProtected(int aMediaId)
     {
         DriveInfo[] allDrives = DriveUtilities.getAllDrives();
+        boolean driveFound = false;
         if (allDrives != null)
         {
             for (int i=0; i<allDrives.length; i++)
@@ -1134,11 +1159,11 @@
                     {
                         return false;
                     }
-                    return true;
+                    driveFound = true;
                 }
             }
         }
-        return false;
+        return driveFound;
     }
 
     private Credentials selectCredentials(String selectedJarHash, Vector allAuthCredentials, Vector validatedChainIndexes)
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java	Tue Jul 06 20:36:19 2010 +0300
@@ -327,6 +327,7 @@
             String mappingsSystemProperty)
     {
         String[] mappings = Tokenizer.split(mappingsSystemProperty, ";");
+        Vector validatedPermNames = new Vector();
         if (mappings != null)
         {
             for (int i=0; i<mappings.length; i++)
@@ -358,11 +359,13 @@
                             // one more check against the existing extensions
                             // permission mappings
                             found = find(namedPermName,
-                                         classBasedPermName,
+                                         (validatedPermNames.contains(classBasedPermName) 
+                                         ? null: classBasedPermName),
                                          extPermissionMappings);
                         }
                         if (!found)
                         {
+                            validatedPermNames.addElement(classBasedPermName);
                             extPermissionMappings.put(
                                 namedPermName,
                                 new MIDPPermission(
@@ -387,8 +390,9 @@
             Object key = e.nextElement();
             Object value = permMapping.get(key);
             if (((String)key).equalsIgnoreCase(namedPermName)
-                    || (((MIDPPermission)value)).getName()
-                    .equalsIgnoreCase(classBasedPermName))
+                    || ( classBasedPermName != null 
+                    && (((MIDPPermission)value)).getName()
+                    .equalsIgnoreCase(classBasedPermName)))
             {
                 return true;
             }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettingsImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettingsImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -18,6 +18,7 @@
 package com.nokia.mj.impl.security.midp.common;
 
 import java.util.Vector;
+import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.ResourceLoader;
 
 /**
@@ -33,25 +34,31 @@
     private int[] allowedInteractionModes;
     private boolean blanketPrompt;
     private static ResourceLoader resLoader = null;
+    private boolean active;
 
-    private static final String NET_ACCESS_ID = "setting_net_access";
-    private static final String LOW_LEVEL_NET_ACCESS_ID = "setting_low_level_net_access";
-    private static final String MESSAGING_ID = "setting_messaging";
-    private static final String RESTRICTED_MESSAGING_ID = "setting_restricted_messaging";
-    private static final String CALL_CONTROL_ID = "setting_call_control";
-    private static final String LOCAL_CONNECTIVITY_ID = "setting_local_conn";
-    private static final String MULTIMEDIA_RECORDING_ID = "setting_mm_record";
-    private static final String READ_USER_DATA_ACCESS_ID = "setting_read_data";
-    private static final String WRITE_USER_DATA_ACCESS_ID = "setting_write_data";
-    private static final String APPLICATION_AUTO_INVOCATION_ID = "setting_app_auto_invocat";
-    private static final String PHONE_CALL_ID = "setting_phone_call";
-    private static final String LOCATION_ID = "setting_location";
-    private static final String LANDMARK_ID = "setting_landmarks";
-    private static final String SMART_CARD_COMMUNICATION_ID = "setting_smartcard";
-    private static final String AUTHENTICATION_ID = "setting_auth";
-    private static final String BROADCAST_ID = "setting_broadcast";
-    private static final String NFC_WRITE_ACCESS_ID = "setting_nfc_write_access";
-    private static final String URL_START_ID = "setting_url_start";
+    private static final Id NET_ACCESS_ID = new Id("setting_net_access", "setlabel_net_access");
+    private static final Id LOW_LEVEL_NET_ACCESS_ID = new Id("setting_low_level_net_access", "setlabel_low_level_net_access");
+    private static final Id MESSAGING_ID = new Id("setting_messaging", "setlabel_messaging");
+    private static final Id RESTRICTED_MESSAGING_ID = new Id("setting_restricted_messaging", "setlabel_restricted_messaging");
+    private static final Id CALL_CONTROL_ID = new Id("setting_call_control", "setlabel_call_control");
+    private static final Id LOCAL_CONNECTIVITY_ID = new Id("setting_local_conn", "setlabel_local_conn");
+    private static final Id MULTIMEDIA_RECORDING_ID = new Id("setting_mm_record", "setlabel_mm_record");
+    private static final Id READ_USER_DATA_ACCESS_ID = new Id("setting_read_data", "setlabel_read_data");
+    private static final Id WRITE_USER_DATA_ACCESS_ID = new Id("setting_write_data", "setlabel_write_data");
+    private static final Id APPLICATION_AUTO_INVOCATION_ID = new Id("setting_app_auto_invocat", "setlabel_app_auto_invoc");
+    private static final Id PHONE_CALL_ID = new Id("setting_phone_call", "setlabel_call_control");
+    private static final Id LOCATION_ID = new Id("setting_location", "setlabel_location");
+    private static final Id LANDMARK_ID = new Id("setting_landmarks", "setlabel_landmarks");
+    private static final Id SMART_CARD_COMMUNICATION_ID = new Id("setting_smartcard", "setlabel_smartcard");
+    private static final Id AUTHENTICATION_ID = new Id("setting_auth", "setlabel_auth");
+    private static final Id BROADCAST_ID = new Id("setting_broadcast", "setlabel_broadcast");
+    private static final Id NFC_WRITE_ACCESS_ID = new Id("setting_nfc_write_access", "setlabel_nfc_write_access");
+    private static final Id URL_START_ID = new Id("setting_url_start", "setlabel_url_start");
+
+    private static final String AVKON_LOC_FILE = "javaapplicationsettings";
+    private static final String AVKON_PREFIX = "qtn_java_";
+    private static final String QT_LOC_FILE = "javaruntimeapplicationsettings";
+    private static final String QT_PREFIX = "txt_java_sett_";
 
     public UserSecuritySettingsImpl(
         String name,
@@ -65,12 +72,28 @@
         String name,
         int currentInteractionMode,
         int[] allowedInteractionModes,
-        boolean blanketPrompt)
+        boolean blanketPrompt,
+        boolean active)
     {
         this.name = name;
         setCurrentInteractionMode(currentInteractionMode);
         setAllowedInteractionModes(allowedInteractionModes);
         this.blanketPrompt = blanketPrompt;
+        this.active = active;
+    }
+
+    public UserSecuritySettingsImpl(
+        String name,
+        int currentInteractionMode,
+        int[] allowedInteractionModes,
+        boolean blanketPrompt)
+    {
+        this(name, currentInteractionMode, allowedInteractionModes, blanketPrompt, true);
+    }
+    
+    public boolean isActive()
+    {
+        return active;
     }
 
     public String getName()
@@ -89,9 +112,9 @@
     {
         if (resLoader == null)
         {
-            resLoader = ResourceLoader.getInstance("javaapplicationsettings", "qtn_java_");
+            resLoader = ResourceLoader.getInstance(AVKON_LOC_FILE, AVKON_PREFIX, QT_LOC_FILE, QT_PREFIX);
         }
-        String id = "";
+        Id id = null;
         if (NET_ACCESS_SETTINGS.equalsIgnoreCase(aSettingName))
         {
             id = NET_ACCESS_ID;
@@ -164,14 +187,18 @@
         {
             id = URL_START_ID;
         }
+        else
+        {
+            return aSettingName;   
+        }
         return resLoader.format(id, null /*aTextParameters*/);
     }
 
-    public static String getLocalizedString(String aStrId)
+    public static String getLocalizedString(Id aStrId)
     {
         if (resLoader == null)
         {
-            resLoader = ResourceLoader.getInstance("javaapplicationsettings", "qtn_java_");
+            resLoader = ResourceLoader.getInstance(AVKON_LOC_FILE, AVKON_PREFIX, QT_LOC_FILE, QT_PREFIX);
         }
         return resLoader.format(aStrId, null /*aTextParameters*/);
     }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java	Tue Jul 06 20:36:19 2010 +0300
@@ -39,6 +39,7 @@
     public static final int OCSP_GENERAL_ERR = 7;
     public static final int OCSP_SETTINGS_ERR = 8;
     public static final int OCSP_REVOKED_ERR = 9;
+    public static final int JAR_NOT_FOUND = 10;
 
 
     /*** ----------------------------- PUBLIC ------------------------------ */
@@ -65,6 +66,7 @@
         messageTable.put(new Integer(OCSP_GENERAL_ERR), "ocsp_general_details");
         messageTable.put(new Integer(OCSP_SETTINGS_ERR), "ocsp_settings");
         messageTable.put(new Integer(OCSP_REVOKED_ERR), "ocsp_revoked");
+        messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found_details");
         iMessageTable = messageTable;
         return iMessageTable;
     }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java	Tue Jul 06 20:36:19 2010 +0300
@@ -23,18 +23,16 @@
 
 /**
  * Class defining Security short error messages.
- *
- * @author Nokia Corporation
- * @version 1.0
  */
 public final class SecurityErrorMessage extends ErrorMessageBase
 {
     // Security error codes.
-    public static final int JAR_TAMPERED = 1;
-    public static final int CERT_NOT_AVAILABLE = 2;
-    public static final int UNEXPECTED_ERR = 3;
-    public static final int NETWORK_RESTRICTION_VIOLATION = 4;
-    public static final int OCSP_GENERAL_ERR = 5;
+    public static final int JAR_TAMPERED = 1 + ErrorMessageBase.SECURITY_RANGE_START;
+    public static final int CERT_NOT_AVAILABLE = 2 + ErrorMessageBase.SECURITY_RANGE_START;
+    public static final int UNEXPECTED_ERR = 3 + ErrorMessageBase.SECURITY_RANGE_START;
+    public static final int NETWORK_RESTRICTION_VIOLATION = 4 + ErrorMessageBase.SECURITY_RANGE_START;
+    public static final int OCSP_GENERAL_ERR = 5 + ErrorMessageBase.SECURITY_RANGE_START;
+    public static final int JAR_NOT_FOUND = 6 + ErrorMessageBase.SECURITY_RANGE_START;
 
     /*** ----------------------------- PUBLIC ------------------------------ */
     /*** ---------------------------- PROTECTED --------------------------- */
@@ -56,6 +54,7 @@
         messageTable.put(new Integer(UNEXPECTED_ERR), "unexpected_err");
         messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation");
         messageTable.put(new Integer(OCSP_GENERAL_ERR), "ocsp_general");
+        messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found");
         iMessageTable = messageTable;
         return iMessageTable;
     }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPermissionTexts.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPermissionTexts.java	Tue Jul 06 20:36:19 2010 +0300
@@ -17,6 +17,7 @@
 
 package com.nokia.mj.impl.security.utils;
 
+import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.LocalizedTextProvider;
 import com.nokia.mj.impl.utils.ResourceLoader;
 
@@ -28,20 +29,25 @@
     private static ResourceLoader iRes = null;
 
     // identifiers for the security permission texts
-    public static final String CALL_CONTROL = "call_control";
-    public static final String NET_ACCESS = "net_access";
-    public static final String LOW_LEVEL_NET_ACCESS = "low_level_net_access";
-    public static final String MESSAGING = "messaging";
-    public static final String RESTRICTED_MESSAGING = "restricted_messaging";
-    public static final String APP_AUTO_INVOCAT = "app_auto_invocat";
-    public static final String LOCAL_CONN = "local_conn";
-    public static final String MM_RECORD = "mm_record";
-    public static final String READ_DATA = "read_data";
-    public static final String WRITE_DATA = "write_data";
-    public static final String LOCATION = "location";
-    public static final String LANDMARKS = "landmarks";
-    public static final String AUTH = "auth";
-    public static final String BROADCAST = "broadcast";
+    public static final Id CALL_CONTROL = new Id("call_control", "N/A");
+    public static final Id NET_ACCESS = new Id("net_access", "N/A");
+    public static final Id LOW_LEVEL_NET_ACCESS = new Id("low_level_net_access", "N/A");
+    public static final Id MESSAGING = new Id("messaging", "qt_kalle_test_d");
+    public static final Id RESTRICTED_MESSAGING = new Id("restricted_messaging", "N/A");
+    public static final Id APP_AUTO_INVOCAT = new Id("app_auto_invocat", "N/A");
+    public static final Id LOCAL_CONN = new Id("local_conn", "N/A");
+    public static final Id MM_RECORD = new Id("mm_record", "N/A");
+    public static final Id READ_DATA = new Id("read_data", "N/A");
+    public static final Id WRITE_DATA = new Id("write_data", "N/A");
+    public static final Id LOCATION = new Id("location", "N/A");
+    public static final Id LANDMARKS = new Id("landmarks", "N/A");
+    public static final Id AUTH = new Id("auth", "N/A");
+    public static final Id BROADCAST = new Id("broadcast", "N/A");
+
+    private static final String AVKON_LOC_FILE = "javainstallation";
+    private static final String AVKON_PREFIX = "qtn_java_inst_perm_";
+    private static final String QT_LOC_FILE = "N/A";
+    private static final String QT_PREFIX = "N/A";
 
     /**
      * Creates an instance of the SecurityPermissionTexts
@@ -73,12 +79,13 @@
      * @return            the localized text associated with the provided
      *                    identifier and parameters
      */
-    public String getText(String aTextId, Object[] aTextParams)
+    public String getText(Id aTextId, Object[] aTextParams)
     {
         if (iRes == null)
         {
-            iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_perm_");
+            iRes = ResourceLoader.getInstance(AVKON_LOC_FILE, AVKON_PREFIX, QT_LOC_FILE, QT_PREFIX);
         }
+
         return iRes.format(aTextId, aTextParams);
     }
 }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPromptMessage.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPromptMessage.java	Tue Jul 06 20:36:19 2010 +0300
@@ -17,6 +17,7 @@
 
 package com.nokia.mj.impl.security.utils;
 
+import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.LocalizedTextProvider;
 import com.nokia.mj.impl.utils.ResourceLoader;
 
@@ -28,68 +29,74 @@
     private static ResourceLoader iRes = null;
 
     // identifiers for the security prompt questions
-    public static final String QUESTION_ID_NETWORK_USAGE = "network_usage";
-    public static final String QUESTION_ID_SMS_OPENING_CONN = "sms_opening_conn";
-    public static final String QUESTION_ID_MMS_OPENING_CONN = "mms_opening_conn";
-    public static final String QUESTION_ID_CBS_OPENING_CONN = "cbs_opening_conn";
-    public static final String QUESTION_ID_SMS_RECEIVING = "sms_receiving";
-    public static final String QUESTION_ID_MMS_RECEIVING = "mms_receiving";
-    public static final String QUESTION_ID_CBS_RECEIVING = "cbs_receiving";
-    public static final String QUESTION_ID_SMS_SENDING = "sms_sending";
-    public static final String QUESTION_ID_SMS_SINGLE_SENDING = "sms_single_sending";
-    public static final String QUESTION_ID_MMS_SENDING = "mms_sending";
-    public static final String QUESTION_ID_MMS_SINGLE_SENDING = "mms_single_sending";
-    public static final String QUESTION_ID_MMS_SINGLE_SENDING_MULTIPLE_DESTINATIONS = "mms_single_sending_multiple_destinations";
-    public static final String QUESTION_ID_SEND_RECEIVE_MESSAGES = "receive_send_messages";
-    public static final String QUESTION_ID_LOCAL_CONNECTIVITY = "local_connectivity";
-    public static final String QUESTION_ID_AUDIO_VIDEO_RECORDING = "audio_video_recording";
-    public static final String QUESTION_ID_READING_USER_DATA = "reading_user_data";
-    public static final String QUESTION_ID_WRITING_USER_DATA = "writing_user_data";
-    public static final String QUESTION_ID_READING_FILE = "reading_file";
-    public static final String QUESTION_ID_MANAGE_USER_DATA = "manage_user_data";
-    public static final String QUESTION_ID_MODIFYING_FILE = "modifying_file";
-    public static final String QUESTION_ID_READING_LOCATION_DATA = "reading_location_data";
-    public static final String QUESTION_ID_READING_LANDMARK_DATA = "reading_landmark_data";
-    public static final String QUESTION_ID_READING_SMARTCARD = "reading_smartcard";
-    public static final String QUESTION_ID_AUTH_SERVICES_USAGE = "auth_services_usage";
-    public static final String QUESTION_ID_BLUETOOTH_USAGE = "bluetooth_usage";
-    public static final String QUESTION_ID_READING_CONTACTS = "reading_contacts";
-    public static final String QUESTION_ID_MODIFYING_CONTACTS = "modifying_contacts";
-    public static final String QUESTION_ID_READING_EVENTS = "reading_events";
-    public static final String QUESTION_ID_MODIFYING_EVENTS = "modifying_events";
-    public static final String QUESTION_ID_READING_TODOS = "reading_todos";
-    public static final String QUESTION_ID_MODIFYING_TODOS = "modifying_todos";
-    public static final String QUESTION_ID_DELETING_ITEM = "deleting_item";
-    public static final String QUESTION_ID_UPDATING_ITEM = "updating_item";
-    public static final String QUESTION_ID_DELETING_CATEGORY = "deleting_category";
-    public static final String QUESTION_ID_UPDATING_CATEGORY = "updating_category";
-    public static final String QUESTION_ID_DELETING_UNNAMED_ITEM = "deleting_unnamed_item";
-    public static final String QUESTION_ID_UPDATING_UNNAMED_ITEM = "updating_unnamed_item";
-    public static final String QUESTION_ID_ADDING_CALENDAR = "adding_calendar";
-    public static final String QUESTION_ID_DELETING_CALENDAR = "deleting_calendar";
-    public static final String QUESTION_ID_LISTING_CALENDARS = "listing_calendars";
-    public static final String QUESTION_ID_ORIENTATION_DATA_USAGE = "orientation_data_usage";
-    public static final String QUESTION_ID_POSITIONING_DATA_USAGE = "positioning_data_usage";
-    public static final String QUESTION_ID_LANDMARK_DATA_USAGE = "landmark_data_usage";
-    public static final String QUESTION_ID_PROXIMITY_LISTENER_REGISTRATION = "proximity_listener_registration";
-    public static final String QUESTION_ID_MOBITV_DATA_USAGE = "tv_broadcast_user_data_access";
-    public static final String QUESTION_ID_NETWORK_USAGE_VIA_PLAT_REQ = "network_usage_via_plat_req";
-    public static final String QUESTION_ID_APP_LAUNCH_VIA_PLAT_REQ = "app_launch_via_plat_req";
-    public static final String QUESTION_ID_PUSH_STATIC_REGISTRATION = "push_registration_static";
-    public static final String QUESTION_ID_PUSH_DYNAMIC_REGISTRATION = "push_registration_dynamic";
-    public static final String QUESTION_ID_AUTO_INVOCATION = "auto_invocation";
-    public static final String QUESTION_ID_NDEF_TAG_WRITE = "nfc_ndef_tag_write";
-    public static final String QUESTION_ID_APP_AUTO_LAUNCH = "url_start";
+    public static final Id QUESTION_ID_NETWORK_USAGE = new Id("network_usage", "N/A");
+    public static final Id QUESTION_ID_SMS_OPENING_CONN = new Id("sms_opening_conn", "N/A");
+    public static final Id QUESTION_ID_MMS_OPENING_CONN = new Id("mms_opening_conn", "N/A");
+    public static final Id QUESTION_ID_CBS_OPENING_CONN = new Id("cbs_opening_conn", "N/A");
+    public static final Id QUESTION_ID_SMS_RECEIVING = new Id("sms_receiving", "N/A");
+    public static final Id QUESTION_ID_MMS_RECEIVING = new Id("mms_receiving", "N/A");
+    public static final Id QUESTION_ID_CBS_RECEIVING = new Id("cbs_receiving", "N/A");
+    public static final Id QUESTION_ID_SMS_SENDING = new Id("sms_sending", "N/A");
+    public static final Id QUESTION_ID_SMS_SINGLE_SENDING = new Id("sms_single_sending", "N/A");
+    public static final Id QUESTION_ID_MMS_SENDING = new Id("mms_sending", "N/A");
+    public static final Id QUESTION_ID_MMS_SINGLE_SENDING = new Id("mms_single_sending", "N/A");
+    public static final Id QUESTION_ID_MMS_SINGLE_SENDING_MULTIPLE_DESTINATIONS = new Id("mms_single_sending_multiple_destinations", "N/A");
+    public static final Id QUESTION_ID_SEND_RECEIVE_MESSAGES = new Id("receive_send_messages", "N/A");
+    public static final Id QUESTION_ID_LOCAL_CONNECTIVITY = new Id("local_connectivity", "N/A");
+    public static final Id QUESTION_ID_AUDIO_VIDEO_RECORDING = new Id("audio_video_recording", "N/A");
+    public static final Id QUESTION_ID_READING_USER_DATA = new Id("reading_user_data", "N/A");
+    public static final Id QUESTION_ID_WRITING_USER_DATA = new Id("writing_user_data", "N/A");
+    public static final Id QUESTION_ID_READING_FILE = new Id("reading_file", "N/A");
+    public static final Id QUESTION_ID_MANAGE_USER_DATA = new Id("manage_user_data", "N/A");
+    public static final Id QUESTION_ID_MODIFYING_FILE = new Id("modifying_file", "N/A");
+    public static final Id QUESTION_ID_READING_LOCATION_DATA = new Id("reading_location_data", "N/A");
+    public static final Id QUESTION_ID_READING_LANDMARK_DATA = new Id("reading_landmark_data", "N/A");
+    public static final Id QUESTION_ID_READING_SMARTCARD = new Id("reading_smartcard", "N/A");
+    public static final Id QUESTION_ID_AUTH_SERVICES_USAGE = new Id("auth_services_usage", "N/A");
+    public static final Id QUESTION_ID_BLUETOOTH_USAGE = new Id("bluetooth_usage", "N/A");
+    public static final Id QUESTION_ID_READING_CONTACTS = new Id("reading_contacts", "N/A");
+    public static final Id QUESTION_ID_MODIFYING_CONTACTS = new Id("modifying_contacts", "N/A");
+    public static final Id QUESTION_ID_READING_EVENTS = new Id("reading_events", "N/A");
+    public static final Id QUESTION_ID_MODIFYING_EVENTS = new Id("modifying_events", "N/A");
+    public static final Id QUESTION_ID_READING_TODOS = new Id("reading_todos", "N/A");
+    public static final Id QUESTION_ID_MODIFYING_TODOS = new Id("modifying_todos", "N/A");
+    public static final Id QUESTION_ID_DELETING_ITEM = new Id("deleting_item", "N/A");
+    public static final Id QUESTION_ID_UPDATING_ITEM = new Id("updating_item", "N/A");
+    public static final Id QUESTION_ID_DELETING_CATEGORY = new Id("deleting_category", "N/A");
+    public static final Id QUESTION_ID_UPDATING_CATEGORY = new Id("updating_category", "N/A");
+    public static final Id QUESTION_ID_DELETING_UNNAMED_ITEM = new Id("deleting_unnamed_item", "N/A");
+    public static final Id QUESTION_ID_UPDATING_UNNAMED_ITEM = new Id("updating_unnamed_item", "N/A");
+    public static final Id QUESTION_ID_ADDING_CALENDAR = new Id("adding_calendar", "N/A");
+    public static final Id QUESTION_ID_DELETING_CALENDAR = new Id("deleting_calendar", "N/A");
+    public static final Id QUESTION_ID_LISTING_CALENDARS = new Id("listing_calendars", "N/A");
+    public static final Id QUESTION_ID_ORIENTATION_DATA_USAGE = new Id("orientation_data_usage", "N/A");
+    public static final Id QUESTION_ID_POSITIONING_DATA_USAGE = new Id("positioning_data_usage", "N/A");
+    public static final Id QUESTION_ID_LANDMARK_DATA_USAGE = new Id("landmark_data_usage", "N/A");
+    public static final Id QUESTION_ID_PROXIMITY_LISTENER_REGISTRATION = new Id("proximity_listener_registration", "N/A");
+    public static final Id QUESTION_ID_MOBITV_DATA_USAGE = new Id("tv_broadcast_user_data_access", "N/A");
+    public static final Id QUESTION_ID_NETWORK_USAGE_VIA_PLAT_REQ = new Id("network_usage_via_plat_req", "N/A");
+    public static final Id QUESTION_ID_APP_LAUNCH_VIA_PLAT_REQ = new Id("app_launch_via_plat_req", "N/A");
+    public static final Id QUESTION_ID_PUSH_STATIC_REGISTRATION = new Id("push_registration_static", "N/A");
+    public static final Id QUESTION_ID_PUSH_DYNAMIC_REGISTRATION = new Id("push_registration_dynamic", "N/A");
+    public static final Id QUESTION_ID_AUTO_INVOCATION = new Id("auto_invocation", "N/A");
+    public static final Id QUESTION_ID_NDEF_TAG_WRITE = new Id("nfc_ndef_tag_write", "N/A");
+    public static final Id QUESTION_ID_APP_AUTO_LAUNCH = new Id("url_start", "N/A");
 
     // identifiers for the security prompt answer options
-    public static final String ANSWER_ID_ALLOW = "prompt_allow";
-    public static final String ANSWER_ID_DENY = "prompt_deny";
-    public static final String ANSWER_ID_YES = "prompt_yes";
-    public static final String ANSWER_ID_NO = "prompt_no";
+    public static final Id ANSWER_ID_ALLOW = new Id("prompt_allow", "N/A");
+    public static final Id ANSWER_ID_DENY = new Id("prompt_deny", "N/A");
+    public static final Id ANSWER_ID_YES = new Id("prompt_yes", "N/A");
+    public static final Id ANSWER_ID_NO = new Id("prompt_no", "N/A");
 
     // general purpose identifiers
-    public static final String SECURITY_WARNING_ID = "general_warning";
-    public static final String OCSP_WARNING_ID = "ocsp_warning";
+    public static final Id SECURITY_WARNING_ID = new Id("general_warning", "N/A");
+    public static final Id OCSP_WARNING_ID = new Id("ocsp_warning", "N/A");
+
+    // Localised resources
+    private static final String AVKON_LOC_FILE = "javausermessages";
+    private static final String AVKON_PREFIX = "qtn_java_secur_";
+    private static final String QT_LOC_FILE = "N/A";
+    private static final String QT_PREFIX = "";
 
     /**
      * Creates an instance of the SecurityPromptMessage
@@ -121,12 +128,13 @@
      * @return            the localized text associated with the provided
      *                    identifier and parameters
      */
-    public String getText(String aTextId, Object[] aTextParams)
+    public String getText(Id aTextId, Object[] aTextParams)
     {
         if (iRes == null)
         {
-            iRes = ResourceLoader.getInstance("javausermessages", "qtn_java_secur_");
+            iRes = ResourceLoader.getInstance(AVKON_LOC_FILE, AVKON_PREFIX, QT_LOC_FILE, QT_PREFIX);
         }
+
         return iRes.format(aTextId, aTextParams);
     }
 }
--- a/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -33,8 +33,6 @@
 // Use bytepair compression to enable code paging
 PAGED
 
-systeminclude   /epoc32/include/ecom
-
 userinclude   ../../../../inc
 
 sourcepath      ../src.s60
--- a/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/build/MIDP2SecurityPolicyV2Dll.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/build/MIDP2SecurityPolicyV2Dll.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -21,8 +21,10 @@
 
 @SYMPurpose MIDP2SecurityPolicyV2.dll Java security policy interface implementation
 */
+#include <platform_paths.hrh>
+#include <../../../../../../../inc/project_defines.hrh>
 
-#include <../../../../../../../inc/project_defines.hrh>
+APP_LAYER_SYSTEMINCLUDE
 
 target			MIDP2SecurityPolicyV2.dll
 targettype		dll
@@ -42,10 +44,6 @@
 deffile ./midp2secrp/eabi/MIDP2SecurityPolicyV2.def
 #endif
 
-systeminclude	/epoc32/include
-systeminclude	/epoc32/include/libc
-
-systeminclude ../../../../../../../inc
 
 userinclude		../export
 userinclude     ../../../../../../../inc
--- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -22,6 +22,7 @@
 #include "midpauthenticationmoduleimpl.h"
 #include "storagehandler.h"
 #include "securityutils.h"
+#include "telutils.h"
 #include "javacertstorehandler.h"
 #include "securitycommsmessagedefs.h"
 #include "javastorage.h"
@@ -38,8 +39,8 @@
 #include <openssl/err.h>
 #include <openssl/rsa.h>
 #include <openssl/sha.h>
-#include <sys/time.h>
 #include <string.h>
+#include <errno.h>
 
 using namespace java::security;
 using namespace java::storage;
@@ -252,6 +253,13 @@
         jar_hash_value = NULL;
         return hash;
     }
+    else
+    {
+        if (errno == ENOENT)
+        {
+            SecurityUtils::throw_exception(env, "JAR_NOT_FOUND");
+        }
+    }
     return NULL;
 }
 
@@ -455,9 +463,7 @@
             break;
         }
 
-        struct timeval tv;
-        int i = gettimeofday(&tv, NULL);
-        X509_STORE_CTX_set_time(x509_ctx, X509_V_FLAG_USE_CHECK_TIME, tv.tv_sec);
+        X509_STORE_CTX_set_time(x509_ctx, X509_V_FLAG_USE_CHECK_TIME, TelUtils::getSecureTime());
         // set the callback for validation - needed for the critical extension
         // used by developer certificates
         X509_STORE_CTX_set_verify_cb(x509_ctx, verify_callback);
@@ -475,7 +481,7 @@
         {
             bool extKeyUsageKnown = false;
             char EXT_KEY_USAGE_OID[80];
-            for (i = 0; i < sk_ASN1_OBJECT_num(extKeyUsage); i++)
+            for (int i = 0; i < sk_ASN1_OBJECT_num(extKeyUsage); i++)
             {
                 ASN1_OBJECT *usage = sk_ASN1_OBJECT_value(extKeyUsage,i);
                 OBJ_obj2txt(EXT_KEY_USAGE_OID,
--- a/javacommons/utils/build/bwins/javautilsu.def	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/build/bwins/javautilsu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -128,4 +128,5 @@
 	??_ERuntimeException@runtime@java@@UAE@I@Z @ 127 NONAME ; java::runtime::RuntimeException::~RuntimeException(unsigned int)
 	??1RuntimeException@runtime@java@@UAE@XZ @ 128 NONAME ; java::runtime::RuntimeException::~RuntimeException(void)
 	?toString@RuntimeException@runtime@java@@UBE?AV?$basic_string@DV?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ @ 129 NONAME ; class std::basic_string<char, class std::char_traits<char>, class std::allocator<char> > java::runtime::RuntimeException::toString(void) const
+	?wbase64encode@JavaCommonUtils@util@java@@SA?AV?$basic_string@_WV?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV45@@Z @ 130 NONAME ; class std::basic_string<wchar_t, class std::char_traits<wchar_t>, class std::allocator<wchar_t> > java::util::JavaCommonUtils::wbase64encode(class std::basic_string<wchar_t, class std::char_traits<wchar_t>, class std::allocator<wchar_t> > const &)
 
--- a/javacommons/utils/build/eabi/javautilsu.def	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/build/eabi/javautilsu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -178,5 +178,5 @@
 	_ZNK4java7runtime16RuntimeException8toStringEv @ 177 NONAME
 	_ZTIN4java7runtime16RuntimeExceptionE @ 178 NONAME
 	_ZTVN4java7runtime16RuntimeExceptionE @ 179 NONAME
-	
-	
+	_ZN4java4util15JavaCommonUtils13wbase64encodeERKSbIwSt11char_traitsIwESaIwEE @ 180 NONAME
+
--- a/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh	Tue Jul 06 20:36:19 2010 +0300
@@ -49,9 +49,6 @@
 macro J9EPOC32
 #define J9EPOC32
 
-macro RD_JAVA_OMJ_FSERVER
-#define RD_JAVA_OMJ_FSERVER
-
 #include "build_defines.hrh"
 
 #ifdef RD_JAVA_STDCPPV5
--- a/javacommons/utils/inc/javacommonutils.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/inc/javacommonutils.h	Tue Jul 06 20:36:19 2010 +0300
@@ -87,6 +87,23 @@
     OS_IMPORT static std::string base64encode(const std::string& aData);
 
     /**
+     * Encode wstring to base64 wstring byte by byte.
+     *
+     * wstring aData is base64 encoded as a byte array.
+     * If the wstring has been created from TDesC16 in Symbian it contains
+     * UTF-16LE (UCS-2) encoded 16-bit characters.
+     * The result is byte array that contains 8-bit ASCII characters.
+     * Each of these 8-bit character is converted to the corresponding
+     * wchar and appended to the result wstring.
+     *
+     * @see \sf\app\jrt\javamanager\javainstaller\installer\javasrc\com\nokia
+     *  \mj\impl\installer\utils\Args.java, decodeBase64Args()
+     * @param aData wstring containing the data to be encoded.
+     * @return base64 encoded result wstring.
+     */
+    OS_IMPORT static std::wstring wbase64encode(const std::wstring& aData);
+
+    /**
      * Decode base64 string.
      *
      * @param aData base64 encoded string.
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/rt/support/ApplicationUtils.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/rt/support/ApplicationUtils.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -162,11 +162,14 @@
      * <p>
      * This method is meant ONLY for the UI and no other API are allowed
      * to use it. The UI must use this API ONLY when the user explicitly
-     * wants to close the application using some platform depedent feataure
+     * wants to close the application using some platform dependent feature
      * (e.g. red key in S60). If the user tries to close the application
      * using the mechanism provided by the application itself, this method
      * must not be called.
      * <p>
+     * Note that calling this method might cause the UI framework to call
+     * uiDisposed method, depending on which UI framework is used.
+     * <p>
      * This method is a problematic in such runtimes that may run more than one
      * application in same JVM instance (e.g. eRCP). If the application
      * doesn't close nicely the runtime may have to terminate
@@ -177,6 +180,23 @@
     public abstract void notifyExitCmd();
 
     /**
+     * Notifies the runtime that UI has been disposed. The runtime is
+     * responsible for killing the application if it doesn't close itself
+     * nicely after specified grace time. The specified grace time is
+     * runtime dependent.
+     * <p>
+     * This method is meant ONLY for the UI and no other API are allowed
+     * to use it.
+     * <p>
+     * It is possible that the method is called several times from different 
+     * phases of the UI exit sequence. 
+     */
+    public void uiDisposed()
+    {
+        notifyExitCmd();
+    }
+
+    /**
      * Determines whether the access request indicated by the specified
      * permission should be allowed or denied, based on the security policy
      * currently in effect. This method quietly returns if the access request
@@ -221,7 +241,7 @@
      * @param listener the new listener.
      */
     public void addShutdownListener(ShutdownListener listener)
-{
+    {
         if (mListeners == null)
         {
             mListeners = new Vector();
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -24,8 +24,6 @@
 /**
  * Base class for classes defining localized error messages.
  *
- * @author Nokia Corporation
- * @version 1.0
  * @see InstallerExceptionBase
  */
 abstract public class ErrorMessageBase
@@ -34,6 +32,19 @@
 
     public static final int NO_MSG = 0; // Used when the error message is not available.
 
+    /** Start of Runtime error message ids range. */
+    public static final int RUNTIME_RANGE_START = 0;
+    /** End of Runtime error message ids range. */
+    public static final int RUNTIME_RANGE_END = 99;
+    /** Start of Installer error message ids range. */
+    public static final int INSTALLER_RANGE_START = 100;
+    /** End of Installer error message ids range. */
+    public static final int INSTALLER_RANGE_END = 199;
+    /** Start of Security error message ids range. */
+    public static final int SECURITY_RANGE_START = 200;
+    /** End of Security error message ids range. */
+    public static final int SECURITY_RANGE_END = 299;
+
     /**
      * Method for retrieving the message of a certain error.
      *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Id.java	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.utils;
+
+/**
+ * Localisation Identifier. This class is used to hide platform localisation
+ * specifics.
+ */
+public class Id
+{
+    private String iAvkonLocString = null;
+    private String iQtLocString = null;
+
+    /**
+     * Default constructor.
+     */
+    private Id()
+    {
+    }
+
+    public Id(String aAvkonLocString, String aQtLocString)
+    {
+        this.iAvkonLocString = aAvkonLocString;
+        this.iQtLocString = aQtLocString;
+    }
+
+    public String getString(int aPlatform)
+    {
+        if (aPlatform == ResourceLoader.QT)
+        {
+            return iQtLocString;
+        }
+        else
+        {
+            return iAvkonLocString;       
+        }
+    }     
+}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -22,9 +22,6 @@
 
 /**
  * Class defining Installer detailed error messages.
- *
- * @author Nokia Corporation
- * @version 1.0
  */
 public final class InstallerDetailedErrorMessage extends ErrorMessageBase
 {
@@ -42,6 +39,8 @@
     public static final int UNINST_BLOCKED = 11;
     public static final int INTERNAL_ERROR = 12;
     public static final int NO_MEM_MB = 13;
+    public static final int INST_CANCEL = 14;
+    public static final int UNINST_CANCEL = 15;
 
     /*** ----------------------------- PUBLIC ------------------------------ */
     /*** ---------------------------- PROTECTED --------------------------- */
@@ -58,19 +57,44 @@
             return iMessageTable;
         }
         Hashtable messageTable = new Hashtable();
-        messageTable.put(new Integer(NO_MEM), "no_mem_detail");
-        messageTable.put(new Integer(NO_MEM_MB), "no_mem_detail_mb");
-        messageTable.put(new Integer(NO_NET), "no_net_detail");
-        messageTable.put(new Integer(ATTR_BAD_SYNTAX), "attr_bad_syntax");
-        messageTable.put(new Integer(ATTR_MISSING), "attr_missing");
-        messageTable.put(new Integer(ATTR_MISMATCH), "attr_mismatch");
-        messageTable.put(new Integer(ATTR_UNSUPPORTED), "attr_unsupported_value");
-        messageTable.put(new Integer(ATTR_HANDLING_FAILED), "attr_handling_failed");
-        messageTable.put(new Integer(CERT_UNSUPPORTED), "cert_unsupported");
-        messageTable.put(new Integer(PROT_PKG_MISUSE), "protected_pkg_misuse");
-        messageTable.put(new Integer(DIFFERENT_SIGNERS), "different_signers");
-        messageTable.put(new Integer(UNINST_BLOCKED), "uninst_blocked");
-        messageTable.put(new Integer(INTERNAL_ERROR), "internal");
+        // Change this after Qt localisation files are in place.
+        //if (ResourceLoader.getLocaleIdQt() == null)
+        if (true)
+        {
+            messageTable.put(new Integer(NO_MEM), "no_mem_detail");
+            messageTable.put(new Integer(NO_MEM_MB), "no_mem_detail_mb");
+            messageTable.put(new Integer(NO_NET), "no_net_detail");
+            messageTable.put(new Integer(ATTR_BAD_SYNTAX), "attr_bad_syntax");
+            messageTable.put(new Integer(ATTR_MISSING), "attr_missing");
+            messageTable.put(new Integer(ATTR_MISMATCH), "attr_mismatch");
+            messageTable.put(new Integer(ATTR_UNSUPPORTED), "attr_unsupported_value");
+            messageTable.put(new Integer(ATTR_HANDLING_FAILED), "attr_handling_failed");
+            messageTable.put(new Integer(CERT_UNSUPPORTED), "cert_unsupported");
+            messageTable.put(new Integer(PROT_PKG_MISUSE), "protected_pkg_misuse");
+            messageTable.put(new Integer(DIFFERENT_SIGNERS), "different_signers");
+            messageTable.put(new Integer(UNINST_BLOCKED), "uninst_blocked");
+            messageTable.put(new Integer(INTERNAL_ERROR), "internal");
+            messageTable.put(new Integer(INST_CANCEL), "Installation cancelled.");
+            messageTable.put(new Integer(UNINST_CANCEL), "Uninstallation cancelled.");
+        }
+        else
+        {
+            messageTable.put(new Integer(NO_MEM), "error_no_mem_detail");
+            messageTable.put(new Integer(NO_MEM_MB), "error_no_mem_detail_mb");
+            messageTable.put(new Integer(NO_NET), "error_no_net_detail");
+            messageTable.put(new Integer(ATTR_BAD_SYNTAX), "error_bad_syntax");
+            messageTable.put(new Integer(ATTR_MISSING), "error_attr_missing");
+            messageTable.put(new Integer(ATTR_MISMATCH), "error_attr_mismatch");
+            messageTable.put(new Integer(ATTR_UNSUPPORTED), "error_attr_unsupported_value");
+            messageTable.put(new Integer(ATTR_HANDLING_FAILED), "error_attr_handling_failed");
+            messageTable.put(new Integer(CERT_UNSUPPORTED), "error_cert_unsupported");
+            messageTable.put(new Integer(PROT_PKG_MISUSE), "error_pkg_misuse");
+            messageTable.put(new Integer(DIFFERENT_SIGNERS), "error_different_signers");
+            messageTable.put(new Integer(UNINST_BLOCKED), "uninst_blocked");
+            messageTable.put(new Integer(INTERNAL_ERROR), "internal_error");
+            messageTable.put(new Integer(INST_CANCEL), "error_cancel");
+            messageTable.put(new Integer(UNINST_CANCEL), "error_uninst_cancel");
+        }
         iMessageTable = messageTable;
         return iMessageTable;
     }
@@ -84,7 +108,16 @@
     {
         if (iRes == null)
         {
-            iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
+            // Change this after Qt localisation files are in place.
+            //if (ResourceLoader.getLocaleIdQt() == null)
+            if (true)
+            {
+                iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
+            }
+            else
+            {
+                iRes = ResourceLoader.getInstance("javaapplicationinstaller", "txt_java_inst_info_");
+            }
         }
         return iRes;
     }
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -22,34 +22,31 @@
 
 /**
  * Class defining Installer short error messages.
- *
- * @author Nokia Corporation
- * @version 1.0
  */
 public final class InstallerErrorMessage extends ErrorMessageBase
 {
     // Installation error codes.
-    public static final int INST_NO_MEM = 1;
-    public static final int INST_NO_NET = 2;
-    public static final int INST_CORRUPT_PKG = 3;
-    public static final int INST_COMPAT_ERR = 4;
-    public static final int INST_AUTHORIZATION_ERR = 5;
-    public static final int INST_AUTHENTICATION_ERR = 6;
-    public static final int INST_PUSH_REG_ERR = 7;
-    public static final int INST_UNEXPECTED_ERR = 8;
-    public static final int INST_CANCEL = 9;
+    public static final int INST_NO_MEM = 1 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_NO_NET = 2 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_CORRUPT_PKG = 3 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_COMPAT_ERR = 4 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_AUTHORIZATION_ERR = 5 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_AUTHENTICATION_ERR = 6 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_PUSH_REG_ERR = 7 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_UNEXPECTED_ERR = 8 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int INST_CANCEL = 9 + ErrorMessageBase.INSTALLER_RANGE_START;
 
     // Uninstallation error codes.
-    public static final int UNINST_NOT_ALLOWED = 101;
-    public static final int UNINST_UNEXPECTED_ERR = 102;
-    public static final int UNINST_CANCEL = 103;
+    public static final int UNINST_NOT_ALLOWED = 10 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int UNINST_UNEXPECTED_ERR = 11 + ErrorMessageBase.INSTALLER_RANGE_START;
+    public static final int UNINST_CANCEL = 12 + ErrorMessageBase.INSTALLER_RANGE_START;
 
     /**
      * Error codes for other than install and uninstall operations.
      * Do not use these error codes in installation or uninstallation.
      * These are only used in installer "list" and "test" commands.
      */
-    public static final int OTHER_UNEXPECTED_ERR = 201;
+    public static final int OTHER_UNEXPECTED_ERR = 13 + ErrorMessageBase.INSTALLER_RANGE_START;
 
     /*** ----------------------------- PUBLIC ------------------------------ */
     /*** ---------------------------- PROTECTED --------------------------- */
@@ -66,19 +63,40 @@
             return iMessageTable;
         }
         Hashtable messageTable = new Hashtable();
-        messageTable.put(new Integer(INST_NO_MEM), "no_mem");
-        messageTable.put(new Integer(INST_NO_NET), "no_net");
-        messageTable.put(new Integer(INST_CORRUPT_PKG), "corrupt_pkg");
-        messageTable.put(new Integer(INST_COMPAT_ERR), "compat_err");
-        messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "authorization_err");
-        messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "authentication_err");
-        messageTable.put(new Integer(INST_PUSH_REG_ERR), "push_reg_err");
-        messageTable.put(new Integer(INST_UNEXPECTED_ERR), "unexpected");
-        messageTable.put(new Integer(INST_CANCEL), "cancel");
-        messageTable.put(new Integer(UNINST_NOT_ALLOWED), "uninst_not_allowed");
-        messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "uninst_unexpected");
-        messageTable.put(new Integer(UNINST_CANCEL), "uninst_cancel");
-        messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "other_unexpected");
+        // Change this after Qt localisation files are in place.
+        //if (ResourceLoader.getLocaleIdQt() == null)
+        if (true)
+        {
+            messageTable.put(new Integer(INST_NO_MEM), "no_mem");
+            messageTable.put(new Integer(INST_NO_NET), "no_net");
+            messageTable.put(new Integer(INST_CORRUPT_PKG), "corrupt_pkg");
+            messageTable.put(new Integer(INST_COMPAT_ERR), "compat_err");
+            messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "authorization_err");
+            messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "authentication_err");
+            messageTable.put(new Integer(INST_PUSH_REG_ERR), "push_reg_err");
+            messageTable.put(new Integer(INST_UNEXPECTED_ERR), "unexpected");
+            messageTable.put(new Integer(INST_CANCEL), "cancel");
+            messageTable.put(new Integer(UNINST_NOT_ALLOWED), "uninst_not_allowed");
+            messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "uninst_unexpected");
+            messageTable.put(new Integer(UNINST_CANCEL), "uninst_cancel");
+            messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "other_unexpected");
+        }
+        else
+        {
+            messageTable.put(new Integer(INST_NO_MEM), "info_there_is_not_enough_space_currently");
+            messageTable.put(new Integer(INST_NO_NET), "info_network_is_unavailable_currently");
+            messageTable.put(new Integer(INST_CORRUPT_PKG), "info_installation_package_is_invalid");
+            messageTable.put(new Integer(INST_COMPAT_ERR), "info_application_is_not_compatible_with");
+            messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "info_there_is_a_security_issue_with_this");
+            messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "info_there_is_a_security_issue_with_this");
+            messageTable.put(new Integer(INST_PUSH_REG_ERR), "info_an_unexpected_error_occurred");
+            messageTable.put(new Integer(INST_UNEXPECTED_ERR), "info_an_unexpected_error_occurred");
+            messageTable.put(new Integer(INST_CANCEL), "info_application_not_installed");
+            messageTable.put(new Integer(UNINST_NOT_ALLOWED), "info_application_cannot_be_deleted");
+            messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "installer_info_uninstallation_failed");
+            messageTable.put(new Integer(UNINST_CANCEL), "info_application_not_deleted");
+            messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "info_an_unexpected_error_occurred");
+        }
         iMessageTable = messageTable;
         return iMessageTable;
     }
@@ -92,7 +110,16 @@
     {
         if (iRes == null)
         {
-            iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
+            // Change this after Qt localisation files are in place.
+            //if (ResourceLoader.getLocaleIdQt() == null)
+            if (true)
+            {
+                iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
+            }
+            else
+            {
+                iRes = ResourceLoader.getInstance("common_errors", "txt_error_");
+            }
         }
         return iRes;
     }
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/LocalizedTextProvider.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/LocalizedTextProvider.java	Tue Jul 06 20:36:19 2010 +0300
@@ -28,5 +28,5 @@
      * @return           the text associated with the provided
      *                   identifier and parameters
      */
-    public abstract String getText(String aTextId, Object[] aTextParams);
+    public abstract String getText(Id aTextId, Object[] aTextParams);
 }
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java	Tue Jul 06 20:36:19 2010 +0300
@@ -40,6 +40,11 @@
  */
 public class ResourceLoader
 {
+    /** AVKON UI identifier. */
+    public static final int AVKON = 1;
+    /** QT UI identifier. */
+    public static final int QT = 2;
+
     /** Localisation resource basepath */
     private static final String LOC_RESOURCE_BASE = "/resources/com/nokia/mj/impl/";
 
@@ -50,10 +55,30 @@
     private Hashtable resourceMap = new Hashtable();
 
     /** Resource name prefix */
-    private String prefix;
+    private String prefix = null;
+
+    /** Platform localisation type. */
+    private int locType = -1;
 
     /*** ----------------------------- PUBLIC ------------------------------ */
 
+    public static ResourceLoader getInstance(String avkonFileName,
+                                             String avkonPrefix,
+                                             String qtFileName,
+                                             String qtPrefix)
+    {
+        // Avkon name prefix pair is used as key and this is same between platforms.
+        String key = avkonFileName + ":" + avkonPrefix;
+        ResourceLoader result = (ResourceLoader)resourceLoaders.get(key);
+
+        if (result == null)
+        {
+            result = new ResourceLoader(avkonFileName, avkonPrefix, qtFileName, qtPrefix);
+            resourceLoaders.put(key, result);
+        }
+        return result;
+    }
+
     /**
      * Returns a resource loader instance.
      *
@@ -74,6 +99,46 @@
     }
 
     /**
+     * Private constructor. Loads localisation resource file.
+     * On Avkon UI it's resources are loaded. On Qt platfor it's
+     * resource is first read and if that fails Avkon one is read.
+     *
+     * @param avkonFileName Avkon localisation resource file.
+     * @param avkonPrefix   Avkon logical string prefix.
+     * @param qtFileName    Qt localisation resource file.
+     * @param qtPrefix      Qt logical string prefix.
+     */
+    private ResourceLoader(String avkonFileName,
+                           String avkonPrefix,
+                           String qtFileName,
+                           String qtPrefix)
+    {
+        String localeId = getLocaleIdQt();
+
+        if (localeId == null)
+        {
+            locType = AVKON;
+            prefix = avkonPrefix;
+            loadFile(avkonFileName, true);
+        }
+        else
+        {
+            if (!loadFile(qtFileName, false))
+            {
+                // Fallback to Avkon
+                locType = AVKON;
+                prefix = avkonPrefix;
+                loadFile(avkonFileName, true);
+            }
+            else
+            {
+                locType = QT;
+                prefix = qtPrefix;
+            }
+        }
+    }
+
+    /**
      * Creates resource loader, using the current locale of the environment.
      *
      * @param resourceName name of the resource
@@ -82,7 +147,7 @@
     public ResourceLoader(String resourceName, String aPrefix)
     {
         prefix = aPrefix;
-        loadFile(resourceName);
+        loadFile(resourceName, true);  // Avkon
     }
 
     /**
@@ -98,6 +163,59 @@
     }
 
     /**
+     * Get a string formatter of a given resource id.
+     *
+     * @param avkonId Avkon resource id.
+     * @param qtId Qt resource id.
+     * @return formatter instance
+     * @see Formatter
+     */
+    public Formatter format(String avkonId, String qtId)
+    {
+        if (locType == AVKON)
+        {
+            return new Formatter(string(avkonId));
+        }
+        else
+        {
+            return new Formatter(string(qtId));        
+        }
+    }
+
+    /**
+     * Formats localised text with specified parameters from an array.
+     *
+     * @param avkonId Avkon resource id.
+     * @param qtId Qt resource id.
+     * @param textParameters parameters to be filled into the text.
+     * @return localised text formatted with the provided parameters.
+     * @see Formatter
+     */
+    public String format(String avkonId, String qtId, Object[] textParameters)
+    {
+        if (locType == AVKON)
+        {
+            return new Formatter(string(avkonId)).format(textParameters);
+        }
+        else
+        {
+            return new Formatter(string(qtId)).format(textParameters);
+        }
+    }
+
+    /**
+     * Get a string formatter of a given resource id.
+     *
+     * @param id resource id
+     * @return formatter instance
+     * @see Formatter
+     */
+    public Formatter format(Id id)
+    {
+        return new Formatter(id.getString(locType));
+    }
+
+    /**
      * Formats localised text with specified parameters from an array.
      *
      * @param id resource id
@@ -111,6 +229,20 @@
     }
 
     /**
+     * Formats localised text with specified parameters from an array.
+     *
+     * @param id resource id
+     * @param textParameters parameters to be filled into the text
+     * @return localised text formatted with the provided parameters
+     * @see Formatter
+     */
+    public String format(Id id, Object[] textParameters)
+    {
+        return new Formatter(string(id.getString(locType))).format(textParameters);
+    }
+
+
+    /**
      * Get a plain string resource with a given resource id.
      *
      * @param id resource id, either with prefix or without
@@ -172,35 +304,77 @@
         return "sc";
     }
 
+    /**
+     * Return locale id string on Qt platform.
+     *
+     * @return Qt Locale Id String, null if not in Qt.
+     */
+    public static String getLocaleIdQt()
+    {
+        return _getLocaleIdQt();
+    }
+
+
     /*** ----------------------------- PRIVATE ---------------------------- */
 
     /**
-     * Loads the resources from .loc type file
+     * Loads the resources from .loc type file.
+     *
+     * @param resourceName name of the resource file.
+     * @param aIs InputStream pointing to resource. It will be closed after use.
+     * @param true if operation succeed.
      */
-    private void loadFile(String resourceName)
+    private boolean loadFile(String resourceName, boolean avkon)
     {
         InputStream is = null;
 
-        // Load with real locale id
-        is = this.getClass().getResourceAsStream(
-                 LOC_RESOURCE_BASE + resourceName + "_" + getLocaleId() + ".loc");
-        if (is == null)
+        if (!avkon)  // Qt resources.
         {
-            // Load the engineering english
+            String langName = getLocaleIdQt();
+           
+            // Emulator returns falsely en_GB as engineering English locale name.
+            if (langName.equals("en_GB"))
+            {
+                langName = "en";
+            }
+            
+            // Load with real locale id
             is = this.getClass().getResourceAsStream(
-                     LOC_RESOURCE_BASE + resourceName + "_sc" + ".loc");
+                LOC_RESOURCE_BASE + resourceName + "_" + langName + ".loc");
+
+            if (is == null)
+            {
+                /*
+                 * Does not exist. No need to continue as avkon file cannot
+                 * found using qt name.
+                 */
+                return false;
+            }
         }
-        if (is == null)
+        else  // Avkon resources.
         {
-            // Load the reference engineering english
+            // Load with real locale id
             is = this.getClass().getResourceAsStream(
-                     LOC_RESOURCE_BASE + resourceName + ".loc");
-        }
-        if (is == null)
-        {
-            Logger.WLOG(Logger.EUtils,
-                        "Cannot load resource file: " + resourceName);
-            return;
+                 LOC_RESOURCE_BASE + resourceName + "_" + getLocaleId() + ".loc");
+
+            if (is == null)
+            {
+                // Load the engineering english
+                is = this.getClass().getResourceAsStream(
+                         LOC_RESOURCE_BASE + resourceName + "_sc" + ".loc");
+            }
+            if (is == null)
+            {
+                // Load the reference engineering english
+                is = this.getClass().getResourceAsStream(
+                         LOC_RESOURCE_BASE + resourceName + ".loc");
+            }
+            if (is == null)
+            {
+                Logger.WLOG(Logger.EUtils,
+                            "Cannot load resource file: " + resourceName);
+                return false;
+            }
         }
 
         try
@@ -248,6 +422,8 @@
                         "Resource file " + resourceName + " handling failed: "
                         + ex.getMessage());
         }
+
+        return true;
     }
 
     /**
@@ -366,4 +542,11 @@
      */
     private native int _getLocaleId();
 
+    /**
+     * Get Locale Id on Qt platform.
+     *
+     * @return locale Id string. If not in Qt null.
+     */
+    private static native String _getLocaleIdQt();
+
 }
--- a/javacommons/utils/src.s60/formatternative.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/src.s60/formatternative.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -16,13 +16,19 @@
 */
 
 
-//#include <avkon.rsg>
 #include <memory>
 #include <stringresourcereader.h>
 
+#ifdef RD_JAVA_UI_QT
+#include <QLocale>
+#else // RD_JAVA_UI_QT
+#include <AknUtils.h>
+#endif // RD_JAVA_UI_QT
+
 #include "com_nokia_mj_impl_utils_Formatter.h"
 #include "com_nokia_mj_impl_utils_ResourceLoader.h"
 #include "javajniutils.h"
+#include "s60commonutils.h"
 #include "logger.h"
 
 enum EDateTimeFormat
@@ -41,8 +47,8 @@
 // const TInt KMaxDateTimeStringSize = 50;
 const TInt KMaxDateFormatSize = 30;
 const TInt KMaxNumberFormatSize = 40;
+using namespace java::util;
 
-// _LIT( KAvkonResFile, "z:\\resource\\avkon.rsc" );
 
 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatInteger
 (JNIEnv *aJni, jobject, jint aNumber)
@@ -65,6 +71,10 @@
               "Cannot format %d to current locale. Error: %d", aNumber, error);
     }
 
+#ifndef RD_JAVA_UI_QT
+        AknTextUtils::LanguageSpecificNumberConversion( numberPtr );
+#endif // RD_JAVA_UI_QT
+
     return aJni->NewString(
                (const jchar*)numberPtr.Ptr(), numberPtr.Length());
 }
@@ -105,3 +115,31 @@
     return (jint)User::Language();
 }
 
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatDigits
+  (JNIEnv * aEnv, jclass, jstring str)
+{
+    jstring ret = str;
+    std::wstring wstr = JniUtils::jstringToWstring(aEnv, str);
+    HBufC* buf = S60CommonUtils::wstringToDes(wstr.c_str());
+    TPtr ptr(buf->Des());
+
+#ifndef RD_JAVA_UI_QT
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+#endif // RD_JAVA_UI_QT
+    ret = S60CommonUtils::NativeToJavaString(*aEnv, ptr);
+    delete buf; buf = NULL;
+    return ret;
+}
+
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_ResourceLoader__1getLocaleIdQt
+  (JNIEnv *env, jclass)
+{
+#ifdef RD_JAVA_UI_QT
+    QString localeName = QLocale::system().name();
+    jstring loc = env->NewString(localeName.utf16(), localeName.size());
+    return loc;
+#else // RD_JAVA_UI_QT
+    (void)env;     // just to suppress a warning
+    return NULL;
+#endif // RD_JAVA_UI_QT
+}
--- a/javacommons/utils/src/javacommonutils.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/src/javacommonutils.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -277,6 +277,34 @@
     return result;
 }
 
+OS_EXPORT std::wstring JavaCommonUtils::wbase64encode(const std::wstring& aData)
+{
+    BIO* b64  = BIO_new(BIO_f_base64());
+    if (NULL == b64)
+    {
+        return L"";
+    }
+    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+    BIO* bmem = BIO_new(BIO_s_mem());
+
+    b64 = BIO_push(b64, bmem);
+    BIO_write(b64, aData.c_str(), aData.length() * 2);
+    BIO_flush(b64);
+
+    BUF_MEM* bptr;
+    BIO_get_mem_ptr(b64, &bptr);
+
+    std::wstring result;
+    // convert each char to wchar
+    for (int i = 0; i < bptr->length; i++)
+    {
+        result.push_back((wchar_t)*(bptr->data + i));
+    }
+    BIO_free_all(b64);
+
+    return result;
+}
+
 OS_EXPORT std::string JavaCommonUtils::base64decode(const std::string& aData)
 {
     BIO* b64  = BIO_new(BIO_f_base64());
--- a/javacommons/utils/src/logger.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javacommons/utils/src/logger.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -30,6 +30,10 @@
 #include <sstream>
 #include <iomanip>
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include "jdebug_omj.h"
 #include "logger.h"
 #include "javacommonutils.h"
--- a/javaextensions/datagram/datagram/build/javadatagram.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/datagram/datagram/build/javadatagram.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -21,6 +21,6 @@
 
 INCLUDEPATH += ../../inc
 
-LIBS += -ljavadatagramscplugin -ljavagcf
+LIBS += -ljavadatagramscplugin -ljavagcf -ljavasocket
 
 include(../../../../build/omj.pri)
--- a/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/datagram/UDPDatagramConnectionImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/datagram/UDPDatagramConnectionImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -297,7 +297,33 @@
         {
             throw new IOException("getLocalAddress failed: connection is already closed");
         }
-        retVal = _getLocalAddress(iNativePeerHandle, address);
+        int apId = -1;
+        int apType = -1;
+        try
+        {
+
+            Uid appSuite = ApplicationInfo.getInstance().getSuiteUid();
+            iCmInstance = ConnectionManager.getInstance();
+            AccessPoint apn = iCmInstance.getApplicationDefault(appSuite);
+            if (apn != null)
+            {
+                apId = apn.getNapId();
+                apType = apn.getType();
+
+                if ((apType!=AccessPoint.NAP_SNAP) && (apType!=AccessPoint.NAP_IAP))
+                {
+                    apType = -1;
+                    apId = -1;
+                }
+                Logger.LOG(Logger.ESOCKET, Logger.EInfo,
+                           "+SocketServerConnectionImpl:: getApplicationDefault returned,  \n"+apn.getNapId()+" type = "+apn.getType());
+            }
+        }
+        catch (Exception e)
+        {
+
+        }
+        retVal = _getLocalAddress(iNativePeerHandle, address, apId, apType);
         if (retVal < 0)
         {
             throw new IOException("getLocalAddress method failed.Posix error code: " + retVal);
@@ -512,7 +538,7 @@
     public Datagram newDatagram(byte[] aBuf, int aSize, String aAddr)
     throws IOException
     {
-
+        DatagramImpl tmp = null;
         if (!iConnectionOpen)
         {
             throw new IOException("newDatagram failed: connection is already closed");
@@ -524,9 +550,21 @@
         if (aAddr != null)
         {
             UrlParser urlvalidation = new UrlParser(aAddr);
+            tmp = new DatagramImpl(aBuf, aSize, aAddr);
         }
-        DatagramImpl t = new DatagramImpl(aBuf, aSize, aAddr);
-        return t;
+        else
+        {
+            String tmpAddr = null;
+            if (iUri != null)   // server datagram if iUri = null
+            {
+                if (iUri.host != null) // server datagram is host is null
+                {
+                    tmpAddr = iUri.toString();
+                }
+            }
+            tmp = new DatagramImpl(aBuf, aSize, tmpAddr);
+        }
+        return tmp;
     }
 
     Finalizer registerforFinalization()
@@ -571,7 +609,7 @@
                              int length, String host, int port);
     private native int _receive(int iNativePeerHandle, byte[] buf, int offset,
                                 int length, String[] senderAddr, int[] senderPort);
-    private native int _getLocalAddress(int iNativePeerHandle, String[] address);
+    private native int _getLocalAddress(int iNativePeerHandle, String[] address, int aIapId, int aType);
     private native int _getLocalPort(int iNativePeerHandle);
     private native int _close(int iNativePeerHandle);
     private native void _dispose(int iNativePeerHandle);
--- a/javaextensions/datagram/datagram/src/datagramconnectionjni.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/datagram/datagram/src/datagramconnectionjni.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -23,6 +23,7 @@
 #include "logger.h"
 #include "pushexception.h"
 #include "pusherrorcodes.h"
+#include "socketlocalhostinfo.h"
 
 using namespace java;
 
@@ -99,16 +100,18 @@
 }
 
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_datagram_UDPDatagramConnectionImpl__1getLocalAddress
-(JNIEnv *aJni, jobject, jint nativePeerHandle, jobjectArray aAddress)
+(JNIEnv *aJni, jobject, jint /* nativePeerHandle */, jobjectArray aAddress, jint aMidletIapId, jint aApType)
 {
     char * addr = new char[256];
-    NativeDatagramConnection* datagramConn = reinterpret_cast<NativeDatagramConnection*>(nativePeerHandle);
-    int retVal = datagramConn->getLocalAddress(addr);
+
+    int err = SocketLocalHostInfo::getLocalAddress(0,addr,aMidletIapId,aApType);
+    PLOG2(ESOCKET, "getLocalAddress, ret = %d, addr = %s" , err, addr);
     jstring jnistring = aJni->NewStringUTF(addr);
     aJni->SetObjectArrayElement(aAddress, 0, jnistring);
     aJni->DeleteLocalRef(jnistring);
     delete[] addr;
-    return retVal;
+
+    return err;
 }
 
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_datagram_UDPDatagramConnectionImpl__1getLocalPort
--- a/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -98,6 +98,11 @@
 
         LOG(ESOCKET, EInfo, "Datagram client connection");
         mSockDesc = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+        struct sockaddr_in addr;
+        addr.sin_family = AF_INET;
+        addr.sin_addr.s_addr = htonl(INADDR_ANY);
+        int res = bind(mSockDesc, (struct sockaddr*) &addr, sizeof(addr));
+        LOG1(ESOCKET, EInfo, "Datagram client connection, bind returned %d",res);
 
         if (aApn != -1)
         {
--- a/javaextensions/location/position/src/cpositioner.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/location/position/src/cpositioner.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -156,10 +156,9 @@
     case KErrAccessDenied: // Fallthrough
     case KErrUnknown: // Used in MLFW
         // Position request was canceled
-    case KErrCancel: // Fallthrough
-        // Bad implementation but due to partial fixes this cannot be fixed
-        // at the moment. Correct when partial fixes are supported. Java tries
-        // to obtain location fixes until time specified in Java-side expires
+    case KErrCancel: // Fallthrough 
+        // Partial update feature is not supported. So Java tries to obtain
+        // location fixes until time specified in Java-side expires
         // Delay response so that repeated calls to getLocation do not steal
         // all CPU time
     default:
--- a/javaextensions/wma/mms/pushplugin/build/eabi/javammsscpluginu.def	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/wma/mms/pushplugin/build/eabi/javammsscpluginu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -26,4 +26,9 @@
 	_ZThn28_NK4java3wma22S60MmsServerConnection9getFilterEv @ 25 NONAME ; #<thunk>#
 	_ZN4java3wma22S60MmsServerConnection5closeEv @ 26 NONAME
 	_ZThn28_N4java3wma22S60MmsServerConnection5closeEv @ 27 NONAME
+	_ZN4java3wma22S60MmsServerConnectionD0Ev @ 28 NONAME
+	_ZN4java3wma22S60MmsServerConnectionD1Ev @ 29 NONAME
+	_ZN4java3wma22S60MmsServerConnectionD2Ev @ 30 NONAME
+	_ZThn28_N4java3wma22S60MmsServerConnectionD0Ev @ 31 NONAME
+	_ZThn28_N4java3wma22S60MmsServerConnectionD1Ev @ 32 NONAME
 
--- a/javaextensions/wma/mms/pushplugin/src.s60/s60mmsserverconnection.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/wma/mms/pushplugin/src.s60/s60mmsserverconnection.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -55,7 +55,7 @@
     return mmsConn;
 }
 
-S60MmsServerConnection::~S60MmsServerConnection()
+OS_EXPORT S60MmsServerConnection::~S60MmsServerConnection()
 {
     JELOG2(EWMA);
     delete mOpenMonitor;
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -21,6 +21,7 @@
 import java.security.PermissionCollection;
 import com.nokia.mj.impl.security.common.PermissionBase;
 import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
+import com.nokia.mj.impl.utils.Formatter;
 
 public class SMSPermissionImpl extends PermissionBase
 {
@@ -76,15 +77,24 @@
         }
         else if (iAction.compareTo("send") == 0)
         {
+            String prefix = "";
+            String formattedDestination = iDestination;
+            if (formattedDestination.startsWith("+"))
+            {
+                formattedDestination = iDestination.substring(1);
+                prefix = "+";
+            }
+            formattedDestination = prefix + Formatter.formatDigits(formattedDestination);
             if (iNumberOfSegments > 1)
             {
                 return (SecurityPromptMessage.getInstance()).getText(
                            SecurityPromptMessage.QUESTION_ID_SMS_SENDING,
-                           new Object[] {new Integer(iNumberOfSegments),iDestination});
+                           new Object[] {new Integer(iNumberOfSegments),
+                           formattedDestination});
             }
             return (SecurityPromptMessage.getInstance()).getText(
                        SecurityPromptMessage.QUESTION_ID_SMS_SINGLE_SENDING,
-                       new Object[] {iDestination});
+                       new Object[] {formattedDestination});
         }
         return null;
     }
--- a/javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -26,6 +26,12 @@
 // Use bytepair compression to enable code paging
 PAGED
 
+APP_LAYER_SYSTEMINCLUDE
+
+#ifndef RD_JAVA_S60_RELEASE_9_2
+SYSTEMINCLUDE   /epoc32/include/ecom    // Due to SchemeHandler.inl in 5.0 2009w18 and 10.1 builds
+#endif
+
 SOURCEPATH  ../src
 
 SOURCE  javaapphandler.cpp
@@ -37,9 +43,6 @@
 
 USERINCLUDE     ../inc
 
-SYSTEMINCLUDE   /epoc32/include/ecom
-APP_LAYER_SYSTEMINCLUDE
-
 
 LIBRARY     euser.lib
 LIBRARY     ecom.lib
--- a/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -44,13 +44,12 @@
 SOURCE                  apparcbackuputil.cpp
 SOURCE                  javastoragebackuputil.cpp
 SOURCE                  javaversionbackuputil.cpp
+SOURCE                  mediaidupdater.cpp
 
 USERINCLUDE             ../src.s60
 USERINCLUDE             ../../inc.s60
 USERINCLUDE             ../../../../inc
 
-SYSTEMINCLUDE           /epoc32/include/connect
-
 start resource          ../data/10282474.rss
 TARGET                  midp2backupplugin.rsc
 end
@@ -64,6 +63,7 @@
 LIBRARY                 apparc.lib
 LIBRARY                 estlib.lib
 LIBRARY                 javaenvinfo.lib
+LIBRARY                 javafileutils.lib
 
 #if defined(WINSCW)
   deffile ./bwins/backup.def
--- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -19,6 +19,7 @@
 #include "javastoragebackuputil.h"
 #include "midp2backupplugin.h"
 #include "midp2backupdataids.h"
+#include "mediaidupdater.h"
 
 #include "javastorageentry.h"
 #include "javastorage.h"
@@ -171,6 +172,10 @@
             User::Leave(KErrGeneral);
         }
 
+        // ensure that storage contains correct removable media ids
+        MediaIdUpdater updater;
+        updater.update();
+
         // Storage restore is over; Set state to EAppArc
         aRestoreState = EAppArc;
         aBufferSpaceLeft = iBufferSpaceLeft;
@@ -881,6 +886,9 @@
 
             attribute.setEntry(ON_SCREEN_KEYPAD, iStringVector[count++]);
             insertEntry.insert(attribute);
+            
+            attribute.setEntry(SECURITY_WARNINGS, iStringVector[count++]);
+            insertEntry.insert(attribute);
 
             try
             {
@@ -1620,6 +1628,16 @@
             str = (*findIterator).entryValue();
         }
         iStringVector.push_back(str);
+        
+        attribute.setEntry(SECURITY_WARNINGS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
 
         rowsCount++;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup/src.s60/mediaidupdater.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MediaIdUpdater
+*
+*/
+
+
+#include <algorithm>
+#include <memory>
+
+#include "mediaidupdater.h"
+#include "logger.h"
+#include "javacommonutils.h"
+#include "driveutilities.h"
+#include "javastorageentry.h"
+#include "javastorage.h"
+#include "javastoragenames.h"
+
+using namespace java::backup;
+using namespace java::storage;
+using namespace java::util;
+
+
+MediaIdUpdater::MediaIdUpdater() : mStorage(0)
+{
+}
+
+MediaIdUpdater::~MediaIdUpdater()
+{
+    close();
+}
+
+/**
+* Ensures that java storage does not contain media ids that are not valid any more.
+* Media id updating is done in following steps:
+*   - get media ids from storage
+*   - get present (valid) media ids
+*   - get difference between storage and present ids (result is invalid ids that need to be updated)
+*   - update invalid media ids with valid ids
+* @param -
+* @return -
+*/
+void MediaIdUpdater::update()
+{
+    try
+    {
+        open();
+        std::set<std::wstring> storageIds = getMediaIdsFromStorage();
+        std::set<std::wstring> presentIds = getPresentMediaIds();
+
+        std::set<std::wstring> invalidIds = removePresentMediaIds(storageIds, presentIds);
+        std::set<std::wstring> validIds = getPresentRemovableDriveMediaIds();
+
+        if (isMediaIdUpdateNeeded(invalidIds, validIds))
+        {
+            updateMediaIds(invalidIds, validIds);
+        }
+        close();
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG1(EBackup, "MediaIdUpdater::update() failed: %S", jse.toString().c_str());
+    }
+}
+
+/**
+* Gets present media ids. Result includes phone, internal and mass memory drive ids if any
+* @param -
+* @return present media ids
+*/
+std::set<std::wstring> MediaIdUpdater::getPresentMediaIds()
+{
+    std::set<std::wstring> result;
+
+    java::fileutils::driveInfos drives;
+    java::fileutils::DriveUtilities::getAccesibleDrives(drives);
+
+    PLOG1(EBackup, "getPresentMediaIds(count=%d)", drives.size());
+    for (java::fileutils::driveInfos::const_iterator iter = drives.begin(); iter != drives.end(); iter++)
+    {
+        PLOG2(EBackup, "  %S - id=%d", (*iter).iRootPath.c_str(), (*iter).iId);
+        std::wstring mediaId = JavaCommonUtils::intToWstring((*iter).iId);
+        result.insert(mediaId);
+    }
+
+    result.insert(L"0"); // default set by javainstaller for internal drives
+    return result;
+}
+
+/**
+* Gets present removable media ids. Result mass memory drive ids if any
+* @param -
+* @return present removable media ids
+*/
+std::set<std::wstring> MediaIdUpdater::getPresentRemovableDriveMediaIds()
+{
+    std::set<std::wstring> result;
+
+    java::fileutils::driveInfos drives;
+    java::fileutils::DriveUtilities::getAccesibleDrives(drives);
+
+    PLOG1(EBackup, "getPresentRemovableDriveMediaIds(count=%d)", drives.size());
+    for (java::fileutils::driveInfos::const_iterator iter = drives.begin(); iter != drives.end(); iter++)
+    {
+        if ((*iter).iIsRemovable)
+        {
+            PLOG2(EBackup, "  %S - id=%d", (*iter).iRootPath.c_str(), (*iter).iId);
+            std::wstring mediaId = JavaCommonUtils::intToWstring((*iter).iId);
+            result.insert(mediaId);
+        }
+    }
+
+    return result;
+}
+
+/**
+* Filters present media ids from given set.
+* @param[in] aStorageIds original media ids
+* @param[in] aPresentIds present media ids
+* @return set of media ids that are invalid i.e. not present at the moment
+*/
+std::set<std::wstring> MediaIdUpdater::removePresentMediaIds(const std::set<std::wstring>& aStorageIds,
+                                           const std::set<std::wstring>& aPresentIds)
+{
+    std::set<std::wstring> result;
+
+    std::set_difference(aStorageIds.begin(), aStorageIds.end(),
+                        aPresentIds.begin(), aPresentIds.end(),
+                        std::inserter(result, result.end()));
+
+    return result;
+}
+
+/**
+* Checks if there is a need for updating given media ids
+* @param[in] aInvalidIds media ids to be updated
+* @param[in] aValidIds valid ids used during update
+* @return true, if media ids need to be updated, false otherwise
+*/
+bool MediaIdUpdater::isMediaIdUpdateNeeded(const std::set<std::wstring>& aInvalidIds,
+                           const std::set<std::wstring>& aValidIds)
+{
+    if(aInvalidIds.size() > 0 && aValidIds.size() > 0)
+    {
+        return true;
+    }
+    return false;
+}
+
+/**
+* Gets media ids that can be found from java storage.
+* @param -
+* @return media ids found from java storage
+*/
+std::set<std::wstring> MediaIdUpdater::getMediaIdsFromStorage()
+{
+    std::set<std::wstring> result;
+
+    JavaStorageEntry attribute;
+    attribute.setEntry(MEDIA_ID, L"");
+
+    JavaStorageApplicationEntry_t findQuery;
+    findQuery.insert(attribute);
+
+    JavaStorageApplicationList_t foundEntries;
+
+    mStorage->search(APPLICATION_PACKAGE_TABLE, findQuery, foundEntries);
+    PLOG1(EBackup, "getMediaIdsFromStorage(count=%d)", foundEntries.size());
+    for (JavaStorageApplicationList_t::const_iterator iter = foundEntries.begin(); iter != foundEntries.end(); iter++)
+    {
+        std::wstring id = (*iter).begin()->entryValue();
+        PLOG1(EBackup, "  id=%S", id.c_str());
+        result.insert(id);
+    }
+
+    return result;
+}
+
+/**
+* Updates given media ids with new values and saves the result in java storage.
+* @param[in] aInvalidIds media ids to be updated
+* @param[in] aValidIds valid ids used during update
+* @return -
+*/
+void MediaIdUpdater::updateMediaIds(const std::set<std::wstring>& aInvalidIds,
+                    const std::set<std::wstring>& aValidIds)
+{
+    if (aValidIds.size() == 0)
+    {
+        return;
+    }
+    // use the first present media id for all
+    std::wstring newId = *(aValidIds.begin());
+
+    mStorage->startTransaction();
+
+    PLOG1(EBackup, "updateMediaIds(count=%d)", aInvalidIds.size());
+    for (std::set<std::wstring>::const_iterator iter = aInvalidIds.begin(); iter != aInvalidIds.end(); ++iter)
+    {
+        std::wstring origId = (*iter).c_str();
+        PLOG2(EBackup, "  origId=%S - newId=%S", origId.c_str(), newId.c_str());
+
+        JavaStorageEntry attribute;
+        attribute.setEntry(MEDIA_ID, newId);
+
+        JavaStorageApplicationEntry_t updateEntry;
+        updateEntry.insert(attribute);
+
+        JavaStorageApplicationEntry_t matchEntry;
+        attribute.setEntry(MEDIA_ID, origId);
+        matchEntry.insert(attribute);
+
+        mStorage->update(APPLICATION_PACKAGE_TABLE, updateEntry, matchEntry);
+    }
+
+    mStorage->commitTransaction();
+}
+
+/**
+* Opens java storage connection
+* @param -
+* @return -
+*/
+void MediaIdUpdater::open()
+{
+    close();
+    mStorage = JavaStorage::createInstance();
+    mStorage->open(JAVA_DATABASE_NAME);
+}
+
+/**
+* Closes java storage connection
+* @param -
+* @return -
+*/
+void MediaIdUpdater::close()
+{
+    try
+    {
+        if (mStorage)
+        {
+            mStorage->close();
+            delete mStorage;
+            mStorage = 0;
+        }
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG1(EBackup, "MediaIdUpdater::close() failed: %S", jse.toString().c_str());
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup/src.s60/mediaidupdater.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MediaIdUpdater
+*
+*/
+
+
+#ifndef MEDIAIDUPDATER_H
+#define MEDIAIDUPDATER_H
+
+#include <string>
+#include <set>
+
+namespace java
+{
+namespace storage
+{
+    class JavaStorage;
+}
+namespace backup
+{
+
+/**
+* MediaIdUpdater is responsible for ensuring that java storage contains
+* valid media ids after restore.
+* Media id may change in following situations:
+*   - memory card is formatted between backup and restore
+*   - another memory card is used during restore than originally
+*/
+
+class MediaIdUpdater
+{
+public:
+    MediaIdUpdater();
+    virtual ~MediaIdUpdater();
+
+    /**
+    * Updates media ids to valid values if needed
+    * Note: this method must be called after java storage is restored
+    */
+    virtual void update();
+
+protected:
+    virtual std::set<std::wstring> getPresentMediaIds();
+    virtual std::set<std::wstring> getPresentRemovableDriveMediaIds();
+    virtual std::set<std::wstring> removePresentMediaIds(const std::set<std::wstring>& aStorageIds,
+                                                         const std::set<std::wstring>& aPresentIds);
+    virtual bool isMediaIdUpdateNeeded(const std::set<std::wstring>& aInvalidIds,
+                                       const std::set<std::wstring>& aValidIds);
+    virtual std::set<std::wstring> getMediaIdsFromStorage();
+    virtual void updateMediaIds(const std::set<std::wstring>& aInvalidIds,
+                                const std::set<std::wstring>& aValidIds);
+
+    virtual void open();
+    virtual void close();
+
+    java::storage::JavaStorage* mStorage;
+};
+
+} // namespace backup
+} // namespace java
+
+#endif // MEDIAIDUPDATER_H
--- a/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -29,7 +29,7 @@
 #include "javacommonutils.h"
 #include "logger.h"
 
-#include <sbdefs.h>
+#include <connect/sbdefs.h>
 #include <s32mem.h>
 #include <s32file.h>
 #include <f32file.h>
@@ -474,14 +474,14 @@
         CleanupStack::PushL(fileMan);
 
         // Copy to new place
-        iFs.MkDir(path_new);
+        TInt err = iFs.MkDir(path_new);
+        ILOG2(EBackup, "MkDir, status: %d, path=%S", err, path_new.PtrZ());
+
         path_old.Append(KStarWildCard);
-        TInt  err = fileMan->Copy(path_old, path_new);
+        err = fileMan->Copy(path_old, path_new);
 
         ILOG1(EBackup, "File copy, status: %d", err);
 
-        User::LeaveIfError(err);
-
         CleanupStack::PopAndDestroy();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/build/bld.inf	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  bld.inf file for Midp2BackupPlugin
+*
+*/
+
+
+PRJ_MMPFILES
+midp2backupplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/build/bwins/backupu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/build/eabi/backupu.def	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+	_ZTIN4java6backup17CAppArcBackupUtilE @ 2 NONAME
+	_ZTIN4java6backup18CMidp2BackupPluginE @ 3 NONAME
+	_ZTIN4java6backup18CStorageBackupUtilE @ 4 NONAME
+	_ZTVN4java6backup17CAppArcBackupUtilE @ 5 NONAME
+	_ZTVN4java6backup18CMidp2BackupPluginE @ 6 NONAME
+	_ZTVN4java6backup18CStorageBackupUtilE @ 7 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for MIDP2 Backup Plugin
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+#include <../../../../inc/java_stdcpp_support_for_dll.hrh>
+#include <../../../../inc/project_defines.hrh>
+
+TARGET                  midp2backupplugin.dll
+TARGETTYPE              plugin
+UID                     0x10009D8D 0x10282474
+
+#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+CAPABILITY              CAP_ECOM_PLUGIN TrustedUI
+#else
+// SBE has lesser capability set on beta release.
+CAPABILITY              CAP_ECOM_PLUGIN WriteDeviceData
+#endif
+
+VENDORID                VID_DEFAULT
+
+PAGED
+
+SOURCEPATH              ../src.s60
+SOURCE                  proxy.cpp
+SOURCE                  apparcbackuputil.cpp
+SOURCE                  javastoragebackuputil.cpp
+SOURCE                  javaversionbackuputil.cpp
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+SOURCE                  javascrbackuputil.cpp
+SOURCE                  midp2backuppluginusif.cpp
+#else
+SOURCE                  midp2backupplugin.cpp
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+USERINCLUDE             ../src.s60
+USERINCLUDE             ../../inc.s60
+USERINCLUDE             ../../../../inc
+
+start resource          ../data/10282474.rss
+TARGET                  midp2backupplugin.rsc
+end
+
+LIBRARY                 ecom.lib 
+LIBRARY                 efsrv.lib
+LIBRARY                 javastorage.lib
+LIBRARY                 sysutil.lib
+LIBRARY                 apgrfx.lib
+LIBRARY                 apparc.lib
+LIBRARY                 estlib.lib
+LIBRARY                 javaenvinfo.lib
+LIBRARY                 estor.lib
+LIBRARY                 ipcstream.lib
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+LIBRARY                 scrclient.lib
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+#if defined(WINSCW)
+  deffile ./bwins/backup.def
+#else
+  deffile ./eabi/backup.def
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/data/10282474.rss	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file for the Ecom plugin of Java Backup
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include "javauids.h"
+
+// Declares info for one implementation
+RESOURCE REGISTRY_INFO theInfo
+{
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    // UID for the DLL
+    dll_uid = KBackupMidp2DllUid;
+    // Declare array of interface info
+    interfaces = {
+                  INTERFACE_INFO
+                  {
+                      // UID of interface that is implemented
+                      interface_uid = KBackupEcomIfUid;
+                      implementations = {
+                                         // Info for CImplementation1
+                                         IMPLEMENTATION_INFO
+                                         {
+                                             implementation_uid = KBackupEcomImplUid;
+                                             version_no = 1;
+                                             display_name = "MIDP2 Backup Plugin";
+                                             default_data = "midp2";
+                                             opaque_data = "test_params";
+                                             rom_only  =  0;
+                                         }
+                                        };
+                  }
+                 };
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/apparcbackuputil.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,550 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CAppArcBackupUtil
+*
+*/
+
+
+#include "apparcbackuputil.h"
+#include "javaapparcutil.h"
+
+#include "javasymbianoslayer.h"
+#include "javauid.h"
+#include "logger.h"
+#include "javacommonutils.h"
+#include "s60commonutils.h"
+
+#include <apgcli.h>
+#include <wchar.h>
+#include <s32mem.h>
+#include <sysutil.h>
+#include <f32file.h>
+
+#include <memory>
+#include <string>
+
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <apgicnfl.h>
+#else
+#include <apgicnflpartner.h>
+#endif
+
+
+using namespace std;
+using namespace java::storage;
+using namespace java::backup;
+
+const TUid  KMidletApplicationTypeUid = { 0x10210E26 };
+_LIT(KDefaultFolder, "");
+
+// ======== MEMBER FUNCTIONS ========
+
+CAppArcBackupUtil::CAppArcBackupUtil()
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil constructor");
+}
+
+void CAppArcBackupUtil::ConstructL(RFs& aFs)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::ConstructL");
+
+    User::LeaveIfError(iApparcServer.Connect());
+
+    iNumberOfIcons = 0;
+    iFs = aFs;
+}
+
+
+CAppArcBackupUtil* CAppArcBackupUtil::NewL(RFs& aFs)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::NewL");
+
+    CAppArcBackupUtil* self = new(ELeave) CAppArcBackupUtil();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFs);
+    CleanupStack::Pop();
+
+    return self;
+}
+
+
+CAppArcBackupUtil::~CAppArcBackupUtil()
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil destructor");
+
+    iApparcServer.Close();
+}
+
+
+void CAppArcBackupUtil::RegisterAppL(TPtr8& aRestoreIconPtr, TDriveNumber& aDrive)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::RegisterApp");
+
+    RDesReadStream stream(aRestoreIconPtr);
+    CleanupClosePushL(stream);
+
+    // Read Uid
+    int midletUid = stream.ReadUint32L();
+
+    if (!CheckIfAlreadyRegisteredL(midletUid))
+    {
+        // Read filename
+        TInt32 fileNameSize = stream.ReadInt32L();
+        HBufC* fileName = HBufC::NewL(fileNameSize);
+        CleanupStack::PushL(fileName);
+        TPtr16 fileNamePtr = fileName->Des();
+        stream.ReadL(fileNamePtr, fileNameSize / 2);   // half of size
+
+        // Read number of icons
+        TInt numberOfIcons = stream.ReadInt32L();
+//        numberOfIcons = 1;
+        //LOG1(EBackup, EInfo, "Number of Icons = %d", numberOfIcons);
+
+        TInt groupNameSize = stream.ReadInt32L();
+        TBuf<KApaMaxAppGroupName> groupName;
+
+        if (groupNameSize != 0)
+        {
+            stream.ReadL(groupName, groupNameSize / 2);
+        }
+
+        // check disk space
+        TInt index = sizeof(TUint32)    // midletUid
+                     + sizeof(TInt32)                // size of fileNameSize
+                     + fileNameSize                  // size of filename
+                     + sizeof(TInt32)                // size of numberOfIcons
+                     + sizeof(TInt32)                // group name size
+                     + groupNameSize;                // groupname
+
+        if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, aRestoreIconPtr.Size() - index, aDrive))
+        {
+            ELOG(EBackup, "Disk space below critical level. Leaving with KErrDiskFull.");
+            User::Leave(KErrDiskFull);
+        }
+
+        // Make directory if necessary
+        iFs.CreatePrivatePath(aDrive);
+
+        // Make full path of temporary icon file
+        TPath tempPath;
+        TPath tempPrivatePath;
+        iFs.PrivatePath(tempPrivatePath);
+
+        TDriveUnit* driveUnit = new(ELeave) TDriveUnit(aDrive);
+        CleanupStack::PushL(driveUnit);
+
+        tempPath.Append(driveUnit->Name().Left(1));
+        tempPath.Append(KDriveDelimiter);
+        tempPath.Append(tempPrivatePath);
+        tempPath.Append(fileNamePtr);
+
+        // Set private session path to point same drive where restoring
+        iFs.SetSessionToPrivate(aDrive);
+
+
+        RFile iconFile;
+        User::LeaveIfError(iconFile.Create(iFs, fileNamePtr, EFileWrite));
+
+        CleanupStack::PopAndDestroy(fileName);
+        CleanupClosePushL(iconFile);
+
+        iconFile.Write(aRestoreIconPtr.Mid(index));
+
+        // Register application
+        LOG1(EBackup,EInfo,"Registering app %d", midletUid);
+        TUid uid = TUid::Uid(midletUid);
+        TBuf<128>   appName;
+        CJavaApparcUtil::AppName(uid, appName);
+
+        CApaRegistrationResourceFileWriter* writer =
+            CApaRegistrationResourceFileWriter::NewL(uid,
+                    appName,
+                    TApaAppCapability::ENonNative);
+        CleanupStack::PushL(writer);
+
+        const TInt  KOpaqueDataLength = 4;
+        TBuf8<KOpaqueDataLength>    opaqueData;
+        RDesWriteStream             writeStream(opaqueData);
+        CleanupClosePushL(writeStream);
+
+        LOG(EBackup, EInfo, "Getting midlet entry");
+
+        JavaStorageApplicationEntry_t appEntries = StorageEntryL(uid);
+
+        if (appEntries.size() == 0)
+        {
+            ELOG(EBackup, "No midlet entry found in Java Storage; Mismatch between AppArc and Storage data. Abort backup");
+            User::Leave(KErrNotFound);
+        }
+
+        JavaStorageEntry attribute;
+        attribute.setEntry(NAME, L"");
+
+        // Get Name attribute from read attributes.
+        JavaStorageApplicationEntry_t::const_iterator findIterator = appEntries.find(attribute);
+        wstring midName;
+
+        if (findIterator != appEntries.end())
+        {
+            midName = (*findIterator).entryValue();
+
+        }
+        else
+        {
+            User::Leave(KErrBadHandle);
+        }
+
+        appEntries.clear();
+
+        HBufC* tempstr = java::util::S60CommonUtils::wstringToDes(midName.c_str());
+        TPtrC midletName = tempstr->Des();
+
+        if (groupNameSize != 0)
+        {
+            writer->SetGroupNameL(groupName);
+        }
+        else
+        {
+            writer->SetGroupNameL(KDefaultFolder);
+        }
+
+        writeStream.WriteUint32L(midletUid);
+        writeStream.CommitL();
+
+        LOG(EBackup, EInfo, "Setting opaque data");
+        writer->SetOpaqueDataL(opaqueData);
+
+        CApaLocalisableResourceFileWriter*  lWriter =
+            CApaLocalisableResourceFileWriter::NewL(KNullDesC,
+                                                    midletName,
+                                                    numberOfIcons,
+                                                    KNullDesC);
+        CleanupStack::PushL(lWriter);
+
+        // Prepare AppArc for deregistration
+        LOG(EBackup, EInfo, "PrepareNonNativeApplicationsUpdatesL");
+        iApparcServer.PrepareNonNativeApplicationsUpdatesL();
+
+        // Register application
+        LOG(EBackup, EInfo, "RegisterNonNativeApplicationL");
+        iApparcServer.RegisterNonNativeApplicationL(KMidletApplicationTypeUid,
+                aDrive,
+                *writer,
+                lWriter,
+                &iconFile);
+
+        // Commit registration changes
+        LOG(EBackup, EInfo, "CommitNonNativeApplicationsUpdatesL");
+        iApparcServer.CommitNonNativeApplicationsUpdatesL();
+
+        delete tempstr;
+        CleanupStack::PopAndDestroy(lWriter);
+        CleanupStack::PopAndDestroy(&writeStream);
+        CleanupStack::PopAndDestroy(writer);
+        iconFile.Close();
+        CleanupStack::PopAndDestroy(&iconFile);
+
+        TInt err = iFs.Delete(tempPath);
+        LOG1(EBackup, EInfo, "iFs.Delete err = %d", err);
+        CleanupStack::PopAndDestroy(driveUnit);
+    }
+
+    CleanupStack::PopAndDestroy(&stream);
+}
+
+
+void CAppArcBackupUtil::DeregisterAppsL(TDriveNumber aDrive)
+{
+    LOG1(EBackup, EInfo, "CAppArcBackupUtil::DeregisterApps, drive: %d", aDrive);
+
+    // Initialise the process of getting apps
+    iApparcServer.GetFilteredApps(TApaAppCapability::ENonNative,
+                                  TApaAppCapability::ENonNative);
+
+    // Getting the apps one-by-one
+    TApaAppInfo* info = new(ELeave) TApaAppInfo();
+    CleanupStack::PushL(info);
+
+    TUid typeUid;
+
+    // Prepare AppArc for deregistration
+    LOG(EBackup, EInfo, "PrepareNonNativeApplicationsUpdatesL");
+    iApparcServer.PrepareNonNativeApplicationsUpdatesL();
+
+    while (!iApparcServer.GetNextApp((*info)))
+    {
+        LOG1(EBackup, EInfo, "Getting Next App from AppArc, UID = %d", info->iUid);
+
+        // Getting the type of the application
+        iApparcServer.GetAppType(typeUid, info->iUid);
+
+        // If it's a MIDlet, check if it has an entry in Java Registry
+        TInt drive = 0;
+        GetDriveOfApp(info->iFullName, drive);
+
+        if (typeUid == KMidletApplicationTypeUid && drive == aDrive)
+        {
+            LOG1(EBackup, EInfo, "Checking registry, midlet id = %d", info->iUid);
+            wstring PackageID;
+            // If there's no entry on the drive, deregister it from AppArc
+            JavaStorageApplicationEntry_t appEntries = StorageEntryL(info->iUid);
+
+            if (appEntries.size() != 0)
+            {
+                JavaStorageEntry attribute;
+                attribute.setEntry(PACKAGE_ID, L"");
+
+                JavaStorageApplicationEntry_t::const_iterator findIterator = appEntries.find(attribute);
+
+                if (findIterator != appEntries.end())
+                {
+                    PackageID = (*findIterator).entryValue();
+                }
+                else
+                {
+                    User::Leave(KErrBadHandle);
+                }
+
+                if (GetDrivefromStorageL(PackageID) != aDrive)
+                {
+                    iApparcServer.DeregisterNonNativeApplicationL(info->iUid);
+                    LOG1(EBackup, EInfo, "Deregistering midlet id = %d", info->iUid);
+                }
+            }
+            else
+            {
+                LOG(EBackup, EInfo, "Midlet entry not found in Java Storage; Deregister the Application");
+                iApparcServer.DeregisterNonNativeApplicationL(info->iUid);
+                LOG1(EBackup, EInfo, "Deregistering midlet id = %d", info->iUid);
+            }
+            appEntries.clear();
+        }
+    }
+
+    // Commit registration changes
+    LOG(EBackup, EInfo, "CommitNonNativeApplicationsUpdatesL");
+    iApparcServer.CommitNonNativeApplicationsUpdatesL();
+    CleanupStack::PopAndDestroy(info);
+}
+
+
+void CAppArcBackupUtil::GetMidletsFromAppArcL(RArray<TUid>& aUidArray, TDriveNumber aDrive)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::GetMidletsFromAppArc");
+    CleanupClosePushL(aUidArray);
+
+    // Initialise the process of getting apps
+    iApparcServer.GetFilteredApps(TApaAppCapability::ENonNative,
+                                  TApaAppCapability::ENonNative);
+
+    // Getting the apps one-by-one
+    TApaAppInfo* info = new(ELeave) TApaAppInfo();
+    CleanupStack::PushL(info);
+
+    TUid typeUid;
+    LOG1(EBackup, EInfo, "Drive Number aDrive = %d", aDrive);
+
+    while (!iApparcServer.GetNextApp((*info)))
+    {
+        // Getting the type of the application
+        iApparcServer.GetAppType(typeUid, info->iUid);
+
+        // If it's a MIDlet, check if it's registered to this drive
+        if (typeUid == KMidletApplicationTypeUid)
+        {
+            JavaStorageApplicationEntry_t appEntries = StorageEntryL(info->iUid);
+
+            if (appEntries.size() != 0)
+            {
+                JavaStorageEntry attribute;
+                attribute.setEntry(PACKAGE_ID, L"");
+
+                JavaStorageApplicationEntry_t::const_iterator findIterator = appEntries.find(attribute);
+                wstring PackageID;
+
+                if (findIterator != appEntries.end())
+                {
+                    PackageID = (*findIterator).entryValue();
+
+                }
+                else
+                {
+                    User::Leave(KErrBadHandle);
+                }
+                appEntries.clear();
+
+                if (GetDrivefromStorageL(PackageID) == aDrive)
+                {
+                    aUidArray.AppendL(info->iUid);
+                    iNumberOfIcons++;
+                }
+            }
+            else
+            {
+                ELOG(EBackup, "No entries from registry; midlet does not exist");
+            }
+        }
+    }
+    CleanupStack::PopAndDestroy(info);
+    CleanupStack::Pop();
+
+}
+
+
+void CAppArcBackupUtil::GetIconFilename(TUid aUid, HBufC*& aFullFileName)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::GetIconFilename");
+
+    iApparcServer.GetAppIcon(aUid, aFullFileName);
+}
+
+TInt CAppArcBackupUtil::NumberOfIcons()
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::NumberOfIcons");
+
+    return iNumberOfIcons;
+}
+
+void CAppArcBackupUtil::NumberOfOwnDefinedIcons(TUid aUid, TInt& aIconCount)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::NumberOfOwnDefinedIcons");
+
+    iApparcServer.NumberOfOwnDefinedIcons(aUid, aIconCount);
+}
+
+TBool CAppArcBackupUtil::CheckIfAlreadyRegisteredL(TInt& aUid)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::CheckIfAlreadyRegisteredL");
+
+    TApaAppInfo* info = new(ELeave) TApaAppInfo();
+
+    TInt err = iApparcServer.GetAppInfo(*info, TUid::Uid(aUid));
+    delete info;
+    if (err == KErrNone)
+    {
+        return ETrue;
+    }
+    else
+    {
+        return EFalse;
+    }
+
+
+}
+
+void CAppArcBackupUtil::GetDriveOfApp(TFileName aPath, TInt& aDrive)
+{
+    LOG(EBackup, EInfo, "CAppArcBackupUtil::DriveOfApp");
+
+    iFs.CharToDrive(aPath[0], aDrive);
+}
+
+
+TApaAppGroupName CAppArcBackupUtil::GetMidletGroupName(TUid aUid)
+{
+    TApaAppCapabilityBuf cap;
+
+    TInt err = iApparcServer.GetAppCapability(cap, aUid);
+    return cap().iGroupName;
+}
+
+
+JavaStorageApplicationEntry_t CAppArcBackupUtil::StorageEntryL(const TUid& aMidletUID)
+{
+    auto_ptr<JavaStorage> js(JavaStorage::createInstance());
+
+    try
+    {
+        js->open(JAVA_DATABASE_NAME);
+        LOG(EBackup, EInfo, "Java database opened");
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG(EBackup, "Opening database connection failed");
+        User::Leave(KErrNotFound);
+    }
+
+    JavaStorageApplicationEntry_t entries;
+
+    java::util::Uid appUid;
+    TUidToUid(aMidletUID, appUid);
+
+    try
+    {
+        js->read(APPLICATION_TABLE, appUid, entries);
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG(EBackup, "Read in Java Storage failed");
+        js->close();
+        User::Leave(KErrGeneral);
+    }
+    js->close();
+
+    return entries;
+}
+
+TDriveNumber CAppArcBackupUtil::GetDrivefromStorageL(wstring& aPackageID)
+{
+    wchar_t Drive;
+    auto_ptr<JavaStorage> js(JavaStorage::createInstance());
+
+    try
+    {
+        js->open(JAVA_DATABASE_NAME);
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG(EBackup, "Opening database connection failed");
+        User::Leave(KErrNotFound);
+    }
+
+    JavaStorageApplicationEntry_t entries;
+    java::util::Uid PackageID(aPackageID);
+
+    try
+    {
+        js->read(APPLICATION_PACKAGE_TABLE, PackageID, entries);
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG(EBackup, "Read in Java Storage failed");
+        js->close();
+        User::Leave(KErrGeneral);
+    }
+
+    js->close();
+
+    JavaStorageEntry attribute;
+    attribute.setEntry(ROOT_PATH, L"");
+
+    JavaStorageApplicationEntry_t::const_iterator findIterator = entries.find(attribute);
+    wstring RootPath;
+
+    if (findIterator != entries.end())
+    {
+        RootPath = (*findIterator).entryValue();
+
+    }
+    else
+    {
+        User::Leave(KErrBadHandle);
+    }
+
+    Drive = (wchar_t)RootPath[0];
+    LOG1(EBackup, EInfo, "Drive = %c", Drive);
+    TInt i = Drive - (wchar_t)'a';
+    LOG1(EBackup, EInfo, "Drive = %d", (TDriveNumber)i);
+    return (TDriveNumber)i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/apparcbackuputil.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for CAppArcBackupUtil class
+*
+*/
+
+
+#ifndef APPARCBACKUPUTIL_H
+#define APPARCBACKUPUTIL_H
+
+#include <e32base.h>
+#include <apgcli.h>
+#include <apadef.h>
+
+#include "javastorage.h"
+#include "javastorageentry.h"
+#include "javastoragenames.h"
+
+namespace java
+{
+namespace backup
+{
+
+/**
+ *  CAppArcBackupUtil class is handling AppArc registrations during backup
+ *  and restore of Java Domain.
+ */
+class CAppArcBackupUtil : public CBase
+{
+
+public:
+
+    /**
+     * Instantiates an object of this type
+     */
+    static CAppArcBackupUtil* NewL(RFs& aFs);
+
+    ~CAppArcBackupUtil();
+
+    /**
+     * This method registers applications to AppArc during restore.
+     *
+     * @param restoreIconPtr the buffer which contains the Uid and the
+     *        icon file to be restored
+     * @param aDrive current drive to be restored
+     */
+    void RegisterAppL(TPtr8& aRestoreIconPtr, TDriveNumber& aDrive);
+
+    /**
+     * This method deregisters leftover applications from AppArc during
+     * restore.
+     * @param aDrive current drive to be restored
+     */
+    void DeregisterAppsL(TDriveNumber aDrive);
+
+    /**
+     * This method builds an array of the registered apps in AppArc.
+     *
+     * @param [out] aUidArray array of Midlet uids
+     * @param aDrive current drive to be backed up
+     */
+    void GetMidletsFromAppArcL(RArray<TUid>& aUidArray, TDriveNumber aDrive);
+
+    /**
+     * This method looks up the icon filename of the given midlet
+     *
+     * @param aUid Uid of Midlet
+     * @param [out] aFullFilename filename of icon file
+     */
+    void GetIconFilename(TUid aUid, HBufC*& aFullFilename);
+
+    /**
+     * This method gets the number of MIDlet icons registered to AppArc
+     * restore.
+     *
+     * @return iNumberOfIcons
+     */
+    TInt NumberOfIcons();
+
+    /**
+     * Gets the number of icons defined for a midlet from AppArc
+     *
+     * @param aUid Midlet Id
+     * @param [out] aIconCount number of icons defined for the midlet
+     */
+    void NumberOfOwnDefinedIcons(TUid aUid, TInt& aIconCount);
+
+    /**
+     * Gets an entry from Java Storage for the midlet uid specified
+     *
+     * @param midletUid Uid of the midlet
+     *
+     * @return returns the entry of the midlet
+     */
+    java::storage::JavaStorageApplicationEntry_t StorageEntryL(const TUid& aMidletUID);
+
+    /**
+     * Gets the Drive of the midlet suite for the specified UID
+     *
+     * @param packageID the ID of the application package
+     *
+     * @return returns the drive number of the application package
+     */
+
+    TDriveNumber GetDrivefromStorageL(std::wstring& aPackageID);
+
+    /**
+     * Gets the group name of the midlet for the pecified UID
+     *
+     * @param aUid the UID of the midlet
+     *
+     * @return returns the group name of the midlet
+     */
+
+    TApaAppGroupName GetMidletGroupName(TUid aUid);
+
+private:
+
+    CAppArcBackupUtil();
+
+    void ConstructL(RFs& aFs);
+
+    /**
+     * Checks if midlet is already registered to AppArc.
+     *
+     * @param aUid Uid of Midlet
+     * @return ETrue if midlet is already registered to AppArc
+     */
+    TBool CheckIfAlreadyRegisteredL(TInt& aUid);
+
+    /**
+     * Gets the drive of the Midlet based on the path
+     *
+     * @param aPath Full path of Midlet
+     * @param [out] aDrive the drive where the midlet is registered to
+     */
+    void GetDriveOfApp(TFileName aPath, TInt& aDrive);
+
+    /**
+     * Gets the index of the midlet in its midlet suite
+     *
+     * @param aMidletSuiteEntry Midlet suite
+     * @param aUid Midlet Id
+     * @return index of midlet in the suite
+     */
+    //TInt MidletIndexL( CJavaRegistrySuiteEntry &aMidletSuiteEntry,
+    //                   TUid aUid );
+
+
+private: // data
+
+    /**
+     * File session
+     * Not own.
+     */
+    RFs iFs;
+
+    /**
+     * Number of MIDlet icons registered to AppArc
+     * Own.
+     */
+    TInt iNumberOfIcons;
+
+    /**
+     * ApparcSession
+     * Own.
+     */
+    RApaLsSession iApparcServer;
+
+};
+
+} //namespace backup
+} //namespace java
+
+#endif // APPARCBACKUPUTIL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javaapparcutil.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CJavaApparcUtil definition.
+*
+*/
+
+
+#ifndef JAVAAPPARCUTIL_H
+#define JAVAAPPARCUTIL_H
+
+#include <e32base.h>
+
+namespace java
+{
+namespace backup
+{
+/**
+ * Common utilities for Apparc registration.
+ */
+class CJavaApparcUtil : public CBase
+{
+
+public:
+
+    /**
+     * Creates a reasonably unique executable name, since the UI Framework
+     * uses this as a key to look up the application opaque data.
+     *
+     * This name is not actually used to run the application, but it must
+     * look reasonably like an acceptable file name.
+     *
+     * @param aAppUid Uid of the application
+     * @param aAppName On return, it contains an unique executable name.
+     * Maximum length of this descriptor should be >= 20 or the function
+     * panics with USER 11.
+     */
+    static void inline AppName(const TUid aAppUid, TDes& aAppName);
+
+};
+
+} //namespace backup
+} //namespace java
+
+#include "javaapparcutil.inl"
+
+#endif // JAVAAPPARCUTIL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javaapparcutil.inl	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CJavaApparcUtil inline functions definition
+*
+*/
+
+
+using namespace java::backup;
+
+inline void CJavaApparcUtil::AppName(const TUid aAppUid, TDes& aAppName)
+{
+    _LIT(KPathSeperator, "\\");
+    _LIT(KAppPostfix, ".fakeapp");
+    aAppName.Copy(KPathSeperator);
+    aAppName.AppendNum(aAppUid.iUid);
+    aAppName.Append(KAppPostfix);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javascrbackuputil.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,1014 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CScrBackupUtil
+*
+*/
+
+#include "javascrbackuputil.h"
+#include "midp2backupdataids.h"
+
+#include "logger.h"
+#include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL
+
+#include <scs/nullstream.h>
+#include <e32cmn.h> 
+#include <apaid.h> //for TApaAppCapability::ENonNative
+#include <e32def.h>
+
+using namespace java::backup;
+using namespace Usif;
+
+// Properties registered to SCR.
+_LIT(KMIDletName, "MIDlet-Name");
+_LIT(KUid, "Uid");
+_LIT(KMediaId, "Media-Id");
+_LIT(KMIDletInfoURL, "MIDlet-Info-URL");
+_LIT(KMIDletDescription, "MIDlet-Description");
+_LIT(KDownloadURL, "Download-URL");
+_LIT(KSettingsPlugin, "SettingsName");
+_LIT(KMIDletDeletionConformation, "MIDlet-Delete-Confirm");
+
+_LIT(KDomainCategory,"Domain-Category");
+
+
+CScrBackupUtil* CScrBackupUtil::NewL()
+    {
+    LOG(EBackup,EInfo," --->  CScrBackupUtil:  NewL()");
+    
+    CScrBackupUtil *self = CScrBackupUtil::NewLC();
+   
+    CleanupStack::Pop(self);
+    
+    LOG(EBackup,EInfo," <--- CScrBackupUtil: NewL()");
+    return self;
+    }
+
+
+CScrBackupUtil* CScrBackupUtil::NewLC()
+    {
+    LOG(EBackup,EInfo," --->  CScrBackupUtil: NewLC");
+    CScrBackupUtil *self = new(ELeave) CScrBackupUtil();
+    CleanupStack::PushL(self); 
+    self->ConstructL();
+    LOG(EBackup,EInfo," <--- CScrBackupUtil: NewLC");
+    return self;
+    }
+
+CScrBackupUtil::CScrBackupUtil():iPtrToWriteBuffer(NULL,0)
+    {
+    LOG(EBackup,EInfo," --->  CScrBackupUtil: CScrBackupUtil");
+    LOG(EBackup,EInfo," <---  CScrBackupUtil: CScrBackupUtil");
+    }
+
+
+void CScrBackupUtil::ConstructL()
+    {
+        LOG(EBackup,EInfo," ---> CScrBackupUtil: ConstructL ");
+        
+        //will be incremented as and when needed
+        iRemainingInfo = HBufC8::NewL(4096);//TODO :need to change it to the total size of the the attribute
+        //iPtrToWriteBuffer = ((const_cast<TUint8*>(iRemainingInfo->Ptr())));// need to do this coz when fun end and goes to fetch next 4096 bytes i lose it
+        iPtrToWriteBuffer.Set(iRemainingInfo->Des());
+        iIsFristCall = ETrue;
+        
+        iState = EIsFetchCompleteInfo;
+        iIsToWriteInStream = ETrue;
+        LOG(EBackup,EInfo," <--- CScrBackupUtil: ConstructL()");
+    }
+void CScrBackupUtil::ConnectScrL()
+    {
+            LOG(EBackup,EInfo," ---> CScrBackupUtil: ConnectScrL()");
+            iScr = new RSoftwareComponentRegistry();
+            if (NULL == iScr)
+            {
+                ELOG(EBackup,"Creating RSoftwareComponentRegistry failed");
+                User::Leave(KErrGeneral);
+            }
+            
+            TInt err = iScr->Connect();
+            if (KErrNone != err)
+            {
+                ELOG1(EBackup,"Connecting to RSoftwareComponentRegistry failed, error %d",err);
+                //TODO need to see can we afford leaving here ;)
+                User::Leave(err);
+            }
+            LOG(EBackup,EInfo," <--- CScrBackupUtil: ConnectScrL()");
+    }
+void CScrBackupUtil::ExtractUidAndComponentIdL(RArray<Usif::TComponentId>& componentIds,RArray<TInt>& uids,TInt& ComponentsCount)
+    {
+        LOG(EBackup,EInfo," ---> CScrBackupUtil: ExtractUidAndComponentId()");
+        CComponentFilter* filter;
+        CPropertyEntry* property;
+        filter = CComponentFilter::NewLC();
+        //Set the filter for software type Usif::KSoftwareTypeJava and ftech the Ids
+        filter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
+        TRAPD(error,iScr->GetComponentIdsL(componentIds,filter));
+        if(error)
+            {
+            ELOG(EBackup,"Failed to get the components ID");
+            }
+        CleanupStack::PopAndDestroy(filter);
+        // fetch the no. of component from the given RArray
+        ComponentsCount = componentIds.Count();
+        // No use of Component Ids as such as they are used by SCR internally 
+        //so exctracted the UID of of each component
+        for(TInt i = 0 ;i < ComponentsCount ; i++)
+            {
+        
+                property = iScr->GetComponentPropertyL(componentIds.operator [](i),KUid());
+                if (property->PropertyType() == CPropertyEntry::EIntProperty)
+                        {
+                           TInt uid = ((CIntPropertyEntry*)property)->IntValue();
+                           uids.AppendL(uid);
+                             
+                        }
+                        else
+                        {
+                                 //Error
+                        }  
+                        
+                        delete property;
+                        property = NULL;
+                    
+            }
+        LOG(EBackup,EInfo," <--- CScrBackupUtil: ExtractUidAndComponentId()");
+    }
+void CScrBackupUtil::BackupScrDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft)
+    {
+        LOG(EBackup,EInfo," ---> CScrBackupUtil: BackupScrDataL()");
+        
+        iBufferSpaceLeft = aBufferSpaceLeft ;
+        
+        if(iIsFristCall)
+            {
+               
+                // to get no. of components need to keep a flag that its called only once
+                ConnectScrL();
+                
+                ExtractUidAndComponentIdL(iComponentIds,iUids,iNumberOfComponents);
+                
+                //write the no. of components so that it will help us in restoration time
+                aStream.WriteInt32L(iNumberOfComponents);
+                iBufferSpaceLeft -= sizeof(TInt32);
+                              
+                //all the ids of the midlets that are to be backedup and the size of the rarray with holds the Ids 
+                TPckgBuf<RArray<TInt> > ids(iUids);
+                TInt size = ComputeSizeL(ids);
+                aStream.WriteInt32L(size);
+                iBufferSpaceLeft -= sizeof(TInt32);
+                
+                aStream.WriteL(ids);
+                
+                iBufferSpaceLeft = iBufferSpaceLeft - size;
+        
+                iIsFristCall = EFalse;
+            }    
+                
+            for( i ; i < iComponentIds.Count() ;)
+                {
+                    if(iState == EIsFetchCompleteInfo)
+                        {
+                            
+                            TInt at = iComponentIds.operator[](i);
+                            
+                            //Temp stream in which all attributes are backed up 
+                            RDesWriteStream writeStream;
+                            writeStream.Open(iPtrToWriteBuffer);
+                            
+                            GetComponentInfoL(at,writeStream);
+                            
+                            writeStream.CommitL();
+                            iLengthOfString = iPtrToWriteBuffer.Length();
+                            
+                            iWriteToStream = ETrue;
+                            
+                            // write the size, Used while restoring
+                            aStream.WriteInt32L(iLengthOfString);
+                            iBufferSpaceLeft = iBufferSpaceLeft - sizeof(TInt);
+                            
+                            
+                        }
+                    if(iState == EIsWriteCompleteInfo)
+                        {                           
+                         
+                            //writing the remaining information into the new buffer
+                            if(iBufferToWriteNextTime)
+                            {
+                                aStream.WriteL(iPtrToWriteBuffer,iRemainingBuffer);
+                                aStream.CommitL();
+                                LOG(EBackup, EInfo, "attributes written fully in the stream fetching for next component");
+                                    
+                                iBufferSpaceLeft = iBufferSpaceLeft - iRemainingBuffer;
+                                
+                                iBufferToWriteNextTime = EFalse;
+                                iState = EIsFetchCompleteInfo;
+                                
+                                iLengthOfString = 0; // to maintain the loop
+                                
+                                iWriteToStream = EFalse;
+                                i++;
+                            }
+                            // if the whole string cannot be writen, write part of it
+                            if (iLengthOfString > iBufferSpaceLeft && !iBufferToWriteNextTime)
+                            {
+                                
+                                iRemainingBuffer = iLengthOfString - iBufferSpaceLeft;
+                                
+                                aStream.WriteL(iPtrToWriteBuffer,iBufferSpaceLeft);
+                                aStream.CommitL();
+                                
+                                iBufferToWriteNextTime = ETrue;
+                                break;
+                            }
+                            // else write the complete string
+                            else if(iWriteToStream)
+                            {       aStream.WriteL(iPtrToWriteBuffer,iLengthOfString);
+                                    
+                                    aStream.CommitL();
+                                    iBufferSpaceLeft = iBufferSpaceLeft - iLengthOfString;
+                                    iState = EIsFetchCompleteInfo;
+                                    iLengthOfString = 0; // to maintain the loop 
+                                    i++;
+                            }
+                            
+                        }
+                }
+            // making it false to backup next component next time
+            if(i >= iComponentIds.Count())
+                aBackupNotFinished = EFalse; 
+            
+    }
+
+template <typename T>
+TInt CScrBackupUtil::ComputeSizeL(const T &aObject)
+    {
+        LOG(EBackup,EInfo," ---> computeSize() ");
+        TInt size(0);
+        RNullWriteStream nullstream;
+        CleanupClosePushL(nullstream);
+        nullstream << aObject;
+        nullstream.CommitL();
+        size = nullstream.BytesWritten();
+     
+        CleanupStack::PopAndDestroy(&nullstream);
+        LOG(EBackup,EInfo," <--- computeSize() ");
+        return size;
+       
+        
+    }
+void CScrBackupUtil::GetComponentInfoL(TComponentId aComponentId ,RDesWriteStream& aStream )
+    {
+        
+        LOG(EBackup,EInfo," ---> GetComponentInfo() ");
+        
+        TInt j = 0 ;
+        CPropertyEntry* property;
+        CComponentEntry* entries = CComponentEntry::NewL();
+        CleanupStack::PushL(entries);
+        TLanguage language =KNonLocalized;
+        
+        TBool result = iScr->GetComponentL(aComponentId,*entries,language);
+        entries->ExternalizeL(aStream);
+        
+        CleanupStack::PopAndDestroy(entries);
+        TBool isComponentPresent = iScr->IsComponentPresentL(aComponentId);
+        aStream.WriteInt8L(isComponentPresent);
+        
+        
+        // Localizable Component info 
+        RPointerArray<CLocalizableComponentInfo> localizableComponentInfo;
+        iScr->GetComponentLocalizedInfoL(aComponentId,localizableComponentInfo);
+        aStream.WriteInt32L(localizableComponentInfo.Count());
+        
+        
+        for(j ; j < localizableComponentInfo.Count(); j++)
+            {
+                    (localizableComponentInfo.operator [](j))->ExternalizeL(aStream);
+                     
+            }
+        
+        // Properties
+        // extracted the UID
+        property = iScr->GetComponentPropertyL(aComponentId,KUid());
+        if (NULL != property)
+            {  
+                 property->ExternalizeL(aStream);
+                
+                  
+                delete property;
+                property = NULL;
+            }
+        else 
+            {
+                // need to return or have to proceed
+            }
+        // Exctracted Domain - Category
+        property = iScr->GetComponentPropertyL(aComponentId,KDomainCategory());
+        if (NULL != property)
+            {
+                property->ExternalizeL(aStream);
+                                
+                delete property;
+                property = NULL;
+            }
+        // Exctracted Media ID
+        property = iScr->GetComponentPropertyL(aComponentId,KMediaId());
+        if (NULL != property)
+            {
+                property->ExternalizeL(aStream);
+                
+    
+                delete property;
+                property = NULL;
+            }
+        // Exctracted Setings plugin name
+        property = iScr->GetComponentPropertyL(aComponentId,KSettingsPlugin());
+        if (NULL != property)
+            {
+                property->ExternalizeL(aStream);
+                
+                
+                delete property;
+                property = NULL;
+            }
+        
+        // Optional Properties
+        // extracted info URL
+        property = iScr->GetComponentPropertyL(aComponentId,KMIDletInfoURL());
+        if (NULL != property)
+            {
+                property->ExternalizeL(aStream);
+                
+                
+                delete property;
+                property = NULL;
+            }
+        else // as its optional property so could be NULL 
+            {
+                aStream.WriteInt8L(NULL);
+            }
+    
+        // extracted midlet description
+        property = iScr->GetComponentPropertyL(aComponentId,KMIDletDescription());
+        if (NULL != property)
+            {
+                property->ExternalizeL(aStream);
+                
+                
+                delete property;
+                property = NULL;
+            }
+        else // as its optional property so could be NULL 
+           {
+               aStream.WriteInt8L(NULL);
+           }
+        // extracted midlet DeletionConformation
+        property = iScr->GetComponentPropertyL(aComponentId,KMIDletDeletionConformation());
+        if (NULL != property)
+            {
+                property->ExternalizeL(aStream);
+                
+                
+                delete property;
+                property = NULL;
+            }
+        else // as its optional property so could be NULL 
+           {
+               aStream.WriteInt8L(NULL);
+           }
+        //extracted midlet DN URL
+        property = iScr->GetComponentPropertyL(aComponentId,KDownloadURL());
+        if (NULL != property)
+            {  
+              property->ExternalizeL(aStream);
+              
+              
+              delete property;
+              property = NULL;
+            }
+        else // as its optional property so could be NULL 
+           {
+               aStream.WriteInt8L(NULL);
+           }
+        
+        
+        // backing up files corresponds to component
+        RSoftwareComponentRegistryFilesList fileList;
+        CleanupClosePushL(fileList);
+        TInt count = iScr->GetComponentFilesCountL(aComponentId); 
+        TInt k = 0;
+        RPointerArray<HBufC> files;
+        fileList.OpenListL(*iScr,aComponentId);
+        fileList.NextFileSetL(count,files);        
+        aStream.WriteInt32L(files.Count());
+        CleanupStack::PopAndDestroy(&fileList);//filelist
+        
+        for( k ; k < files.Count(); k++)
+            {
+               HBufC* temp =  files.operator [](k);
+               aStream.WriteInt32L(temp->Length());
+               aStream.WriteL(temp->Des());                                    
+            }
+        
+        
+        RArray<TUid> noOfApps; 
+        HBufC* appIcon;
+        TAppRegInfo appInfo;
+        iScr->GetAppUidsForComponentL(aComponentId,noOfApps); 
+        RRegistrationInfoForApplication regInfoIcon;
+        CleanupClosePushL(regInfoIcon);
+        RApplicationRegistrationInfo regInfoCaption;
+        CleanupClosePushL(regInfoCaption);
+       
+        
+       //backing up the no. of apps
+       aStream.WriteInt32L(noOfApps.Count()); 
+               
+        
+        for(j = 0 ; j < noOfApps.Count(); j++ )
+            {
+                regInfoIcon.OpenL(*iScr,noOfApps.operator [](j));
+                regInfoCaption.OpenL(*iScr);
+                
+               //check if language is imp to give as an argument\
+               // Language extracted
+               TLanguage language = regInfoIcon.ApplicationLanguageL();
+               // Language backed up
+               aStream.WriteInt32L(language);
+                                     
+               // AppUID extracted
+               TUid appUid = noOfApps[j];               
+               // AppUID backed up
+               aStream.WriteInt32L(appUid.iUid);
+              
+               //App caption extracted 
+               regInfoCaption.GetAppInfoL(appUid,appInfo,language);
+               TAppCaption caption = appInfo.Caption();
+               caption.Trim();// would give the acctual size of content
+               //App caption backed up
+               aStream.WriteL(caption);
+               
+               //AppIcon path extracted
+               regInfoIcon.GetAppIconL(appIcon);
+               //AppIcon path backed up
+               aStream.WriteL(appIcon->Des());
+                     
+            
+               //need to backup no. of icons to needed for registrating application
+               TInt noOfIcons = regInfoIcon.NumberOfOwnDefinedIconsL();
+               aStream.WriteInt32L(noOfIcons);
+            }
+               CleanupStack::PopAndDestroy();//regInfoIcon
+               CleanupStack::PopAndDestroy();//regInfoCaption
+               //regInfoIcon.Close();
+               //regInfoCaption.Close();
+
+        iState = EIsWriteCompleteInfo;
+        
+        LOG(EBackup,EInfo," <--- GetComponentInfo() ");
+            
+    }
+void CScrBackupUtil::RestoreScrDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft)
+    {
+		LOG(EBackup,EInfo," ---> RestoreScrDataL() ");
+        if(iIsFristCall)
+            {
+                ConnectScrL();
+                TInt j = 0;
+                TInt presentComponentsCount;
+                RArray<Usif::TComponentId> presentComponentsIds;
+                iBufferSpaceLeft = aBufferSpaceLeft;
+                //aStream.r
+                //reading components count
+                iNumberOfComponents = aStream.ReadInt32L();
+                iBufferSpaceLeft = iBufferSpaceLeft - sizeof(TInt32);
+                
+                //reading the size of the TPckgBuf<RArray<TComponentId>>
+                TInt size = aStream.ReadInt32L();
+                iBufferSpaceLeft = iBufferSpaceLeft - sizeof(TInt32);
+                
+                //reading TPckgBuf<RArray<TComponentId>> 
+                HBufC* temp = HBufC::NewLC(aStream , size);
+                
+                TPckgBuf<RArray<TInt> > ids;
+                //extracting RArray from TPckgBuf<RArray<TUids>>
+                ids.Append(temp->Des());
+                CleanupStack::PopAndDestroy(temp);
+                iUids = ids.operator ()();// populated iUids
+                iBufferSpaceLeft = iBufferSpaceLeft - size;
+                iNumberOfComponents = iUids.Count();
+                
+                
+                ExtractUidAndComponentIdL(presentComponentsIds,iPresentUids,presentComponentsCount);
+                                
+                // calculating the midlets to be deleted from SCR
+                for(j ; j <= iNumberOfComponents ; j++ )
+                    {
+                          TInt id = NULL;
+                          TInt index = 0;
+                          id = iUids.operator [](j);
+                          index = iPresentUids.Find(iUids.operator [](j));
+                          if(index != NULL)
+                              {
+                                  presentComponentsIds.Remove(index);// removeing the app that is present in SCr and backed up too
+                                  iPresentUids.Remove(index);// TODO : check if right component Id is removed
+                              }       
+                    }
+
+                
+                   iPresentUids.Compress();  // need to see if this works
+                   presentComponentsIds.Compress();// contains the uids that has to be deleted
+                   //Updated the count
+                   presentComponentsCount = iPresentUids.Count();
+                   for(j = 0 ; j <= presentComponentsCount ; j++ )
+                       {       
+                           TRAPD(err ,iScr->DeleteApplicationEntriesL(presentComponentsIds.operator [](j)));
+                           if (KErrNone == err)
+                               {
+                                   iScr->DeleteComponentL(presentComponentsIds.operator [](j));
+                               }
+                            
+                       }
+                   
+                   
+            }
+        RDesReadStream readStream;
+        readStream.Open(iPtrToWriteBuffer);
+        for( i ; i < iComponentIds.Count() ;)
+            {
+                if(iState == EIsFetchCompleteInfo)
+                    {   
+                        TUid uid ;
+                        uid.iUid = iUids.operator [](i);
+                        SetDataInScrL(uid,readStream);
+                        i++;
+                    }
+                if(iState == EIsWriteCompleteInfo)
+                    {                           
+                        RDesReadStream readStream;
+                        readStream.Open(iPtrToWriteBuffer);
+                        iLengthOfString = aStream.ReadInt32L();
+                        
+                         
+                        //Reading the remaining information into the new buffer
+                        if(iBufferToWriteNextTime)
+                            {
+                            //appened it in the remaing
+                             HBufC* remainingBuff = HBufC::NewL(iRemainingBuffer);
+                             TPtr ptr(remainingBuff->Des());            
+                             aStream.ReadL(ptr,iRemainingBuffer);
+                             iPtrToWriteBuffer.Append(ptr);
+                             iState = EIsFetchCompleteInfo;                     
+                             iLengthOfString = 0; // to maintain the loop
+                             iWriteToStream = EFalse;
+                                                       
+                            
+                            }
+                        if (iLengthOfString > iBufferSpaceLeft && !iBufferToWriteNextTime)
+                        {  
+                        iRemainingBuffer = iLengthOfString - iBufferSpaceLeft;
+                        aStream.ReadL(iPtrToWriteBuffer,iBufferSpaceLeft);
+                        iBufferToWriteNextTime = ETrue;
+                        break ;
+                        }
+                        // Read the complete string
+                        else if(iWriteToStream)
+                        {       
+                            aStream.ReadL(iPtrToWriteBuffer,iLengthOfString);
+                            iBufferSpaceLeft = iBufferSpaceLeft - iLengthOfString;
+                            iState = EIsFetchCompleteInfo;
+                            iLengthOfString = 0; // to maintain the loop 
+                            
+                        }
+                                                
+                    }
+            }
+        //take care of restorestate
+        // SCR restore is over; Set state to EAppArc
+        if(i >= iComponentIds.Count())
+            {
+                aRestoreState = EAppArc;
+                aBufferSpaceLeft = iBufferSpaceLeft;// need to to this coz of last iteration
+            }
+              
+        LOG(EBackup,EInfo," <--- RestoreScrDataL() ");
+    }
+void CScrBackupUtil::SetDataInScrL(TUid aUid , RDesReadStream& aStream)
+    {
+		LOG(EBackup,EInfo," ---> SetDataInScrL() ");
+        TInt tempSize = NULL;
+        TInt j = 0;
+        tempSize = aStream.ReadInt32L();
+        CComponentEntry* entries;
+        entries = CComponentEntry::NewL();
+        CleanupStack::PushL( entries);
+        entries->InternalizeL(aStream);
+        
+        
+        TBool isComponentPresent = aStream.ReadInt8L();
+        
+        // Localizable Component info 
+        RPointerArray<CLocalizableComponentInfo> localizableComponentInfoArray; // Not owned by me nee to delete in last 
+        TInt temp = aStream.ReadInt32L();
+        for(j ; j <= temp; j++)
+            {
+                CLocalizableComponentInfo* componentinfo = CLocalizableComponentInfo::NewL(aStream);
+                localizableComponentInfoArray.Append(componentinfo);
+            }
+ 
+        // now need to set all the properties
+        // extracted the UID
+        CIntPropertyEntry* property;
+        property = (CIntPropertyEntry*)CPropertyEntry::NewL(aStream);
+        TInt64 id = property->Int64Value();
+        delete property;
+        
+        //extracted midlet Domain-Catogary
+        CLocalizablePropertyEntry* propertyString;
+        propertyString =(CLocalizablePropertyEntry*) CPropertyEntry::NewL(aStream);
+        HBufC* domainCategory  = (propertyString->StrValue()).Alloc();
+        delete propertyString;
+        
+        // Exctracted Media ID
+        property = (CIntPropertyEntry*)CPropertyEntry::NewL(aStream);
+        TInt64 mediaID = property->Int64Value();
+        delete property;
+        
+        //extracted midlet SettingsValue
+        propertyString =(CLocalizablePropertyEntry*) CPropertyEntry::NewL(aStream);
+        HBufC* SettingsValue  = (propertyString->StrValue()).Alloc();
+        delete propertyString;
+        
+        // Optional Properties
+        // extracted info URL
+        propertyString = propertyString = (CLocalizablePropertyEntry*)CPropertyEntry::NewL(aStream);  
+        HBufC* url = (propertyString->StrValue()).Alloc();
+        delete propertyString;
+                    
+               
+        // extracted midlet description
+        propertyString = (CLocalizablePropertyEntry*)CPropertyEntry::NewL(aStream);
+        HBufC* midletDescription  = (propertyString->StrValue()).Alloc();
+        delete propertyString;
+        
+        // midlet deletion conformation has to be here
+        CBinaryPropertyEntry* propertyBinary = (CBinaryPropertyEntry*)CPropertyEntry::NewL(aStream);
+        HBufC8* midletDeletionConformation  = (propertyBinary->BinaryValue()).Alloc();
+        delete propertyBinary;
+        
+        //extracted midlet DN URL
+        propertyString =(CLocalizablePropertyEntry*) CPropertyEntry::NewL(aStream);
+        HBufC* dnUrl  = (propertyString->StrValue()).Alloc();
+        delete propertyString;
+        
+        //Extracting no. of files registered with a component
+        //1st the no. of files
+        RPointerArray<HBufC> componentFilesArray;
+        
+        TInt fileCount = aStream.ReadInt32L();
+       //now the files 
+        for(TInt k = 0 ; k < fileCount ; k++)
+            {   
+                TInt size = aStream.ReadInt32L();
+                HBufC* componentFile = HBufC::NewL(aStream,size);
+                CleanupStack::PushL( componentFile);
+                componentFilesArray.AppendL(componentFile);
+                CleanupStack::Pop( componentFile);
+            }
+        
+        //Extracting no. of apps with a component
+        TInt noOfApps = aStream.ReadInt32L();
+        RPointerArray<CAppInfo> appinfoArray;
+        for(j = 0 ; j < noOfApps ; j++ )
+            {
+                   CAppInfo* appinfo = CAppInfo::NewL();
+                   CleanupStack::PushL( appinfo);// i will not own it after using has to be destroyed  
+                   TLanguage language;
+                   language = (TLanguage)(aStream.ReadInt32L());
+                   TUid uid;
+                   uid.Uid(aStream.ReadInt32L());
+                   
+                   TAppCaption caption ;
+                   aStream.ReadL(caption);
+                   HBufC* appIcon ;
+                   TPtr temp(appIcon->Des());
+                   aStream.ReadL(temp);
+                   TInt noOfIcons = aStream.ReadInt32L();
+                   
+                   appinfo->Set(language,uid,caption,temp,noOfIcons);// TODO: check if it works
+                   appinfoArray.Append(appinfo);
+                   
+                   
+                   
+            }
+        
+         
+        TInt index =  iPresentUids.Find(aUid.iUid);
+        if(index != NULL)
+            {           CComponentEntry* entry = CComponentEntry::NewLC();
+                        TUid uid ;
+                        uid.Uid(iPresentUids.operator [](index));
+                        TComponentId componentId = iScr->GetComponentIdForAppL(uid);
+                        iScr->GetComponentL(componentId,*entry);
+                        HBufC* versionPresent = entry->Version().AllocLC();
+                        CleanupStack::PopAndDestroy(entry);
+                        HBufC* versionBackUpComponent = entries->Version().AllocLC();
+                       if((versionPresent->CompareC(versionBackUpComponent->Des())))//check version
+                           {
+                                   //ignore  Write a log statement as the midlet is same no need to do any thing :)
+                           }    
+                       else 
+                           {
+                             //  delete it and thn register it 
+                             TRAPD(err ,iScr->DeleteApplicationEntriesL(componentId));
+                             if (KErrNone == err)
+                                  {
+                                      iScr->DeleteComponentL(componentId);
+                                  }
+                            // call register
+                            TComponentId newComponentId = RegisterComponentL(*entries,uid,url->Des(),midletDescription->Des(),midletDeletionConformation->Des(),dnUrl->Des(),mediaID,domainCategory->Des(),SettingsValue->Des(),componentFilesArray,isComponentPresent,localizableComponentInfoArray);
+                             for(j=0; j < appinfoArray.Count() ; j++)
+                                 {
+                                     CAppInfo* appInfo = appinfoArray.operator [](j);
+                                     
+                                     RegisterApplicationL(newComponentId,appInfo->GetAppUid(),appInfo->GetCaption(),appInfo->GetAppIcon()->Des(),appInfo->NoOfIcons(),appInfo->GetLanguage());
+                                     CleanupStack::PopAndDestroy(appInfo);
+                                 }
+                           }
+                       CleanupStack::PopAndDestroy(versionPresent);
+                       CleanupStack::PopAndDestroy(versionBackUpComponent);
+            }
+        else
+            {
+                //just go register it as its not there in the phone 
+                TComponentId newComponentId = RegisterComponentL(*entries,aUid,url->Des(),midletDescription->Des(),midletDeletionConformation->Des(),dnUrl->Des(),mediaID,domainCategory->Des(),SettingsValue->Des(),componentFilesArray,isComponentPresent,localizableComponentInfoArray);
+                 for(j=0; j < appinfoArray.Count() ; j++)
+                     {
+                         CAppInfo* appInfo = appinfoArray.operator [](j);
+                         
+                         RegisterApplicationL(newComponentId,appInfo->GetAppUid(),appInfo->GetCaption(),appInfo->GetAppIcon()->Des(),appInfo->NoOfIcons(),appInfo->GetLanguage());
+                         CleanupStack::PopAndDestroy(appInfo);
+                     }
+            }
+        
+        //CleanupStack::Pop();//componentFilesArray
+        CleanupStack::PopAndDestroy( entries);
+        
+        LOG(EBackup,EInfo," <--- SetDataInScrL() ");
+    }
+
+
+TComponentId CScrBackupUtil::RegisterComponentL(CComponentEntry& aEntry ,TUid aUid,TPtr aMidletInfoUrl,
+        TPtr aMidletDescription,TPtr8 aMidletDeletionConformation, TPtr aDownloadUrl,TInt64 aMediaId,TPtr aDomainCatogary , TPtr aSettingValue,
+        RPointerArray<HBufC>& aComponentFilesArray, TBool aIsComponentPresent,RPointerArray<CLocalizableComponentInfo>& aLocalizableComponentInfoArray)
+{
+	LOG(EBackup,EInfo," ---> RegisterComponentL() ");
+    HBufC* globalId =( aEntry.GlobalId()).AllocLC();
+   
+    TComponentId componentId = iScr->AddComponentL(aLocalizableComponentInfoArray,Usif::KSoftwareTypeJava,globalId);
+   
+    
+    
+    iScr->SetComponentVersionL(componentId, aEntry.Version());
+    //LOG1(EJavaInstaller, EInfo, "RegisterComponentL: version set %s",*version);
+    
+    iScr->SetIsComponentRemovableL(componentId, aEntry.IsRemovable());
+    
+    
+    iScr->SetIsComponentDrmProtectedL(componentId, aEntry.IsDrmProtected());
+    
+    
+    iScr->SetIsComponentKnownRevokedL(componentId,aEntry.IsKnownRevoked());
+    
+    
+    iScr->SetIsComponentOriginVerifiedL(componentId, aEntry.IsOriginVerified());
+    
+    
+    iScr->SetComponentSizeL(componentId, aEntry.ComponentSize());
+    
+    
+    iScr->SetScomoStateL(componentId,aEntry.ScomoState());
+    
+    
+    iScr->SetIsComponentPresentL(componentId,aIsComponentPresent);
+    
+    
+    
+    iScr->SetComponentPropertyL(componentId,KUid(), aUid.iUid);
+    
+    
+    iScr->SetComponentPropertyL(componentId,KMIDletInfoURL(),aMidletInfoUrl);
+    
+    iScr->SetComponentPropertyL(componentId, KMIDletDescription(), aMidletDescription);
+    
+    iScr->SetComponentPropertyL(componentId,KMIDletDeletionConformation(),aMidletDeletionConformation);
+        
+    iScr->SetComponentPropertyL(componentId, KDownloadURL(), aDownloadUrl);
+    
+    iScr->SetComponentPropertyL(componentId,KDomainCategory(),aDomainCatogary);
+    
+    iScr->SetComponentPropertyL(componentId, KMediaId(), aMediaId);
+    
+    
+    iScr->SetComponentPropertyL(componentId, KSettingsPlugin(), aSettingValue);
+    
+
+    CleanupStack::PopAndDestroy(globalId);
+  
+    TInt fileCount = aComponentFilesArray.Count();
+    for (TInt i = 0; i < fileCount; i++)
+    {
+        HBufC *componentFile = aComponentFilesArray.operator [](i);
+        iScr->RegisterComponentFileL(componentId, *componentFile);
+        CleanupStack::PopAndDestroy(componentFile);
+    }
+    LOG(EBackup,EInfo," <--- RegisterComponentL() ");
+    return componentId;
+}
+
+void CScrBackupUtil::RegisterApplicationL(TInt aComponentId, TUid aAppUid,
+        TAppCaption aAppName, TDesC aIconFilename, TInt aNumberOfIcons,
+        TLanguage aLanguages)
+    {
+		LOG(EBackup,EInfo," ---> RegisterApplicationL() ");
+        TFileName appName;
+        RPointerArray<HBufC> ownedFileArray; // codescanner::resourcenotoncleanupstack
+        RPointerArray<Usif::CServiceInfo> serviceArray; // codescanner::resourcenotoncleanupstack
+        RPointerArray<Usif::CPropertyEntry> appPropertiesArray; // codescanner::resourcenotoncleanupstack
+        RPointerArray<Usif::CAppViewData> viewDataList; // codescanner::resourcenotoncleanupstack
+
+        RPointerArray<Usif::COpaqueData> opaqueDataArray;
+        CleanupResetAndDestroyPushL(opaqueDataArray);
+        // Write application Uid to opaque data (needed by MIDlet launcher).
+        TBuf8<4> opaqueDataBuf; // Opaque data will contain one signed 32-bit int.
+        RDesWriteStream writeStream(opaqueDataBuf);
+        writeStream.WriteInt32L(aAppUid.iUid);
+        writeStream.CommitL();
+        
+       
+        
+        COpaqueData *opaqueData = COpaqueData::NewLC(opaqueDataBuf, KUnspecifiedLocale);
+        opaqueDataArray.AppendL(opaqueData);
+        CleanupStack::Pop(opaqueData);
+
+        RPointerArray<Usif::CLocalizableAppInfo> localizableAppInfoList;
+        CleanupResetAndDestroyPushL(localizableAppInfoList);
+        // Add non-localized application name (caption) and icon.
+
+        CCaptionAndIconInfo *captionAndIconInfo = CCaptionAndIconInfo::NewLC(aAppName,aIconFilename,aNumberOfIcons);
+        
+        CLocalizableAppInfo *locAppInfo = CLocalizableAppInfo::NewLC(/*aShortCaption=*/ KNullDesC,KNonLocalized,
+            /*aGroupName=*/ KNullDesC,captionAndIconInfo,viewDataList);
+        localizableAppInfoList.AppendL(locAppInfo);
+        
+        CleanupStack::Pop(locAppInfo);
+        CleanupStack::Pop(captionAndIconInfo);
+               
+    CCaptionAndIconInfo *tmpCaptionAndIconInfo =CCaptionAndIconInfo::NewLC(aAppName,/*aIconFileName=*/ KNullDesC,/*aNumOfAppIcons=*/ 0);
+    CLocalizableAppInfo *tmpLocAppInfo = CLocalizableAppInfo::NewLC(/*aShortCaption=*/ KNullDesC,aLanguages,/*aGroupName=*/ KNullDesC,
+                                                                        tmpCaptionAndIconInfo,/*aViewDataList=*/ viewDataList);
+                localizableAppInfoList.AppendL(tmpLocAppInfo);
+               
+                CleanupStack::Pop(tmpLocAppInfo);
+                CleanupStack::Pop(tmpCaptionAndIconInfo);
+            
+            
+        
+        // Create application registration data objects.
+        TApplicationCharacteristics appCharacteristics;
+        appCharacteristics.iAttributes = TApaAppCapability::ENonNative;
+        appCharacteristics.iEmbeddability = TApplicationCharacteristics::ENotEmbeddable;
+        appCharacteristics.iSupportsNewFile = EFalse;
+        appCharacteristics.iAppIsHidden = EFalse;
+        appCharacteristics.iLaunchInBackground = EFalse;
+        
+        CApplicationRegistrationData *appRegData =
+        CApplicationRegistrationData::NewLC(ownedFileArray, serviceArray,localizableAppInfoList,appPropertiesArray,opaqueDataArray,
+                /*aAppUid=*/ aAppUid, /*aAppFile=*/ appName,/*aCharacteristics=*/ appCharacteristics,/*aDefaultScreenNumber=*/ 0);
+        
+        LOG(EJavaInstaller, EInfo,"RegisterApplicationL : Called AddApplicationEntryL  >>>>>>>>>>>> ");
+        iScr->AddApplicationEntryL(aComponentId, *appRegData);
+        CleanupStack::PopAndDestroy(appRegData);
+
+      
+        CleanupStack::Pop(&localizableAppInfoList); // deleted in appRegData destructor
+        CleanupStack::Pop(&opaqueDataArray); // deleted in appRegData destructor
+
+        LOG(EBackup,EInfo," <--- RegisterApplicationL() ");
+    }
+
+CScrBackupUtil::~CScrBackupUtil()
+    {
+    LOG(EBackup,EInfo," ---> ~CScrBackupUtil() ");
+    
+    if(iScr)
+        {
+            iScr->Close();
+            delete iScr;
+            iScr = NULL;
+        }
+    if(iRemainingInfo)
+        {
+            delete iRemainingInfo;
+            iRemainingInfo = NULL;
+        }
+            
+    LOG(EBackup,EInfo," <--- ~CScrBackupUtil() ");
+    }
+
+CAppInfo* CAppInfo::NewL()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:NewL()");
+    CAppInfo *self = CAppInfo::NewLC();
+    CleanupStack::Pop(self);
+    LOG(EBackup,EInfo," <--- CAppInfo:NewL()");
+    return self;
+    }
+
+
+CAppInfo* CAppInfo::NewLC()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:NewLC");
+    CAppInfo *self = new(ELeave) CAppInfo();
+    CleanupStack::PushL(self); 
+    self->ConstructL();
+    LOG(EBackup,EInfo," <---CAppInfo:NewLC");
+    return self;
+    }
+CAppInfo::CAppInfo()
+    {
+
+    }
+void CAppInfo::ConstructL()
+    {
+        LOG(EBackup,EInfo," ---> CAppInfo:ConstructL ");
+        
+        
+        
+        LOG(EBackup,EInfo," <--- CAppInfo:ConstructL()");
+    }
+CAppInfo::~CAppInfo()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:~CAppInfo() ");
+    if(iAppIcon)
+        {
+            delete iAppIcon;
+        }
+    LOG(EBackup,EInfo," <--- CAppInfo:~CAppInfo() ");
+    }
+    
+void CAppInfo::Set(TLanguage language,TUid appUid,Usif::TAppCaption caption,TDesC& appIcon,TInt aNoOfIcons)
+    {
+        LOG(EBackup,EInfo," ---> CAppInfo:Set() ");
+        iLanguage = language;
+        iAppUid = appUid;
+        iCaption = caption;
+        iAppIcon->Des().Copy(appIcon);
+        iNoOfIcons = aNoOfIcons;
+        LOG(EBackup,EInfo," <--- CAppInfo:Set() ");
+        
+    }
+TLanguage CAppInfo::GetLanguage()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:GetLanguage() ");
+    LOG(EBackup,EInfo," <--- CAppInfo:GetLanguage() ");
+    return iLanguage;
+    }
+TUid CAppInfo::GetAppUid()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:GetAppUid() ");
+    LOG(EBackup,EInfo," <--- CAppInfo:GetAppUid() ");
+    return iAppUid;
+    }
+Usif::TAppCaption CAppInfo::GetCaption()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:GetCaption() ");
+    LOG(EBackup,EInfo," <--- CAppInfo:GetCaption() ");
+    return iCaption;
+   
+    }
+HBufC* CAppInfo::GetAppIcon()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:GetAppIcon() ");
+    LOG(EBackup,EInfo," <--- CAppInfo:GetAppIcon() ");
+    return iAppIcon;
+    
+    }
+
+TInt CAppInfo::NoOfIcons()
+    {
+    LOG(EBackup,EInfo," ---> CAppInfo:NoOfIcons() ");
+    LOG(EBackup,EInfo," <--- CAppInfo:NoOfIcons() ");
+    return iNoOfIcons;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javascrbackuputil.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,266 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for CScrBackupUtil class
+*
+*/
+
+#ifndef JAVASCRBACKUPUTIL_H_
+#define JAVASCRBACKUPUTIL_H_
+
+
+#include <e32base.h>
+#include <s32strm.h>
+#include <f32file.h> 
+#include <e32cmn.h>
+#include <s32mem.h>
+#include <S32BUF.H>  
+
+#include <mw/usif/usifcommon.h>
+#include <mw/usif/scr/scr.h>
+#include <mw/usif/scr/screntries.h>
+#include <mw/usif/scr/appreginfo.h> //for TAppCaption
+#include <e32lang.h>
+
+#include <string>
+#include <vector>
+
+namespace java
+    {
+namespace  backup
+    {
+
+class CScrBackupUtil : public CBase
+    {
+public:
+    static CScrBackupUtil* NewL();
+
+    ~CScrBackupUtil();
+    
+    static CScrBackupUtil* NewLC();
+    
+    /*
+     * filling the data with the SCR value one by one 
+     */
+    void BackupScrDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft);
+    
+    void GetComponentInfoL(Usif::TComponentId aComponentId,RDesWriteStream& aStream);
+    void WriteToActualStream(RDesWriteStream& aStream);
+    
+    void RestoreScrDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft);
+    void SetDataInScrL(TUid aUid ,RDesReadStream& aStream);
+    
+private: //fun
+    void ConstructL();
+    void ConnectScrL();
+    void writeRemainingData();
+    void RegisterApplicationL(TInt aComponentId, TUid aAppUid,
+            Usif::TAppCaption aAppName, TDesC aIconFilename, TInt aNumberOfIcons,
+            TLanguage aLanguages);
+    
+    template <typename T>
+    TInt ComputeSizeL(const T &aObject);
+    void ExtractUidAndComponentIdL(RArray<Usif::TComponentId>& componentIds,RArray<TInt>& uids,TInt& ComponentsCount);   
+    Usif::TComponentId RegisterComponentL(Usif::CComponentEntry& aEntry ,TUid aUid,TPtr aMidletInfoUrl, TPtr aMidletDescription, TPtr8 aMidletDeletionConformation,TPtr aDownloadUrl,TInt64 aMediaId,TPtr aDomainCatogary , TPtr aSettingValue,RPointerArray<HBufC>& aComponentFilesArray, TBool aIsComponentPresent,RPointerArray<Usif::CLocalizableComponentInfo>& aLocalizableComponentInfoArray);
+    CScrBackupUtil();
+private://members
+      
+     enum TState
+         {
+         EIsFetchCompleteInfo,
+         EIsWriteCompleteInfo
+         };
+     TState iState;
+     HBufC8* iRemainingInfo;
+     // to check if the previous attribte claims that he cant 
+     //write in stream because of space so all other attribute 
+     //down the lane should be in the remaining info buffer to maintain the sequence
+     TBool iIsToWriteInStream;
+     TBool iBufferToWriteNextTime;
+     TBool iWriteToStream;
+    TInt i ;
+    TInt iLengthOfString;
+    Usif::RSoftwareComponentRegistry* iScr;
+    RArray<Usif::TComponentId> iComponentIds;
+    RArray<TInt> iUids;
+    RArray<TInt> iPresentUids;
+    
+    TInt iNumberOfComponents;
+    TInt iBufferSpaceLeft;
+    
+    TInt iRemainingBuffer;
+    TPtr8 iPtrToWriteBuffer;
+    
+    TBool iIsFristCall;
+  
+    };
+
+// Helper class pass the info of midlet with in midletSuite 
+class CAppInfo : public CBase
+    {
+public:
+    static CAppInfo* NewL();
+
+    ~CAppInfo();
+
+    static CAppInfo* NewLC();
+    void ConstructL();
+    void Set(TLanguage language,TUid appUid,Usif::TAppCaption caption,TDesC& appIcon,TInt aNoOfIcons);
+    TLanguage GetLanguage();
+    TUid GetAppUid();
+    Usif::TAppCaption GetCaption();
+    HBufC* GetAppIcon();
+    TInt NoOfIcons();
+protected:
+        
+    CAppInfo();
+    
+    
+private:
+    TLanguage iLanguage;
+    TUid iAppUid;
+    Usif::TAppCaption iCaption;
+    HBufC* iAppIcon;
+    TInt iNoOfIcons;
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class CJavaBackupEntries : public CBase
+    {
+public:
+    ~CJavaBackupEntries();
+    static CJavaBackupEntries* NewL(Usif::TComponentId aId); 
+    
+    static CJavaBackupEntries* NewLC(Usif::TComponentId aId);
+    
+    
+    //used to get the below info
+    /*
+     * will get all the entries in this API
+     * called when restoring
+     */
+    void GetEntries();
+    
+    /*
+     * to set all the entries
+     * 
+     */
+    void SetEntries();
+private :
+    
+    void ConstructL(Usif::TComponentId aId);
+    
+private:
+            //check if this duplication can be removed as the same variable is in ccomponentEntry
+    Usif::TComponentId iComponentId;   ///< The unique id of the software component.
+            //HBufC* iName;                ///< Name of the software component.
+            //HBufC* iVendor;              ///< Vendor of the software component.
+            //HBufC* iSwType;              ///< Software type name of the component.
+            //HBufC* iGlobalId;            ///< Globally unique component identifier.
+            //TBool iRemovable;            ///< Whether the component is removable.
+            //TInt64 iSize;                ///< The total size of the component at installation time in bytes.
+            //TScomoState iScomoState;     ///< SCOMO state of the component.
+            //TDriveList iInstalledDrives; ///< The set of drives that files for the software component were installed to.
+            //HBufC* iVersion;             ///< Version identifier of the software component
+                //HBufC* iInstallTime;         ///< The install time of the component. 
+            //TBool iDrmProtected;         ///< Whether the component is DRM protected.
+                //TBool iHidden;               ///< Whether the component is hidden in the list of installed components.
+            //TBool iKnownRevoked;         ///< Whether the component has been revoked.
+            //TBool iOriginVerified;       ///< Whether the installer has verified the originator of the component.
+            
+            
+            // TODO Can we keep a pointer here 
+    Usif::CComponentEntry iEntries;
+            TBool iIsComponentPresent;
+            // component property
+            TInt  iMidletSuitId;
+            HBufC *iMidletInfoUrl;
+            HBufC *iMidletDescription;
+            TBool iMidletDeletetionConfirmation; // Didnt got any thing for it 
+            HBufC *iMidletDownloadUrl;
+            HBufC *iDomainCatagory;// didnt got any thing for it 
+            TInt iMediaId;
+            //addtion to CcomponentEntry Class
+            RPointerArray<Usif::CLocalizableComponentInfo> &iCompLocalizedInfoArray;
+            
+            
+            Usif::RSoftwareComponentRegistry *iScr;
+            
+            
+            
+    };
+   }
+
+   }
+
+
+
+#endif /* JAVASCRBACKUPUTIL_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javastoragebackuputil.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,2084 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CStorageBackupUtil
+*
+*/
+
+
+#include "javastoragebackuputil.h"
+#include "midp2backupplugin.h"
+#include "midp2backupdataids.h"
+
+#include "javastorageentry.h"
+#include "javastorage.h"
+#include "javastoragenames.h"
+
+#include "logger.h"
+#include "javauid.h"
+#include "javaoslayer.h"
+#include "javacommonutils.h"
+#include "s60commonutils.h"
+#include "javasymbianoslayer.h"
+
+#include <memory>
+#include <s32mem.h>
+
+using namespace std;
+using namespace java::storage;
+using namespace java::backup;
+
+// ======== MEMBER FUNCTIONS ========
+
+CStorageBackupUtil::CStorageBackupUtil()
+{
+    LOG(EBackup, EInfo, "CStorageBackupUtil constructor");
+}
+
+void CStorageBackupUtil::ConstructL()
+{
+    LOG(EBackup, EInfo, "CStorageBackupUtil::ConstructL");
+
+    iFirstCalltoBackupStorageData = ETrue;
+    iFirstCalltoRestoreStorageData = ETrue;
+
+    iBufferSpaceLeft = 0;
+
+    iRemainingString = EFalse;
+    iStrCount = 0;
+
+    for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++)
+    {
+        iTableSize[tableNumber] = 0;
+    }
+}
+
+CStorageBackupUtil* CStorageBackupUtil::NewL()
+{
+    LOG(EBackup, EInfo, "CStorageBackupUtil::NewL");
+
+    CStorageBackupUtil* self = new(ELeave) CStorageBackupUtil();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+}
+
+CStorageBackupUtil::~CStorageBackupUtil()
+{
+    LOG(EBackup, EInfo, "CStorageBackupUtil Destructor");
+
+    // clear the vectors to free all the heap data.
+    iStringVector.clear();
+}
+
+
+void CStorageBackupUtil::BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CStorageBackupUtil::BackupStorageDataL");
+
+    iBufferSpaceLeft = aBufferSpaceLeft;
+
+    if (iFirstCalltoBackupStorageData)
+    {
+        int err = FillVectorWithStorageData();
+
+        if (err != KErrNone)
+        {
+            User::Leave(err);
+        }
+        LOG1(EBackup, EInfo, "Total no of rows in vector: %d", iStringVector.size());
+
+        // First write the total no of rows in the vector to the stream
+
+        aStream.WriteInt32L(iStringVector.size());
+        iBufferSpaceLeft -= sizeof(TInt32);
+
+        /* Then write the number of rows in each table to the stream.
+           This will be used while writing the data to storage. */
+
+        for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++)
+        {
+            aStream.WriteInt16L(iTableSize[tableNumber]);
+            iBufferSpaceLeft -= sizeof(TInt16);
+        }
+
+        iFirstCalltoBackupStorageData = EFalse;
+    }
+
+    // Now write the actual string data into the stream.
+
+    while (iBufferSpaceLeft > 0 && iStrCount < iStringVector.size())
+    {
+        WriteStringtoStreamL(aStream, iStringVector[iStrCount]);
+        LOG1(EBackup, EInfo, "StrCount = %d", iStrCount);
+    }
+
+    if (iStrCount >= iStringVector.size())
+    {
+        LOG(EBackup, EInfo, "Backup of storage data finished");
+        aBackupNotFinished = EFalse;
+    }
+}
+
+void CStorageBackupUtil::RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CStorageBackupUtil::RestoreStorageDataL()");
+
+    iBufferSpaceLeft = aBufferSpaceLeft;
+
+    if (iFirstCalltoRestoreStorageData)
+    {
+        // the no of strings in the stream
+        iStrCount = aStream.ReadInt32L();
+        iBufferSpaceLeft -= sizeof(TInt32);
+
+        // read the number of rows in each table
+        for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++)
+        {
+            iTableSize[tableNumber] = aStream.ReadInt16L();
+            iBufferSpaceLeft -= sizeof(TInt16);
+        }
+        iFirstCalltoRestoreStorageData = EFalse;
+    }
+
+    while (iBufferSpaceLeft > 0 && iStrCount > 0)
+    {
+        ReadStringfromStreamL(aStream);
+    }
+
+    if (iStrCount == 0)
+    {
+        LOG1(EBackup, EInfo, "Finished reading from stream, row count = %d", iStringVector.size());
+
+
+        int err = WriteDataToStorage();
+
+        if (err != KErrNone)
+        {
+            CleanupStack::PopAndDestroy(&aStream);
+            User::Leave(KErrGeneral);
+        }
+
+        // Storage restore is over; Change the state 
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+        aRestoreState = EScr;
+#else
+        aRestoreState = EAppArc;
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+     
+        aBufferSpaceLeft = iBufferSpaceLeft;
+    }
+}
+
+
+void CStorageBackupUtil::WriteStringtoStreamL(RDesWriteStream& aStream, wstring aStr)
+{
+    iLenOfString = aStr.length();
+
+    // if length of string is 0, do not write any string to the stream.
+    if (iLenOfString == 0)
+    {
+        aStream.WriteInt16L(iLenOfString*2);
+        iBufferSpaceLeft -= sizeof(TInt16);
+        iStrCount++;
+    }
+
+    else
+    {
+        /* if space is not enough for writing the complete string,
+           do not write it. Could be written next time.  */
+        if (((iLenOfString*2) + sizeof(TInt16)) > iBufferSpaceLeft)
+        {
+            LOG(EBackup, EInfo, "Stream size is not enough to hold the string");
+            // set the bufferspaceleft to zero
+            iBufferSpaceLeft = 0;
+        }
+        // stream has enough space for the length and the string data.
+        else
+        {
+            aStream.WriteInt16L(iLenOfString*2);
+            iBufferSpaceLeft -= sizeof(TInt16);
+
+            HBufC* tempstr = java::util::S60CommonUtils::wstringToDes(aStr.c_str());
+            TPtrC tempStr = tempstr->Des();
+            aStream.WriteL(tempStr);
+            iBufferSpaceLeft -= (iLenOfString*2);
+            delete tempstr;
+
+            iStrCount++;
+        }
+    }
+}
+
+void CStorageBackupUtil::ReadStringfromStreamL(RDesReadStream& aStream)
+{
+    wstring emptyString;
+
+    /* if only part of the string was read last time,
+       read the remaining and append it to that string.  */
+    if (iRemainingString)
+    {
+        // if the whole string cannot be read, read part of it and store it.
+        if (iLenOfString > iBufferSpaceLeft)
+        {
+            LOG(EBackup, EInfo, "Cant read the full string; read only part of it");
+
+            HBufC* data = HBufC::NewL(iBufferSpaceLeft/2+1);
+            TPtr pdata = data->Des();
+
+            aStream.ReadL(pdata, iBufferSpaceLeft/2);
+            iLenOfString -= iBufferSpaceLeft;
+            iBufferSpaceLeft = 0;
+
+            wchar_t* str = desToWstring(pdata);
+            wstring stringData(str);
+            iHalfReadString += stringData;
+
+            delete data;
+            iRemainingString = ETrue;
+        }
+        // else read the complete string
+        else
+        {
+            HBufC* data = HBufC::NewL(iLenOfString/2+1);
+            TPtr pdata = data->Des();
+
+            aStream.ReadL(pdata, iLenOfString/2);
+            iBufferSpaceLeft -= (iLenOfString);
+
+            wchar_t* str = desToWstring(pdata);
+            wstring stringData(str);
+            iHalfReadString += stringData;
+
+            iStringVector.push_back(iHalfReadString);
+
+            delete data;
+            iStrCount--;
+            iRemainingString = EFalse;
+            iHalfReadString = emptyString;
+        }
+    }
+
+    else
+    {
+        iLenOfString = aStream.ReadInt16L();
+        iBufferSpaceLeft -= sizeof(TInt16);
+
+        if (iLenOfString > 0)
+        {
+            // if full string cannot be read, read only part of it.
+            if (iLenOfString > iBufferSpaceLeft)
+            {
+                /* if the stream does not have even part of the string,
+                   just set the iRemainingFlag to ETrue so that the
+                   string can be read next time. */
+
+                if (iBufferSpaceLeft == 0)
+                {
+                    iRemainingString = ETrue;
+                    iHalfReadString = emptyString;
+                }
+                // else stream contains part of the stream. Read it
+                else
+                {
+                    LOG(EBackup, EInfo, "Cant read the full string; read only part of it");
+
+                    HBufC* data = HBufC::NewL(iBufferSpaceLeft/2+1);
+                    TPtr pdata = data->Des();
+
+                    aStream.ReadL(pdata, iBufferSpaceLeft/2);
+                    iLenOfString -= iBufferSpaceLeft;
+                    iBufferSpaceLeft = 0;
+
+                    wchar_t* str = desToWstring(pdata);
+                    wstring stringData(str);
+                    iHalfReadString = stringData;
+                    delete data;
+                    iRemainingString = ETrue;
+                }
+            }
+            // else full string can be read
+            else
+            {
+                HBufC* data = HBufC::NewL(iLenOfString/2+1);
+                TPtr pdata = data->Des();
+
+                aStream.ReadL(pdata, iLenOfString/2);
+                iBufferSpaceLeft -= (iLenOfString);
+
+                wchar_t* str = desToWstring(pdata);
+                wstring stringData(str);
+
+                iStringVector.push_back(stringData);
+                iStrCount--;
+                delete data;
+            }
+        }
+        /* if length of string is 0, do not read anything from the stream;
+           just push an empty string into the vector */
+        else
+        {
+            iStringVector.push_back(emptyString);
+            iStrCount--;
+        }
+    }
+}
+
+
+int CStorageBackupUtil::FillVectorWithStorageData()
+{
+    // get data from storage
+
+    LOG(EBackup, EInfo, "CStorageBackupUtil::FillVectorsWithData");
+
+    auto_ptr<JavaStorage> js(JavaStorage::createInstance());
+    LOG(EBackup, EInfo, "Opening connection to JAVA_DATABASE");
+
+    try
+    {
+        js->open(JAVA_DATABASE_NAME);
+        LOG(EBackup, EInfo, "Opening commection succeeded");
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG1(EBackup, "Opening JAVA_DATABASE failed; %S", jse.toString().c_str());
+        return KErrGeneral;
+    }
+
+    JavaStorageEntry attribute;
+    JavaStorageApplicationEntry_t findPattern;
+    JavaStorageApplicationList_t foundEntries;
+
+
+    // table 1 : Application package table
+    {
+        LOG(EBackup, EInfo, "Read entries from APPLICATION_PACKAGE_TABLE");
+
+        try
+        {
+            js->search(APPLICATION_PACKAGE_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo, "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[0] = FillVectorwithAppPackageTableData(foundEntries);
+        foundEntries.clear();
+
+        if (iTableSize[0] == 0)
+        {
+            LOG(EBackup, EInfo,  "No data in Storage; So no midlets in system;");
+            return KErrGeneral;
+        }
+    }
+
+
+    // table 2: Application table
+    {
+        LOG(EBackup, EInfo,  "Read entries from APPLICATION_TABLE");
+
+        try
+        {
+            js->search(APPLICATION_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[1] = FillVectorwithAppTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // table 3: Application package attributes table
+
+    /* for this table, since there are very large number of rows,
+       read the data from the table suite-by-suite
+       ie. read entries for the first suite, then read entries for the
+       second suite. This would prevent stack overflow  */
+    {
+        LOG(EBackup, EInfo,  "Read entries from APPLICATION_PACKAGE_ATTRIBUTES_TABLE");
+
+        int rowCount = 0;
+
+        for (int suiteNumber = 0; suiteNumber < iTableSize[0]; suiteNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[suiteNumber*14]);
+            findPattern.insert(attribute);
+
+            try
+            {
+                js->search(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, findPattern, foundEntries);
+                LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+
+            rowCount += FillVectorwithAppPackageAttTableData(foundEntries);
+
+            foundEntries.clear();
+            findPattern.clear();
+        }
+        iTableSize[2] = rowCount;
+    }
+
+    // table 4: Midp package table
+    {
+        LOG(EBackup, EInfo,  "Read entries from MIDP_PACKAGE_TABLE");
+
+        try
+        {
+            js->search(MIDP_PACKAGE_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[3] = FillVectorwithMidpPackageTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // table 5: Midp permissions table
+
+    /* for this table, since there are very large number of rows,
+       read the data from the table suite-by-suite
+       ie. read entries for the first suite, then read entries for the
+       second suite. This would prevent stack overflow  */
+    {
+        LOG(EBackup, EInfo,  "Read entries from MIDP_PERMISSIONS_TABLE");
+
+        int rowCount = 0;
+
+        for (int suiteNumber = 0; suiteNumber < iTableSize[0]; suiteNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[suiteNumber*14]);
+            findPattern.insert(attribute);
+
+            try
+            {
+                js->search(MIDP_PERMISSIONS_TABLE, findPattern, foundEntries);
+                LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+
+            rowCount += FillVectorwithMidpPermTableData(foundEntries);
+
+            foundEntries.clear();
+            findPattern.clear();
+        }
+        iTableSize[4] = rowCount;
+    }
+
+    // table 6: Midp function group settings table
+    {
+        LOG(EBackup, EInfo,  "Read entries from MIDP_FUNC_GRP_SETTINGS_TABLE");
+
+        try
+        {
+            js->search(MIDP_FUNC_GRP_SETTINGS_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[5] = FillVectorwithMidpFuncGrpSetTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // table 7: push registration table
+    {
+        LOG(EBackup, EInfo,  "Read entries from PUSH_REGISTRATIONS_TABLE");
+
+        try
+        {
+            js->search(PUSH_REGISTRATIONS_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[6] = FillVectorwithPushRegTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // table 8: alarm registration table
+    {
+        LOG(EBackup, EInfo,  "Read entries from ALARM_REGISTRATIONS_TABLE");
+
+        try
+        {
+            js->search(ALARM_REGISTRATIONS_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[7] = FillVectorwithAlarmRegTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // table 9: runtime settings table
+    {
+        LOG(EBackup, EInfo,  "Read entries from RUNTIME_SETTINGS_TABLE");
+
+        try
+        {
+            js->search(RUNTIME_SETTINGS_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[8] = FillVectorwithRuntimeSetTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // table 10: pre-install table
+    {
+        LOG(EBackup, EInfo,  "Read entries from PREINSTALL_TABLE");
+
+        try
+        {
+            js->search(PREINSTALL_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[9] = FillVectorwithPreinstallTableData(foundEntries);
+
+        foundEntries.clear();
+    }
+
+    // Data read from JAVA_DATABASE; So close the connection
+    js->close();
+
+    // table 11: ota status table
+    /* Stored in another database called javaotadatabase.
+       so open a new connection to that database.  */
+    {
+        LOG(EBackup, EInfo,  "Read entries from OTA_STATUS_TABLE");
+
+        auto_ptr<JavaStorage> jos(JavaStorage::createInstance());
+
+        try
+        {
+            jos->open(JAVA_OTA_DATABASE_NAME);
+            ILOG(EBackup, "Opening connection to OTA database succeeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Opening OTA database failed: %s", jse.toString().c_str());
+            return KErrGeneral;
+        }
+
+        try
+        {
+            jos->search(OTA_STATUS_TABLE, findPattern, foundEntries);
+            LOG(EBackup, EInfo,  "Search in Java Storage succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Search in Java Storage failed; %s", jse.toString().c_str());
+            jos->close();
+            return KErrGeneral;
+        }
+
+        iTableSize[10] = FillVectorwithOtaStatusTableData(foundEntries);
+
+        foundEntries.clear();
+        jos->close();
+    }
+
+    //################ printing the vectors #############
+    //printVector();
+    //###################################################
+
+    ILOG(EBackup, "Vector filled with data");
+    return KErrNone;
+}
+
+
+int CStorageBackupUtil::WriteDataToStorage()
+{
+    JELOG2(EBackup);
+    ILOG(EBackup, "Create instance of JAVA_DATABASE_NAME and open the database");
+
+    auto_ptr<JavaStorage> js(JavaStorage::createInstance());
+
+    try
+    {
+        js->open(JAVA_DATABASE_NAME);
+        ILOG(EBackup, "Opening database succeded");
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG1(EBackup, "Opening database failed: %S", jse.toString().c_str());
+        return KErrGeneral;
+    }
+
+    try
+    {
+        js->startTransaction();
+        ILOG(EBackup, "Transaction started");
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG1(EBackup, "startTransaction() failed: %S", jse.toString().c_str());
+        js->close();
+        return KErrGeneral;
+    }
+
+    ILOG(EBackup, "Before writing data to storage, existing data must be cleared");
+
+    // call delete * from table one-by-one
+    {
+        JavaStorageApplicationEntry_t emptyEntry;
+
+        try
+        {
+            js->remove(APPLICATION_PACKAGE_TABLE, emptyEntry);
+            js->remove(APPLICATION_TABLE, emptyEntry);
+            js->remove(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, emptyEntry);
+            js->remove(MIDP_PACKAGE_TABLE, emptyEntry);
+            js->remove(MIDP_PERMISSIONS_TABLE, emptyEntry);
+            js->remove(MIDP_FUNC_GRP_SETTINGS_TABLE, emptyEntry);
+            js->remove(PUSH_REGISTRATIONS_TABLE, emptyEntry);
+            js->remove(ALARM_REGISTRATIONS_TABLE, emptyEntry);
+            js->remove(RUNTIME_SETTINGS_TABLE, emptyEntry);
+            js->remove(PREINSTALL_TABLE, emptyEntry);
+
+            ILOG(EBackup, "Data removed successfully from table");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Failed during removal of entries from table: %S", jse.toString().c_str());
+            js->close();
+            return KErrGeneral;
+        }
+    }
+
+    JavaStorageEntry attribute;
+    JavaStorageApplicationEntry_t insertEntry;
+
+    ILOG(EBackup, "Start transaction for writing into the database");
+
+    int count = 0;
+    // table 1 : Application package table
+    {
+        LOG(EBackup, EInfo,  "Writing to APPLICATION_PACKAGE_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[0]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(PACKAGE_NAME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(VENDOR, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(VERSION, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(ROOT_PATH, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(MEDIA_ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(INITIAL_SIZE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(JAD_PATH, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(JAR_PATH, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(JAD_URL, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(JAR_URL, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(ACCESS_POINT, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(CONTENT_INFO, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(CONTENT_ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(APPLICATION_PACKAGE_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 2: Application table
+    {
+        LOG(EBackup, EInfo,  "Writing to APPLICATION_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[1]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(PACKAGE_ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(NAME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(MAIN_CLASS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(AUTORUN, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(APPLICATION_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 3: Application package attributes table
+    {
+        LOG(EBackup, EInfo,  "Writing to APPLICATION_PACKAGE_ATTRIBUTES_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[2]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(NAME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(VALUE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(TRUSTED, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 4: Midp package table
+    {
+        LOG(EBackup, EInfo,  "Writing to MIDP_PACKAGE_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[3]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(TYPE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(SECURITY_DOMAIN, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(HASH, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(CERT_HASH, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(RMS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(VALID_CERTS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(ON_SCREEN_KEYPAD, iStringVector[count++]);
+            insertEntry.insert(attribute);
+            
+            attribute.setEntry(SECURITY_WARNINGS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(MIDP_PACKAGE_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 5: Midp permissions table
+    {
+        LOG(EBackup, EInfo,  "Writing to MIDP_PERMISSIONS_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[4]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(CLASS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(NAME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(ACTION, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(MIDP_PERMISSIONS_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 6: Midp function group settings table
+    {
+        LOG(EBackup, EInfo,  "MIDP_FUNC_GRP_SETTINGS_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[5]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(ALLOWED_SETTINGS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(CURRENT_SETTING, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(BLANKET_PROMPT, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(MIDP_FUNC_GRP_SETTINGS_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 7: push registration table
+    {
+        LOG(EBackup, EInfo,  "Writing to PUSH_REGISTRATIONS_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[6]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(URL, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(NAME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(FILTER, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(REGISTRATION_TYPE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(PUSH_REGISTRATIONS_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 8: alarm registration table
+    {
+        LOG(EBackup, EInfo,  "Writing to ALARM_REGISTRATIONS_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[7]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(ALARM_TIME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(ALARM_REGISTRATIONS_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+
+    // table 9: runtime settings table
+    {
+        LOG(EBackup, EInfo,  "Writing to RUNTIME_SETTINGS_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[8]; rowNumber++)
+        {
+            attribute.setEntry(EXTENSIONS, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(RUNTIME_SETTINGS_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    // table 10: pre-install table
+    {
+        LOG(EBackup, EInfo,  "Writing to PREINSTALL_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[9]; rowNumber++)
+        {
+            attribute.setEntry(NAME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(VENDOR, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(VERSION, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(INSTALL_STATE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                js->write(PREINSTALL_TABLE, insertEntry);
+                ILOG(EBackup, "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                js->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+    }
+
+    ILOG(EBackup, "Data written to JAVA_DATABASE; So Commit the transaction and close the database");
+    ILOG(EBackup, "Committing the transaction");
+
+    try
+    {
+        js->commitTransaction();
+        ILOG(EBackup, "Transaction committed successfully");
+    }
+    catch (JavaStorageException jse)
+    {
+        ELOG1(EBackup, "Committing the transaction failed: %S", jse.toString().c_str());
+        js->close();
+        return KErrGeneral;
+    }
+
+    ILOG(EBackup, "Close the database");
+
+    // close the JAVA_DATABASE
+    js->close();
+
+
+    // table 11: ota status table
+    /* stored in another database called javaotadatabase.
+       so open a new connection to that database   */
+
+    {
+        ILOG(EBackup, "Create instance of JAVA_OTA_DATABASE_NAME and open the database");
+        auto_ptr<JavaStorage> jos(JavaStorage::createInstance());
+
+        try
+        {
+            jos->open(JAVA_OTA_DATABASE_NAME);
+            ILOG(EBackup, "Opening database succeded");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Opening database failed: %S", jse.toString().c_str());
+            return KErrGeneral;
+        }
+
+        ILOG(EBackup, "Start a transaction for writing to this database");
+
+        try
+        {
+            jos->startTransaction();
+            ILOG(EBackup, "Transaction started");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "startTransaction() failed: %S", jse.toString().c_str());
+            jos->close();
+            return KErrGeneral;
+        }
+
+        ILOG(EBackup, "Before writing data to this database, existing data must be cleared");
+
+        try
+        {
+            JavaStorageApplicationEntry_t emptyEntry;
+            jos->remove(OTA_STATUS_TABLE, emptyEntry);
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Removing data from OTA database failed: %S", jse.toString().c_str());
+            jos->close();
+            return KErrGeneral;
+        }
+
+        LOG(EBackup, EInfo,  "Writing to OTA_STATUS_TABLE");
+
+        for (int rowNumber = 0; rowNumber < iTableSize[10]; rowNumber++)
+        {
+            attribute.setEntry(ID, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(CREATION_TIME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(TYPE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(OTA_CODE, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(URL, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(LATEST_RETRY_TIME, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            attribute.setEntry(RETRY_COUNT, iStringVector[count++]);
+            insertEntry.insert(attribute);
+
+            try
+            {
+                jos->write(OTA_STATUS_TABLE, insertEntry);
+                LOG(EBackup, EInfo,  "Writing to table succeded");
+            }
+            catch (JavaStorageException jse)
+            {
+                ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str());
+                jos->close();
+                return KErrGeneral;
+            }
+            insertEntry.clear();
+        }
+
+        ILOG(EBackup, "Data written to JAVA_OTA_DATABASE; commit the transaction and close the database");
+        ILOG(EBackup, "Committing the transaction");
+
+        try
+        {
+            jos->commitTransaction();
+            LOG(EBackup, EInfo, "Transaction committed successfully");
+        }
+        catch (JavaStorageException jse)
+        {
+            ELOG1(EBackup, "Committing the transaction failed: %S", jse.toString().c_str());
+            jos->close();
+            return KErrGeneral;
+        }
+
+        LOG(EBackup, EInfo, "Close the database");
+
+        // close the OTA_DATABASE
+        jos->close();
+    }
+
+    LOG(EBackup, EInfo, "Data written to Storage");
+    return KErrNone;
+}
+
+
+int CStorageBackupUtil::FillVectorwithAppPackageTableData(JavaStorageApplicationList_t& foundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = foundEntries.begin(); applications != foundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(PACKAGE_NAME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(VENDOR, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(VERSION, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(ROOT_PATH, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(MEDIA_ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(INITIAL_SIZE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(JAD_PATH, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(JAR_PATH, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(JAD_URL, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(JAR_URL, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(ACCESS_POINT, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(CONTENT_INFO, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(CONTENT_ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithAppTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(PACKAGE_ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(NAME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(MAIN_CLASS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(AUTORUN, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithAppPackageAttTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(NAME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(VALUE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(TRUSTED, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithMidpPackageTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(TYPE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(SECURITY_DOMAIN, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(SECURITY_DOMAIN_CATEGORY, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(HASH, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(CERT_HASH, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(RMS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(VALID_CERTS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(ON_SCREEN_KEYPAD, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+        
+        attribute.setEntry(SECURITY_WARNINGS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithMidpPermTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(CLASS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(NAME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(ACTION, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(FUNCTION_GROUP, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithMidpFuncGrpSetTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(FUNCTION_GROUP, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(ALLOWED_SETTINGS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(CURRENT_SETTING, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(BLANKET_PROMPT, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithPushRegTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(URL, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(NAME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(FILTER, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(REGISTRATION_TYPE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithAlarmRegTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(ALARM_TIME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithRuntimeSetTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(EXTENSIONS, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithPreinstallTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(NAME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(VENDOR, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(VERSION, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(INSTALL_STATE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
+int CStorageBackupUtil::FillVectorwithOtaStatusTableData(JavaStorageApplicationList_t& afoundEntries)
+{
+    const wstring emptyString;
+    wstring str;
+
+    JavaStorageEntry attribute;
+
+    /* Initialise Iterators to iterate through all applications
+       matched with search patterns.  */
+    JavaStorageApplicationList_t::const_iterator applications;
+    JavaStorageApplicationEntry_t::const_iterator findIterator;
+
+    int rowsCount=0;
+    for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
+    {
+        attribute.setEntry(ID, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(CREATION_TIME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(TYPE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(OTA_CODE, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(URL, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(LATEST_RETRY_TIME, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        attribute.setEntry(RETRY_COUNT, L"");
+        str = emptyString;
+        findIterator = (*applications).find(attribute);
+
+        if (findIterator != (*applications).end())
+        {
+            str = (*findIterator).entryValue();
+        }
+        iStringVector.push_back(str);
+
+        rowsCount++;
+    }
+    ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
+    return rowsCount;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javastoragebackuputil.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,404 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for CStorageBackupUtil class
+*
+*/
+
+
+#ifndef JAVASTORAGEBACKUPUTIL_H
+#define JAVASTORAGEBACKUPUTIL_H
+
+#include <string>
+#include <vector>
+
+#include <e32base.h>
+#include <wchar.h>
+#include <s32strm.h>
+
+#include "javastorageentry.h"
+#include "javastorage.h"
+#include "javastoragenames.h"
+
+#define NUMBER_OF_TABLES 11
+
+class RDesWriteStream;
+class RDesReadStream;
+
+namespace java
+{
+namespace backup
+{
+
+
+/**
+--------------------------------------------------------------------------------
+
+*  CStorageBackupUtil class is handling backup and restore of Java Storage data
+*  This class is instantiated when a BUR operation is starting.
+
+Example Data that could be present in JavaStorage which is backed up and restored by this class.
+
+Application Package Data
+ID        | PACKAGE_NAME | VENDOR | VERSION | ROOT_PATH                              | MEDIA_ID | INITIAL_SIZE | JAD_PATH                                              | JAR_PATH                                              | JAD_URL                          | JAR_URL                           | ACCESS_POINT | CONTENT_INFO | CONTENT_ID
+788463512 | HelloWorld?  | Nokia  | 1.1     | \C\Private\102033E6\MIDlets\[101e59d8] | 123456   | 200          | \C\Private\102033E6\MIDlets\[101e59d8]\HelloWorld.jad | \C\Private\102033E6\MIDlets\[101e59d8]\HelloWorld.jar | http://getjar.com/MyGreatApp.jad | http://getjar.com/MyGreatApp2.jar | IAP:2        | 0            | 78d78sd89f789
+
+
+Application Data
+ID        | PACKAGE_ID | NAME       | MAIN_CLASS | AUTORUN
+788463616 | 788463512  | HelloWorld | HelloWorld | 0
+
+
+Application Package Attributes Data
+ID        | NAME            | VALUE      | TRUSTED
+788463512 | MIDlet-Name     | HelloWorld | 00
+788463512 | MIDlet-Version  | 1.0        | 10
+788463512 | MIDlet-Vendor   | Nokia      | 10
+
+
+MIDP Application Package Data
+ID        | TYPE         | SECURITY_DOMAIN | HASH      | CERT_HASH | RMS                                                | VALID_CERTS | ON_SCREEN_KEYPAD
+788463512 | MIDletSuite? | Trusted         | 123456789 | 123456789 | \C\Private\102033E6\MIDlets\[101e59d8]\RMSdata.bin | 1,3,5       | 0
+
+
+MIDP Permissions Data
+ID        | CLASS                                        | NAME                     | ACTION | FUNCTION_GROUP
+788463616 | javax.microedition.io.HttpProtocolPermission | http://server/index.html | read   | HTTP
+
+
+MIDP Function Group Settings Data
+ID        | FUNCTION_GROUP | ALLOWED_SETTINGS                     | CURRENT_SETTING | BLANKET_PROMPT
+788463616 | HTTP           | 111 (e.g. BLANKET, SESSION, ONESHOT) | 001 (ONESHOT)   | 0
+
+The allowed settings could be a an encoded integer based on the binary representation of 3 bits (e.g. 100 if only BLANKET is allowed, 011 if SESSION and ONESHOT are allowed).
+
+
+MIDP Push Registrations Data
+ID        | URL                                                                                       | NAME             | FILTER | REGISTRATION_TYPE
+788463616 | sip:*;type=""application/test"", SIPPushReceiver?                                         | SIPPushReceiver? | *      | 1
+788463616 | btspp://localhost:99999999999999999999999999999999;*;authenticated;blacklist=00E001234567 | BTPushReceiver?  | *      | 0
+
+
+MIDP Alarm Push Registrations Data
+ID        | ALARM_TIME
+788463616 | 2008-09-13;15:20:30
+
+
+MIDP Runtime Settings Data
+EXTENSIONS
+\C\Private\102033E6\Extenstions\12345678\Location.jar
+
+
+Preinstall Data
+NAME            | VENDOR     | VERSION | INSTALL_STATE
+TestMIDletSuite | TestVendor | 1.2.3   | 2
+
+
+MIDP OTA Status Data table
+ID        | CREATION_TIME       | TYPE | OTA_CODE | URL                           | LATEST_RETRY_TIME   | RETRY_COUNT
+788463616 | 2008-09-13;12:20:30 | 1    | 900      | http://www.moo.com/MIDLETS.js | 2008-09-13;15:20:30 | 2
+
+-----------------------------------------------------------------------------------------------------------------------------
+*/
+
+class CStorageBackupUtil : public CBase
+{
+public:
+
+    /**
+     * Instantiates an object of this type
+     */
+    static CStorageBackupUtil* NewL();
+
+    ~CStorageBackupUtil();
+
+    /**
+     * This method requests a section of Java Storage data.
+     * Called by the function GetBackupDataSectionL from midp2backupplugin
+     * The data is filled into the stream till it is full.
+     * The data returned may be base or incremental depending
+     * on the type of backup and the capability of the data owner.
+     *
+     * @param aBuffer a pointer to the base of the location where data
+     *        can be copied.
+     * @param aBackupNotFinished on return EFalse if all data has
+     *        been returned for this drive, else ETrue.
+     */
+    void BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft);
+
+    /**
+     * This method receives a section of base restore data.
+     * Stores the restore data in the vector so that it can be
+     * written to Java Storage when all data have come.
+     *
+     * @param stream holds the restore data
+     * @param aRestoreState EFirstBuffer if all data has been returned
+     *        for this drive, else remains at EStorage.
+     * @param aBufferSpaceLeft the space left in the buffer
+     */
+    void RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft);
+
+private:
+
+    // Default constructor for the class
+
+    CStorageBackupUtil();
+
+    // Second phase constructor function
+
+    void ConstructL();
+
+    /**
+     * This method fills the vector with Java Storage data.
+     * Data is read from JavaStorage tables and put inside the vector
+     * which will later be put into the buffer stream.
+     * The reason for having vector to store the data is that connection to
+     * Java Storage cannot be open for a long period of time
+     * ie writing into buffer stream's time
+     *
+     * @return returns an integer value telling whether the operation
+     *         was completed successfully or not.
+     */
+    int FillVectorWithStorageData();
+
+    /**
+     * A utility function which converts a wstring into a TDesC
+     * and writes it into the stream.
+     *
+     * @param stream an RDesWriteStream into which the converted
+     *        string is written
+     * @param tempString the wstring which is to be converted.
+     */
+    void WriteStringtoStreamL(RDesWriteStream& aStream, std::wstring aTempString);
+
+    /**
+     * A utility function which reads a TDesC from the stream, converts it
+     * to a wstring and writes it into the vector.
+     *
+     * @param stream an RDesReadStream from which the TDesC data is read
+     */
+    void ReadStringfromStreamL(RDesReadStream& aStream);
+
+    /**
+     * This method writes the data to storage.
+     * Gets called after FillVectorsWithStreamDataL() function is called.
+     * This function opens a transaction to Storage and writes
+     * the vector's data into storage row-by-row, and then commits
+     * the transaction.
+     *
+     * @return returns an integer specifying whether the operation
+     *         has completed successfully or not.
+     */
+    int WriteDataToStorage();
+public:
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only APPLICATION_PACKAGE_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithAppPackageTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only APPLICATION_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithAppTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only APPLICATION_PACKAGE_ATTRIBUTES_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithAppPackageAttTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only MIDP_PACKAGE_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithMidpPackageTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only MIDP_PERMISSIONS_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithMidpPermTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only MIDP_FUNCTION_GROUP_SETTINGS_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithMidpFuncGrpSetTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only PUSH_REGISTRATION_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithPushRegTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only ALARM_REGISTRATION_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithAlarmRegTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only RUNTIME_SETTINGS_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithRuntimeSetTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only PREINSTALL_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithPreinstallTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Utility function which fills the vector with data got from storage.
+     * Handles data of only OTA_STATUS_TABLE.
+     *
+     * @param afoundEntries the application entries which match
+     *        the SQL query.
+     * @return an integer representing the number of rows written
+     *         into the vector.
+     */
+    int FillVectorwithOtaStatusTableData(java::storage::JavaStorageApplicationList_t& afoundEntries);
+
+    /**
+     * Prints the vectors
+     */
+    void printVector();
+
+private:
+
+    /**
+     * The actual wstring vector which holds the data during a B&R operation.
+     * During a backup, this vector is filled with storage data and then
+     * written to the stream.
+     * During a restore, this vector is filled with data from the stream
+     * before it is written to storage.
+     * Own
+     */
+    std::vector< std::wstring > iStringVector;
+
+    /**
+     * An integer which holds the length of the string.
+     * When only half the data is read from the stream, this holds the
+     * length of the remaining data which is to be read.
+     * Own
+     */
+    int iLenOfString;
+
+    /**
+     * An integer which holds the count of the number of strings
+     * in the vector. Used during a B&R operation.
+     * Own
+     */
+    int iStrCount;
+
+    /**
+     * An integer array which holds the number of rows of each table
+     * present in storage.
+     * This information is written to stream and is used when the
+     * restored data is written back to storage.
+     * Own
+     */
+    int iTableSize[NUMBER_OF_TABLES];
+
+    /**
+     * A Boolean value which says if a string was only
+     * half read during a previous iteration.
+     * Own
+     */
+    TBool iRemainingString;
+
+    /**
+     * A wstring which holds the half read string so that the
+     * completed string can be appended to it during the next iteration
+     * before it is put into the vector.
+     * Own
+     */
+    std::wstring iHalfReadString;
+
+    /**
+     * Shows if it's the fill call to backup storage data.
+     * Vectors filled only at the first call.
+     * Own
+     */
+    TBool iFirstCalltoBackupStorageData;
+
+    /**
+     * Shows if it's the fill call to restore storage data.
+     * Own
+     */
+    TBool iFirstCalltoRestoreStorageData;
+
+    /**
+     * Shows the remaining number of bytes available in the stream.
+     * Own
+     */
+    int iBufferSpaceLeft;
+};
+
+} // namespace backup
+} // namespace java
+
+#endif // JAVASTORAGEBACKUPUTIL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javaversionbackuputil.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of JavaVersionBackupUtil
+*
+*/
+
+
+#include <javaenvinfo.h>
+#include "javaversionbackuputil.h"
+#include "logger.h"
+
+
+#include <s32mem.h>
+#include <e32base.h>
+
+#define KOMJIdentifier 0x20000F3D
+
+using namespace Java;
+using namespace java::backup;
+
+// ======== MEMBER FUNCTIONS ========
+
+void JavaVersionBackupUtil::WriteJavaVersionL(RDesWriteStream& aStream)
+{
+    JELOG2(EBackup);
+
+    // Get the Java version number from the environment API's
+
+    TVersion version = Java::JavaEnvInfo::Version();
+
+    PLOG3(EBackup, "JavaEnvInfo::Version: major = %d, minor = %d, build = %d",
+          version.iMajor, version.iMinor, version.iBuild);
+
+    /* Put OMJ Package UID in the front indicating that it is an
+       OMJ environment from which backup was taken.  */
+    aStream.WriteInt32L(KOMJIdentifier);
+
+    // write the version numbers to the stream
+    aStream.WriteInt8L(version.iMajor);
+    aStream.WriteInt8L(version.iMinor);
+    aStream.WriteInt16L(version.iBuild);
+
+    ILOG(EBackup, "Version information written to stream");
+}
+
+TUint JavaVersionBackupUtil::CheckJavaVersionL(RDesReadStream& aStream, TDriveNumber aDrive, TBool versionCheck)
+{
+    JELOG2(EBackup);
+    TInt32 omjID = 0;
+    if (versionCheck)
+    {
+        // Read the OMJSpecific ID only on first call
+        omjID = aStream.ReadInt32L();
+    }
+
+    if (omjID != KOMJIdentifier)
+    {
+        _LIT(KJavaRestoreConverterExe, "javarestoreconverter.exe");
+
+        RProcess rProcess;
+
+        TChar targetDrive;
+        _LIT(KText , "");
+        TBuf<15> commandLine(KText);
+        RFs session;
+        TInt err = session.Connect();
+        if (KErrNone != err)
+        {
+            ELOG1(EBackup,
+                  "JavaVersionBackupUtil::CheckJavaVersionL: Session Connection failed, error %d", err);
+            CleanupStack::PopAndDestroy(&aStream);
+            User::Leave(err);
+        }
+
+        err = session.DriveToChar(aDrive, targetDrive);
+        if (KErrNone == err)
+        {
+            _LIT(KDrive, " -drive");
+            commandLine.Append(KDrive);
+            commandLine.Append(targetDrive);
+        }
+
+        err = rProcess.Create(KJavaRestoreConverterExe, commandLine);
+        if (KErrNone == err)
+        {
+            TRequestStatus status;
+            rProcess.Logon(status);
+            rProcess.Resume();
+
+            // now wait until javarestoreconverter exits
+            User::WaitForRequest(status);
+            if (status.Int() != KErrNone)
+            {
+                // Installing old JRT 1.x MIDlets to JRT 2.x failed
+                err = status.Int();
+                ELOG1(EBackup,
+                      "JavaVersionBackupUtil::CheckJavaVersionL: Installation failed, error %d", err);
+                CleanupStack::PopAndDestroy(&aStream);
+                User::Leave(err);
+            }
+            else
+            {
+                LOG(EBackup,EInfo,
+                    "JavaVersionBackupUtil::CheckJavaVersionL: Installing Midlets successful");
+            }
+        }
+        else
+        {
+            // Cannot even start javarestoreconverter
+            ELOG1(EBackup,
+                  "JavaVersionBackupUtil::CheckJavaVersionL: Cannot start Installer, error %d", err);
+            CleanupStack::PopAndDestroy(&aStream);
+            User::Leave(err);
+        }
+        rProcess.Close();
+        return 1;
+
+    }
+    else
+    {
+        TInt8 major = aStream.ReadInt8L();
+        TInt8 minor = aStream.ReadInt8L();
+        TInt16 build = aStream.ReadInt16L();
+
+        TVersion version(major, minor, build);
+
+        PLOG3(EBackup, "JavaVersion read from Stream: major = %d, minor = %d, build = %d",
+              version.iMajor, version.iMinor, version.iBuild);
+
+        // read current version and compare it with the read version
+        TVersion curVersion = Java::JavaEnvInfo::Version();
+
+        PLOG3(EBackup," Current JavaVersion: major = %d, minor = %d, build = %d",
+              curVersion.iMajor, curVersion.iMinor, curVersion.iBuild);
+        return 0;
+
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/javaversionbackuputil.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for JavaVersionBackupUtil class
+*
+*/
+
+
+#ifndef JAVAVERSIONBACKUPUTIL_H
+#define JAVAVERSIONBACKUPUTIL_H
+
+#include <e32base.h>
+#include <driveinfo.h>
+#include <javaenvinfo.h>
+
+class RDesReadStream;
+class RDesWriteStream;
+
+namespace java
+{
+namespace backup
+{
+/**
+ *  JavaVersionBackupUtil class is used for checking the java version
+ *  during a B&R operation. This class writes the current java version
+ *  while backing up and then checks whether the backed up version
+ *  is compatible with the currnet version while doing a restore.
+ *  If it is not compatible, then the backup process is gracefully exited.
+ */
+
+class JavaVersionBackupUtil
+{
+
+public:
+
+    /**
+     * This method writes the current java version into the SBE buffer.
+     * This functions is called when a backup process is started.
+     *
+     * @param aBuffer the buffer which is sent by the SBE
+     */
+    static void WriteJavaVersionL(RDesWriteStream& aStream);
+
+    /**
+     * This method reads the java version from the stream. If there is no
+     * Java version or if the Java version is not compatible with the
+     * current version, then the restore process is exited gracefully.
+     *
+     * @param aStream an RDesReadStream on the buffer which is sent
+     *        by the SBE
+     * @param aDrive current drive to be backed up
+     * @return status
+     */
+    static TUint CheckJavaVersionL(RDesReadStream& aStream, TDriveNumber aDrive, TBool versionCheck);
+
+private:
+
+    /**
+     * This method is used to compare the current java version with the
+     * one read from the stream.
+     * This method is not used presently. Logic may be added in the future
+     *
+     * @param aVersion the java version read from the stream
+     * @param aCurVersion the current java version
+     */
+    void CompareL(TVersion aVersion, TVersion aCurVersion);
+
+};
+
+} // namespace backup
+} // namespace java
+
+#endif // JAVAVERSIONBACKUPUTIL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/midp2backupdataids.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  midp2backupdataids definition
+*
+*/
+
+#include <e32base.h>
+
+#ifndef MIDP2BACKUPDATAIDS_H
+#define MIDP2BACKUPDATAIDS_H
+
+namespace java
+{
+namespace backup
+{
+/**
+ * State of streaming during restore
+ */
+enum TRestoreState
+{
+    EVersion = 0,
+    EStorage,
+    EAppArc,
+    EInIcon,
+    EInSize,
+    EInstall,
+    EScr
+};
+
+} //namespace backup
+} //namespace java
+
+
+#endif // MIDP2BACKUPDATAIDS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/midp2backupplugin.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,637 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Midp2BackupPlugin
+*
+*/
+
+
+#include "midp2backupplugin.h"
+#include "midp2backupdataids.h"
+#include "apparcbackuputil.h"
+#include "javastoragebackuputil.h"
+#include "javaversionbackuputil.h"
+
+#include "javastoragenames.h"
+#include "javastorageentry.h"
+#include "javastorage.h"
+
+#include "javacommonutils.h"
+#include "logger.h"
+
+#include <connect/sbdefs.h>
+#include <s32mem.h>
+#include <s32file.h>
+#include <f32file.h>
+#include <apgcli.h>
+
+
+using namespace std;
+using namespace java::storage;
+using namespace java::backup;
+
+// ======== MEMBER FUNCTIONS ========
+
+CMidp2BackupPlugin::CMidp2BackupPlugin()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin constructor");
+}
+
+void CMidp2BackupPlugin::ConstructL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ConstructL");
+
+    iIconDescIndex = 0;
+    iBufferSpaceLeft = 0;
+    iFirstCallToGetBackupDataSection = ETrue;
+    iStorageDataBackup = ETrue;
+    iStorageDataRestore = ETrue;
+    iJavaVersionInfoWritten = EFalse;
+    iRestoreState = EVersion;
+
+    User::LeaveIfError(iFs.Connect());
+    // to share file handles with AppArc
+    User::LeaveIfError(iFs.ShareProtected());
+
+    iStorageBackupUtil = CStorageBackupUtil::NewL();
+    iAppArcUtil = CAppArcBackupUtil::NewL(iFs);
+}
+
+CMidp2BackupPlugin* CMidp2BackupPlugin::NewL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::NewL");
+
+    CMidp2BackupPlugin* self = new(ELeave) CMidp2BackupPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+}
+
+CMidp2BackupPlugin::~CMidp2BackupPlugin()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin destructor");
+
+    iFs.Close();
+    iIconUidArray.Close();
+    delete iAppArcUtil;
+    delete iIconDesc;
+    delete iRestoreIconDesc;
+    delete iStorageBackupUtil;
+}
+
+// from base class CBackupPlugin
+
+void CMidp2BackupPlugin::PrepareForBURL(TInt aBackupStateValue)
+{
+    (void)aBackupStateValue;  // Just to suppress a warning in release builds
+    LOG1(EBackup, EInfo, "CMidp2BackupPlugin::PrepareForBURL, BUR state: %d", aBackupStateValue);
+}
+
+void CMidp2BackupPlugin::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, TDesC8& /* aBuffer */, TBool /* aLastSection */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+TUint CMidp2BackupPlugin::GetExpectedDataSize(TDriveNumber /* aDrive */)
+{
+    JELOG2(EBackup);
+    return 0;
+}
+
+void CMidp2BackupPlugin::GetSnapshotDataL(TDriveNumber /* aDrive */, TPtr8& /* aBuffer */, TBool& /* aFinished */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+void CMidp2BackupPlugin::InitialiseGetBackupDataL(TDriveNumber aDrive)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::InitialiseGetBackupDataL");
+    iDrive = aDrive;
+}
+
+void CMidp2BackupPlugin::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::GetBackupDataSectionL");
+
+    iBufferSpaceLeft = aBuffer.MaxLength();
+    RDesWriteStream stream(aBuffer);
+    CleanupClosePushL(stream);
+
+    if (!iJavaVersionInfoWritten)
+    {
+        JavaVersionBackupUtil::WriteJavaVersionL(stream);
+        iJavaVersionInfoWritten = ETrue;
+        iBufferSpaceLeft -= 8;
+    }
+
+    if (iStorageDataBackup)
+    {
+        iStorageBackupUtil->BackupStorageDataL(stream, iStorageDataBackup, iBufferSpaceLeft);
+        aFinished = EFalse;
+    }
+
+    else
+    {
+        if (iFirstCallToGetBackupDataSection)
+        {
+            LOG(EBackup, EInfo, "First Call To GetBackupDataSection");
+            // Get the uids of midlets whose icons are to be backed up
+            iIconFilePointer = 0;
+            ResetIconArray();
+            iAppArcUtil->GetMidletsFromAppArcL(iIconUidArray, iDrive);
+
+            /* Streaming MMC's unique Id, if current drive is MMC
+               and there's at least one midlet on the drive*/
+            if (iIconUidArray.Count() > 0 && iDrive >= EDriveE && iDrive <= EDriveZ)
+            {
+                TUint32 mmcId = MmcIdL();
+
+                if (mmcId != 0)
+                {
+                    LOG1(EBackup,EInfo, "Write MMC id: %u", mmcId);
+                    stream.WriteUint32L(mmcId);
+                    iBufferSpaceLeft -= sizeof(mmcId);
+                }
+            }
+            // Setting flag to EFalse
+            iFirstCallToGetBackupDataSection = EFalse;
+        }
+
+        // Next icon uid and filename
+        TUid currentUid;
+        HBufC* fullFileName = NULL;
+
+        // Streaming leftover part of icon file
+        if (iIconDescIndex)
+        {
+            LOG(EBackup, EInfo, "Streaming leftover part of icon file");
+
+            /* if the icon file is bigger than the space in the buffer, write only
+             part of it and fill iLeftover with remaining part. */
+            if (iIconDesc->Size() - iIconDescIndex > iBufferSpaceLeft)
+            {
+                stream.WriteL(iIconDesc->Mid(iIconDescIndex), iBufferSpaceLeft);
+                iIconDescIndex += iBufferSpaceLeft;
+            }
+            else
+            {
+                stream.WriteL(iIconDesc->Mid(iIconDescIndex));
+                iIconDescIndex = 0;
+            }
+
+            aFinished = EFalse;
+        }
+
+        // Get new icon file
+        else if (NextIcon(currentUid, fullFileName))
+        {
+            LOG1(EBackup, EInfo, "New icon file, id: %d", currentUid.iUid);
+
+            // Readstream for icon file
+            RFileReadStream fileStream;
+
+            User::LeaveIfError(fileStream.Open(iFs, *fullFileName, EFileRead));
+            CleanupClosePushL(fileStream);
+
+            TEntry* entry = new(ELeave) TEntry();
+            CleanupStack::PushL(entry);
+
+            iFs.Entry(*fullFileName, *entry);
+            TInt32 size = entry->iSize;
+
+            // Write icon file content into iIconDesc
+            LOG(EBackup, EInfo, "Write icon file content into iIconDesc");
+            delete iIconDesc;
+            iIconDesc = NULL;
+            iIconDesc = HBufC8::NewL(size);
+
+            TPtr8 buf = iIconDesc->Des();
+            fileStream.ReadL(buf, size);
+
+            // get the group name of the midlet from AppArc
+            TBuf< KApaMaxAppGroupName >groupName(iAppArcUtil->GetMidletGroupName(currentUid));
+            TInt groupNameSize = groupName.Size();
+
+            // Write the size of the data
+            LOG(EBackup,EInfo, "Write the size of the data");
+
+            TParsePtrC parse(*fullFileName);
+            TPtrC fileName = parse.NameAndExt();
+            TInt32 fileNameSize = fileName.Size();
+
+            stream.WriteInt32L(sizeof(TUid)    // Uid
+                               + sizeof(TInt32)   // fileNameSize
+                               + fileNameSize // filename
+                               + sizeof(TInt32)   // number of icons
+                               + sizeof(TInt32)   // groupnamesize
+                               + groupNameSize
+                               + size // icon file
+                              );
+            iBufferSpaceLeft -= sizeof(TInt32);
+
+            // Write the Uid of the midlet
+            LOG(EBackup, EInfo, "Write the Uid of the midlet");
+            stream.WriteInt32L(currentUid.iUid);
+            iBufferSpaceLeft -= sizeof(TUid);
+
+            // Write the size of the icon filename
+            LOG(EBackup, EInfo, "Write the size of the icon filename");
+            stream.WriteInt32L(fileNameSize);
+            iBufferSpaceLeft -= sizeof(TInt32);
+
+            // Write icon filename
+            LOG(EBackup, EInfo, "Write icon filename");
+            stream.WriteL(fileName);
+            iBufferSpaceLeft -= fileNameSize;
+
+            // Write number of icons in midlet
+            LOG(EBackup, EInfo, "Write number of icons in midlet");
+            TInt iconCount;
+            iAppArcUtil->NumberOfOwnDefinedIcons(TUid::Uid(currentUid.iUid), iconCount);
+            stream.WriteInt32L(iconCount);
+            iBufferSpaceLeft -= sizeof(TInt32);
+
+            // TPtr8 groupName(iAppArcUtil->GetMidletGroupName(currentUid));
+            LOG(EBackup, EInfo, "Write the size of the Group name of the midlet");
+            stream.WriteInt32L(groupNameSize);
+            iBufferSpaceLeft -= sizeof(TInt32);
+
+            if (groupNameSize != 0)
+            {
+                LOG(EBackup, EInfo, "Write the Group name of the midlet");
+                stream.WriteL(groupName);
+                iBufferSpaceLeft -= groupNameSize;
+            }
+
+            /* if the icon file is bigger than the space in the buffer,
+               write only part of it and fill iLeftover with remaining part */
+            LOG(EBackup, EInfo, "Write icon");
+            if (size > iBufferSpaceLeft)
+            {
+                stream.WriteL(buf, iBufferSpaceLeft);
+                iIconDescIndex = iBufferSpaceLeft;
+            }
+            else
+            {
+                stream.WriteL(buf, size);
+                iIconDescIndex = 0;
+            }
+
+            aFinished = EFalse;
+
+            CleanupStack::PopAndDestroy(&fileStream);
+            CleanupStack::PopAndDestroy(entry);
+        }
+
+        else
+        {
+            aFinished = ETrue;
+            iFirstCallToGetBackupDataSection = ETrue;
+            iStorageDataBackup = ETrue;
+        }
+
+        delete fullFileName;
+    }
+    CleanupStack::PopAndDestroy(&stream);
+}
+
+
+void CMidp2BackupPlugin::InitialiseRestoreBaseDataL(TDriveNumber aDrive)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::InitialiseRestoreBaseDataL");
+    iDrive = aDrive;
+}
+
+void CMidp2BackupPlugin::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreBaseDataSectionL");
+
+    iBufferSpaceLeft = aBuffer.Size();
+    RDesReadStream stream(aBuffer);
+    CleanupClosePushL(stream);
+    TBool versionCheck = ETrue;
+
+    if (((iRestoreState == EVersion) || (iRestoreState == EInstall)) && iBufferSpaceLeft >= 8)
+    {
+        if (iRestoreState == EInstall)
+        {
+            versionCheck = EFalse;
+        }
+        TUint ret = JavaVersionBackupUtil::CheckJavaVersionL(stream,iDrive,versionCheck);
+        if (1==ret)
+        {
+            // Here set the satus to restore finished, so that control goes back to SBE & SBE calls B&R for another drive
+            iRestoreState = EInstall;
+        }
+        else
+        {
+            /* version information has been written to stream.
+             So change restore state to restore storage data  */
+            iRestoreState = EStorage;
+        }
+        // version information is of length 8 bytes.
+        iBufferSpaceLeft -= 8;
+    }
+
+    if (iRestoreState == EStorage)
+    {
+        iStorageBackupUtil -> RestoreStorageDataL(stream, iRestoreState, iBufferSpaceLeft);
+    }
+
+    // Only at first call
+    if ((iRestoreState != EStorage && iRestoreState != EVersion) && (iRestoreState != EInstall))
+    {
+        if (iRestoreState == EAppArc)
+        {
+            // Making AppArc deregistrations
+            TRAPD(err, iAppArcUtil->DeregisterAppsL(iDrive));
+
+            if (err)
+            {
+                ELOG(EBackup, "Leave in deregistering apps");
+            }
+        }
+
+        // Process the data buffer for restore
+        ProcessBufferL(stream);
+
+        if (aFinished)
+        {
+            // Set state to EStorage
+            iRestoreState = EStorage;
+        }
+    }
+
+    aFinished = ETrue;
+    CleanupStack::PopAndDestroy(&stream);
+}
+
+void CMidp2BackupPlugin::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+void CMidp2BackupPlugin::RestoreIncrementDataSectionL(TDesC8& /* aBuffer */, TBool /* aFinished */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+void CMidp2BackupPlugin::RestoreComplete(TDriveNumber /* aDrive */)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreComplete");
+}
+
+TUint CMidp2BackupPlugin::MmcIdL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::MmcIdL()");
+
+    TVolumeInfo* volumeInfo = new(ELeave) TVolumeInfo();
+
+    TInt err = iFs.Volume(*volumeInfo, iDrive);
+
+    if (!err)
+    {
+        TUint mmcId = volumeInfo->iUniqueID;
+        return mmcId;
+    }
+    else
+    {
+        return 0;
+    }
+
+
+}
+
+void CMidp2BackupPlugin::ProcessBufferL(RDesReadStream& stream)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessBuffer()");
+
+    // Cycle until there's data in the buffer
+    while (iBufferSpaceLeft > 0)
+    {
+        switch (iRestoreState)
+        {
+        case EAppArc:
+            ProcessFirstBufferL(stream, iBufferSpaceLeft);
+            break;
+
+        case EInIcon:
+            ProcessInIconL(stream, iBufferSpaceLeft);
+            break;
+
+        case EInSize:
+            ProcessInSizeL(stream, iBufferSpaceLeft);
+            break;
+
+        default:
+            CleanupStack::PopAndDestroy(&stream);
+            User::Leave(KErrNotSupported);
+        }
+    }
+}
+
+
+_LIT(KStarWildCard, "*.*");
+
+void CMidp2BackupPlugin::RestoreMmcRegistryL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreMmcRegistry()");
+
+    /* If backed up MMC is not the same as the current MMC, copy the entries
+       from the directory of the backed up MMC to the directory
+       of the current MMC */
+    TUint32 mmc = MmcIdL();
+
+    if (iBackupMmc != mmc)
+    {
+        // Create path to old place
+        TPath path_old;
+        CreateMmcPath(path_old, iDrive, iBackupMmc);
+
+        // Create path to new place
+        TPath path_new;
+        CreateMmcPath(path_new, iDrive, mmc);
+
+        // Get old files list
+        CFileMan* fileMan = CFileMan::NewL(iFs);
+
+        CleanupStack::PushL(fileMan);
+
+        // Copy to new place
+        iFs.MkDir(path_new);
+        path_old.Append(KStarWildCard);
+        TInt  err = fileMan->Copy(path_old, path_new);
+
+        ILOG1(EBackup, "File copy, status: %d", err);
+
+        User::LeaveIfError(err);
+
+        CleanupStack::PopAndDestroy();
+    }
+}
+
+_LIT(KPrivatePath, "C:\\private\\");
+
+void CMidp2BackupPlugin::CreateMmcPath(TDes& aPathName, TInt aDrive, TUint aUniqueId)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::CreateMmcPath()");
+
+    aPathName.Zero();
+    aPathName.Append(KPrivatePath);
+    aPathName.AppendNum(KRegistryServerUid, EHex);
+    aPathName.Append(KPathDelimiter);
+
+    // append drive name
+    TDriveUnit driveUnit(aDrive);
+    aPathName.Append(driveUnit.Name().Left(1));
+    aPathName.Append(KPathDelimiter);
+
+    TUint64 id = aUniqueId;
+    aPathName.AppendNum(id, EHex);
+    aPathName.Append(KPathDelimiter);
+}
+
+TBool CMidp2BackupPlugin::NextIcon(TUid& aCurrentUid, HBufC*& aFullFileName)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::NextIcon()");
+
+    if (iIconUidArray.Count() > iIconFilePointer)
+    {
+        aCurrentUid = iIconUidArray[iIconFilePointer];
+        iAppArcUtil->GetIconFilename(iIconUidArray[iIconFilePointer], aFullFileName);
+        iIconFilePointer++;
+        return ETrue;
+    }
+    else
+    {
+        // There are no more icon files
+        return EFalse;
+    }
+}
+
+void CMidp2BackupPlugin::ProcessFirstBufferL(RDesReadStream& aStream, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessFirstBuffer()");
+
+    if (iDrive >= EDriveE && iDrive <= EDriveZ)
+    {
+        // Read MMC id and restore MMC entries if needed
+        iBackupMmc = aStream.ReadUint32L();
+        aBufferSpaceLeft -= sizeof(iBackupMmc);
+        LOG1(EBackup, EInfo, "Read MMC Id: %u", iBackupMmc);
+        RestoreMmcRegistryL();
+    }
+    if (aBufferSpaceLeft >= sizeof(TInt32))
+    {
+        iIconFileSizeLeft = aStream.ReadInt32L();
+        aBufferSpaceLeft -= sizeof(iIconFileSizeLeft);
+        iRestoreIconDesc = HBufC8::NewL(iIconFileSizeLeft);
+        iRestoreState = EInIcon;
+    }
+    else
+    {
+        // No more data to read
+        aBufferSpaceLeft = 0;
+    }
+}
+
+void CMidp2BackupPlugin::ProcessInIconL(RDesReadStream& aStream, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessInIcon()");
+
+    TPtr8 restoreIconPtr = iRestoreIconDesc->Des();
+    HBufC8* tempDesc = HBufC8::NewL(iIconFileSizeLeft);
+    CleanupStack::PushL(tempDesc);
+    TPtr8 tempPtr = tempDesc->Des();
+
+    // Icon cannot be read fully
+    if (iIconFileSizeLeft > aBufferSpaceLeft)
+    {
+        aStream.ReadL(tempPtr, aBufferSpaceLeft);
+        restoreIconPtr.Append(tempPtr);
+        iIconFileSizeLeft -= aBufferSpaceLeft;
+        aBufferSpaceLeft = 0;
+        iRestoreState = EInIcon;
+    }
+    // Icon can be read fully
+    else
+    {
+        aStream.ReadL(tempPtr, iIconFileSizeLeft);
+        restoreIconPtr.Append(tempPtr);
+        aBufferSpaceLeft -= iIconFileSizeLeft;
+        iRestoreState = EInSize;
+
+        TRAPD(err, iAppArcUtil->RegisterAppL(restoreIconPtr, iDrive));
+
+        if (err)
+        {
+            ELOG(EBackup, "Registerin application to AppArc failed.");
+        }
+    }
+
+    CleanupStack::PopAndDestroy(tempDesc);
+}
+
+void CMidp2BackupPlugin::ProcessInSizeL(RDesReadStream& aStream, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessInSize()");
+
+    if (aBufferSpaceLeft >= sizeof(TInt32))
+    {
+        if (iSizeBuffer.Size() != 0)
+        {
+            // Read leftover part of size
+            TInt readData = sizeof(TInt32) - iSizeBuffer.Size();
+            aStream.ReadL(iSizeBuffer, readData);
+            RMemReadStream sizeStream(iSizeBuffer.Ptr(), 4);
+            CleanupClosePushL(sizeStream);
+            iIconFileSizeLeft = sizeStream.ReadInt32L();
+            CleanupStack::PopAndDestroy(&sizeStream);
+            aBufferSpaceLeft -= sizeof(readData);
+        }
+        else
+        {
+            // Read size in full
+            iIconFileSizeLeft = aStream.ReadInt32L();
+            aBufferSpaceLeft -= sizeof(iIconFileSizeLeft);
+        }
+
+        delete iRestoreIconDesc;
+        iRestoreIconDesc = NULL;
+        iRestoreIconDesc = HBufC8::NewL(iIconFileSizeLeft);
+        iRestoreState = EInIcon;
+    }
+    else
+    {
+        // Read first byte(s) of size
+        aStream.ReadL(iSizeBuffer, aBufferSpaceLeft);
+        aBufferSpaceLeft = 0;
+    }
+}
+
+void CMidp2BackupPlugin::ResetIconArray()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ResetIconArray()");
+
+    // Remove all entries
+    while (iIconUidArray.Count())
+    {
+        iIconUidArray.Remove(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/midp2backupplugin.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,412 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for CMidp2BackupPlugin class
+*
+*/
+
+
+#ifndef MIDP2BACKUPPLUGIN_H
+#define MIDP2BACKUPPLUGIN_H
+
+#include "backupplugin.h"
+#include <apadef.h>
+#include "logger.h"
+
+class RDesWriteStream;
+class RDesReadStream;
+
+
+
+namespace java
+{
+namespace backup
+{
+
+class CAppArcBackupUtil;
+class CJavaVersionBackupUtil;
+class CStorageBackupUtil;
+
+
+
+/**
+ *  CMidp2BackupPlugin class is handling backup and restore operations
+ *  for MIDlets
+ *
+ *  This class is instantiated when a BUR operation is starting.
+ */
+class CMidp2BackupPlugin : public CBackupPlugin
+{
+
+public:
+
+    /**
+     * Instantiates an object of this type
+     */
+    static CMidp2BackupPlugin* NewL();
+
+    ~CMidp2BackupPlugin();
+
+
+    // from base class CBackupPlugin
+
+    /**
+     * This method is called when a backup or restore operation is
+     * starting. Preparations can be done to prepare for BUR.
+     *
+     * @param aBackupStateValue the value of the current backup state
+     */
+    void PrepareForBURL(TInt aBackupStateValue);
+
+    /**
+     * This method receives all or part of a snapshot of data to allow
+     * calculation of an incremental backup.  The snapshot is one that
+     * was previously supplied by the data owner.  The snapshot data
+     * should be read from the location supplied. The snapshot data may
+     * be larger than the location supplied in which case the routine
+     * will be called repeatedly until all data has been supplied.
+     *
+     * Snapshot data will also be supplied as part of a restore operation
+     *
+     * @param aDrive the drive being backed up
+     * @param aBuffer a pointer to the base of the location from whence
+     *        data can be copied.
+     * @param aLastSection ETrue if this is the last section of snapshot
+     *        data, else EFalse.
+     */
+    void ReceiveSnapshotDataL(TDriveNumber aDrive,
+                              TDesC8& aBuffer,
+                              TBool aLastSection);
+
+    /**
+     * This method returns the expected size of backup data that will be
+     * supplied. If an incremental backup is underway then this method
+     * will not be called until after ReceiveSnapshotDataL().
+     * The size data will be used for the purpose of tracking progess
+     * during a backup. If it is inaccurate then the user may see
+     * irregular progress but the actual backup data will not be
+     * affected so it is acceptable to return an estimated value.
+     *
+     * @param aDrive the drive being backed up.
+     * @return the size of the data that will be returned
+     */
+    TUint GetExpectedDataSize(TDriveNumber aDrive);
+
+    /**
+     * This method returns a snapshot of data to accompany a backup. The
+     * snapshot is expected to contain details on files / data being
+     * backed up. The format of the snapshot is only meaningful to the
+     * data owner. The snapshot will be supplied if the data owner is
+     * asked for an incremental backup and for a restore operation. The
+     * snapshot data should be copied to the location supplied.
+     *
+     * The snapshot data may be larger than the location supplied in
+     * which case the routine will be called repeatedly until all data
+     * has been retrieved.
+     *
+     * @param aDrive the drive being backed up
+     * @param aBuffer a pointer to the base of the location where data
+     *        can be copied.
+     * @param aFinished on return ETrue if all data has been returned
+     *        for this drive, else EFalse.
+     */
+    void GetSnapshotDataL(TDriveNumber aDrive,
+                          TPtr8& aBuffer,
+                          TBool& aFinished);
+
+    /**
+     * This method prepares the implementor to return backup data. It
+     * will be followed by a sequence of calls to request the actual
+     * data.
+     *
+     * @param aDrive the drive being backed up.
+     */
+    void InitialiseGetBackupDataL(TDriveNumber aDrive);
+
+    /**
+     * This method requests a section of backup data.
+     * InitialiseGetBackupDataL() will have been called previously to
+     * specify the drive concerned.  The data returned may be base or
+     * incremental depending on the type of backup and the capability of
+     * the data owner.
+     *
+     * @param aBuffer a pointer to the base of the location where data
+     *        can be copied.
+     * @param aFinished on return ETrue if all data has been returned
+     *        for this drive, else EFalse.
+     */
+    void GetBackupDataSectionL(TPtr8& aBuffer,
+                               TBool& aFinished);
+
+    /**
+     * This method prepares the implementor to receive base restore data
+     * for a drive. It will be followed by a sequence of calls to supply
+     * the actual data.
+     *
+     * @param aDrive the drive being restored.
+     */
+    void InitialiseRestoreBaseDataL(TDriveNumber aDrive);
+
+    /**
+     * This method receives a section of base restore data.
+     * InitialiseRestoreBaseDataL() will have been called previously to
+     * specify the drive concerned.
+     *
+     * @param aBuffer a pointer to the base of the location whence data
+     *        can be read.
+     * @param aFinished ETrue if all data has been returned for this
+     *        drive, else EFalse.
+     */
+    void RestoreBaseDataSectionL(TDesC8& aBuffer,
+                                 TBool aFinished);
+
+    /**
+     * This method prepares the implementor to receive incremental
+     * restore data for a drive. It will be followed by a sequence
+     * of calls to supply the actual data.  If multiple increments
+     * are supplied then this methid will be called before each increment
+     *
+     * @param aDrive the drive being restored.
+     */
+    void InitialiseRestoreIncrementDataL(TDriveNumber aDrive);
+
+    /**
+     * This method receives a section of increment restore data.
+     * InitialiseRestoreIncrementDataL() will have been called
+     * previously to specify the drive concerned.
+     *
+     * @param aBuffer a pointer to the base of the location whence data
+     *        can be read.
+     * @param aFinished ETrue if all data has been returned for this
+     *        increment, else EFalse.
+     */
+    void RestoreIncrementDataSectionL(TDesC8& aBuffer,
+                                      TBool aFinished);
+
+    /**
+     * This method is called when all data to be restored has been
+     * supplied.
+     *
+     * @param aDrive the drive being restored.
+     */
+    void RestoreComplete(TDriveNumber aDrive);
+
+private:
+
+    CMidp2BackupPlugin();
+
+    void ConstructL();
+
+    /**
+     * This method is called to get the unique Id of the current MMC
+     *
+     * @return The Id of the MMC, or 0, if no MMC is inserted
+     */
+    TUint MmcIdL();
+
+    /**
+     * This method is called to process the content of the buffer
+     * provided in active phase of restore
+     *
+     * @param aBuffer the buffer to process
+     */
+    void ProcessBufferL(RDesReadStream& stream);
+
+    /**
+     * This method is called to restore the Java Registry entries
+     * on the MMC, if needed
+     */
+    void RestoreMmcRegistryL();
+
+    /**
+     * This method creates the path for the Java Registry entries on
+     * the specified MMC
+     *
+     * @param [out] aPathName path of the entries of the MMC
+     * @param aDrive drive of the MMC
+     * @param aUniqueId Unique Id of the MMC
+     */
+    void CreateMmcPath(TDes& aPathName,
+                       TInt aDrive,
+                       TUint aUniqueId);
+
+    /**
+     * This method gets the path for the next icon file to be backed up
+     *
+     * @param [out] aCurrentUid Uid of the next icon
+     * @param [out] aFullFileName path of the next icon
+     * @return EFalse if there are no more icons in the array, ETrue
+     *         otherwise
+     */
+    TBool NextIcon(TUid& aCurrentUid, HBufC*& aFullFileName);
+
+    /**
+     * Process buffer when restore state is EFirstBuffer
+     *
+     * @param aStream readstream of buffer to process
+     * @param aBufferSpaceLeft space left of buffer to be processed
+     */
+    void ProcessFirstBufferL(RDesReadStream& aStream, TInt& aBufferSpaceLeft);
+
+    /**
+     * Process buffer when restore state is EInIcon
+     *
+     * @param aStream readstream of buffer to process
+     * @param aBufferSpaceLeft space left of buffer to be processed
+     */
+    void ProcessInIconL(RDesReadStream& aStream, TInt& aBufferSpaceLeft);
+
+    /**
+     * Process buffer when restore state is EInSize
+     *
+     * @param aStream readstream of buffer to process
+     * @param aBufferSpaceLeft space left of buffer to be processed
+     */
+    void ProcessInSizeL(RDesReadStream& aStream, TInt& aBufferSpaceLeft);
+
+    /**
+     * Resets the array of icons to be backed up
+     */
+    void ResetIconArray();
+
+private: // data
+
+    /**
+     * File session
+     * Own.
+     */
+    RFs iFs;
+
+    /**
+     * AppArcBackupUtil object for AppArc operations
+     * Own.
+     */
+    CAppArcBackupUtil* iAppArcUtil;
+
+    /**
+     * StorageBackupUtil object for storage B&R
+     * Own.
+     */
+    CStorageBackupUtil* iStorageBackupUtil;
+    /**
+     * The drive that is backed up or restored currently
+     * Own.
+     */
+    TDriveNumber iDrive;
+
+    /**
+     * Id of backed up drive, gets its value from restored data
+     * Own.
+     */
+    TInt32 iBackupDrive;
+
+    /**
+     * Id of backed up MMC, gets its value from restored data
+     * Own.
+     */
+    TUint32 iBackupMmc;
+
+    /**
+     * State of streaming during restore
+     * Own.
+     */
+    TInt iRestoreState;
+
+    /**
+     * Shows if it's the first call to GetBackupDataSectionL
+     * Own.
+     */
+    TBool iFirstCallToGetBackupDataSection;
+
+    /**
+     * Shows if Backup of storage data is finished or not
+     * Own.
+     */
+    TBool iStorageDataBackup;
+
+    /**
+     * Shows if Restore of storage data is finished or not
+     * Own.
+     */
+    TBool iStorageDataRestore;
+
+    /**
+     * Shows if Java version information is already written or not
+     * Own
+     */
+    TBool iJavaVersionInfoWritten;
+
+    /**
+     * Shows if its the first call to restore data or not.
+     * Own.
+     */
+    TBool iFirstCallToRestoreBackupDataSection;
+
+    /**
+     * Stores the uids of the midlets whose icons are to be backed up.
+     * Own.
+     */
+    RArray<TUid> iIconUidArray;
+
+    /**
+     * The current index in the icon file array
+     * Own.
+     */
+    TInt iIconFilePointer;
+
+    /**
+     * Stores the current icon file for streaming
+     * This descriptor will be streamed at subsequent calls of
+     * GetBackupDataSectionL()
+     * Own.
+     */
+    HBufC8* iIconDesc;
+
+    /**
+     * Stores the current icon file being restored
+     * Own.
+     */
+    HBufC8* iRestoreIconDesc;
+
+    /**
+     * Size of the icon to be still read during restore
+     * Own.
+     */
+    TInt32 iIconFileSizeLeft;
+
+    /**
+     * Current index of iIconDesc
+     * Own.
+     */
+    TInt iIconDescIndex;
+
+    /**
+     * Holds the remaining bytes in the buffer
+     * Own
+     */
+
+    TInt iBufferSpaceLeft;
+
+    /**
+     * Buffer for storing data size in restore
+     * Own.
+     */
+    TBuf8<4> iSizeBuffer;
+};
+
+
+ 
+} //namespace backup
+} //namespace java
+
+#endif // MIDP2BACKUPPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/midp2backuppluginusif.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,490 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Midp2BackupPlugin with USIF 
+*
+*/
+
+#include <connect/sbdefs.h>
+#include <s32mem.h>
+#include <s32file.h>
+#include <f32file.h>
+#include <apgcli.h>
+
+#include "midp2backuppluginusif.h"
+#include "midp2backupdataids.h"
+#include "javastoragebackuputil.h"
+#include "javaversionbackuputil.h"
+#include "javascrbackuputil.h"
+
+#include "javastoragenames.h"
+#include "javastorageentry.h"
+#include "javastorage.h"
+
+
+#include "javacommonutils.h"
+#include "logger.h"
+
+
+using namespace std;
+using namespace java::storage;
+using namespace java::backup;
+
+// ======== MEMBER FUNCTIONS ========
+
+CMidp2BackupPlugin::CMidp2BackupPlugin()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin constructor");
+}
+
+void CMidp2BackupPlugin::ConstructL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ConstructL");
+
+    iIconDescIndex = 0;
+    iBufferSpaceLeft = 0;
+    iFirstCallToGetBackupDataSection = ETrue;
+    iStorageDataBackup = ETrue;
+    iScrDataBackup = ETrue;
+    iStorageDataRestore = ETrue;
+    iJavaVersionInfoWritten = EFalse;
+    iRestoreState = EVersion;
+
+    User::LeaveIfError(iFs.Connect());
+    // to share file handles with AppArc
+    User::LeaveIfError(iFs.ShareProtected());
+
+    iStorageBackupUtil = CStorageBackupUtil::NewL();
+    
+    //iAppArcUtil = CAppArcBackupUtil::NewL(iFs);
+    
+    iScrBackupUtil = CScrBackupUtil::NewL();
+}
+
+CMidp2BackupPlugin* CMidp2BackupPlugin::NewL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::NewL");
+
+    CMidp2BackupPlugin* self = new(ELeave) CMidp2BackupPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+}
+
+CMidp2BackupPlugin::~CMidp2BackupPlugin()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin destructor");
+
+    iFs.Close();
+    iIconUidArray.Close();
+    //delete iAppArcUtil;
+    delete iIconDesc;
+    delete iRestoreIconDesc;
+    delete iStorageBackupUtil;
+}
+
+// from base class CBackupPlugin
+
+void CMidp2BackupPlugin::PrepareForBURL(TInt aBackupStateValue)
+{
+    (void)aBackupStateValue;  // Just to suppress a warning in release builds
+    LOG1(EBackup, EInfo, "CMidp2BackupPlugin::PrepareForBURL, BUR state: %d", aBackupStateValue);
+}
+
+void CMidp2BackupPlugin::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, TDesC8& /* aBuffer */, TBool /* aLastSection */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+TUint CMidp2BackupPlugin::GetExpectedDataSize(TDriveNumber /* aDrive */)
+{
+    JELOG2(EBackup);
+    return 0;
+}
+
+void CMidp2BackupPlugin::GetSnapshotDataL(TDriveNumber /* aDrive */, TPtr8& /* aBuffer */, TBool& /* aFinished */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+void CMidp2BackupPlugin::InitialiseGetBackupDataL(TDriveNumber aDrive)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::InitialiseGetBackupDataL");
+    iDrive = aDrive;
+}
+
+void CMidp2BackupPlugin::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::GetBackupDataSectionL");
+
+    iBufferSpaceLeft = aBuffer.MaxLength();
+    RDesWriteStream stream(aBuffer);
+    CleanupClosePushL(stream);
+
+    if (!iJavaVersionInfoWritten)
+    {
+        JavaVersionBackupUtil::WriteJavaVersionL(stream);
+        iJavaVersionInfoWritten = ETrue;
+        iBufferSpaceLeft -= 8;
+    }
+
+    if (iStorageDataBackup)
+    {
+        iStorageBackupUtil->BackupStorageDataL(stream, iStorageDataBackup, iBufferSpaceLeft);
+        aFinished = EFalse;
+    }
+    else if(iScrDataBackup)
+    {
+        iScrBackupUtil->BackupScrDataL(stream,iScrDataBackup,iBufferSpaceLeft);
+        aFinished = EFalse;
+    }
+    
+    CleanupStack::PopAndDestroy(&stream);
+}
+
+
+void CMidp2BackupPlugin::InitialiseRestoreBaseDataL(TDriveNumber aDrive)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::InitialiseRestoreBaseDataL");
+    iDrive = aDrive;
+}
+
+void CMidp2BackupPlugin::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreBaseDataSectionL");
+
+    iBufferSpaceLeft = aBuffer.Size();
+    RDesReadStream stream(aBuffer);
+    CleanupClosePushL(stream);
+    TBool versionCheck = ETrue;
+
+    if (((iRestoreState == EVersion) || (iRestoreState == EInstall)) && iBufferSpaceLeft >= 8)
+    {
+        if (iRestoreState == EInstall)
+        {
+            versionCheck = EFalse;
+        }
+        TUint ret = JavaVersionBackupUtil::CheckJavaVersionL(stream,iDrive,versionCheck);
+        if (1==ret)
+        {
+            // Here set the satus to restore finished, so that control goes back to SBE & SBE calls B&R for another drive
+            iRestoreState = EInstall;
+        }
+        else
+        {
+            /* version information has been written to stream.
+             So change restore state to restore storage data  */
+            iRestoreState = EStorage;
+        }
+        // version information is of length 8 bytes.
+        iBufferSpaceLeft -= 8;
+    }
+
+    if (iRestoreState == EStorage)
+    {
+        iStorageBackupUtil -> RestoreStorageDataL(stream, iRestoreState, iBufferSpaceLeft);
+    }
+
+    if(iRestoreState == EScr)
+        {
+            iScrBackupUtil->RestoreScrDataL(stream,iRestoreState,iBufferSpaceLeft); 
+        }
+    // Only at first call
+    if ((iRestoreState != EScr && iRestoreState != EVersion) && (iRestoreState != EInstall))
+    {/*
+        if (iRestoreState == EAppArc)
+        {
+            // Making AppArc deregistrations
+            TRAPD(err, iAppArcUtil->DeregisterAppsL(iDrive));
+
+            if (err)
+            {
+                ELOG(EBackup, "Leave in deregistering apps");
+            }
+        }
+
+        // Process the data buffer for restore
+        ProcessBufferL(stream);
+
+        if (aFinished)
+        {
+            // Set state to EStorage
+            iRestoreState = EStorage;
+        }
+   */ }
+
+    aFinished = ETrue;
+    CleanupStack::PopAndDestroy(&stream);
+}
+
+void CMidp2BackupPlugin::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+void CMidp2BackupPlugin::RestoreIncrementDataSectionL(TDesC8& /* aBuffer */, TBool /* aFinished */)
+{
+    JELOG2(EBackup);
+    User::Leave(KErrNotSupported);
+}
+
+void CMidp2BackupPlugin::RestoreComplete(TDriveNumber /* aDrive */)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreComplete");
+}
+
+TUint CMidp2BackupPlugin::MmcIdL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::MmcIdL()");
+
+    TVolumeInfo* volumeInfo = new(ELeave) TVolumeInfo();
+
+    TInt err = iFs.Volume(*volumeInfo, iDrive);
+
+    if (!err)
+    {
+        TUint mmcId = volumeInfo->iUniqueID;
+        return mmcId;
+    }
+    else
+    {
+        return 0;
+    }
+
+
+}
+/*
+void CMidp2BackupPlugin::ProcessBufferL(RDesReadStream& stream)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessBuffer()");
+
+    // Cycle until there's data in the buffer
+    while (iBufferSpaceLeft > 0)
+    {
+        switch (iRestoreState)
+        {
+        case EAppArc:
+            ProcessFirstBufferL(stream, iBufferSpaceLeft);
+            break;
+
+        case EInIcon:
+            ProcessInIconL(stream, iBufferSpaceLeft);
+            break;
+
+        case EInSize:
+            ProcessInSizeL(stream, iBufferSpaceLeft);
+            break;
+
+        default:
+            CleanupStack::PopAndDestroy(&stream);
+            User::Leave(KErrNotSupported);
+        }
+    }
+}
+*/
+
+_LIT(KStarWildCard, "*.*");
+
+void CMidp2BackupPlugin::RestoreMmcRegistryL()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreMmcRegistry()");
+
+    /* If backed up MMC is not the same as the current MMC, copy the entries
+       from the directory of the backed up MMC to the directory
+       of the current MMC */
+    TUint32 mmc = MmcIdL();
+
+    if (iBackupMmc != mmc)
+    {
+        // Create path to old place
+        TPath path_old;
+        CreateMmcPath(path_old, iDrive, iBackupMmc);
+
+        // Create path to new place
+        TPath path_new;
+        CreateMmcPath(path_new, iDrive, mmc);
+
+        // Get old files list
+        CFileMan* fileMan = CFileMan::NewL(iFs);
+
+        CleanupStack::PushL(fileMan);
+
+        // Copy to new place
+        iFs.MkDir(path_new);
+        path_old.Append(KStarWildCard);
+        TInt  err = fileMan->Copy(path_old, path_new);
+
+        ILOG1(EBackup, "File copy, status: %d", err);
+
+        User::LeaveIfError(err);
+
+        CleanupStack::PopAndDestroy();
+    }
+}
+
+_LIT(KPrivatePath, "C:\\private\\");
+
+void CMidp2BackupPlugin::CreateMmcPath(TDes& aPathName, TInt aDrive, TUint aUniqueId)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::CreateMmcPath()");
+
+    aPathName.Zero();
+    aPathName.Append(KPrivatePath);
+    aPathName.AppendNum(KRegistryServerUid, EHex);
+    aPathName.Append(KPathDelimiter);
+
+    // append drive name
+    TDriveUnit driveUnit(aDrive);
+    aPathName.Append(driveUnit.Name().Left(1));
+    aPathName.Append(KPathDelimiter);
+
+    TUint64 id = aUniqueId;
+    aPathName.AppendNum(id, EHex);
+    aPathName.Append(KPathDelimiter);
+}
+/*
+TBool CMidp2BackupPlugin::NextIcon(TUid& aCurrentUid, HBufC*& aFullFileName)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::NextIcon()");
+
+    if (iIconUidArray.Count() > iIconFilePointer)
+    {
+        aCurrentUid = iIconUidArray[iIconFilePointer];
+        iAppArcUtil->GetIconFilename(iIconUidArray[iIconFilePointer], aFullFileName);
+        iIconFilePointer++;
+        return ETrue;
+    }
+    else
+    {
+        // There are no more icon files
+        return EFalse;
+    }
+}
+
+void CMidp2BackupPlugin::ProcessFirstBufferL(RDesReadStream& aStream, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessFirstBuffer()");
+
+    if (iDrive >= EDriveE && iDrive <= EDriveZ)
+    {
+        // Read MMC id and restore MMC entries if needed
+        iBackupMmc = aStream.ReadUint32L();
+        aBufferSpaceLeft -= sizeof(iBackupMmc);
+        LOG1(EBackup, EInfo, "Read MMC Id: %u", iBackupMmc);
+        RestoreMmcRegistryL();
+    }
+    if (aBufferSpaceLeft >= sizeof(TInt32))
+    {
+        iIconFileSizeLeft = aStream.ReadInt32L();
+        aBufferSpaceLeft -= sizeof(iIconFileSizeLeft);
+        iRestoreIconDesc = HBufC8::NewL(iIconFileSizeLeft);
+        iRestoreState = EInIcon;
+    }
+    else
+    {
+        // No more data to read
+        aBufferSpaceLeft = 0;
+    }
+}
+
+void CMidp2BackupPlugin::ProcessInIconL(RDesReadStream& aStream, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessInIcon()");
+
+    TPtr8 restoreIconPtr = iRestoreIconDesc->Des();
+    HBufC8* tempDesc = HBufC8::NewL(iIconFileSizeLeft);
+    CleanupStack::PushL(tempDesc);
+    TPtr8 tempPtr = tempDesc->Des();
+
+    // Icon cannot be read fully
+    if (iIconFileSizeLeft > aBufferSpaceLeft)
+    {
+        aStream.ReadL(tempPtr, aBufferSpaceLeft);
+        restoreIconPtr.Append(tempPtr);
+        iIconFileSizeLeft -= aBufferSpaceLeft;
+        aBufferSpaceLeft = 0;
+        iRestoreState = EInIcon;
+    }
+    // Icon can be read fully
+    else
+    {
+        aStream.ReadL(tempPtr, iIconFileSizeLeft);
+        restoreIconPtr.Append(tempPtr);
+        aBufferSpaceLeft -= iIconFileSizeLeft;
+        iRestoreState = EInSize;
+
+        TRAPD(err, iAppArcUtil->RegisterAppL(restoreIconPtr, iDrive));
+
+        if (err)
+        {
+            ELOG(EBackup, "Registerin application to AppArc failed.");
+        }
+    }
+
+    CleanupStack::PopAndDestroy(tempDesc);
+}
+
+void CMidp2BackupPlugin::ProcessInSizeL(RDesReadStream& aStream, TInt& aBufferSpaceLeft)
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ProcessInSize()");
+
+    if (aBufferSpaceLeft >= sizeof(TInt32))
+    {
+        if (iSizeBuffer.Size() != 0)
+        {
+            // Read leftover part of size
+            TInt readData = sizeof(TInt32) - iSizeBuffer.Size();
+            aStream.ReadL(iSizeBuffer, readData);
+            RMemReadStream sizeStream(iSizeBuffer.Ptr(), 4);
+            CleanupClosePushL(sizeStream);
+            iIconFileSizeLeft = sizeStream.ReadInt32L();
+            CleanupStack::PopAndDestroy(&sizeStream);
+            aBufferSpaceLeft -= sizeof(readData);
+        }
+        else
+        {
+            // Read size in full
+            iIconFileSizeLeft = aStream.ReadInt32L();
+            aBufferSpaceLeft -= sizeof(iIconFileSizeLeft);
+        }
+
+        delete iRestoreIconDesc;
+        iRestoreIconDesc = NULL;
+        iRestoreIconDesc = HBufC8::NewL(iIconFileSizeLeft);
+        iRestoreState = EInIcon;
+    }
+    else
+    {
+        // Read first byte(s) of size
+        aStream.ReadL(iSizeBuffer, aBufferSpaceLeft);
+        aBufferSpaceLeft = 0;
+    }
+}
+
+void CMidp2BackupPlugin::ResetIconArray()
+{
+    LOG(EBackup, EInfo, "CMidp2BackupPlugin::ResetIconArray()");
+
+    // Remove all entries
+    while (iIconUidArray.Count())
+    {
+        iIconUidArray.Remove(0);
+    }
+}
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/midp2backuppluginusif.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,411 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for CMidp2BackupPlugin class with USIF changes
+*
+*/
+#ifndef MIDP2BACKUPPLUGINUSIF_H_
+#define MIDP2BACKUPPLUGINUSIF_H_
+
+#include "backupplugin.h"
+#include <apadef.h>
+#include "logger.h"
+
+class RDesWriteStream;
+class RDesReadStream;
+
+namespace java
+{
+namespace backup
+{
+
+
+class CJavaVersionBackupUtil;
+class CStorageBackupUtil;
+class CScrBackupUtil;
+
+
+/**
+ *  CMidp2BackupPlugin class is handling backup and restore operations
+ *  for MIDlets
+ *
+ *  This class is instantiated when a BUR operation is starting.
+ */
+class CMidp2BackupPlugin : public CBackupPlugin
+{
+
+public:
+
+    /**
+     * Instantiates an object of this type
+     */
+    static CMidp2BackupPlugin* NewL();
+
+    ~CMidp2BackupPlugin();
+
+
+    // from base class CBackupPlugin
+
+    /**
+     * This method is called when a backup or restore operation is
+     * starting. Preparations can be done to prepare for BUR.
+     *
+     * @param aBackupStateValue the value of the current backup state
+     */
+    void PrepareForBURL(TInt aBackupStateValue);
+
+    /**
+     * This method receives all or part of a snapshot of data to allow
+     * calculation of an incremental backup.  The snapshot is one that
+     * was previously supplied by the data owner.  The snapshot data
+     * should be read from the location supplied. The snapshot data may
+     * be larger than the location supplied in which case the routine
+     * will be called repeatedly until all data has been supplied.
+     *
+     * Snapshot data will also be supplied as part of a restore operation
+     *
+     * @param aDrive the drive being backed up
+     * @param aBuffer a pointer to the base of the location from whence
+     *        data can be copied.
+     * @param aLastSection ETrue if this is the last section of snapshot
+     *        data, else EFalse.
+     */
+    void ReceiveSnapshotDataL(TDriveNumber aDrive,
+                              TDesC8& aBuffer,
+                              TBool aLastSection);
+
+    /**
+     * This method returns the expected size of backup data that will be
+     * supplied. If an incremental backup is underway then this method
+     * will not be called until after ReceiveSnapshotDataL().
+     * The size data will be used for the purpose of tracking progess
+     * during a backup. If it is inaccurate then the user may see
+     * irregular progress but the actual backup data will not be
+     * affected so it is acceptable to return an estimated value.
+     *
+     * @param aDrive the drive being backed up.
+     * @return the size of the data that will be returned
+     */
+    TUint GetExpectedDataSize(TDriveNumber aDrive);
+
+    /**
+     * This method returns a snapshot of data to accompany a backup. The
+     * snapshot is expected to contain details on files / data being
+     * backed up. The format of the snapshot is only meaningful to the
+     * data owner. The snapshot will be supplied if the data owner is
+     * asked for an incremental backup and for a restore operation. The
+     * snapshot data should be copied to the location supplied.
+     *
+     * The snapshot data may be larger than the location supplied in
+     * which case the routine will be called repeatedly until all data
+     * has been retrieved.
+     *
+     * @param aDrive the drive being backed up
+     * @param aBuffer a pointer to the base of the location where data
+     *        can be copied.
+     * @param aFinished on return ETrue if all data has been returned
+     *        for this drive, else EFalse.
+     */
+    void GetSnapshotDataL(TDriveNumber aDrive,
+                          TPtr8& aBuffer,
+                          TBool& aFinished);
+
+    /**
+     * This method prepares the implementor to return backup data. It
+     * will be followed by a sequence of calls to request the actual
+     * data.
+     *
+     * @param aDrive the drive being backed up.
+     */
+    void InitialiseGetBackupDataL(TDriveNumber aDrive);
+
+    /**
+     * This method requests a section of backup data.
+     * InitialiseGetBackupDataL() will have been called previously to
+     * specify the drive concerned.  The data returned may be base or
+     * incremental depending on the type of backup and the capability of
+     * the data owner.
+     *
+     * @param aBuffer a pointer to the base of the location where data
+     *        can be copied.
+     * @param aFinished on return ETrue if all data has been returned
+     *        for this drive, else EFalse.
+     */
+    void GetBackupDataSectionL(TPtr8& aBuffer,
+                               TBool& aFinished);
+
+    /**
+     * This method prepares the implementor to receive base restore data
+     * for a drive. It will be followed by a sequence of calls to supply
+     * the actual data.
+     *
+     * @param aDrive the drive being restored.
+     */
+    void InitialiseRestoreBaseDataL(TDriveNumber aDrive);
+
+    /**
+     * This method receives a section of base restore data.
+     * InitialiseRestoreBaseDataL() will have been called previously to
+     * specify the drive concerned.
+     *
+     * @param aBuffer a pointer to the base of the location whence data
+     *        can be read.
+     * @param aFinished ETrue if all data has been returned for this
+     *        drive, else EFalse.
+     */
+    void RestoreBaseDataSectionL(TDesC8& aBuffer,
+                                 TBool aFinished);
+
+    /**
+     * This method prepares the implementor to receive incremental
+     * restore data for a drive. It will be followed by a sequence
+     * of calls to supply the actual data.  If multiple increments
+     * are supplied then this methid will be called before each increment
+     *
+     * @param aDrive the drive being restored.
+     */
+    void InitialiseRestoreIncrementDataL(TDriveNumber aDrive);
+
+    /**
+     * This method receives a section of increment restore data.
+     * InitialiseRestoreIncrementDataL() will have been called
+     * previously to specify the drive concerned.
+     *
+     * @param aBuffer a pointer to the base of the location whence data
+     *        can be read.
+     * @param aFinished ETrue if all data has been returned for this
+     *        increment, else EFalse.
+     */
+    void RestoreIncrementDataSectionL(TDesC8& aBuffer,
+                                      TBool aFinished);
+
+    /**
+     * This method is called when all data to be restored has been
+     * supplied.
+     *
+     * @param aDrive the drive being restored.
+     */
+    void RestoreComplete(TDriveNumber aDrive);
+
+private:
+
+    CMidp2BackupPlugin();
+
+    void ConstructL();
+
+    /**
+     * This method is called to get the unique Id of the current MMC
+     *
+     * @return The Id of the MMC, or 0, if no MMC is inserted
+     */
+    TUint MmcIdL();
+
+    /**
+     * This method is called to process the content of the buffer
+     * provided in active phase of restore
+     *
+     * @param aBuffer the buffer to process
+     */
+    void ProcessBufferL(RDesReadStream& stream);
+
+    /**
+     * This method is called to restore the Java Registry entries
+     * on the MMC, if needed
+     */
+    void RestoreMmcRegistryL();
+
+    /**
+     * This method creates the path for the Java Registry entries on
+     * the specified MMC
+     *
+     * @param [out] aPathName path of the entries of the MMC
+     * @param aDrive drive of the MMC
+     * @param aUniqueId Unique Id of the MMC
+     */
+    void CreateMmcPath(TDes& aPathName,
+                       TInt aDrive,
+                       TUint aUniqueId);
+
+    /**
+     * This method gets the path for the next icon file to be backed up
+     *
+     * @param [out] aCurrentUid Uid of the next icon
+     * @param [out] aFullFileName path of the next icon
+     * @return EFalse if there are no more icons in the array, ETrue
+     *         otherwise
+     */
+    //TBool NextIcon(TUid& aCurrentUid, HBufC*& aFullFileName);
+
+    /**
+     * Process buffer when restore state is EFirstBuffer
+     *
+     * @param aStream readstream of buffer to process
+     * @param aBufferSpaceLeft space left of buffer to be processed
+     */
+   // void ProcessFirstBufferL(RDesReadStream& aStream, TInt& aBufferSpaceLeft);
+
+    /**
+     * Process buffer when restore state is EInIcon
+     *
+     * @param aStream readstream of buffer to process
+     * @param aBufferSpaceLeft space left of buffer to be processed
+     */
+   // void ProcessInIconL(RDesReadStream& aStream, TInt& aBufferSpaceLeft);
+
+    /**
+     * Process buffer when restore state is EInSize
+     *
+     * @param aStream readstream of buffer to process
+     * @param aBufferSpaceLeft space left of buffer to be processed
+     */
+    //void ProcessInSizeL(RDesReadStream& aStream, TInt& aBufferSpaceLeft);
+
+    /**
+     * Resets the array of icons to be backed up
+     */
+    //void ResetIconArray();
+
+private: // data
+
+    /**
+     * File session
+     * Own.
+     */
+    RFs iFs;
+
+    /**
+     * StorageBackupUtil object for storage B&R
+     * Own.
+     */
+    CStorageBackupUtil* iStorageBackupUtil;
+    /**
+     * CScrBackupUtil object for SCR B&R
+     * Own.
+     */
+    CScrBackupUtil* iScrBackupUtil;
+    /**
+     * The drive that is backed up or restored currently
+     * Own.
+     */
+    TDriveNumber iDrive;
+
+    /**
+     * Id of backed up drive, gets its value from restored data
+     * Own.
+     */
+    TInt32 iBackupDrive;
+
+    /**
+     * Id of backed up MMC, gets its value from restored data
+     * Own.
+     */
+    TUint32 iBackupMmc;
+
+    /**
+     * State of streaming during restore
+     * Own.
+     */
+    TInt iRestoreState;
+
+    /**
+     * Shows if it's the first call to GetBackupDataSectionL
+     * Own.
+     */
+    TBool iFirstCallToGetBackupDataSection;
+
+    /**
+     * Shows if Backup of storage data is finished or not
+     * Own.
+     */
+    TBool iStorageDataBackup;
+    /**
+     * Shows if Backup of SCR is finished or not
+     * Own.
+     */
+    TBool iScrDataBackup;
+
+    /**
+     * Shows if Restore of storage data is finished or not
+     * Own.
+     */
+    TBool iStorageDataRestore;
+
+    /**
+     * Shows if Java version information is already written or not
+     * Own
+     */
+    TBool iJavaVersionInfoWritten;
+
+    /**
+     * Shows if its the first call to restore data or not.
+     * Own.
+     */
+    TBool iFirstCallToRestoreBackupDataSection;
+
+    /**
+     * Stores the uids of the midlets whose icons are to be backed up.
+     * Own.
+     */
+    RArray<TUid> iIconUidArray;
+
+    /**
+     * The current index in the icon file array
+     * Own.
+     */
+    TInt iIconFilePointer;
+
+    /**
+     * Stores the current icon file for streaming
+     * This descriptor will be streamed at subsequent calls of
+     * GetBackupDataSectionL()
+     * Own.
+     */
+    HBufC8* iIconDesc;
+
+    /**
+     * Stores the current icon file being restored
+     * Own.
+     */
+    HBufC8* iRestoreIconDesc;
+
+    /**
+     * Size of the icon to be still read during restore
+     * Own.
+     */
+    TInt32 iIconFileSizeLeft;
+
+    /**
+     * Current index of iIconDesc
+     * Own.
+     */
+    TInt iIconDescIndex;
+
+    /**
+     * Holds the remaining bytes in the buffer
+     * Own
+     */
+
+    TInt iBufferSpaceLeft;
+
+    /**
+     * Buffer for storing data size in restore
+     * Own.
+     */
+    TBuf8<4> iSizeBuffer;
+};
+
+
+ 
+} //namespace backup
+} //namespace java
+#endif /* MIDP2BACKUPPLUGINUSIF_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/src.s60/proxy.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008-2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This module contains the ECom plugin UID and mappings.
+*
+*/
+
+
+// system include files
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "midp2backupplugin.h"
+
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+{
+    IMPLEMENTATION_PROXY_ENTRY(KBackupEcomImplUid, CMidp2BackupPlugin::NewL)
+};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- a/javamanager/javacaptain/extensionplugins/autostarter/build/javacaptain_ext_autostarter.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/autostarter/build/javacaptain_ext_autostarter.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -21,6 +21,6 @@
 CONFIG -= qt
 
 
-LIBS += -ljavacomms -ljavastorage
+LIBS += -ljavacomms -ljavastorage -lapparc -lapgrfx
 
 include(../../../../../build/omj.pri)
--- a/javamanager/javacaptain/extensionplugins/autostarter/inc/autostarter.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/autostarter/inc/autostarter.h	Tue Jul 06 20:36:19 2010 +0300
@@ -52,6 +52,7 @@
     virtual EventConsumerInterface* getEventConsumer();
 
 private:
+    bool isMIDletPresent(const std::wstring& aUid);
     bool startMIDletL(const std::wstring& aUid);
     void checkMIDletsToBeStartedL();
 
--- a/javamanager/javacaptain/extensionplugins/autostarter/src.s60/autostarter.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/autostarter/src.s60/autostarter.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -17,6 +17,7 @@
 *
 */
 
+#include <apgcli.h> // for RApaLsSession
 #include <e32base.h>
 #include <f32file.h>
 #include <javastorage.h>
@@ -28,6 +29,7 @@
 #include "coreinterface.h"
 #include "javaprocessconstants.h"
 #include "javasymbianoslayer.h"
+#include "javauid.h"
 #include "javauids.h"
 #include "logger.h"
 #include "preinstallerstartermessages.h"
@@ -50,9 +52,9 @@
     return new java::captain::AutoStarter();
 }
 
-namespace java
+namespace java  // codescanner::namespace
 {
-namespace captain
+namespace captain  // codescanner::namespace
 {
 
 /**
@@ -123,13 +125,6 @@
                 ELOG1(EJavaCaptain, "AutoStarter::checkMIDletsToBeStartedL: leaved (%d)", err);
             }
     }
-/*
-    else if ( MESSAGE TELLS THAT NEW MIDLET HAS BEEN INSTALLED )
-    {
-        // Auto-start the new MIDlet if it is auto-start MIDlet
-    }
-*/
-
 }
 
 /**
@@ -138,15 +133,13 @@
  */
 void AutoStarter::checkMIDletsToBeStartedL()
 {
-
-
     // Find all MIDlets with Nokia-MIDlet-auto-start
     // APPLICATION_TABLE, if (AUTORUN == AUTOSTART_TRUE) || (AUTORUN == AUTOSTART_ONCE),
     // call startMIDletL(ID)
 
     LOG(EJavaCaptain, EInfo, "AutoStarter::checkMIDletsToBeStartedL called");
 
-    std::auto_ptr<JavaStorage> js(JavaStorage::createInstance());    
+    std::auto_ptr<JavaStorage> js(JavaStorage::createInstance());
     try
     {
         js->open(JAVA_DATABASE_NAME);
@@ -246,7 +239,14 @@
  */
 bool AutoStarter::startMIDletL(const std::wstring& aUid)
 {
-    // start MIDlet
+    // Try to check whether the MIDlet is present (or whether it has been
+    // installed to a removable media that is not present now)
+    if (!isMIDletPresent(aUid))
+    {
+        return false;
+    }
+
+    // Start MIDlet
     rtcLaunchInfo launchInfo(aUid);
 
     bool launchSuccess = mCore->getRtc()->launch(launchInfo);
@@ -259,5 +259,70 @@
 }
 
 
+/**
+ * Try to check whether the MIDlet is present (or whether it has been
+ * installed to a removable media that is not present now)
+ *
+ * @return false if it is certain that the MIDlet is not present, true otherwise
+ */
+bool AutoStarter::isMIDletPresent(const std::wstring& aUid)
+{
+    RApaLsSession apaSession;
+    TInt err = apaSession.Connect();
+    if (KErrNone != err)
+    {
+        // Cannot check presence from AppArc, try to start the MIDlet anyway
+        ELOG1(EJavaCaptain,
+              "AutoStarter::isMIDletPresent: RApaLsSession Connect error %d", err);
+        return true;
+    }
+    CleanupClosePushL(apaSession);
+
+    TUid appUid;
+    Uid javaUid(aUid);
+    err = uidToTUid(javaUid, appUid);
+    if (KErrNone != err)
+    {
+        WLOG1(EJavaCaptain,
+            "AutoStarter::isMIDletPresent: Cannot convert %S to TUid", aUid.c_str());
+        CleanupStack::PopAndDestroy(&apaSession); // apaSession
+        return true;
+    }
+
+    TUid appTypeUid;
+    err = apaSession.GetAppType(appTypeUid, appUid);
+    if (KErrNone != err)
+    {
+        if (KErrNotFound == err)
+        {
+            // The application is not present
+            WLOG1(EJavaCaptain,
+                "AutoStarter::isMIDletPresent: trying to start MIDlet %S that is not present",
+                aUid.c_str());
+            CleanupStack::PopAndDestroy(&apaSession); // apaSession
+            return false;
+        }
+
+        // Cannot check presence from AppArc, try to start the MIDlet anyway
+        ELOG1(EJavaCaptain,
+            "AutoStarter::isMIDletPresent: RApaLsSession GetAppType error %d", err);
+        CleanupStack::PopAndDestroy(&apaSession); // apaSession
+        return true;
+    }
+    else if (appTypeUid.iUid != KMidletApplicationTypeUid)
+    {
+        // The application is present but it is NOT a MIDlet
+        WLOG1(EJavaCaptain,
+            "AutoStarter::isMIDletPresent: tried to start application %S that is not MIDlet",
+            aUid.c_str());
+        CleanupStack::PopAndDestroy(&apaSession); // apaSession
+        return false;
+    }
+
+    CleanupStack::PopAndDestroy(&apaSession); // apaSession
+    return true;
+}
+
+
 } // namespace captain
 } // namespace java
--- a/javamanager/javacaptain/extensionplugins/boot/src/booteventprovider.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/boot/src/booteventprovider.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -17,6 +17,8 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <string.h>
 
--- a/javamanager/javacaptain/extensionplugins/config/src/configextensionplugin.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/config/src/configextensionplugin.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -80,6 +80,7 @@
 #endif // __SYMBIAN32__
     mCore->loadExtensionPlugin("boot");
     mCore->loadExtensionPlugin("mmc");
+    mCore->loadExtensionPlugin("settingslistener");
 }
 
 } // namespace captain
--- a/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/build/javasmartcardcertsunittests.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/build/javasmartcardcertsunittests.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -14,9 +14,8 @@
 * Description: 
 *
 */
-// #include <oem/bldvariant.hrh>
+
 #include <data_caging_paths.hrh>
-//#include <domain/osextensions/platform_paths.hrh>
 #include <platform_paths.hrh>
 
 #include <../../../../../../inc/java_stdcpp_support_for_exe.hrh>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/scrupdater/src/lookup.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  lookup
+*
+*/
+
+#include <string> //For strcmp
+
+#include "javasymbianoslayer.h"
+#include "logger.h"
+
+#include "extensionplugininterface.h"
+
+using namespace java::captain;
+
+ExtensionPluginInterface* getExtensionPlugin();
+
+EXPORT_C FuncPtr findDllMethod(const char* funcName)
+{    
+    FuncPtr ptr = 0;
+    if (funcName)
+    {
+        if (strcmp(funcName, "getExtensionPlugin") == 0)
+        {
+            ptr = (FuncPtr)getExtensionPlugin;
+        }
+    }
+    else
+    {
+        ELOG(EJavaCaptain,
+             "scrupdater extensionplugin findDllMethod() funcName == null");
+    }
+    return ptr;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/scrupdater/src/scrupdater.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,666 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ScrUpdater is Java Captain Symbian plugin that updates
+*               presence information of Java Applications in USIF SCR
+*               when removable drive is added or removed to the device.
+*
+*/
+
+#include <apgcli.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "javaprocessconstants.h"
+#include "javasymbianoslayer.h"
+#include "javauids.h"
+#include "logger.h"
+#include "coreinterface.h"
+#include "booteventprovidermessages.h"
+#include "mmceventprovidermessages.h"
+
+#include "scrupdater.h"
+
+using namespace Usif;
+
+_LIT(KMediaId, "Media-Id");
+
+/**
+ * Return pointer to ExtensionPluginInterface implementation for this
+ * extension dll
+ */
+java::captain::ExtensionPluginInterface* getExtensionPlugin()
+{
+    return new java::captain::ScrUpdater();
+}
+
+namespace java  // codescanner::namespace
+{
+namespace captain  // codescanner::namespace
+{
+
+using java::fileutils::driveInfo;
+using java::fileutils::DriveListenerInterface;
+
+/**
+ * Empty contructor
+ */
+ScrUpdater::ScrUpdater()
+{
+}
+
+/**
+ * Empty destructor
+ */
+ScrUpdater::~ScrUpdater()
+{
+}
+
+/**
+ * Implement PluginInterface method
+ */
+void ScrUpdater::startPlugin(CoreInterface* /* aCore */)
+{
+    LOG(EJavaCaptain, EInfo, "ScrUpdater plugin started");
+}
+
+/**
+ * Implement PluginInterface method
+ */
+void ScrUpdater::stopPlugin()
+{
+}
+
+/**
+ * Implement ExtensionPluginInterface method
+ */
+EventConsumerInterface* ScrUpdater::getEventConsumer()
+{
+    return this;
+}
+
+/**
+ * Handle Java Captain events sent by Boot event provider or
+ * MMC event provider.
+ *
+ * Implement EventConsumerInterface method
+ */
+void ScrUpdater::event(const std::string& aEventProvider,
+                       java::comms::CommsMessage& aMsg)
+{
+    if (aEventProvider == BOOT_EVENT_PROVIDER)
+    {
+        int bootType = NORMAL_BOOT_C;
+        getBootMessageParams(aMsg, bootType);
+        LOG1(
+            EJavaCaptain,
+            EInfo,
+            "ScrUpdater::event() boot event received (type=%d)",
+            bootType);
+        switch (bootType)
+        {
+            case IAD_BOOT_C:
+            case FIRST_DEVICE_BOOT_C:
+            case NORMAL_BOOT_C:
+            {
+                // Update presence information
+                TRAPD(err, initializeScrPresenceInfoL())
+                if (KErrNone != err)
+                {
+                    ELOG1(EJavaCaptain, "initializeScrPresenceInfoL: leaved (%d)", err);
+                }
+            }
+            break;
+
+            default:
+            {
+                WLOG1(EJavaCaptain,
+                    "DriveListenerInterface: event() unknown boot event (type=%d)", bootType);
+            }
+            break;
+        }
+    }
+    else if (aEventProvider == MMC_EVENT_PROVIDER)
+    {
+        int operation = 0;
+        driveInfo di;
+        getMmcChangedMessageParams(aMsg, operation, di);
+        LOG1(
+            EJavaCaptain,
+            EInfo,
+            "ScrUpdater::event() mmc event received (operation=%d)",
+            operation);
+
+        switch (operation)
+        {
+            case DriveListenerInterface::REMOVABLE_MEDIA_REMOVED_C:
+            {
+                // All Java applications in the removed drive are set
+                // to 'not present' state
+                TRAPD(err, removeScrPresencesL(&di));
+                if (KErrNone != err)
+                {
+                    ELOG1(EJavaCaptain, "removeScrPresencesL leaved (%d)", err);
+                }
+            }
+            break;
+
+            case DriveListenerInterface::REMOVABLE_MEDIA_INSERTED_C:
+            {
+                // Those Java applications in the drive to where the media
+                // (e.g. memory card) was added are set to 'present' state
+                // IF the media id is correct (in other words if the same
+                // memory card that they have been installed to is added
+                // to the drive).
+                TRAPD(err, addScrPresencesL(&di));
+                if (KErrNone != err)
+                {
+                    ELOG1(EJavaCaptain, "addScrPresencesL leaved (%d)", err);
+                }
+            }
+            break;
+        }
+    }
+}
+
+/**
+ * Set the presence state of all Java applications installed
+ * to the removable drive specified in aInfo to not present
+ */
+void ScrUpdater::removeScrPresencesL(driveInfo *aInfo)
+{
+    __UHEAP_MARK;
+    LOG1WSTR(EJavaCaptain, EInfo,
+        "removeScrPresencesL: driveInfo root path is %s", aInfo->iRootPath);
+
+    RSoftwareComponentRegistry *pScr = createScrL();
+    CleanupStack::PushL(pScr);
+
+    // Get ids of all Java components in scr
+    RArray<TComponentId> componentIdList;
+    CleanupClosePushL(componentIdList);
+
+    CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
+    pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
+
+    pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
+    CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
+
+    // For each component check whether it has been installed
+    // to the removed drive
+    TInt  nComponents = componentIdList.Count();
+    TUint removedDrive = (TUint)(aInfo->iRootPath[0]);
+    // Now removedDrive contains the drive letter, convert it to drive number 0-25
+    if ((removedDrive > 64) && (removedDrive < 91))  // codescanner::magicnumbers
+    {
+        // 'A' - 'Z'
+        removedDrive -= 65;  // codescanner::magicnumbers
+    }
+    else if ((removedDrive > 96) && (removedDrive < 123))  // codescanner::magicnumbers
+    {
+        // 'a' - 'z'
+        removedDrive -= 97;  // codescanner::magicnumbers
+    }
+    else
+    {
+        ELOG1WSTR(EJavaCaptain,
+            "removeScrPresencesL: Unexpected root path in remove drive info %s",
+            aInfo->iRootPath);
+        CleanupStack::PopAndDestroy(pScr);
+        return;
+    }
+
+    LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, removed drive is %d",
+        nComponents, removedDrive);
+
+    RArray<TApaAppUpdateInfo> removedApps;
+    CleanupClosePushL(removedApps);
+
+    for (TInt nInd = 0; nInd < nComponents; nInd++)
+    {
+        CComponentEntry *pEntry = CComponentEntry::NewLC();
+        if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry)))
+        {
+            ELOG1(EJavaCaptain,
+                "removeScrPresencesL: SCR GetComponentIdsL returned id %d "
+                "but GetComponentL does not find it", componentIdList[nInd]);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+
+        TInt nInstalledDrives = pEntry->InstalledDrives().Length();
+        if (nInstalledDrives <= removedDrive)
+        {
+            // SCR InstalledDrives should be array of 26 elements (value 0 or 1)
+            ELOG2(EJavaCaptain,
+                "removeScrPresencesL: The length of InstalledDrives array (%d) "
+                "is smaller than removedDrive (%d)", nInstalledDrives, removedDrive);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+
+        LOG1(EJavaCaptain, EInfo, "Java component id %d", componentIdList[nInd]);
+
+        if (pEntry->InstalledDrives()[removedDrive])
+        {
+            // This component has been installed to the drive
+            // that has just been removed
+            pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
+
+            LOG1(EJavaCaptain, EInfo,
+                "removeScrPresencesL: set component %d to not present",
+                componentIdList[nInd]);
+
+            // Gather the Uids of all applications that are no longer present
+            RArray<TUid> appsInComponent;
+            CleanupClosePushL(appsInComponent);
+            pScr->GetAppUidsForComponentL(
+                componentIdList[nInd], appsInComponent);
+            for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
+            {
+                TApaAppUpdateInfo appInfo;
+                appInfo.iAppUid = appsInComponent[nInd2];
+                appInfo.iAction = TApaAppUpdateInfo::EAppNotPresent;
+                removedApps.AppendL(appInfo);
+            }
+            CleanupStack::PopAndDestroy(&appsInComponent);
+        }
+
+        CleanupStack::PopAndDestroy(pEntry);
+    }
+
+    // Tell AppArc which applications are no longer present
+    if (removedApps.Count() > 0)
+    {
+        RApaLsSession apaSession;
+        TInt err = apaSession.Connect();
+        if (KErrNone != err)
+        {
+            ELOG1(EJavaCaptain, "removeScrPresencesL: Error %d when connecting AppArc", err);
+        }
+        else
+        {
+            CleanupClosePushL(apaSession);
+            apaSession.UpdateAppListL(removedApps);
+            CleanupStack::PopAndDestroy(); // closes apaSession
+        }
+    }
+
+    CleanupStack::PopAndDestroy(); // Close removedApps
+    CleanupStack::PopAndDestroy(); // Close componentIdList
+    CleanupStack::PopAndDestroy(pScr);
+    __UHEAP_MARKEND;
+}
+
+
+/**
+ * Set the presence state of all Java applications installed
+ * to the removable drive specified in aInfo to present
+ */
+void ScrUpdater::addScrPresencesL(driveInfo *aInfo)
+{
+    __UHEAP_MARK;
+    LOG1WSTR(EJavaCaptain, EInfo,
+        "addScrPresencesL: driveInfo root path is %s", aInfo->iRootPath);
+
+    RSoftwareComponentRegistry *pScr = createScrL();
+    CleanupStack::PushL(pScr);
+
+    // Get ids of all Java components in scr
+    RArray<TComponentId> componentIdList;
+    CleanupClosePushL(componentIdList);
+
+    CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
+    pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
+
+    pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
+    CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
+
+    // For each component check whether it has been installed
+    // to the added drive AND whether the media id is correct
+    // (in other words if the actual memory card where the component
+    // has been installed to is added to the drive).
+    TInt  nComponents  = componentIdList.Count();
+    TUint addedMediaId = (TUint)(aInfo->iId);
+    TUint addedDrive   = (TUint)(aInfo->iRootPath[0]);
+    // Now addedDrive contains the drive letter, convert it to drive number 0-25
+    if ((addedDrive > 64) && (addedDrive < 91))  // codescanner::magicnumbers
+    {
+        // 'A' - 'Z'
+        addedDrive -= 65;  // codescanner::magicnumbers
+    }
+    else if ((addedDrive > 96) && (addedDrive < 123))  // codescanner::magicnumbers
+    {
+        // 'a' - 'z'
+        addedDrive -= 97;  // codescanner::magicnumbers
+    }
+    else
+    {
+        ELOG1WSTR(EJavaCaptain,
+            "addScrPresencesL: Unexpected root path in add drive info %s",
+            aInfo->iRootPath);
+        CleanupStack::PopAndDestroy(pScr);
+        return;
+    }
+
+    LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, added drive is %d",
+        nComponents, addedDrive);
+
+    RArray<TApaAppUpdateInfo> addedApps;
+    CleanupClosePushL(addedApps);
+
+    for (TInt nInd = 0; nInd < nComponents; nInd++)
+    {
+        CComponentEntry *pEntry = CComponentEntry::NewLC();
+        if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry)))
+        {
+            ELOG1(EJavaCaptain,
+                "addScrPresencesL: SCR GetComponentIdsL returned id %d "
+                "but GetComponentL does not find it", componentIdList[nInd]);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+
+        // When Java Installer registers Java app to SCR it stores also
+        // the media id using SetComponentPropertyL(TComponentId aComponentId,
+        // _L("Media-Id"), TInt64 aValue);  (aValue is actually 32 bit int)
+        CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
+            pScr->GetComponentPropertyL(componentIdList[nInd], KMediaId);
+        if (NULL == pMediaIdProperty)
+        {
+            ELOG1(EJavaCaptain,
+                "addScrPresencesL: media_id property not found for component %d",
+                componentIdList[nInd]);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+        CleanupStack::PushL(pMediaIdProperty);
+
+        TInt nInstalledDrives = pEntry->InstalledDrives().Length();
+        if (nInstalledDrives <= addedDrive)
+        {
+            // SCR InstalledDrives should be array of 26 elements (value 0 or 1)
+            ELOG2(EJavaCaptain,
+                "addScrPresencesL: The length of InstalledDrives array (%d) "
+                "is smaller than addedDrive (%d)", nInstalledDrives, addedDrive);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+
+        LOG1(EJavaCaptain, EInfo, "Java component id %d", componentIdList[nInd]);
+
+        if (pEntry->InstalledDrives()[addedDrive])
+        {
+            // This component has been installed to the drive
+            // that has just been added.
+            // Now check whether the media id of the added media
+            // is OK for this component.
+            if (addedMediaId == pMediaIdProperty->IntValue())
+            {
+                pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue);
+
+                LOG1(EJavaCaptain, EInfo,
+                    "addScrPresencesL: set component %d to present",
+                    componentIdList[nInd]);
+
+                // Gather the Uids of all 'new' applications that are now present
+                RArray<TUid> appsInComponent;
+                CleanupClosePushL(appsInComponent);
+                pScr->GetAppUidsForComponentL(
+                    componentIdList[nInd], appsInComponent);
+                for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
+                {
+                    TApaAppUpdateInfo appInfo;
+                    appInfo.iAppUid = appsInComponent[nInd2];
+                    appInfo.iAction = TApaAppUpdateInfo::EAppPresent;
+                    addedApps.AppendL(appInfo);
+                }
+                CleanupStack::PopAndDestroy(&appsInComponent);
+            }
+        }
+
+        CleanupStack::PopAndDestroy(pMediaIdProperty);
+        CleanupStack::PopAndDestroy(pEntry);
+    }
+
+    // Tell AppArc which 'new' applications are now present
+    if (addedApps.Count() > 0)
+    {
+        RApaLsSession apaSession;
+        TInt err = apaSession.Connect();
+        if (KErrNone != err)
+        {
+            ELOG1(EJavaCaptain, "addScrPresencesL: Error %d when connecting AppArc", err);
+        }
+        else
+        {
+            CleanupClosePushL(apaSession);
+            apaSession.UpdateAppListL(addedApps);
+            CleanupStack::PopAndDestroy(); // closes apaSession
+        }
+    }
+
+    CleanupStack::PopAndDestroy(); // Close addedApps
+    CleanupStack::PopAndDestroy(); // Close componentIdList
+    CleanupStack::PopAndDestroy(pScr);
+    __UHEAP_MARKEND;
+}
+
+
+/**
+ * Loop through all removable drives and get the media id of
+ * the memory card or other removable media in the drive and update
+ * presence information of all Java applications installed
+ * to removable drives accordingly.
+ */
+void ScrUpdater::initializeScrPresenceInfoL()
+{
+    __UHEAP_MARK;
+    RFs fs;  // codescanner::rfs
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);
+
+    // Which drives are present and what is the media id of
+    // each removable volume
+    TInt  err = KErrNone;
+    TInt  err2 = KErrNone;
+    TBool drivePresent[EDriveZ + 1];
+    TUint driveMediaId[EDriveZ + 1];
+    TVolumeInfo volumeInfo;
+    TDriveInfo  driveInfo;
+
+    for (TInt nInd = EDriveA; nInd < EDriveZ; nInd++)
+    {
+        err = fs.Volume(volumeInfo, nInd);
+        if (KErrNone == err)
+        {
+            drivePresent[nInd] = ETrue;  // codescanner::accessArrayElementWithoutCheck2
+            driveMediaId[nInd] = volumeInfo.iUniqueID;  // codescanner::accessArrayElementWithoutCheck2
+            // If the media is not removable, media id is not checked
+            err2 = fs.Drive(driveInfo, nInd);
+            if (KErrNone != err2)
+            {
+                ELOG1(EJavaCaptain,
+                    "initializeScrPresenceInfoL: error (%d) when trying to get drive info",
+                    err2);
+                User::Leave(err2);
+            }
+            else
+            {
+                if (!(driveInfo.iDriveAtt & KDriveAttRemovable))
+                {
+                    driveMediaId[nInd] = 0;  // codescanner::accessArrayElementWithoutCheck2
+                }
+            }
+        }
+        else if (KErrNotReady == err)
+        {
+            // no volume in this drive
+            drivePresent[nInd] = EFalse;  // codescanner::accessArrayElementWithoutCheck2
+            driveMediaId[nInd] = 0;  // codescanner::accessArrayElementWithoutCheck2
+        }
+        else
+        {
+            ELOG1(EJavaCaptain,
+                "initializeScrPresenceInfoL: error (%d) when trying to get volume info",
+                err);
+            User::Leave(err);
+        }
+    }
+    CleanupStack::PopAndDestroy(); // close RFs
+
+
+    RSoftwareComponentRegistry *pScr = createScrL();
+    CleanupStack::PushL(pScr);
+
+    // Get ids of all Java components in scr
+    RArray<TComponentId> componentIdList;
+    CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
+    pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
+
+    pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
+    CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
+    CleanupClosePushL(componentIdList);
+
+    // For each component check whether the drive it has been installed
+    // to is present AND whether the media id is correct
+    TInt  nComponents  = componentIdList.Count();
+
+    LOG1(EJavaCaptain, EInfo, "initializeScrPresenceInfoL: Number of Java components is %d",
+        nComponents);
+
+    for (TInt nInd = 0; nInd < nComponents; nInd++)
+    {
+        CComponentEntry *pEntry = CComponentEntry::NewLC();
+        if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry)))
+        {
+            ELOG1(EJavaCaptain,
+                "initializeScrPresenceInfoL: SCR GetComponentIdsL returned id %d "
+                "but GetComponentL does not find it", componentIdList[nInd]);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+
+        CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
+            pScr->GetComponentPropertyL(componentIdList[nInd], KMediaId);
+        if (NULL == pMediaIdProperty)
+        {
+            ELOG1(EJavaCaptain,
+                "initializeScrPresenceInfoL: media_id property not found for component %d",
+                componentIdList[nInd]);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+        CleanupStack::PushL(pMediaIdProperty);
+
+        TInt nInstalledDrives = pEntry->InstalledDrives().Length();
+        if (nInstalledDrives > (EDriveZ + 1))
+        {
+            WLOG2(EJavaCaptain,
+                "initializeScrPresenceInfoL: too big (%d) installed drives array for "
+                "component %d", nInstalledDrives, componentIdList[nInd]);
+            nInstalledDrives = EDriveZ;
+        }
+        // When Java components are installed, only one installed drive
+        // and corresponding media id are registered.
+        TInt installationDrive = -1;
+
+        for (TInt driveNumber = EDriveA; driveNumber < nInstalledDrives; driveNumber++)
+        {
+            if (pEntry->InstalledDrives()[driveNumber])
+            {
+                installationDrive = driveNumber;
+                break;
+            }
+        }
+
+        if (installationDrive == -1)
+        {
+            ELOG1(EJavaCaptain,
+                "initializeScrPresenceInfoL: component (id %d) did not have installed drive info",
+                componentIdList[nInd]);
+            CleanupStack::PopAndDestroy(pMediaIdProperty);
+            CleanupStack::PopAndDestroy(pEntry);
+            continue;
+        }
+
+        if (drivePresent[installationDrive])  // codescanner::accessArrayElementWithoutCheck2
+        {
+            // Check also the media id
+            if (driveMediaId[installationDrive] == pMediaIdProperty->IntValue())  // codescanner::accessArrayElementWithoutCheck2
+            {
+                LOG1(EJavaCaptain, EInfo,
+                    "initializeScrPresenceInfoL: set component %d to present",
+                    componentIdList[nInd]);
+
+                pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue);
+            }
+            else
+            {
+                LOG1(EJavaCaptain, EInfo,
+                    "initializeScrPresenceInfoL: set component %d to NOT present",
+                    componentIdList[nInd]);
+
+                pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
+            }
+        }
+        else
+        {
+            LOG1(EJavaCaptain, EInfo,
+                "initializeScrPresenceInfoL: set component %d to NOT present",
+                componentIdList[nInd]);
+
+            // drive is not present -> Java component installed to that
+            // drive is not present
+            pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
+        }
+
+        CleanupStack::PopAndDestroy(pMediaIdProperty);
+        CleanupStack::PopAndDestroy(pEntry);
+    }
+
+    CleanupStack::PopAndDestroy(); // Close componentIdList
+    CleanupStack::PopAndDestroy(pScr); // Also closes RSoftwareComponentRegistry
+
+    __UHEAP_MARKEND;
+}
+
+
+/**
+ * Creates an instance of RSoftwareComponentRegistry and connects to it.
+ */
+RSoftwareComponentRegistry *ScrUpdater::createScrL()
+{
+    RSoftwareComponentRegistry *pScr = new RSoftwareComponentRegistry;  // codescanner::nonleavenew
+    if (NULL == pScr)
+    {
+        ELOG(EJavaInstaller,
+            "CreateScrL: Creating RSoftwareComponentRegistry failed");
+        User::Leave(KErrGeneral);
+    }
+    TInt err = pScr->Connect();
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+            "CreateScrL: Connecting to RSoftwareComponentRegistry failed, error %d",
+            err);
+        delete pScr;
+        User::Leave(err);
+    }
+
+    return pScr;
+}
+
+
+} // namespace captain
+} // namespace java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/scrupdater/src/scrupdater.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ScrUpdater is Java Captain Symbian plugin that updates
+*               presence information of Java Applications in USIF SCR
+*               when removable drive is added or removed to the device.
+*
+*/
+
+#ifndef SCRUPDATER_H
+#define SCRUPDATER_H
+
+#include <usif/scr/scr.h>
+#include <usif/scr/screntries.h>
+
+#include "javaosheaders.h"
+
+#include "eventconsumerinterface.h"
+#include "extensionplugininterface.h"
+
+namespace java  // codescanner::namespace
+{
+
+namespace captain  // codescanner::namespace
+{
+
+class CoreInterface;
+
+OS_NONSHARABLE_CLASS(ScrUpdater) :  public EventConsumerInterface,
+        public ExtensionPluginInterface
+{
+public:
+    ScrUpdater();
+    virtual ~ScrUpdater();
+
+    // PluginInterface
+    virtual void startPlugin(CoreInterface* aCore);
+    virtual void stopPlugin();
+
+    // EventConsumerInterface
+    virtual void event(const std::string& aEventProvider,
+                       java::comms::CommsMessage& aMsg);
+
+    // ExtensionPluginInterface methods
+    virtual EventConsumerInterface* getEventConsumer();
+
+private:
+    void removeScrPresencesL(driveInfo *aInfo);
+    void addScrPresencesL(driveInfo *aInfo);
+    void initializeScrPresenceInfoL();
+
+    Usif::RSoftwareComponentRegistry *createScrL();
+};
+
+} // namespace captain
+} // namespace java
+
+#endif // SCRUPDATER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/bwins/javacaptain_ext_settingslisteneru.def	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?findDllMethod@@YAP6APAXXZPBD@Z @ 1 NONAME ; void * (*)(void) findDllMethod(char const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/eabi/javacaptain_ext_settingslisteneru.def	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z13findDllMethodPKc @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/exports.inf	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+PRJ_EXPORTS
+../inc/settingschangeeventsprovidermessages.h                          |../../../inc/settingschangeeventsprovidermessages.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2009 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"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE=lib
+TARGET=javacaptain_ext_settingslistener
+CONFIG += omj stl
+CONFIG -= qt
+
+symbian {
+    SOURCES += ../src/*.cpp ../src.s60/*.cpp
+    LIBS += -lcommonengine \
+            -lcentralrepository \
+            -lcenrepnotifhandler \
+            -ljavacomms
+}
+
+!symbian {
+    SOURCES += ../src/*.cpp ../src.linux/*.cpp
+}
+
+
+include(../../../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingschangeeventsprovidermessages.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  BootEventProviderMessages
+*
+*/
+
+#ifndef SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
+#define SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
+
+#include "commsmessage.h"
+#include "logger.h"
+
+namespace java
+{
+namespace captain
+{
+
+using namespace java::util;
+using namespace java::comms;
+
+const int SETTINGS_CHANGE_EVENT_MESSAGE_ID_C = 1;
+
+const char* const SETTINGS_CHANGE_EVENT_PROVIDER = "settingslistener";
+
+typedef enum
+{
+    UNDEFINED_CHANGE          = 0x00,
+    MIDP_CLASS_PATH_CHANGE          = 0x01,
+
+} SettingsChangeEventType_t;
+
+
+inline void setSettingsChangeEventMessageParams(CommsMessage& aMessage,
+                                                      const int& aChangeEventType)
+{
+    aMessage.setMessageId(SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
+    aMessage << aChangeEventType;
+}
+
+inline void getSettingsChangeEventMessageParams(CommsMessage& aMessage,
+                                                      int& aChangeEventType)
+{
+    if (aMessage.getMessageId() == SETTINGS_CHANGE_EVENT_MESSAGE_ID_C)
+    {
+        aMessage >> aChangeEventType;
+    }
+    else
+    {
+        ELOG2(EJavaCaptain, "Received Settings Change Event with  wrong MessageId!: %d should be %d",
+              aMessage.getMessageId(), SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
+        aChangeEventType = 0;
+    }
+}
+
+} // namespace captain
+} // namespace java
+
+#endif // SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerextension.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Sample
+*
+*/
+
+#ifndef SETTINGSLISTENEREXTENSION_H
+#define SETTINGSLISTENEREXTENSION_H
+
+#include "javaosheaders.h"
+
+#include "extensionplugininterface.h"
+#include "settingslistenerinterface.h"
+
+using namespace java::comms;
+
+namespace java
+{
+namespace captain
+{
+
+class CoreInterface;
+
+OS_NONSHARABLE_CLASS(SettingsListenerExtension) :  public ExtensionPluginInterface
+{
+public:
+    SettingsListenerExtension();
+    virtual ~SettingsListenerExtension();
+
+    // ExtensionPluginInterface
+    virtual void startPlugin(CoreInterface* aCore);
+    virtual void stopPlugin();
+
+protected:
+
+private:
+    CoreInterface* mCore; // resource not owned
+    SettingsListenerInterface* mSettingsListenerImpl; // resource owned
+};
+
+} // namespace captain
+} // namespace java
+
+#endif // SETTINGSLISTENEREXTENSION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerinterface.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ExtensionPluginInterface
+*
+*/
+
+#ifndef SETTINGSLISTENERINTERFACE_H
+#define SETTINGSLISTENERINTERFACE_H
+
+namespace java
+{
+
+namespace captain
+{
+
+class CoreInterface;
+
+class SettingsListenerInterface
+{
+public:
+    virtual ~SettingsListenerInterface() {}
+
+    virtual void StartListening() = 0;
+    virtual void StopListening() = 0;
+
+};
+
+} // namespace captain
+} // namespace java
+
+#endif // SETTINGSLISTENERINTERFACE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "coreinterface.h"
+#include "eventconsumerinterface.h"
+
+#include "logger.h"
+#include "cenreplistener.h"
+#include "settingschangeeventsprovidermessages.h"
+
+#include <e32base.h>
+#include <centralrepository.h>
+
+namespace java
+{
+namespace captain
+{
+
+    // General listener used as a base value indicating that whole repository is being
+    // listened instead of individual key.
+    CenRepListener::CenRepListener() : mKeyType(CenRepListener::GENERAL_LISTENER)
+    {
+        JELOG2(EJavaCaptain);
+    }
+
+    CenRepListener::~CenRepListener()
+    {
+        JELOG2(EJavaCaptain);
+        Close();
+    }
+
+    void CenRepListener::Close()
+    {
+        JELOG2(EJavaCaptain);
+        if (mNotifyHandler ) {
+            mNotifyHandler->StopListening();
+            delete mNotifyHandler;
+            mNotifyHandler = 0;
+        }
+        if ( mCenRepSession ) {
+            delete mCenRepSession;
+            mCenRepSession = 0;
+        }
+    }
+
+    CenRepListener* CenRepListener::NewLC(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+        CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+    {
+        JELOG2(EJavaCaptain);
+        CenRepListener* crListener = new (ELeave) CenRepListener();
+        CleanupStack::PushL(crListener);
+        crListener->ConstructL(aCore, aRepoId, aKeyId, aKeyType);
+        return (crListener);
+    }
+
+    CenRepListener* CenRepListener::NewL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+        CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+    {
+        JELOG2(EJavaCaptain);
+        CenRepListener* crListener = CenRepListener::NewLC(aCore, aRepoId, aKeyId, aKeyType);
+        CleanupStack::Pop(crListener);
+        return (crListener);
+    }
+
+    CenRepListener* CenRepListener::NewLC(CoreInterface* aCore, TUid aRepoId)
+    {
+        JELOG2(EJavaCaptain);
+        CenRepListener* crListener = new (ELeave) CenRepListener();
+        CleanupStack::PushL(crListener);
+        crListener->ConstructL(aCore, aRepoId);
+        return (crListener);
+    }
+
+    CenRepListener* CenRepListener::NewL(CoreInterface* aCore, TUid aRepoId)
+    {
+        JELOG2(EJavaCaptain);
+        CenRepListener* crListener = CenRepListener::NewLC(aCore, aRepoId);
+        CleanupStack::Pop(crListener);
+        return (crListener);
+    }
+
+    void CenRepListener::ConstructL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+        CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+    {
+        JELOG2(EJavaCaptain);
+        mCore = aCore;
+        mRepoId = aRepoId;
+        mKeyType = aKeyType;
+        mCenRepSession = CRepository::NewL(mRepoId);
+        mNotifyHandler = CCenRepNotifyHandler::NewL(*this, *mCenRepSession,
+                                                    aKeyType, aKeyId);
+        mNotifyHandler->StartListeningL();
+    }
+
+    void CenRepListener::ConstructL(CoreInterface* aCore, TUid aRepoId)
+    {
+        JELOG2(EJavaCaptain);
+        mCore = aCore;
+        mRepoId = aRepoId;
+        mCenRepSession = CRepository::NewL(mRepoId);
+        mNotifyHandler = CCenRepNotifyHandler::NewL(*this, *mCenRepSession);
+        mNotifyHandler->StartListeningL();
+    }
+
+    void CenRepListener::HandleNotifyInt(TUint32 aKeyId, TInt /*aNewValue*/)
+    {
+        JELOG2(EJavaCaptain);
+        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep TInt key noticed! "
+              "CR Key= %0x", aKeyId);
+    }
+
+    void CenRepListener::HandleNotifyReal( TUint32 aKeyId, TReal /*aNewValue*/ )
+    {
+        JELOG2(EJavaCaptain);
+        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep TReal key noticed! "
+              "CR Key= %0x", aKeyId);
+    }
+
+    void CenRepListener::HandleNotifyBinary( TUint32 aKeyId, const TDesC8& /*aNewValue*/ )
+    {
+        JELOG2(EJavaCaptain);
+        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep Binary key noticed! "
+              "CR Key= %0x", aKeyId);
+    }
+
+    void CenRepListener::HandleNotifyGeneric(TUint32 aKeyId)
+    {
+        JELOG2(EJavaCaptain);
+        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep key noticed! "
+              "CR Key= %0x", aKeyId);
+    }
+
+    void CenRepListener::HandleNotifyString( TUint32 aKeyId, const TDesC16& /*aNewValue*/ )
+    {
+        JELOG2(EJavaCaptain);
+        if ( KCRUidJavaRuntime == mRepoId && KJavaRuntimeMIDPClasspath == aKeyId ) {
+            ILOG(EJavaCaptain, "CenRepListener::HandleNotifyString: change notified "
+                 "in key KJavaRuntimeMIDPClasspath");
+            dispatchEvent(SETTINGS_CHANGE_EVENT_PROVIDER,
+                                        MIDP_CLASS_PATH_CHANGE);
+        } else {
+            WLOG1(EJavaCaptain, "Change in Unrecognised cenrep string key noticed! "
+                  "CR Key= %0x", aKeyId);
+        }
+    }
+
+    void CenRepListener::HandleNotifyError(TUint32 aKeyId, TInt error, CCenRepNotifyHandler* /* aHandler */)
+    {
+        JELOG2(EJavaCaptain);
+        ELOG2(EJavaCaptain, "Error (code: %d) occured when listening changes on "
+              "Cenrep key (Key ID: %0x). Listening stopped!", error, aKeyId);
+        Close();
+    }
+
+    void CenRepListener::dispatchEvent(const std::string& aEvent,
+                                       const SettingsChangeEventType_t& aType) const
+    {
+        JELOG2(EJavaCaptain);
+        ILOG2(EJavaCaptain, "CenRepListener::dispatchEvent: dispatching event=%s "
+              "type=%d", aEvent.c_str(), aType);
+        CommsMessage eventMsg;
+        setSettingsChangeEventMessageParams(eventMsg, aType);
+        mCore->getEventDispatcher()->event(aEvent, eventMsg);
+    }
+
+} // namespace captain
+} // namespace java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class is used for listening changes in various Symbian Central
+*                     repository keys.
+*
+*/
+
+#ifndef CENREP_LISTENER_H
+#define CENREP_LISTENER_H
+
+#include "javaosheaders.h"
+#include "settingschangeeventsprovidermessages.h"
+
+#include <e32std.h>
+#include <cenrepnotifyhandler.h>
+
+namespace java
+{
+namespace captain
+{
+
+/**
+ * Java Runtime environment Central Repository UID
+ */
+const TUid    KCRUidJavaRuntime             = { 0x10282DFD };
+
+/**
+ * Indicates classpath for MIDP runtimes. This key value is generated
+ * from the values defined by extension libraries.
+ */
+const TUint32 KJavaRuntimeMIDPClasspath     = 0x00000001;
+
+
+class CoreInterface;
+
+OS_NONSHARABLE_CLASS(CenRepListener) :
+public CBase, public MCenRepNotifyHandlerCallback
+{
+public:
+    enum TListenerType {GENERAL_LISTENER = -1};
+
+    static CenRepListener* NewLC(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+                                 CCenRepNotifyHandler::TCenRepKeyType aKeyType);
+    static CenRepListener* NewL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+                                  CCenRepNotifyHandler::TCenRepKeyType aKeyType);
+    static CenRepListener* NewLC(CoreInterface* aCore, TUid aRepoId);
+    static CenRepListener* NewL(CoreInterface* aCore, TUid aRepoId);
+
+    virtual ~CenRepListener();
+
+    // MCenRepNotifyHandlerCallback
+    // These handler methods must know what to do in each case, i.e
+    // how to handle the change in each particular key.
+    virtual void HandleNotifyString( TUint32 aKeyId, const TDesC16& aNewValue );
+    virtual void HandleNotifyInt(TUint32 aKeyId, TInt aNewValue);
+    virtual void HandleNotifyReal( TUint32 aId, TReal aNewValue );
+    virtual void HandleNotifyBinary( TUint32 aId, const TDesC8& aNewValue );
+    virtual void HandleNotifyGeneric(TUint32 aKeyId);
+    virtual void HandleNotifyError(TUint32 aKeyId, TInt error,
+                                   CCenRepNotifyHandler* aHandler);
+protected:
+    CenRepListener();
+
+    void dispatchEvent(const std::string& aEvent,
+                       const SettingsChangeEventType_t& aType) const;
+
+private:
+    void ConstructL(CoreInterface* aCore, TUid aRepoId);
+    void ConstructL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+                    CCenRepNotifyHandler::TCenRepKeyType aKeyType);
+    void Close();
+    TInt mKeyType;
+    CoreInterface* mCore;
+    TUid mRepoId;
+    CCenRepNotifyHandler* mNotifyHandler;
+    CRepository* mCenRepSession;
+};
+
+} // namespace captain
+} // namespace java
+
+#endif // CENREP_LISTENER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/lookup.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  lookup
+*
+*/
+
+#include <string> //For strcmp
+
+#include "javasymbianoslayer.h"
+#include "logger.h"
+
+#include "extensionplugininterface.h"
+
+using namespace java::captain;
+
+ExtensionPluginInterface* getExtensionPlugin();
+
+EXPORT_C FuncPtr findDllMethod(const char* funcName)
+{
+    JELOG2(EJavaCaptain);
+    FuncPtr ptr = 0;
+    if (funcName)
+    {
+        if (strcmp(funcName, "getExtensionPlugin") == 0)
+        {
+            ptr = (FuncPtr)getExtensionPlugin;
+        }
+    }
+    else
+    {
+        ELOG(EJavaCaptain, "settingslistener extensionplugin findDllMethod() funcName == null");
+    }
+    return ptr;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "settingslistenerimpl.h"
+#include "cenreplistener.h"
+#include "logger.h"
+
+namespace java
+{
+namespace captain
+{
+
+    SettingsListenerImpl::SettingsListenerImpl(CoreInterface* aCore) :
+        mCore(aCore)
+    {
+        JELOG2(EJavaCaptain);
+
+    }
+
+    SettingsListenerImpl::~SettingsListenerImpl()
+    {
+        JELOG2(EJavaCaptain);
+        cleanUp();
+    }
+
+    void SettingsListenerImpl::StartListening()
+    {
+        JELOG2(EJavaCaptain);
+        // All "listeners" must be created&started here.
+
+        // Currently there is just this one CenRep key to be listened
+        std::auto_ptr<CenRepListener> cRMidpClassPathChangeListener;
+        int error = createCenRepKeyListener(KCRUidJavaRuntime, KJavaRuntimeMIDPClasspath,
+                                         CCenRepNotifyHandler::EStringKey,
+                                         cRMidpClassPathChangeListener);
+        if ( KErrNone == error ) {
+            mCenRepListeners.push_back(cRMidpClassPathChangeListener.release());
+        } else {
+            ELOG4(EJavaCaptain, "Error (code: %d) occured when starting "
+                  "CenRepListener (repo=%0x, key=%0x, keytype=%d)",
+                  error, KCRUidJavaRuntime.iUid, KJavaRuntimeMIDPClasspath,
+                  CCenRepNotifyHandler::EStringKey);
+        }
+    }
+
+    void SettingsListenerImpl::StopListening()
+    {
+        JELOG2(EJavaCaptain);
+        cleanUp();
+    }
+
+    int SettingsListenerImpl::createCenRepKeyListener(TUid aRepoId, TUint32 aKeyId,
+                                                  CCenRepNotifyHandler::TCenRepKeyType aKeyType,
+                                                std::auto_ptr<CenRepListener>& aListener)
+    {
+        JELOG2(EJavaCaptain);
+        TRAPD( error, aListener.reset(CenRepListener::NewL(mCore, aRepoId, aKeyId, aKeyType)) );
+        return error;
+    }
+
+    int SettingsListenerImpl::createCenRepListener(TUid aRepoId, CenRepListener*& aListener)
+    {
+        JELOG2(EJavaCaptain);
+        TRAPD( error, aListener = CenRepListener::NewL(mCore, aRepoId));
+        return error;
+    }
+
+    // Clean up owned resources
+    void SettingsListenerImpl::cleanUp()
+    {
+        JELOG2(EJavaCaptain);
+
+        for  ( crListeners_t::iterator listenersIter = mCenRepListeners.begin();
+               listenersIter != mCenRepListeners.end();  ++listenersIter )
+        {
+            delete *listenersIter;
+            *listenersIter = 0;
+        }
+        mCenRepListeners.clear();
+    }
+
+} // namespace captain
+} // namespace java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Platform specific component which manages all the listeners
+*                     listening changes in system configuration. Currently only Central
+*                     Repository listening is supported.
+*
+*/
+
+#ifndef SETTINGSLISTENERIMPL_H
+#define SETTINGSLISTENERIMPL_H
+
+#include "javaosheaders.h"
+
+#include "settingslistenerinterface.h"
+
+#include <vector>
+#include <memory>
+#include <cenrepnotifyhandler.h>
+
+namespace java
+{
+namespace captain
+{
+
+class CoreInterface;
+class CenRepListener;
+
+OS_NONSHARABLE_CLASS(SettingsListenerImpl) :  public SettingsListenerInterface
+{
+public:
+    SettingsListenerImpl(CoreInterface* aCore);
+    virtual ~SettingsListenerImpl();
+
+    // SystemSettingsChangeListenerInterface
+    virtual void StartListening();
+    virtual void StopListening();
+
+private:
+    void cleanUp();
+    int createCenRepKeyListener(TUid aRepoId, TUint32 aKeyId,
+                            CCenRepNotifyHandler::TCenRepKeyType aKeyType,
+                            std::auto_ptr<CenRepListener>& aListener);
+    int createCenRepListener(TUid aRepoId, CenRepListener*& aListener);
+
+    CoreInterface* mCore;  // resource not owned
+    typedef std::vector<CenRepListener*> crListeners_t;
+    crListeners_t mCenRepListeners; // listeners are owned resources.
+
+};
+
+} // namespace captain
+} // namespace java
+
+#endif // SETTINGSLISTENERIMPL_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src/settingslistenerextension.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Sample
+*
+*/
+
+#include "logger.h"
+
+#include "settingslistenerextension.h"
+#include "settingslistenerimpl.h"
+
+#ifdef __SYMBIAN32__
+java::captain::ExtensionPluginInterface* getExtensionPlugin()
+{
+#else
+extern "C" java::captain::ExtensionPluginInterface* getExtensionPlugin()
+{
+#endif
+    return new java::captain::SettingsListenerExtension();
+}
+
+namespace java
+{
+namespace captain
+{
+
+    SettingsListenerExtension::SettingsListenerExtension() : mCore(0), mSettingsListenerImpl(0)
+{
+    JELOG2(EJavaCaptain);
+    ILOG(EJavaCaptain, "SettingsListenerExtension::SettingsListenerExtension()");
+}
+
+SettingsListenerExtension::~SettingsListenerExtension()
+{
+    JELOG2(EJavaCaptain);
+    ILOG(EJavaCaptain, "SettingsListenerExtension::~SettingsListenerExtension()");
+}
+
+void SettingsListenerExtension::startPlugin(CoreInterface* core)
+{
+    JELOG2(EJavaCaptain);
+    ILOG(EJavaCaptain, "SettingsListenerExtension::startPlugin()");
+    if ( mSettingsListenerImpl || mCore )
+    {
+        WLOG(EJavaCaptain, "Settingslistener plugin already running, terminating previous instance first!");
+        stopPlugin();
+    }
+    mCore = core;
+    mSettingsListenerImpl = new SettingsListenerImpl(mCore);
+    mSettingsListenerImpl->StartListening();
+}
+
+void SettingsListenerExtension::stopPlugin()
+{
+    JELOG2(EJavaCaptain);
+    ILOG(EJavaCaptain, "SettingsListenerExtension::stopPlugin()");
+    mCore = 0;
+    if ( mSettingsListenerImpl )
+    {
+        mSettingsListenerImpl->StopListening();
+        delete mSettingsListenerImpl;
+        mSettingsListenerImpl = 0;
+    }
+}
+
+
+} // namespace captain
+} // namespace java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javacaptain/inc/settingschangeeventsprovidermessages.h	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  BootEventProviderMessages
+*
+*/
+
+#ifndef SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
+#define SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
+
+#include "commsmessage.h"
+#include "logger.h"
+
+namespace java
+{
+namespace captain
+{
+
+using namespace java::util;
+using namespace java::comms;
+
+const int SETTINGS_CHANGE_EVENT_MESSAGE_ID_C = 1;
+
+const char* const SETTINGS_CHANGE_EVENT_PROVIDER = "settingslistener";
+
+typedef enum
+{
+    UNDEFINED_CHANGE          = 0x00,
+    MIDP_CLASS_PATH_CHANGE          = 0x01,
+
+} SettingsChangeEventType_t;
+
+
+inline void setSettingsChangeEventMessageParams(CommsMessage& aMessage,
+                                                      const int& aChangeEventType)
+{
+    aMessage.setMessageId(SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
+    aMessage << aChangeEventType;
+}
+
+inline void getSettingsChangeEventMessageParams(CommsMessage& aMessage,
+                                                      int& aChangeEventType)
+{
+    if (aMessage.getMessageId() == SETTINGS_CHANGE_EVENT_MESSAGE_ID_C)
+    {
+        aMessage >> aChangeEventType;
+    }
+    else
+    {
+        ELOG2(EJavaCaptain, "Received Settings Change Event with  wrong MessageId!: %d should be %d",
+              aMessage.getMessageId(), SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
+        aChangeEventType = 0;
+    }
+}
+
+} // namespace captain
+} // namespace java
+
+#endif // SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
--- a/javamanager/javacaptain/javacaptain.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/javacaptain.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -18,6 +18,7 @@
 SUBDIRS += extensionplugins/config/build/javacaptain_ext_config.pro 
 SUBDIRS += extensionplugins/javacertstore/build/javacaptain_ext_javacertstore.pro 
 SUBDIRS += extensionplugins/storageserver/build/javacaptain_ext_storageserverplugin.pro 
+SUBDIRS += extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro 
 SUBDIRS += extensionplugins/preinstallerstarter/build/javacaptain_ext_preinstallerstarter.pro 
 SUBDIRS += extensionplugins/autostarter/build/javacaptain_ext_autostarter.pro 
 SUBDIRS += extensionplugins/scrupdater/build/javacaptain_ext_scrupdater.pro 
--- a/javamanager/javacaptain/src/rtc.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/src/rtc.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -36,6 +36,8 @@
 #include "javastorage.h"
 #include "javastoragenames.h"
 
+#include "settingschangeeventsprovidermessages.h"
+
 #include "midprtcplugin.h"
 #ifdef RD_JAVA_CAPTAIN_TESTRUNTIME
 #include "testrtcplugin.h"
@@ -498,15 +500,31 @@
 }
 
 void Rtc::event(const std::string& eventProvider,
-                java::comms::CommsMessage& /* aMsg */)
+                java::comms::CommsMessage& aMsg )
 {
     ILOG(EJavaCaptain, "+Rtc::event()");
     if (BOOT_EVENT_PROVIDER == eventProvider)
     {
         if (mSupportPreWarming && isThereInstalledMidlets())
         {
-            ILOG(EJavaCaptain, "Rtc::event() - Boot event received, Starting prewarm VM since found Installed MIDlets");
-            launchPrewarm(); //New prewarm VM instance is will be created only if it did not exist already
+            ILOG(EJavaCaptain, "Rtc::event() - Boot event received, Starting "
+                 "prewarm VM since found Installed MIDlets");
+            launchPrewarm(); //New prewarm VM instance is will be created only
+                                      //if it did not exist already
+        }
+    } else if ( SETTINGS_CHANGE_EVENT_PROVIDER == eventProvider )
+    {
+        int changeEventType = 0;
+        getSettingsChangeEventMessageParams(aMsg, changeEventType);
+        if ( MIDP_CLASS_PATH_CHANGE == changeEventType &&
+             (mRuntimes.find(PREWARM_UID) != mRuntimes.end()) )
+        {
+            // Java libraries have been modified in the system.
+            //Prewarm instance must be restarted
+            ILOG(EJavaCaptain, "Rtc::event() - Restarting prewarm VM instance "
+                 "since MIDP classpath has changed");
+            stopPrewarm();
+            launchPrewarm();
         }
     }
 }
--- a/javamanager/javacaptain/subsystem.mk	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javacaptain/subsystem.mk	Tue Jul 06 20:36:19 2010 +0300
@@ -22,6 +22,7 @@
     extensionplugins/config/build \
     extensionplugins/javacertstore/build \
     extensionplugins/storageserver/build \
+    extensionplugins/settingslistener/build \
     $(LINUX_ONLY)
 
 
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java	Tue Jul 06 20:36:19 2010 +0300
@@ -46,6 +46,8 @@
 
     // Maximum number of progress updates to SysUtil.setProperty().
     private static final int MAX_PROPERTY_PROGRESS_UPDATES = 5;
+    // Maximum number of progress updates to SIF.
+    private static final int MAX_SIF_PROGRESS_UPDATES = 5;
     // Maximum number of progress updates to UI.
     private static final int MAX_UI_PROGRESS_UPDATES = 20;
 
@@ -61,11 +63,16 @@
     private int iMaxValue = 1;
     // Tells how often property progress should be updated.
     private int iPropertyProgressStep = 1;
+    // Tells how often SIF progress should be updated.
+    private int iSifProgressStep = 1;
     // Tells how often UI progress should be updated.
     private int iUiProgressStep = 1;
     // Point between 0 and iMaxValue where the last property
     // update has been made.
     private int iLastPropertyUpdate = 0;
+    // Point between 0 and iMaxValue where the last SIF update
+    // has been made.
+    private int iLastSifUpdate = 0;
     // Point between 0 and iMaxValue where the last UI update
     // has been made.
     private int iLastUiUpdate = 0;
@@ -203,6 +210,11 @@
         {
             iPropertyProgressStep = 1;
         }
+        iSifProgressStep = iMaxValue / MAX_SIF_PROGRESS_UPDATES;
+        if (iSifProgressStep == 0)
+        {
+            iSifProgressStep = 1;
+        }
         iUiProgressStep = iMaxValue / MAX_UI_PROGRESS_UPDATES;
         if (iUiProgressStep == 0)
         {
@@ -241,29 +253,44 @@
         Log.log("InstallationNotifier.set: progress " + currentPercentage);
         defineProperties();
 
-        if (aCurrentValue == 0 ||
-                aCurrentValue == iMaxValue ||
-                aCurrentValue >= iLastPropertyUpdate + iPropertyProgressStep ||
-                aCurrentValue <= iLastPropertyUpdate - iPropertyProgressStep)
+        if (isUpdateNeeded(aCurrentValue, iMaxValue,
+                           iLastPropertyUpdate, iPropertyProgressStep))
         {
             iLastPropertyUpdate = aCurrentValue;
             Log.log("InstallationNotifier.set: update property to " +
                     currentPercentage);
             // Update property values: progress.
-            SysUtil.setPropertyValue
-            (SysUtil.PROP_CATEGORY_SYSTEM,
-             SysUtil.PROP_KEY_JAVA_LATEST_INSTALLATION_PROGRESS,
-             currentPercentage);
+            SysUtil.setPropertyValue(
+                SysUtil.PROP_CATEGORY_SYSTEM,
+                SysUtil.PROP_KEY_JAVA_LATEST_INSTALLATION_PROGRESS,
+                currentPercentage);
         }
 
-        if (aCurrentValue == 0 ||
-                aCurrentValue == iMaxValue ||
-                aCurrentValue >= iLastUiUpdate + iUiProgressStep ||
-                aCurrentValue <= iLastUiUpdate - iUiProgressStep)
+        if (isUpdateNeeded(aCurrentValue, iMaxValue,
+                           iLastSifUpdate, iSifProgressStep))
         {
-            iLastUiUpdate = aCurrentValue;
+            if (iSifNotifier != null)
+            {
+                iLastSifUpdate = aCurrentValue;
+                try
+                {
+                    iSifNotifier.notifyProgress(
+                        iSifNotifier.SUB_OP_NO, currentPercentage, 100);
+                }
+                catch (Throwable t)
+                {
+                    Log.logError(
+                        "InstallationNotifier: SifNotifier.notifyProgress threw exception", t);
+                }
+            }
+        }
+
+        if (isUpdateNeeded(aCurrentValue, iMaxValue,
+                           iLastUiUpdate, iUiProgressStep))
+        {
             if (iInstallerUi != null)
             {
+                iLastUiUpdate = aCurrentValue;
                 Log.log("InstallationNotifier.set: update ui to " +
                         currentPercentage);
                 try
@@ -276,19 +303,6 @@
                         "InstallationNotifier: InstallerUi.updateProgress threw exception", t);
                 }
             }
-            if (iSifNotifier != null)
-            {
-                try
-                {
-                    iSifNotifier.notifyProgress(
-                        iSifNotifier.SUB_OP_NO, currentPercentage, 100);
-                }
-                catch (Throwable t)
-                {
-                    Log.logError(
-                        "InstallationNotifier: SifNotifier.notifyProgress threw exception", t);
-                }
-            }
         }
     }
 
@@ -380,4 +394,24 @@
                 "InstallationNotifier: Deleting property failed", ex);
         }
     }
+
+    /**
+     * Returns true if progress update is needed, false otherwise.
+     *
+     * @param aCurrent current progress value
+     * @param aMax maximum progress value
+     * @param aPrevious previously updated progress value
+     * @param aStep step between progress updates
+     */
+    private static boolean isUpdateNeeded(
+        int aCurrent, int aMax, int aPrevious, int aStep)
+    {
+        if (aCurrent == 0 || aCurrent == aMax ||
+            aCurrent >= aPrevious + aStep ||
+            aCurrent <= aPrevious - aStep)
+        {
+            return true;
+        }
+        return false;
+    }
 }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java	Tue Jul 06 20:36:19 2010 +0300
@@ -21,12 +21,14 @@
 import com.nokia.mj.impl.comms.CommsEndpoint;
 import com.nokia.mj.impl.comms.CommsMessage;
 import com.nokia.mj.impl.installer.applicationregistrator.SifNotifier;
+import com.nokia.mj.impl.installer.applicationregistrator.SifRegistrator;
 import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo;
 import com.nokia.mj.impl.installer.storagehandler.SuiteInfo;
 import com.nokia.mj.impl.installer.utils.InstallerException;
 import com.nokia.mj.impl.installer.utils.Log;
 import com.nokia.mj.impl.installer.utils.PlatformUid;
 import com.nokia.mj.impl.utils.exception.ExceptionBase;
+import com.nokia.mj.impl.utils.ErrorMessageBase;
 import com.nokia.mj.impl.utils.InstallerErrorMessage;
 import com.nokia.mj.impl.utils.Tokenizer;
 import com.nokia.mj.impl.utils.Uid;
@@ -37,30 +39,77 @@
 
 /**
  * InstallerResultMessage contains information about install, uninstall
- * and componentinfo operations. It is sent to Comms endpoint specified
- * at JavaInstaller startup.
+ * and componentinfo operation results. JavaInstaller sends it at the end
+ * of operation to Comms endpoint specified at JavaInstaller startup with
+ * -commsresult option.
+ * <p>
+ * InstallerResultMessage contains name-value pairs: name is a string,
+ * value can be either a string or an int. Message syntax:
+ * <p>
+ * <pre>
+ * message := length named_int_value* length named_string_value*
+ * named_int_value := name int_value
+ * named_string_value := name string_value
+ * name := &lt;string&gt;
+ * int_value := &lt;int&gt;
+ * string_value := &lt;string&gt;
+ * length := &lt;int telling the length of the table that follows&gt;
+ * </pre>
+ * <p>
  */
 public class InstallerResultMessage
 {
+    /** Operation type. Value type: int.
+        Possible values: 0: install, 1: uninstall, 2: componentinfo. */
     public static final String NAME_OPERATION = "operation";
+    /** Status code indicating operation result. Value type: int. */
     public static final String NAME_RESULT = "result";
+    /** SIF error category. Value type: int. */
     public static final String NAME_ERROR_CATEGORY = "error-category";
+    /** Java runtime specific error code. Value type: int. */
+    public static final String NAME_ERROR_CODE = "error-code";
+    /** Localized error message. Value type: string. */
     public static final String NAME_ERROR_MSG = "error-message";
+    /** Localized message with more details of the error reason. Value type: string. */
     public static final String NAME_ERROR_DETAILS = "error-details";
+    /** Suite UID. Value type: int. */
     public static final String NAME_SUITE_UID = "suite-uid";
+    /** Midlet-n UID. Value type: int. */
     public static final String NAME_MIDLET_UID = "midlet-uid-";
+    /** Suite component id. Value type: int. */
     public static final String NAME_SUITE_CID = "suite-cid";
+    /** Midlet-n component id. Value type: int. */
     public static final String NAME_MIDLET_CID = "midlet-cid-";
+    /** Suite global id. Value type: string. */
     public static final String NAME_SUITE_GID = "suite-gid";
+    /** Midlet-n global id. Value type: string. */
     public static final String NAME_MIDLET_GID = "midlet-gid-";
+    /** Suite name. Value type: string. */
     public static final String NAME_SUITE_NAME = "suite-name";
+    /** Midlet-n name. Value type: string. */
     public static final String NAME_MIDLET_NAME=  "midlet-name-";
+    /** Suite vendor. Value type: string. */
     public static final String NAME_VENDOR = "vendor";
+    /** Suite version. Value type: string. */
     public static final String NAME_VERSION = "version";
+    /** Component installation status. Value type: int. Possible values:
+        0: new component,
+        1: upgrade,
+        2: already installed,
+        3: newer version already installed,
+        4: invalid package, cannot be installed. */
     public static final String NAME_INSTALL_STATUS = "install-status";
+    /** Component authenticity. Value type: int. Possible values:
+        0: component is not authenticated, 1: component is authenticated. */
     public static final String NAME_AUTHENTICITY = "authenticity";
+    /** Size of the files owned by the component at the time of the
+        installation. Calculated from MIDlet-Data-Size and
+        MIDlet-Jar-Size attributes. Value type: int. */
     public static final String NAME_COMPONENT_SIZE = "component-size";
 
+    /** Id for installer result Comms message. */
+    private static final int INSTALLER_RESULT_MESSAGE_ID = 601;
+
     private Hashtable iNamedIntValues = null;
     private Hashtable iNamedStringValues = null;
 
@@ -165,7 +214,7 @@
             {
                 addValue(NAME_ERROR_DETAILS, msg);
             }
-            addErrorCategory(eb);
+            addErrorCodes(eb);
         }
         if (aException instanceof InstallerException)
         {
@@ -193,25 +242,24 @@
     }
 
     /**
-     * Get a string value from this message.
-     * @throws IllegalArgumentException if value with given name is not found
+     * Returns a string value from this message, or null
+     * if string value is not present.
      */
-    public String getStringValue(String aName)
+    String getStringValue(String aName)
     {
         Object value = iNamedStringValues.get(aName);
         if (value instanceof String)
         {
             return (String)value;
         }
-        throw new IllegalArgumentException(
-            "InstallerResultMessage: string value " + aName + " not found");
+        return null;
     }
 
     /**
      * Get an int value from this message.
      * @throws IllegalArgumentException if value with given name is not found
      */
-    public int getIntValue(String aName)
+    int getIntValue(String aName)
     {
         Object value = iNamedIntValues.get(aName);
         if (value instanceof Integer)
@@ -225,7 +273,7 @@
     /**
      * Removes a value from this message.
      */
-    public void removeValue(String aName)
+    void removeValue(String aName)
     {
         iNamedStringValues.remove(aName);
         iNamedIntValues.remove(aName);
@@ -255,19 +303,20 @@
         }
         if (iSifNotifier != null)
         {
-            int errCategory = 0;
-            int errCode = 0;
-            String errMsg = null;
-            String errDetails = null;
-            if (getIntValue(NAME_RESULT) != Installer.ERR_NONE)
-            {
-                errCategory = getIntValue(NAME_ERROR_CATEGORY);
-                errCode = Installer.ERR_GENERAL;
-                errMsg = getStringValue(NAME_ERROR_MSG);
-                errDetails = getStringValue(NAME_ERROR_DETAILS);
-            }
             try
             {
+                int result = getIntValue(NAME_RESULT);
+                int errCategory = 0;
+                int errCode = 0;
+                String errMsg = null;
+                String errDetails = null;
+                if (result != Installer.ERR_NONE)
+                {
+                    errCategory = getIntValue(NAME_ERROR_CATEGORY);
+                    errCode = getIntValue(NAME_ERROR_CODE);
+                    errMsg = getStringValue(NAME_ERROR_MSG);
+                    errDetails = getStringValue(NAME_ERROR_DETAILS);
+                }
                 iSifNotifier.notifyEnd(errCategory, errCode, errMsg, errDetails);
             }
             catch (Throwable t)
@@ -298,7 +347,7 @@
         {
             comms.connect(aEndpoint);
             CommsMessage msg = new CommsMessage();
-            msg.setMessageId(601);
+            msg.setMessageId(INSTALLER_RESULT_MESSAGE_ID);
             // Initialise the message data.
             msg.write(iNamedIntValues.size());
             Enumeration e = iNamedIntValues.keys();
@@ -318,7 +367,7 @@
             }
             // Send the message.
             Log.log("Sending InstallerResultMessage to " + aEndpoint);
-            CommsMessage installerResultResponse = comms.sendReceive(msg, 5);
+            comms.sendReceive(msg, 5);
             comms.disconnect();
             Log.log("Received InstallerResultResponse from " + aEndpoint);
         }
@@ -385,48 +434,34 @@
     }
 
     /**
-     * Adds error category to the result message.
+     * Adds error codes to the result message.
      */
-    private void addErrorCategory(ExceptionBase aEb)
+    private void addErrorCodes(ExceptionBase aEb)
     {
-        switch (aEb.getShortMessageId())
+        if (aEb.getShortMessageId() >= ErrorMessageBase.INSTALLER_RANGE_START &&
+            aEb.getShortMessageId() <= ErrorMessageBase.INSTALLER_RANGE_END)
         {
-        case InstallerErrorMessage.INST_NO_MEM:
-            addValue(NAME_ERROR_CATEGORY, 2); // ELowDiskSpace
-            break;
-        case InstallerErrorMessage.INST_NO_NET:
-            addValue(NAME_ERROR_CATEGORY, 3); // ENetworkUnavailable
-            break;
-        case InstallerErrorMessage.INST_CORRUPT_PKG:
-            addValue(NAME_ERROR_CATEGORY, 5); // ECorruptedPackage
-            break;
-        case InstallerErrorMessage.INST_COMPAT_ERR:
-            addValue(NAME_ERROR_CATEGORY, 6); // EApplicationNotCompatible
-            break;
-        case InstallerErrorMessage.INST_AUTHORIZATION_ERR:
-            // fall through
-        case InstallerErrorMessage.INST_AUTHENTICATION_ERR:
-            addValue(NAME_ERROR_CATEGORY, 7); // ESecurityError
-            break;
-        case InstallerErrorMessage.INST_PUSH_REG_ERR:
-            // fall through
-        case InstallerErrorMessage.INST_UNEXPECTED_ERR:
-            // fall through
-        case InstallerErrorMessage.UNINST_UNEXPECTED_ERR:
-            // fall through
-        case InstallerErrorMessage.OTHER_UNEXPECTED_ERR:
-            addValue(NAME_ERROR_CATEGORY, 8); // EUnexpectedError
-            break;
-        case InstallerErrorMessage.INST_CANCEL:
-            // fall through
-        case InstallerErrorMessage.UNINST_CANCEL:
-            addValue(NAME_ERROR_CATEGORY, 9); // EUserCancelled
-            break;
-        case InstallerErrorMessage.UNINST_NOT_ALLOWED:
-            addValue(NAME_ERROR_CATEGORY, 10); // EUninstallationBlocked
-            break;
-        default:
-            addValue(NAME_ERROR_CATEGORY, 8); // EUnexpectedError
+            addValue(NAME_ERROR_CATEGORY,
+                     SifRegistrator.getErrorCategory(aEb.getShortMessageId()));
+            addValue(NAME_ERROR_CODE,
+                     aEb.getShortMessageId() + aEb.getDetailedMessageId());
+        }
+        else if (aEb.getShortMessageId() >= ErrorMessageBase.SECURITY_RANGE_START &&
+                 aEb.getShortMessageId() <= ErrorMessageBase.SECURITY_RANGE_END)
+        {
+            addValue(NAME_ERROR_CATEGORY,
+                     SifRegistrator.getErrorCategory(
+                         InstallerErrorMessage.INST_AUTHORIZATION_ERR));
+            addValue(NAME_ERROR_CODE,
+                     aEb.getShortMessageId() + aEb.getDetailedMessageId());
+        }
+        else
+        {
+            addValue(NAME_ERROR_CATEGORY,
+                     SifRegistrator.getErrorCategory(
+                         InstallerErrorMessage.INST_UNEXPECTED_ERR));
+            addValue(NAME_ERROR_CODE,
+                     aEb.getShortMessageId()*1000 + aEb.getDetailedMessageId());
         }
     }
 }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java	Tue Jul 06 20:36:19 2010 +0300
@@ -20,6 +20,7 @@
 
 import java.util.Hashtable;
 
+import com.nokia.mj.impl.installer.Installer;
 import com.nokia.mj.impl.installer.InstallationNotifier;
 import com.nokia.mj.impl.installer.applicationregistrator.ApplicationRegistrator;
 import com.nokia.mj.impl.installer.applicationregistrator.SifNotifier;
@@ -303,10 +304,11 @@
                     Log.logWarning("checkForCancel: Stopping downloader failed", t);
                 }
             }
-            throw new InstallerException
-            (InstallerErrorMessage.INST_CANCEL, null,
-             InstallerDetailedErrorMessage.NO_MSG, null,
-             OtaStatusCode.USER_CANCELLED);
+            throw new InstallerException(
+                Installer.ERR_CANCEL,
+                InstallerErrorMessage.INST_CANCEL, null,
+                InstallerDetailedErrorMessage.INST_CANCEL, null,
+                OtaStatusCode.USER_CANCELLED);
         }
     }
 
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/StartProgressNotifications.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/StartProgressNotifications.java	Tue Jul 06 20:36:19 2010 +0300
@@ -36,6 +36,12 @@
         InstallBall ball = (InstallBall)aBall;
         Log.log("Starting progress notifications...");
 
+        if (ball.iPreinstallation)
+        {
+            Log.log("SifNotifier disabled during preinstallation.");
+            return;
+        }
+
         if (!SifNotifier.enabled())
         {
             Log.log("SifNotifier disabled.");
@@ -99,7 +105,7 @@
         }
         catch (Throwable t)
         {
-            Log.logError("StartProgressNotifications: SifNotifier.notifyStart failed", t);
+            Log.log("StartProgressNotifications: SifNotifier.notifyStart failed", t);
             try
             {
                 ball.iSifNotifier.destroy();
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/UninstallBall.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/UninstallBall.java	Tue Jul 06 20:36:19 2010 +0300
@@ -21,6 +21,7 @@
 import java.util.Hashtable;
 import java.util.Vector;
 
+import com.nokia.mj.impl.installer.Installer;
 import com.nokia.mj.impl.installer.InstallationNotifier;
 import com.nokia.mj.impl.installer.applicationregistrator.ApplicationRegistrator;
 import com.nokia.mj.impl.installer.applicationregistrator.SifNotifier;
@@ -124,10 +125,11 @@
         super.checkForCancel();
         if (isCancelled())
         {
-            throw new InstallerException
-            (InstallerErrorMessage.UNINST_CANCEL, null,
-             InstallerDetailedErrorMessage.NO_MSG, null,
-             OtaStatusCode.USER_CANCELLED);
+            throw new InstallerException(
+                Installer.ERR_CANCEL,
+                InstallerErrorMessage.UNINST_CANCEL, null,
+                InstallerDetailedErrorMessage.UNINST_CANCEL, null,
+                OtaStatusCode.USER_CANCELLED);
         }
     }
 
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandler.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandler.java	Tue Jul 06 20:36:19 2010 +0300
@@ -925,13 +925,23 @@
         }
         else
         {
-            // Not an update ==> user is making uninstallation.
+            // Not an update ==> suite is being uninstalled.
             int oldPreinstallState = readPreinstallState(aSuiteInfo);
             if (oldPreinstallState == aSuiteInfo.STATE_PREINSTALLED)
             {
-                // User is uninstalling a preinstalled application,
-                // set preinstall state to STATE_NO_PREINSTALL.
-                setNoPreinstallState(aSuiteInfo);
+                if (aSuiteInfo.getResetPreinstall())
+                {
+                    // Preinstallation state should be reset,
+                    // remove existing data from
+                    // StorageNames.PREINSTALL_TABLE table.
+                    removePreinstallState(aSuiteInfo);
+                }
+                else
+                {
+                    // User is uninstalling a preinstalled application,
+                    // set preinstall state to STATE_NO_PREINSTALL.
+                    setNoPreinstallState(aSuiteInfo);
+                }
             }
             else if (oldPreinstallState == aSuiteInfo.STATE_INSTALLED)
             {
@@ -1081,13 +1091,11 @@
 
     /**
      * Removes preinstall state for given suite from
-     * preinstall table but only if preinstall state
-     * in given SuiteInfo is SuiteInfo.STATE_INSTALLED.
+     * preinstall table 
      */
     private void removePreinstallState(SuiteInfo aSuiteInfo)
     {
-        if (aSuiteInfo == null ||
-                aSuiteInfo.iPreinstallState != aSuiteInfo.STATE_INSTALLED)
+        if (aSuiteInfo == null)
         {
             return;
         }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/Args.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/Args.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -20,6 +20,7 @@
 
 import com.nokia.mj.impl.installer.utils.InstallerException;
 import com.nokia.mj.impl.installer.utils.Log;
+import com.nokia.mj.impl.utils.Base64;
 import com.nokia.mj.impl.utils.Tokenizer;
 
 import java.util.Hashtable;
@@ -59,6 +60,7 @@
                 //Log.log("Args: " + arg + "=" + value);
             }
         }
+        decodeBase64Args();
     }
 
     /**
@@ -203,7 +205,59 @@
             }
             drive = aDrive.toLowerCase().charAt(0) - 'a';
         }
-        Log.log("Parsed drive " + aDrive + " --> " + drive);
+        Log.log("Args: Parsed drive " + aDrive + " --> " + drive);
         return drive;
     }
+
+    /**
+     * Decodes base64 encoded arguments.
+     * In Symbian environment the decoded argument is UTF-16LE string.
+     *
+     * @see /sf/app/jrt/javacommons/utils/inc/javacommonutils.h,
+     *  wbase64encode()
+     */
+    private void decodeBase64Args()
+    {
+        String base64Value = get("base64");
+        if (base64Value == null || base64Value.length() == 0)
+        {
+            return;
+        }
+        String[] tokens = Tokenizer.split(base64Value, ",");
+        String name = null;
+        String value = null;
+        for (int i = 0; i < tokens.length; i++)
+        {
+            name = tokens[i];
+            value = null;
+            if (name != null && name.length() > 0)
+            {
+                value = get(name);
+            }
+            if (value != null && value.length() > 0)
+            {
+                try
+                {
+                    byte[] valueBytes = Base64.decode(value);
+                    if (valueBytes != null && valueBytes.length > 0)
+                    {
+                        value = new String(valueBytes, "UTF-16LE");
+                        Log.log("Args: Base64 decoded option " +
+                                name + "=" + value);
+                        iArgs.put(name, value);
+                    }
+                    else
+                    {
+                        Log.logError("Args: Base64 decoding failed for " +
+                                     name + "=" + value);
+                    }
+                }
+                catch (Throwable t)
+                {
+                    Log.logError("Args: Base64 decoding failed for " +
+                                 name + "=" + value, t);
+                }
+            }
+        }
+    }
 }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -85,6 +85,11 @@
         Installer.cancel();
     }
 
+    public void uiDisposed()
+    {
+        Log.log("ApplicationUtilsImpl.uiDisposed");
+    }
+
     public void checkPermission(Permission aPermission)
     throws AccessControlException, NullPointerException
     {
@@ -112,7 +117,7 @@
 
         boolean userPromptAllowed = false;
         if (aPermission.toString().equals(
-                    "javax.microedition.io.PushRegistryPermission"))
+                    "javax.microedition.io.PushRegistry"))
         {
             // PushRegistryPermission is the only permission which
             // must be prompted from the user during installation.
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -21,21 +21,11 @@
 #include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL
 #include "logger.h"
 
-#if defined(SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK) && defined(RD_JAVA_USIF_NOTIFY_PROGRESS)
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 
 #include <usif/sif/sifnotification.h>
 #include <usif/usifcommon.h>
 
-// Helper macro for logging a TDesC.
-#define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \
-    {                                                               \
-        HBufC8* tdescBuf = HBufC8::NewLC(tdescParam.Length() + 1);  \
-        TPtr8 tdescPtr(tdescBuf->Des());                            \
-        tdescPtr.Append(tdescParam);                                \
-        LOG1(compIdParam, logLevelParam, msgParam, tdescPtr.PtrZ());\
-        CleanupStack::PopAndDestroy(tdescBuf);                      \
-    }
-
 // NAMESPACE DECLARATION
 using namespace java;
 using namespace Usif;
@@ -101,6 +91,7 @@
                 HBufC *appIcon = CreateHBufCFromJavaStringLC(aEnv, tmpAppIcon);
                 applicationIcons.AppendL(appIcon);
                 CleanupStack::Pop(appIcon);
+                aEnv->DeleteLocalRef(tmpAppIcon);
             }
             else
             {
@@ -306,7 +297,7 @@
     return KErrNone;
 }
 
-#else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK && RD_JAVA_USIF_NOTIFY_PROGRESS
+#else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 
 /*
  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
@@ -390,4 +381,4 @@
     return KErrNone;
 }
 
-#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK && RD_JAVA_USIF_NOTIFY_PROGRESS
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
--- a/javamanager/javainstaller/installerui/build/build.xml	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/build/build.xml	Tue Jul 06 20:36:19 2010 +0300
@@ -1,6 +1,6 @@
 <!--
 #
-# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2008-2010 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"
@@ -12,7 +12,7 @@
 #
 # Contributors:
 #
-# Description: 
+# Description:
 #
 -->
 
@@ -50,6 +50,16 @@
     </copy>
   </target>
 
+  <target name="compile">
+    <condition property="installer.ui.excludes"
+	       value="com/nokia/mj/impl/installer/ui/eswt/*.java"
+	       else="com/nokia/mj/impl/installer/ui/eswt2/*.java">
+      <isset property="RD_JAVA_UI_QT"/>
+    </condition>
+    <echo message="installerui compilation excludes: ${installer.ui.excludes}"/>
+    <omj.javac excludes="${installer.ui.excludes}"/>
+  </target>
+
   <target name="create.internal.api.jar" depends="export.data">
       <omj.internal.apis includes="com/nokia/mj/impl/installer/ui/*.class"/>
   </target>
Binary file javamanager/javainstaller/installerui/data/java_3_trusted.png has changed
Binary file javamanager/javainstaller/installerui/data/java_3_untrusted.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installerui/data/javaapplicationinstaller.css	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+QScrollArea#dialogArea {
+	/* General size parameters for all installer dialogs */
+
+	/* this depends on display; NHD portrait width:360px and height:640px used */
+	/* Note that popup width and height is according to portrait dimensions, and is the same in portrait and landscape */
+	width: 346.6px; /*expr(var(hb-param-screen-short-edge)- 2*var(hb-param-margin-gene-screen)); /* 2un*/
+	/*height: /*the size of MessageBox with 3-5 rows of text? */
+	max-height: 626.6px; /*expr(var(hb-param-long-edge)-2*var(hb-param-margin-gene-screen));
+	/*position: vertically and horizontally centre of screen - is this needed?*/
+}
+
+QScrollArea#appInfoArea {
+	/* This is valid for all installation query application details,
+	 * and also for application details in short error message */
+	/* (ViewBase) */
+	/* Note: this text area becomes scrollable if there are more text
+	 * that can be displayed at one time (this could be also QAbstractScrollArea?)*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
+QLabel#heading {
+	/* Any installation query heading text: its text size, and top/left margins */
+	font-size: 26.8px; /*hb-param-text-height-primary;/*4un*/
+	font-weight: bold;
+	max-height: 53.6px; /*expr(var(hb-param-text-height-primary)+2*var(hb-param-margin-gene-popup)) - same as hb-param-widget-popup-heading-height;*/
+	margin-top: 13.4px; /*hb-param-margin-gene-top; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-left; /*2un*/
+}
+
+QLabel#contentIcon {
+	/* This is valid for all icons displayed in the installation query content area */
+	/* Application icon, question icon, error icon in installation error dialog etc */
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	/* size of icon - fixed size */
+	min-width: 53.6px; /*hb-param-graphic-size-primary-large;/*8un*/
+	max-width: 53.6px; /*hb-param-graphic-size-primary-large;/*8un*/
+	min-height: 53.6px; /* hb-param-graphic-size-primary-large;/*8un*/
+	max-height: 53.6px; /* hb-param-graphic-size-primary-large;/*8un*/
+}
+
+QComboBox#driveSelector{
+	/* Combo box in installationquery. Need to define the top margin at least (InstallConfirmationView). */
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+}
+
+QProgressBar#progressBar{
+	/* Progress bar in installationquery. Need to define the top margin at least (ProgressView). */
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+}
+
+QLabel#permissionDetails{
+	/* String that requests access for protected functionality in permission query */
+	/* (PermissionInfo) */
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
+QLabel#errorLabel{
+	/* short error message from USIF (note: this is not Java specific error message but
+	 * common to all installers), (ErrorView) */
+	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+}
+
+QLabel#detailsWarningLabel{
+	/* Application is certified / is not certified views and permission details
+	 * view texts (CertificateDetailsView, PermissionDetailsView) */
+	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+}
+
+QLabel#authLabel{
+	/* Text in authentication dialog (UsernamePasswordView) */
+	/* Note that this dialog is always in portrait */
+	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
+QLabel#usernamePasswordLabel{
+	/* Label of username and password input fields in authentication dialog (UsernamePasswordView) */
+	/* Note that this dialog is always in portrait */
+	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
+QLabel#usernamePasswordInputField{
+	/* Input fields of username and password in authentication dialog (UsernamePasswordView) */
+	/* Note that this dialog is always in portrait */
+	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-bottom: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
+/* --- Buttons --- */
+
+QPushButton {
+	font-size: 20.1px;/* hb-param-text-height-tiny; /*3un*/
+}
+
+QPushButton#softKeyButton{
+	/* Installation query OK button (ConfirmationViewBase) */
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	height: 50.25px; /*hb-param-widget-popup-softkey-height;/*7.5un*/
+	/* this depends on display; NHD portrait width:360px and height:640px used */
+	width: 173.3px; /*expr((var(hb-param-screen-short-edge)-2*var(hb-param-margin-gene-screen))/2); /* width of one button is half of popup width*/
+}
+
+QPushButton#softKeyButtonWide{
+	/* Ok button to go back from a details view (application is certified / not certified views
+	 * and permission details view) (CertificateDetailsView, PermissionDetailsView)*/
+	/* this ok button has different top margin otherwise the same as OkCommand button with max-width */
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+	height: 50.25px; /*hb-param-widget-popup-softkey-height;/*7.5un*/
+}
+
+QPushButton#securityButton{
+	/* Security lock icon button in installation query heading (ViewBase.createSecurityButton) */
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	/* size of icon */
+	min-width: 26.8px; /* hb-param-graphic-size-primary-small; /*4un*/
+	max-width: 26.8px; /* hb-param-graphic-size-primary-small; /*4un*/
+	min-height: 26.8px; /* hb-param-graphic-size-primary-small; /*4un*/
+	max-height: 26.8px; /* hb-param-graphic-size-primary-small; /*4un*/
+
+}
+
+QPushButton#detailsLink{
+	/* Button in permission query to view details (PermissionConfirmationView) */
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-left; /*2un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
+QPushButton#allowButton{
+	/* Allow always function button in permission query */
+	/* (PermissionConfirmationView) */
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+
+}
+
+QPushButton#denyButton{
+	/* Ask me later function buttons in permission query */
+	/* (PermissionConfirmationView) */
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+}
+
+QPushButton#cancelButton{
+	/* Cancel installing function button in permission query */
+	/* (PermissionConfirmationView) */
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-top: 5.025px; /*hb-param-margin-gene-middle-vertical; /*0.75un*/
+	margin-bottom: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+
+}
+
+QCheckBox#retainDataButton {
+	/* Retain user data check box button in update query */
+	/* Note that there is 2*hb-param-margin-gene-middle-vertical margin at the top as this check box is placed
+	 * after drive selector combo */
+	/* (InstallConfirmationView) */
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-top: 10.05px; /*expr(2*var(hb-param-margin-gene-middle-vertical));
+}
+
+/* --- End Buttons --- */
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -124,16 +124,11 @@
                             new String[] { iInstallInfo.getName() }),
                            horizontalSpan, labelStyle);
 
-        if (identified)
-        {
-            // Vendor information must be displayed only for
-            // identified applications.
-            Label vendorLabel = createLabel
-                                (InstallerUiTexts.get
-                                 (InstallerUiTexts.VENDOR,
-                                  new String[] { iInstallInfo.getVendor() }),
-                                 horizontalSpan, labelStyle);
-        }
+        Label vendorLabel = createLabel
+            (InstallerUiTexts.get
+             (InstallerUiTexts.VENDOR,
+              new String[] { iInstallInfo.getVendor() }),
+             horizontalSpan, labelStyle);
 
         Label versionLabel = createLabel
                              (InstallerUiTexts.get
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java	Tue Jul 06 20:36:19 2010 +0300
@@ -126,7 +126,6 @@
         // Create a hashtable for icons.
         iImageTable = new Hashtable();
         // Create a new thread to be the UI main thread.
-        iUiThreadExists = true;
         UIThreadSupport.startInUIThread(new Runnable()
         {
             public void run()
@@ -145,6 +144,7 @@
     private void uiMain()
     {
         log("uiMain: thread started");
+        iUiThreadExists = true;
         try
         {
             // Create the necessary views.
@@ -512,6 +512,12 @@
         // updating it.
         synchronized (iProgressSyncObject)
         {
+            if (iDlProgressView != null && iDlProgressView.isVisible())
+            {
+                // If download progress is being displayed,
+                // do not display installation progress.
+                return;
+            }
             if (iDisplayProgress && !iProgressView.isVisible())
             {
                 iProgressView.setVisible(true);
@@ -994,6 +1000,14 @@
     }
 
     /**
+     * Executes given Runnable synchronously in the UI thread.
+     */
+    public void syncExec(Runnable aRunnable)
+    {
+        iParent.getDisplay().syncExec(aRunnable);
+    }
+
+    /**
      * Returns string title basing on mode of this InstallerUi.
      */
     protected String getTitle()
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -119,16 +119,11 @@
                             new String[] { iUninstallInfo.getName() }),
                            horizontalSpan, labelStyle);
 
-        if (identified)
-        {
-            // Vendor information must be displayed only for
-            // identified applications.
-            Label vendorLabel = createLabel
-                                (InstallerUiTexts.get
-                                 (InstallerUiTexts.VENDOR,
-                                  new String[] { iUninstallInfo.getVendor() }),
-                                 horizontalSpan, labelStyle);
-        }
+        Label vendorLabel = createLabel
+            (InstallerUiTexts.get
+             (InstallerUiTexts.VENDOR,
+              new String[] { iUninstallInfo.getVendor() }),
+             horizontalSpan, labelStyle);
 
         Label versionLabel = createLabel
                              (InstallerUiTexts.get
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/CertificateDetailsView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/CertificateDetailsView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -79,7 +79,7 @@
         Label detailsLabel = createLabel(
                                  InstallerUiTexts.get(InstallerUiTexts.NOT_CERTIFIED_TITLE),
                                  horizontalSpan, labelStyle);
-        detailsLabel.setFont(iInstallerUi.getBoldFont());
+        setCssId(detailsLabel, "heading");
 
         // Add domain category label.
         createLabel("", horizontalSpan, labelStyle);
@@ -103,6 +103,7 @@
                                                       new String[] { appName }),
                                  horizontalSpan, labelStyle);
 
+        setCssId(warningLabel, "detailsWarningLabel");
     }
 
     /**
@@ -118,7 +119,7 @@
                              (InstallerUiTexts.get
                               (InstallerUiTexts.CERTIFICATE_TITLE),
                               horizontalSpan, labelStyle);
-        detailsLabel.setFont(iInstallerUi.getBoldFont());
+        setCssId(detailsLabel, "heading");
 
         SigningCertificate certificate = iCerts[iCertIndex];
 
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java	Tue Jul 06 20:36:19 2010 +0300
@@ -100,6 +100,7 @@
                     createCommands();
                     setDefaultCommand();
                 }
+                iInstallerUi.loadCss();
                 setVisible(true);
                 iInstallerUi.unhide();
             }
@@ -184,6 +185,14 @@
         if (iOkText != null)
         {
             iOkCommand = new Button(getCommandComposite(), SWT.PUSH);
+            if (iCancelText != null)
+            {
+                setCssId(iOkCommand, "softKeyButton");
+            }
+            else
+            {
+                setCssId(iOkCommand, "softKeyButtonWide");
+            }
             GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
             gridData.horizontalSpan = horizontalSpan;
             iOkCommand.setLayoutData(gridData);
@@ -230,6 +239,14 @@
         if (iCancelText != null)
         {
             iCancelCommand = new Button(getCommandComposite(), SWT.PUSH);
+            if (iOkText != null)
+            {
+                setCssId(iCancelCommand, "softKeyButton");
+            }
+            else
+            {
+                setCssId(iCancelCommand, "softKeyButtonWide");
+            }
             GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
             gridData.horizontalSpan = horizontalSpan;
             iCancelCommand.setLayoutData(gridData);
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorDetailsView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorDetailsView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -69,20 +69,20 @@
     protected void createView()
     {
         // Add title.
+        Label titleLabel = null;
         String title = InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED);
         if (iInstallerUi.getInstallInfo() != null)
         {
-            Label titleLabel = createLabel(title, getColumns() - 1, SWT.WRAP);
-            titleLabel.setFont(iInstallerUi.getBoldFont());
+            titleLabel = createLabel(title, getColumns() - 1, SWT.WRAP);
             // Add security icon.
             iCertificates = iInstallerUi.getInstallInfo().getCertificates();
             createSecurityButton();
         }
         else
         {
-            Label titleLabel = createLabel(title, getColumns(), SWT.WRAP);
-            titleLabel.setFont(iInstallerUi.getBoldFont());
+            titleLabel = createLabel(title, getColumns(), SWT.WRAP);
         }
+        setCssId(titleLabel, "heading");
 
         int horizontalSpan = getColumns();
         int labelStyle = SWT.WRAP;
@@ -90,6 +90,7 @@
         // Begin widgets creation.
         Label errorLabel = createLabel(
             iException.getDetailedMessage(), horizontalSpan, labelStyle);
+        setCssId(errorLabel, "errorLabel");
         // End of widgets creation.
     }
 
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -78,7 +78,7 @@
         else
         {
             Label titleLabel = createLabel(title, getColumns(), SWT.WRAP);
-            titleLabel.setFont(iInstallerUi.getBoldFont());
+            setCssId(titleLabel, "heading");
         }
 
         int horizontalSpan = getColumns();
@@ -87,6 +87,7 @@
         // Begin widgets creation.
         Label errorLabel = createLabel(
             iException.getShortMessage(), horizontalSpan, labelStyle);
+        setCssId(errorLabel, "errorLabel");
         // End of widgets creation.
 
         if (iInstallerUi.getInstallInfo() != null)
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallConfirmationView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallConfirmationView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -106,15 +106,7 @@
     protected void createView()
     {
         // Add header.
-        String title = InstallerUiTexts.get(InstallerUiTexts.INSTALL_QUERY);
-        if (iInstallInfo != null)
-        {
-            if (iInstallInfo.getOldVersion() != null)
-            {
-                title = InstallerUiTexts.get(InstallerUiTexts.UPDATE_QUERY);
-            }
-        }
-        addHeader(title, iInstallInfo, null);
+        addHeader(null, iInstallInfo, null);
 
         GridData gridData = null;
         int horizontalSpan = getColumns();
@@ -126,6 +118,7 @@
         {
             // Add installation drive selector.
             iDriveSelector = new Combo(getComposite(), SWT.READ_ONLY);
+            setCssId(iDriveSelector, "driveSelector");
             gridData = new GridData(GridData.FILL_HORIZONTAL);
             gridData.horizontalSpan = horizontalSpan;
             iDriveSelector.setLayoutData(gridData);
@@ -155,6 +148,7 @@
         {
             // Add retain user data option.
             iRetainDataButton = new Button(getComposite(), SWT.CHECK);
+            setCssId(iRetainDataButton, "retainDataButton");
             gridData = new GridData(GridData.FILL_HORIZONTAL);
             gridData.horizontalSpan = horizontalSpan;
             iRetainDataButton.setLayoutData(gridData);
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java	Tue Jul 06 20:36:19 2010 +0300
@@ -27,7 +27,6 @@
 import com.nokia.mj.impl.installer.ui.LaunchAppInfo;
 import com.nokia.mj.impl.installer.ui.PermissionInfo;
 import com.nokia.mj.impl.installer.ui.UninstallInfo;
-import com.nokia.mj.impl.installer.ui.eswt.MinimalUi;
 import com.nokia.mj.impl.rt.ui.ConfirmData;
 import com.nokia.mj.impl.rt.ui.RuntimeUi;
 import com.nokia.mj.impl.rt.ui.RuntimeUiFactory;
@@ -47,10 +46,10 @@
 import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.internal.extension.DisplayExtension;
+import org.eclipse.swt.internal.qt.BaseCSSEngine;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Composite;
@@ -62,10 +61,15 @@
  */
 public class InstallerUiEswt extends InstallerUi
 {
+    /** Disable UI temporarily. */
+    private static final boolean DISABLE_UI =
+        (System.getProperty("com.nokia.mj.impl.installer.ui.disableui")
+         == null? false: true);
     /** Default shell style. */
     private static final int SHELL_STYLE =
         SWT.BORDER | SWT.APPLICATION_MODAL | SWT.ON_TOP;
 
+    private BaseCSSEngine iCssEngine = null;
     private Shell iParent = null;
     private Shell iDialog = null;
     private ProgressView iProgressView = null;
@@ -98,8 +102,6 @@
     private boolean iDisplayProgress = false;
     /** Flag telling if the first progress bar update has been traced. */
     private boolean iProgressBarUpdateTraced = false;
-    /** Flag telling if MinimalUi should be used if UI creation fails. */
-    private boolean iMinimalUiEnabled = true;
 
     /** Hashtable for storing the loaded icons. */
     private static Hashtable iImageTable = null;
@@ -135,7 +137,6 @@
         // Create a hashtable for icons.
         iImageTable = new Hashtable();
         // Create a new thread to be the UI main thread.
-        iUiThreadExists = true;
         UIThreadSupport.startInUIThread(new Runnable()
         {
             public void run()
@@ -154,12 +155,14 @@
     private void uiMain()
     {
         log("uiMain: thread started");
+        iUiThreadExists = true;
         try
         {
             // Create the necessary views.
             DisplayExtension display = new DisplayExtension();
             StartUpTrace.doTrace("InstallerUiEswt display created");
             display.setAppName(""); // Remove display title.
+            iCssEngine = new BaseCSSEngine(display);
             iParent = new Shell(display);
             iDialog = new Shell(iParent, SHELL_STYLE);
             iDefaultShellBounds = iDialog.internal_getDefaultBounds();
@@ -182,10 +185,10 @@
             });
 
             // Initialize best icon size.
-            iBestIconSize = new Point(
-                display.getBestImageWidth(DisplayExtension.ALERT),
-                display.getBestImageHeight(DisplayExtension.ALERT));
-            log("Best icon size: " + iBestIconSize);
+            //iBestIconSize = new Point(
+            //    display.getBestImageWidth(DisplayExtension.ALERT),
+            //    display.getBestImageHeight(DisplayExtension.ALERT));
+            //log("Best icon size: " + iBestIconSize);
 
             synchronized (iInitWaitObject)
             {
@@ -302,24 +305,14 @@
         super.confirm(aInstallInfo);
 
         waitForUi();
-        boolean result = true;
         if (!isUiReady())
         {
-            result = false;
-            if (iMinimalUiEnabled)
-            {
-                result = MinimalUi.confirmStatic(aInstallInfo);
-                log("MinimalUi installation confirmation returns " + result);
-                return result;
-            }
-            else
-            {
-                // If UI is not ready by the time confirmation is requested,
-                // throw an exception.
-                throw new RuntimeException("JavaInstallerUi not ready");
-            }
+            // If UI is not ready by the time confirmation is requested,
+            // throw an exception.
+            throw new RuntimeException("JavaInstallerUi not ready");
         }
 
+        boolean result = true;
         if (result)
         {
             StartUpTrace.doTrace("InstallerUiEswt confirm");
@@ -463,7 +456,7 @@
     public void updateProgress(int aProgress)
     {
         super.updateProgress(aProgress);
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
         if (!isUiReady())
         {
             return;
@@ -474,6 +467,12 @@
         // updating it.
         synchronized (iProgressSyncObject)
         {
+            if (iDlProgressView != null && iDlProgressView.isVisible())
+            {
+                // If download progress is being displayed,
+                // do not display installation progress.
+                return;
+            }
             if (iDisplayProgress && !iProgressView.isVisible())
             {
                 // Re-create iProgressView here so that it gets
@@ -510,7 +509,7 @@
     public void ended()
     {
         super.ended();
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
         if (!isUiReady())
         {
             return;
@@ -555,7 +554,7 @@
     public void started(DownloadInfo aDownloadInfo)
     {
         super.started(aDownloadInfo);
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
         if (!isUiReady())
         {
             return;
@@ -582,7 +581,7 @@
     public void updateProgress(DownloadInfo aDownloadInfo)
     {
         super.updateProgress(aDownloadInfo);
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
         if (!isUiReady())
         {
             return;
@@ -632,7 +631,7 @@
     public void ended(DownloadInfo aDownloadInfo)
     {
         super.ended(aDownloadInfo);
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
         if (!isUiReady())
         {
             return;
@@ -659,7 +658,7 @@
     public void setOcspIndicator(boolean aOn)
     {
         super.setOcspIndicator(aOn);
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
         waitForUi();
         if (!isUiReady())
         {
@@ -760,7 +759,7 @@
     public void error(InstallerExceptionBase aInstallerException)
     {
         super.error(aInstallerException);
-        if (true) return; // Disable UI temporarily.
+        if (DISABLE_UI) return; // Disable UI temporarily.
 
         waitForUi();
         if (!isUiReady()) {
@@ -857,7 +856,7 @@
      */
     public boolean confirm(String aAppName, ConfirmData aConfirmData)
     {
-        if (true) return true; // Disable UI temporarily.
+        if (DISABLE_UI) return true; // Disable UI temporarily.
         waitForUi();
         if (!isUiReady()) {
             return true;
@@ -896,7 +895,7 @@
      */
     public String[] getUsernamePassword(String aUrl)
     {
-        if (true) return new String[] { "", "" }; // Disable UI temporarily.
+        if (DISABLE_UI) return new String[] { "", "" }; // Disable UI temporarily.
         waitForUi();
         if (!isUiReady())
         {
@@ -952,7 +951,7 @@
      */
     public boolean launchAppQuery(LaunchAppInfo aLaunchAppInfo)
     {
-        if (true) return false; // Disable UI temporarily.
+        if (DISABLE_UI) return false; // Disable UI temporarily.
         waitForUi();
         if (!isUiReady() || iConfirmationsCanceled || getInstallInfo() == null)
         {
@@ -974,19 +973,31 @@
             });
         }
         boolean result = iLaunchAppQueryView.launchAppQuery(aLaunchAppInfo);
-        iParent.getDisplay().syncExec(new Runnable()
+        iLaunchAppQueryView.dispose();
+        iLaunchAppQueryView = null;
+        if (!result)
         {
-            public void run()
+            iParent.getDisplay().syncExec(new Runnable()
             {
-                iParent.dispose();
-            }
-        });
-        iLaunchAppQueryView = null;
+                public void run()
+                {
+                    iParent.dispose();
+                }
+            });
+        }
         log("LaunchAppQuery returns " + result + " for " + aLaunchAppInfo);
         return result;
     }
 
     /**
+     * Executes given Runnable synchronously in the UI thread.
+     */
+    public void syncExec(Runnable aRunnable)
+    {
+        iParent.getDisplay().syncExec(aRunnable);
+    }
+
+    /**
      * Hides or unhides InstallerUi.
      */
     public void hide(boolean aHide)
@@ -1054,10 +1065,10 @@
         {
             return iSecurityIcon;
         }
-        String iconFilename = ResourceUtil.UNTRUSTED_ICON_NAME;
+        String iconFilename = "java_3_untrusted.png";
         if (aIdentified)
         {
-            iconFilename = ResourceUtil.TRUSTED_ICON_NAME;
+            iconFilename = "java_3_trusted.png";
         }
         String resourceDir = ResourceUtil.getResourceDir(0);
         for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
@@ -1154,19 +1165,21 @@
         try
         {
             long startTime = System.currentTimeMillis();
-            ImageData[] imageDatas = new ImageLoader().load(aInputStream);
-            ImageData imageData = imageDatas[0];
+            Image image = new Image(aDisplay, aInputStream);
+            ImageData imageData = image.getImageData();
             if (aScaleImage)
             {
                 Point bestSize = getBestImageSize(
-                                     imageData.width, imageData.height);
+                    imageData.width, imageData.height);
                 if (bestSize.x != imageData.width ||
                         bestSize.y != imageData.height)
                 {
+                    Point oldSize =
+                        new Point(imageData.width, imageData.height);
                     imageData = imageData.scaledTo(bestSize.x, bestSize.y);
                     log("Image " + aImageName + " scaled from " +
-                        imageDatas[0].width + "x" + imageDatas[0].height +
-                        " to " + bestSize.x + "x" + bestSize.y);
+                        oldSize.x + "x" + oldSize.y + " to " +
+                        bestSize.x + "x" + bestSize.y);
                 }
             }
             result = new Image(aDisplay, imageData);
@@ -1188,8 +1201,8 @@
      */
     private static Point getBestImageSize(int aWidth, int aHeight)
     {
-        final int MAX_WIDTH = iBestIconSize.x;
-        final int MAX_HEIGHT = iBestIconSize.y;
+        final int MAX_WIDTH = (iBestIconSize == null? 50: iBestIconSize.x);
+        final int MAX_HEIGHT = (iBestIconSize == null? 50: iBestIconSize.y);
         Point result = new Point(aWidth, aHeight);
         if (result.x > MAX_WIDTH || result.y > MAX_HEIGHT)
         {
@@ -1317,4 +1330,37 @@
     {
         return iActiveView;
     }
+
+    /**
+     * Loads JavaInstaller UI stylesheet.
+     */
+    void loadCss()
+    {
+        String cssFilename = "javaapplicationinstaller.css";
+        String cssPath = null;
+        try
+        {
+            if (iCssEngine != null)
+            {
+                boolean loaded = false;
+                String resourceDir = ResourceUtil.getResourceDir(0);
+                for (int i = 1; !loaded && resourceDir != null; i++)
+                {
+                    cssPath = resourceDir + cssFilename;
+                    FileUtility cssFile = new FileUtility(cssPath);
+                    if (cssFile.exists())
+                    {
+                        iCssEngine.loadCSS(cssPath);
+                        log("CSS loaded from " + cssPath);
+                        break;
+                    }
+                    resourceDir = ResourceUtil.getResourceDir(i);
+                }
+            }
+        }
+        catch (Throwable t)
+        {
+            logError("Loading CSS from " + cssPath + " failed", t);
+        }
+    }
 }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -61,7 +61,7 @@
     protected PermissionConfirmationView(
         InstallerUiEswt aInstallerUi, Composite aParent)
     {
-        super(aInstallerUi, aParent, 8, true);
+        super(aInstallerUi, aParent, 8);
         setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALLING));
         setCommands(null, null);
     }
@@ -92,17 +92,7 @@
     protected void createView()
     {
         // Add header.
-        String title = "Install?";
-        String appName = "";
-        if (iInstallInfo != null)
-        {
-            if (iInstallInfo.getOldVersion() != null)
-            {
-                title = "Update?";
-            }
-            appName = iInstallInfo.getName();
-        }
-        addHeader(title, iInstallInfo, null);
+        addHeader(null, iInstallInfo, null);
 
         GridData gridData = null;
         int labelStyle = SWT.WRAP;
@@ -110,10 +100,10 @@
         // Add permission query label.
         int detailsColumns = 2;
         int horizontalSpan = getColumns() - detailsColumns;
-        Label domainLabel = createLabel(
-            InstallerUiTexts.get(InstallerUiTexts.PERM_QUERY,
-                                 new String[] { appName }),
+        Label permissionQueryLabel = createLabel(
+            InstallerUiTexts.get(InstallerUiTexts.PERM_QUERY),
             horizontalSpan, labelStyle);
+        setCssId(permissionQueryLabel, "permissionDetails");
 
         // Add link for permission details.
         if (iPermissionInfo != null &&
@@ -122,6 +112,7 @@
         {
             horizontalSpan = detailsColumns;
             Button detailsButton = new Button(getComposite(), SWT.NONE);
+            setCssId(detailsButton, "detailsLink");
             detailsButton.setText(
                 InstallerUiTexts.get(InstallerUiTexts.PERM_VIEW_DETAILS));
             detailsButton.addListener(SWT.Selection, new Listener()
@@ -139,11 +130,9 @@
 
         horizontalSpan = getColumns();
 
-        // Number of pixels on top of the buttons.
-        int verticalIndent = 5;
-
         // Add allow button.
         iAllowButton = new Button(getComposite(), SWT.NONE);
+        setCssId(iAllowButton, "allowButton");
         iAllowButton.setText(InstallerUiTexts.get(
                                  InstallerUiTexts.PERM_ALLOW_ALWAYS));
         iAllowButton.addListener(SWT.Selection, new Listener()
@@ -170,13 +159,13 @@
         });
         gridData = new GridData(GridData.FILL_HORIZONTAL);
         gridData.horizontalSpan = horizontalSpan;
-        gridData.verticalIndent = verticalIndent;
         iAllowButton.setLayoutData(gridData);
         iAllowButton.setFocus();
         addSoftKeyListenerFor(iAllowButton);
 
         // Add deny button.
         iDenyButton = new Button(getComposite(), SWT.NONE);
+        setCssId(iDenyButton, "denyButton");
         iDenyButton.setText(InstallerUiTexts.get(
                                 InstallerUiTexts.PERM_ASK_ME_LATER));
         iDenyButton.addListener(SWT.Selection, new Listener()
@@ -203,12 +192,12 @@
         });
         gridData = new GridData(GridData.FILL_HORIZONTAL);
         gridData.horizontalSpan = horizontalSpan;
-        gridData.verticalIndent = verticalIndent;
         iDenyButton.setLayoutData(gridData);
         addSoftKeyListenerFor(iDenyButton);
 
         // Add cancel button.
         iCancelButton = new Button(getComposite(), SWT.NONE);
+        setCssId(iCancelButton, "cancelButton");
         iCancelButton.setText(InstallerUiTexts.get(InstallerUiTexts.PERM_CANCEL));
         iCancelButton.addListener(SWT.Selection, new Listener()
         {
@@ -233,7 +222,6 @@
         });
         gridData = new GridData(GridData.FILL_HORIZONTAL);
         gridData.horizontalSpan = horizontalSpan;
-        gridData.verticalIndent = verticalIndent;
         iCancelButton.setLayoutData(gridData);
         addSoftKeyListenerFor(iCancelButton);
 
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -64,7 +64,7 @@
                              (InstallerUiTexts.get
                               (InstallerUiTexts.PERM_VIEW_DETAILS_TITLE),
                               horizontalSpan, labelStyle);
-        detailsLabel.setFont(iInstallerUi.getBoldFont());
+        setCssId(detailsLabel, "heading");
 
         // Add permission names.
         String[] permNames = iPermissionInfo.getPermissionNames();
@@ -84,6 +84,7 @@
             Label permissionDetailsLabel = createLabel(
                                                iPermissionInfo.getPermissionsDetails(),
                                                horizontalSpan, labelStyle);
+            setCssId(permissionDetailsLabel, "detailsWarningLabel");
         }
     }
 
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -86,6 +86,7 @@
         {
             setTitle(iMsg);
             iLabel = createLabel(iMsg, SWT.WRAP);
+            setCssId(iLabel, "heading");
         }
 
         iIndeterminate = aIndeterminate;
@@ -102,6 +103,7 @@
             iProgressBar.setMaximum(100);
             iProgressBar.setSelection(iValue);
         }
+        setCssId(iProgressBar, "progressBar");
         GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
         gridData.horizontalSpan = getColumns();
         iProgressBar.setLayoutData(gridData);
@@ -115,6 +117,8 @@
 
         // By default add cancel command to all progress bars.
         addCancelCommand();
+
+        iInstallerUi.loadCss();
     }
 
     /** Update text for this progress bar. */
@@ -169,13 +173,18 @@
         {
             public void run()
             {
+                // Set horizontalSpan to 2 for one button,
+                // and to 1 for one two buttons.
+                int horizontalSpan = 2;
+                GridData gridData = null;
+                /*
                 iHideCommand = new Button(getCommandComposite(), SWT.PUSH);
-                GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
-                gridData.horizontalSpan = 1;
+                setCssId(iHideCommand, "softKeyButton");
+                gridData = new GridData(GridData.FILL_HORIZONTAL);
+                gridData.horizontalSpan = horizontalSpan;
                 iHideCommand.setLayoutData(gridData);
                 iHideCommand.setText(InstallerUiTexts.get(InstallerUiTexts.HIDE));
-                iHideCommand.addSelectionListener
-                (new SelectionListener()
+                iHideCommand.addSelectionListener(new SelectionListener()
                 {
                     public void widgetDefaultSelected(SelectionEvent aEvent)
                     {
@@ -187,15 +196,16 @@
                     }
                 });
                 addSoftKeyListenerFor(iHideCommand);
+                */
 
                 iCancelCommand = new Button(getCommandComposite(), SWT.PUSH);
+                setCssId(iCancelCommand, "softKeyButtonWide");
                 gridData = new GridData(GridData.FILL_HORIZONTAL);
-                gridData.horizontalSpan = 1;
+                gridData.horizontalSpan = horizontalSpan;
                 iCancelCommand.setLayoutData(gridData);
                 iCancelCommand.setText(
                     InstallerUiTexts.get(InstallerUiTexts.CANCEL));
-                iCancelCommand.addSelectionListener
-                (new SelectionListener()
+                iCancelCommand.addSelectionListener(new SelectionListener()
                 {
                     public void widgetDefaultSelected(SelectionEvent aEvent)
                     {
@@ -234,8 +244,11 @@
             public void run()
             {
                 getShell().setDefaultButton(null);
-                iHideCommand.dispose();
-                iHideCommand = null;
+                if (iHideCommand != null)
+                {
+                    iHideCommand.dispose();
+                    iHideCommand = null;
+                }
                 iCancelCommand.dispose();
                 iCancelCommand = null;
             }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/RuntimeConfirmationView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/RuntimeConfirmationView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -57,10 +57,18 @@
         String[] answerOptions = iConfirmData.getAnswerOptions();
         switch (answerOptions.length)
         {
-        case 1: setCommands(answerOptions[0], null); break;
-        case 2: setCommands(answerOptions[0], answerOptions[1]); break;
+        //case 1: setCommands(answerOptions[0], null); break;
+        case 1:
+            setCommands(InstallerUiTexts.get(InstallerUiTexts.OK), null);
+            break;
+        //case 2: setCommands(answerOptions[0], answerOptions[1]); break;
+        case 2:
+            setCommands(InstallerUiTexts.get(InstallerUiTexts.OK),
+                        InstallerUiTexts.get(InstallerUiTexts.CANCEL));
+            break;
         default: setCommands(null, null); break;
         }
+
     }
 
     /**
@@ -68,27 +76,13 @@
      */
     protected void createView()
     {
-        // Add title.
-        if (iInstallerUi.getInstallInfo() != null)
-        {
-            Label titleLabel = createLabel(iAppName, getColumns() - 1, SWT.WRAP);
-            titleLabel.setFont(iInstallerUi.getBoldFont());
-            // Add security icon.
-            iCertificates = iInstallerUi.getInstallInfo().getCertificates();
-            createSecurityButton();
-        }
-        else
-        {
-            Label titleLabel = createLabel(iAppName, getColumns(), SWT.WRAP);
-            titleLabel.setFont(iInstallerUi.getBoldFont());
-        }
+        // Add header.
+        addHeader(null, iInstallerUi.getInstallInfo(), null);
 
         GridData gridData = null;
         int horizontalSpan = getColumns();
         int labelStyle = SWT.WRAP;
 
-        // Begin widgets creation.
-
         // Add question label.
         Label errorLabel = createLabel(
             iConfirmData.getQuestion(), horizontalSpan, labelStyle);
@@ -132,7 +126,9 @@
             iAnswerButtons[iConfirmData.getAnswerSuggestion()].setFocus();
         }
 
-        // End of widgets creation.
+        // After other widgets have been added, add content to
+        // application info Composite.
+        addAppInfo(iInstallerUi.getInstallInfo(), false);
     }
 
     /**
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java	Tue Jul 06 20:36:19 2010 +0300
@@ -110,7 +110,7 @@
 
         Label titleLabel = createLabel
                            (InstallerUiTexts.get(InstallerUiTexts.CONNECT_TO), labelStyle);
-        titleLabel.setFont(iInstallerUi.getBoldFont());
+        setCssId(titleLabel, "heading");
 
         Label urlLabel = createLabel(iUrl, labelStyle);
 
@@ -118,18 +118,23 @@
                           (InstallerUiTexts.get
                            (InstallerUiTexts.DOWNLOAD_APPLICATION, new String[] { iAppName }),
                            labelStyle);
+        setCssId(authLabel, "authLabel");
 
         Label usernameLabel = createLabel
                               (InstallerUiTexts.get(InstallerUiTexts.USERNAME), labelStyle);
+        setCssId(usernameLabel, "usernamePasswordLabel");
 
         iUsernameText = new Text(getComposite(), SWT.BORDER);
+        setCssId(iUsernameText, "usernamePasswordInputField");
         iUsernameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         addSoftKeyListenerFor(iUsernameText);
 
         Label passwordLabel = createLabel
                               (InstallerUiTexts.get(InstallerUiTexts.PASSWORD), labelStyle);
+        setCssId(passwordLabel, "usernamePasswordLabel");
 
         iPasswordText = new Text(getComposite(), SWT.PASSWORD | SWT.BORDER);
+        setCssId(iPasswordText, "usernamePasswordInputField");
         iPasswordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         addSoftKeyListenerFor(iPasswordText);
     }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java	Tue Jul 06 20:36:19 2010 +0300
@@ -34,6 +34,7 @@
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.qt.WidgetConstant;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -42,6 +43,7 @@
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
 
 /**
  * Base class for different InstallerUi views.
@@ -101,6 +103,7 @@
         iParent = (Shell)aParent;
 
         iContainer = new Composite(iParent, 0);
+        setCssId(iContainer, "dialogArea");
         iContainer.setVisible(false);
 
         iColumns = aColumns;
@@ -438,6 +441,14 @@
     }
 
     /**
+     * Sets CSS id for given widget.
+     */
+    protected void setCssId(Widget aWidget, String aCssId)
+    {
+        aWidget.setData(WidgetConstant.CSS_ID, aCssId);
+    }
+
+    /**
      * Adds header used in installation views.
      */
     protected void addHeader(
@@ -454,26 +465,28 @@
         boolean aSecurityButton)
     {
         // Add title.
-        String title = InstallerUiTexts.get(InstallerUiTexts.INSTALL_QUERY);
+        if (aTitle == null)
+        {
+            aTitle = InstallerUiTexts.get(InstallerUiTexts.INSTALL_QUERY);
+            if (aInstallInfo != null && aInstallInfo.getOldVersion() != null)
+            {
+                aTitle = InstallerUiTexts.get(InstallerUiTexts.UPDATE_QUERY);
+            }
+        }
+        Label titleLabel = createLabel(aTitle, getColumns() - 1, SWT.WRAP);
+        setCssId(titleLabel, "heading");
+
         if (aInstallInfo != null)
         {
-            if (aInstallInfo.getOldVersion() != null)
-            {
-                title = InstallerUiTexts.get(InstallerUiTexts.UPDATE_QUERY);
-            }
             iCertificates = aInstallInfo.getCertificates();
         }
-        if (aUninstallInfo != null)
+        else if (aUninstallInfo != null)
         {
-            title = "Uninstall?";
             iCertificates = aUninstallInfo.getCertificates();
         }
-        Label titleLabel = createLabel(aTitle, getColumns() - 1, SWT.WRAP);
-        titleLabel.setFont(iInstallerUi.getBoldFont());
-
         if (aSecurityButton)
         {
-            // Add security icon.
+            // Add security button.
             createSecurityButton();
         }
         else
@@ -505,11 +518,12 @@
         {
             iconColumns = 2;
             Label iconLabel = createLabel(iSuiteIcon, iconColumns, SWT.NONE);
+            setCssId(iconLabel, "contentIcon");
         }
 
         // Create a Composite for displaying application info.
         iAppInfoScrolledComposite =
-            new ScrolledComposite(getComposite(), SWT.H_SCROLL | SWT.V_SCROLL);
+            new ScrolledComposite(getComposite(), SWT.V_SCROLL);
         iAppInfoScrolledComposite.setAlwaysShowScrollBars(false);
         iAppInfoScrolledComposite.setExpandHorizontal(true);
         GridData gridData = new GridData(GridData.FILL_BOTH);
@@ -518,6 +532,7 @@
         iAppInfoComposite = new Composite(iAppInfoScrolledComposite, SWT.NONE);
         iAppInfoComposite.setLayout(new GridLayout(1, true));
         iAppInfoScrolledComposite.setContent(iAppInfoComposite);
+        setCssId(iAppInfoScrolledComposite, "appInfoArea");
     }
 
     /**
@@ -540,15 +555,10 @@
         if (aFull)
         {
             // Add vendor.
-            if (aInstallInfo.getCertificates() != null)
-            {
-                // Vendor information must be displayed only for
-                // identified applications.
-                createAppInfoLabel(
-                    InstallerUiTexts.get(
-                        InstallerUiTexts.SUITE_VENDOR,
-                        new String[] { aInstallInfo.getVendor() }));
-            }
+            createAppInfoLabel(
+                InstallerUiTexts.get(
+                    InstallerUiTexts.SUITE_VENDOR,
+                    new String[] { aInstallInfo.getVendor() }));
         }
         // Add size.
         long size = 0;
@@ -658,7 +668,7 @@
         GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
         gridData.horizontalSpan = aColumns;
         gridData.horizontalAlignment = SWT.CENTER;
-        gridData.verticalAlignment = SWT.CENTER;
+        gridData.verticalAlignment = SWT.TOP;
         label.setLayoutData(gridData);
         return label;
     }
@@ -690,6 +700,7 @@
     protected Label createSecurityLabel(boolean aIdentified)
     {
         Label label = createLabel((Image)null, 1, SWT.NONE);
+        setCssId(label, "securityLabel");
         Image securityIcon = null;
         if (iInstallerUi != null)
         {
@@ -710,6 +721,7 @@
     protected Button createSecurityButton()
     {
         Button button = new Button(getComposite(), SWT.PUSH);
+        setCssId(button, "securityButton");
         GridData gridData = new GridData(
             GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
         gridData.horizontalSpan = 1;
--- a/javamanager/javainstaller/javasifplugin/inc/javasifplugin.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/inc/javasifplugin.h	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 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"
@@ -25,7 +25,8 @@
 #include <usif/sif/sifplugin.h>
 
 #include "f32file.h"
-#include "resultsserver.h"
+
+class ResultsServer;
 
 using namespace Usif;
 
@@ -36,9 +37,9 @@
 const int INSTALLER_CANCEL_MESSAGE_ID = 603;
 const int INSTALLER_CANCEL_RESPONSE_MESSAGE_ID = 604;
 
-namespace Java
+namespace java
 {
-namespace Installer
+namespace installer
 {
 
 /**
@@ -222,6 +223,69 @@
     void CopyFilesIfNeededL(TFileName &aFileName);
 
     /**
+     * Check if the file is Jad file. Argument KSifInParam_MimeType is
+     * used for check if it exists.
+     *
+     * @param[in] aFileHandle the file to be checked
+     * @param[in] aArguments Install request arguments
+     * @param[out] aIsJad set to ETrue if the file is Jad file
+     * @return KErrNone or Symbian error code
+     */
+    TInt IsJadFile(RFile& aFileHandle, const COpaqueNamedParams& aArguments, TBool& aIsJad);
+
+    /**
+     * Check if the file is Jad file.
+     *
+     * @param[in] aFileHandle the file to be checked
+     * @param[out] aIsJad set to ETrue if the file is Jad file
+     * @return KErrNone or Symbian error code
+     */
+    TInt IsJadFile(RFile& aFileHandle, TBool& aIsJad);
+
+    /**
+     * Uses the information in aArguments to create the correct command line for
+     * Java Installer.
+     *
+     * @param[in][out] aCommandLine the buffer to be filled with command line arguments
+     * @param[in]      aArguments The array of opaque params for the plug-in. An empty
+     *   array may be passed.  The following param is defined for the "SCOMO Install
+     *   Inactive" operation:
+     *   Name: InstallInactive, Type: Int, Value: ETrue
+     *   If a plug-in receives this param, it must install a component normally but the SCOMO
+     *   State should remain EDeactivated.
+     */
+    void BuildInstallCommandLine(
+        TPtr& aCommandLine,
+        const COpaqueNamedParams& aArguments);
+
+    /**
+     * Returns the value of int param found from aArguments or -1 if
+     * the param is not found. Must be called only for int params
+     * that have positive value range!
+     *
+     * @param[in] aName The name of the integer param to be obtained.
+     * @param[in] aArguments The array of opaque params for the plug-in.
+     * @return -1 if the named param if not found, otherwise the value of the
+     */
+    TInt GetPositiveIntParam(
+        const TDesC& aName,
+        const COpaqueNamedParams& aArguments);
+
+    /**
+     * Start ResultsServer for receiving Comms message(s) from
+     * Java Installer
+     *
+     * @param[in][out] aResults If Comms message contains installation or
+     *  uninstallation operation results, they will be stored in this variable
+     * @param[in][out] aComponentInfo If Comms message contains contains details of
+     *  a component, they will be stored into this variable
+     * @return
+     */
+    TInt StartResultsServer(
+        COpaqueNamedParams& aResults,
+        CComponentInfo& aComponentInfo);
+
+    /**
      * If Java Installer is already running, set error category EInstallerBusy etc
      * to aResults, set aStatus to KErrAlreadyExists and return ETrue
      * @param[in][out] aResults
@@ -232,23 +296,14 @@
         COpaqueNamedParams& aResults,
         TRequestStatus& aStatus);
 
-    /**
-     * If Java Installer is already running,
-     * set aStatus to KErrAlreadyExists and return ETrue
-     * @param[in][out] aStatus
-     * @return ETrue if Java Installer is running
-     */
-    TBool ExitIfJavaInstallerRunning(TRequestStatus& aStatus);
-
 private: //  Data
 
-    TRequestStatus* iStatus;
-    RFs iRFs;
-    RArray<RProcess> iHandlesToClose;
-    ResultsServer*   iResultsServer;
+    RFs mRFs;
+    RArray<RProcess> mHandlesToClose;
+    ResultsServer*   mResultsServer;
 
-    COpaqueNamedParams* iDummyResults;
-    CComponentInfo*     iDummyInfo;
+    COpaqueNamedParams* mDummyResults;
+    CComponentInfo*     mDummyInfo;
 };
 
 } // Installer
--- a/javamanager/javainstaller/javasifplugin/inc/resultsserver.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/inc/resultsserver.h	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -65,18 +65,19 @@
 
     CommsEndpoint* getComms()
     {
-        return &iComms;
+        return &mComms;
     }
 
 private:
     void clearData();
     void setComponentInfoL();
+    void resetDefaultErrorValues();
+    void setCommonErrorInfo();
 
 private:
-    int iRunning;   // 1 if running, 0 if not running
-    CommsServerEndpoint  iComms;
-    COpaqueNamedParams  &iResults;
-    CComponentInfo      &iInfo;
+    CommsServerEndpoint  mComms;
+    COpaqueNamedParams  &mResults;
+    CComponentInfo      &mInfo;
 
     std::map<std::wstring, int> iIntPairs;
     std::map<std::wstring, std::wstring> iStringPairs;
--- a/javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 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"
@@ -20,34 +20,75 @@
 
 #include <apgcli.h>
 #include <apmstd.h>
-#include <e32cmn.h>
-#include <e32property.h>
 #include <charconv.h>
 #include <data_caging_path_literals.hrh>
-#include <usiferror.h>
+#include <e32cmn.h>
+#include <e32property.h>
+#include <string.h>
+#include <usif/usiferror.h>
 
 #include "comms.h"
+#include "commsclientendpoint.h"
 #include "commsmessage.h"
-#include "commsclientendpoint.h"
-#include "javasifplugin.h"
-#include "javauids.h"
-#include "logger.h"
+#include "javacommonutils.h"
 #include "javaoslayer.h"
 #include "javaprocessconstants.h"
 #include "javasymbianoslayer.h"
+#include "javauids.h"
+#include "logger.h"
+#include "resultsserver.h"
 #include "runtimeexception.h"
 
+#include "javasifplugin.h"
 
-using namespace Java::Installer;
+
+using namespace java::installer;
 using namespace java::util;
 using namespace java::comms;
 
 _LIT(KPrivateDataCage, "\\private\\");
 _LIT(KInboxDataCage, "\\private\\1000484b\\");
-_LIT(KJavaInstallerProcess, "Installer");
+_LIT(KJavaInstallerProcess, "Installer*");
 _LIT(KJavaInstallerDataCage, "\\private\\102033e6\\");
 _LIT(KJavaInstallerTmp, "\\private\\102033E6\\installer\\tmp\\");
 _LIT(KAnyExtension, ".*");
+_LIT(KComponentInfo, " componentinfo");
+_LIT(KCommsResult, " -commsresult=");
+_LIT(KJad, " -jad=");
+_LIT(KJar, " -jar=");
+_LIT(KDoubleQuote, "\"");
+_LIT(KInstall, " install");
+_LIT(KSilent, " -silent");
+_LIT(KUninstall, " uninstall");
+_LIT(KCid, " -cid=");
+_LIT(KDrive, " -drive=");
+_LIT(KYes, "yes");
+_LIT(KNo, "no");
+_LIT(KOcsp, " -ocsp=");
+_LIT(KIgnoreOcspWarnings, " -ignore_ocsp_warnings=");
+_LIT(KUpgrade, " -upgrade=");
+_LIT(KUpgradeData, " -upgrade_data=");
+_LIT(KUntrusted, " -untrusted=");
+_LIT(KOverwrite, " -overwrite=");
+_LIT(KDownload, " -download=");
+_LIT(KIap, " -iap=");
+_LIT(KSnap, " -snap=");
+_LIT(KForceCancel, " -forcecancel");
+_LIT(KBase64, " -base64=");
+_LIT(KUsername, " -username=");
+_LIT(KPassword, " -password=");
+_LIT(KSourceUrl, " -sourceurl=");
+_LIT(KCharSet, " -charset=");
+
+_LIT(KJadMimeType, "text/vnd.sun.j2me.app-descriptor");
+_LIT8(K8JadMimeType, "text/vnd.sun.j2me.app-descriptor");
+
+// Long Java Installer command lines contain max 2 path names (512 chars max) and
+// some options -> 1536 is long enough buffer
+const TInt KLongCmdLineLen = 1536;
+
+// When starting Java Installer for uninstallation the command line is much shorter
+const TInt KShortCmdLineLen = 256;
 
 // Java Installer is executed with same Uid as Java Runtime
 _LIT_SECURE_ID(KJavaInstallerSecureID, KJavaMidpSecureId);
@@ -67,24 +108,24 @@
 
 CJavaSifPlugin::~CJavaSifPlugin()
 {
-    iRFs.Close();
+    mRFs.Close();
 
-    TInt nHandles = iHandlesToClose.Count();
+    TInt nHandles = mHandlesToClose.Count();
     while (nHandles > 0)
     {
         nHandles--;
-        iHandlesToClose[nHandles].Close();
+        mHandlesToClose[nHandles].Close();
     }
-    iHandlesToClose.Reset();
+    mHandlesToClose.Reset();
 
-    delete iResultsServer;
-    iResultsServer = NULL;
+    delete mResultsServer;
+    mResultsServer = NULL;
 
-    delete iDummyResults;
-    iDummyResults = NULL;
+    delete mDummyResults;
+    mDummyResults = NULL;
 
-    delete iDummyInfo;
-    iDummyInfo = NULL;
+    delete mDummyInfo;
+    mDummyInfo = NULL;
 }
 
 CJavaSifPlugin::CJavaSifPlugin()
@@ -93,11 +134,11 @@
 
 void CJavaSifPlugin::ConstructL()
 {
-    User::LeaveIfError(iRFs.Connect());
-    User::LeaveIfError(iRFs.ShareProtected());
-    iResultsServer = NULL;
-    iDummyResults = COpaqueNamedParams::NewL();
-    iDummyInfo = CComponentInfo::NewL();
+    User::LeaveIfError(mRFs.Connect());
+    User::LeaveIfError(mRFs.ShareProtected());
+    mResultsServer = NULL;
+    mDummyResults = COpaqueNamedParams::NewL(); // codescanner::forgottoputptroncleanupstack
+    mDummyInfo = CComponentInfo::NewL();
 }
 
 void CJavaSifPlugin::GetComponentInfo(
@@ -107,7 +148,7 @@
     TRequestStatus& aStatus)
 {
     RFile fileHandle;
-    TInt err = fileHandle.Open(iRFs, aFileName, EFileShareReadersOnly | EFileRead);
+    TInt err = fileHandle.Open(mRFs, aFileName, EFileShareReadersOnly | EFileRead);
     if (KErrNone != err)
     {
         ELOG1(EJavaInstaller,
@@ -128,27 +169,37 @@
     CComponentInfo& aComponentInfo,
     TRequestStatus& aStatus)
 {
-    if (ExitIfJavaInstallerRunning(aStatus))
+    if (ExitIfJavaInstallerRunning(*mDummyResults, aStatus))
     {
         return;
     }
 
     RProcess rJavaInstaller;
     TFileName fileName;
-    TBuf<1536> commandLine;
+    HBufC* pBufCommandLine = NULL;
+    TRAPD(err, pBufCommandLine = HBufC::NewL(KLongCmdLineLen))
+    if (KErrNone != err)
+    {
+        TRequestStatus *statusPtr(&aStatus);
+        User::RequestComplete(statusPtr, err);
+        return;
+    }
+    std::auto_ptr<HBufC> bufCommandLine(pBufCommandLine);
+    TPtr commandLine = pBufCommandLine->Des();
 
     // Build command line used to pass all necessary info to Java Installer
     std::auto_ptr<HBufC> installerStarterDll(
         stringToDes(java::runtime::JAVA_INSTALLER_STARTER_DLL));
     commandLine = installerStarterDll->Des();
-    commandLine.Append(_L(" componentinfo"));
+    commandLine.Append(KComponentInfo);
 
     // Ask Java Installer to send component info back
     // as Comms message. 11000 is IPC_ADDRESS_JAVA_SIF_PLUGIN_C Comms endpoint
     // that our ResultsServer will listen to.
-    commandLine.Append(_L(" -commsresult=11000"));
+    commandLine.Append(KCommsResult);
+    commandLine.AppendNum(IPC_ADDRESS_JAVA_SIF_PLUGIN_C);
 
-    TInt err = aFileHandle.FullName(fileName);
+    err = aFileHandle.FullName(fileName);
 
     // Java Installer does not have AllFiles capability.
     // So if the .jad/.jar file is in the private data cage of
@@ -165,42 +216,30 @@
     }
 
     // Check whether the file is .jad or .jar
-    RApaLsSession apaSession;
-    err = apaSession.Connect();
+    TBool isJad;
+    err = IsJadFile(aFileHandle, isJad);
     if (KErrNone != err)
     {
-        ELOG1(EJavaInstaller,
-              "CJavaSifPlugin::GetComponentInfo RApaLsSession Connect error %d", err);
         TRequestStatus *statusPtr(&aStatus);
         User::RequestComplete(statusPtr, err);
         return;
     }
-    TDataType jadFileMimeType(_L8("text/vnd.sun.j2me.app-descriptor"));
-    TBool isJad = EFalse;
-    err = apaSession.RecognizeSpecificData(aFileHandle, jadFileMimeType, isJad);
-    apaSession.Close();
-    if (KErrNone != err)
-    {
-        // Just log the error
-        ELOG1(EJavaInstaller,
-              "CJavaSifPlugin::GetComponentInfo RApaLsSession RecognizeSpecificData error %d",
-              err);
-    }
     if (isJad)
     {
         // Installation should be started from JAD file
-        commandLine.Append(_L(" -jad="));
+        commandLine.Append(KJad);
     }
     else
     {
         // from JAR file
-        commandLine.Append(_L(" -jar="));
+        commandLine.Append(KJar);
     }
+
     // Filename parameter must be surrounded in double quotes to
     // ensure that spaces in filename are passed correctly.
-    commandLine.Append(_L("\""));
+    commandLine.Append(KDoubleQuote);
     commandLine.Append(fileName);
-    commandLine.Append(_L("\""));
+    commandLine.Append(KDoubleQuote);
 
     // Start JavaInstaller
     std::auto_ptr<HBufC> installerProcess(
@@ -208,21 +247,7 @@
     err = rJavaInstaller.Create(installerProcess->Des(), commandLine);
     if (KErrNone == err)
     {
-        // Destroy old Comms server if it exists
-        delete iResultsServer;
-        iResultsServer = NULL;
-        // Start new Comms server that receives component info and sets it to
-        // to aComponentInfo.
-        iResultsServer = new ResultsServer(*iDummyResults, aComponentInfo);
-        if (NULL == iResultsServer)
-        {
-            err = KErrNoMemory;
-        }
-        else
-        {
-            // Start the server
-            err = iResultsServer->start();
-        }
+        err = StartResultsServer(*mDummyResults, aComponentInfo);
         if (KErrNone != err)
         {
             // server cannot be started
@@ -252,7 +277,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    mHandlesToClose.Append(rJavaInstaller);
 }
 
 void CJavaSifPlugin::Install(
@@ -263,11 +288,12 @@
     TRequestStatus& aStatus)
 {
     RFile fileHandle;
-    TInt err = fileHandle.Open(iRFs, aFileName, EFileShareReadersOnly | EFileRead);
+    TInt err = fileHandle.Open(mRFs, aFileName, EFileShareReadersOnly | EFileRead);
     if (KErrNone != err)
     {
         ELOG1(EJavaInstaller,
               "CJavaSifPlugin::Install Opening file for reading failed with error %d", err);
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
         TRequestStatus *statusPtr(&aStatus);
         User::RequestComplete(statusPtr, err);
         return;
@@ -289,16 +315,24 @@
         return;
     }
 
-    RProcess rJavaInstaller;
-    TFileName fileName;
-    // Max two path names and some options -> 1536 is enough
-    TBuf<1536> commandLine;
+    // Create buffer for Java Installer command line
+    HBufC* pBufCommandLine = NULL;
+    TRAPD(err, pBufCommandLine = HBufC::NewL(KLongCmdLineLen))
+    if (KErrNone != err)
+    {
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, ELowMemory));
+        TRequestStatus *statusPtr(&aStatus);
+        User::RequestComplete(statusPtr, err);
+        return;
+    }
+    std::auto_ptr<HBufC> bufCommandLine(pBufCommandLine);
+    TPtr commandLine = pBufCommandLine->Des();
 
     // Build command line used to pass all necessary info to Java Installer
     std::auto_ptr<HBufC> installerStarterDll(
         stringToDes(java::runtime::JAVA_INSTALLER_STARTER_DLL));
     commandLine = installerStarterDll->Des();
-    commandLine.Append(_L(" install"));
+    commandLine.Append(KInstall);
 
     // Check whether this is silent installation
     TInt silentInstall = 0;
@@ -310,195 +344,25 @@
         {
             ELOG(EJavaInstaller,
                  "CJavaSifPlugin::Install The caller did not have TrustedUI capability");
+            TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, ESecurityError));
             TRequestStatus *statusPtr(&aStatus);
             User::RequestComplete(statusPtr, KErrPermissionDenied);
             return;
         }
 
-        commandLine.Append(_L(" -silent"));
-    }
-
-    TBool paramFound = EFalse;
-    TInt  intValue = 0;
-    TDesC desValue = KNullDesC;
-
-    // KSifInParam_Drive -> -drive=install_target_drive (A, B, C, ..., Z)
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_Drive, intValue));
-    if (paramFound)
-    {
-        // Value 0 is 'A:' drive and  value 25 is 'Z:' drive
-        if ((intValue > -1) && (intValue < 26))
-        {
-            commandLine.Append(_L(" -drive="));
-            TChar drive('A');
-            drive += intValue;
-            commandLine.Append(drive);
-        }
-        else
-        {
-            WLOG1(EJavaInstaller,
-                "CJavaSifPlugin::Install Ignoring illegal KSifInParam_Drive param (value %d)",
-                intValue);
-        }
-    }
-
-    // KSifInParam_PerformOCSP Yes/No/AskUser -> -ocsp=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_PerformOCSP, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -ocsp=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -ocsp=no"));
-        }
-        // AskUser is not supported
-    }
-
-    // KSifInParam_IgnoreOCSPWarnings Yes/No/AskUser -> -ignore_ocsp_warnings=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_IgnoreOCSPWarnings, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -ignore_ocsp_warnings=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -ignore_ocsp_warnings=no"));
-        }
-        // AskUser is not supported
-    }
-
-    // KSifInParam_AllowUpgrade Yes/No/AskUser -> -upgrade=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_AllowUpgrade, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -upgrade=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -upgrade=no"));
-        }
-        // AskUser is not supported
+        commandLine.Append(KSilent);
     }
 
-
-    // TODO: activate this code block when KSifInParam_UpgradeData has been
-    // defined in sifcommon.h
-/*
-    // KSifInParam_UpgradeData Yes/No/AskUser -> -upgrade_data=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_UpgradeData, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -upgrade_data=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -upgrade_data=no"));
-        }
-        // AskUser is not supported
-    }
-*/
-
-    // KSifInParam_AllowUntrusted Yes/No/AskUser -> -untrusted=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_AllowUntrusted, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -untrusted=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -untrusted=no"));
-        }
-        // AskUser is not supported
-    }
-
-    // KSifInParam_AllowOverwrite Yes/No/AskUser -> -overwrite=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_AllowOverwrite, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -overwrite=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -overwrite=no"));
-        }
-        // AskUser is not supported
-    }
-
-    // KSifInParam_AllowDownload Yes/No/AskUser -> -download=yes|no
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_AllowDownload, intValue));
-    if (paramFound)
-    {
-        if (intValue == 0) // Yes
-        {
-            commandLine.Append(_L(" -download=yes"));
-        }
-        else if (intValue == 1) // No
-        {
-            commandLine.Append(_L(" -download=no"));
-        }
-        // AskUser is not supported
-    }
-
-    // KSifInParam_UserName -> -username=download_username
-    TRAP_IGNORE(desValue = aArguments.StringByNameL(KSifInParam_UserName));
-    if (desValue.Length() > 0)
-    {
-        commandLine.Append(_L(" -username="));
-        commandLine.Append(desValue);
-    }
-
-    // KSifInParam_Password -> -password=download_password
-    TRAP_IGNORE(desValue = aArguments.StringByNameL(KSifInParam_Password));
-    if (desValue.Length() > 0)
-    {
-        commandLine.Append(_L(" -password="));
-        commandLine.Append(desValue);
-    }
-
-    // KSifInParam_SourceUrl -> -sourceurl=original (HTTP) URL of the JAD or JAR file
-    TRAP_IGNORE(desValue = aArguments.StringByNameL(KSifInParam_SourceUrl));
-    if (desValue.Length() > 0)
-    {
-        commandLine.Append(_L(" -sourceurl="));
-        commandLine.Append(desValue);
-    }
-
-    // KSifInParam_IAP -> -iap=IAP_ID (internet access point id)
-    TRAP_IGNORE(paramFound = aArguments.GetIntByNameL(KSifInParam_IAP, intValue));
-    if (paramFound)
-    {
-        commandLine.Append(_L(" -iap="));
-        commandLine.AppendNum(intValue);
-    }
-
-    // KSifInParam_Charset -> -charset=Internet-standard character set name
-    TRAP_IGNORE(desValue = aArguments.StringByNameL(KSifInParam_Charset));
-    if (desValue.Length() > 0)
-    {
-        commandLine.Append(_L(" -charset="));
-        commandLine.Append(desValue);
-    }
-
+    BuildInstallCommandLine(commandLine, aArguments);
 
     // Ask Java Installer to send installation results back
     // as Comms message. 11000 is IPC_ADDRESS_JAVA_SIF_PLUGIN_C Comms endpoint
     // that our ResultsServer will listen to.
-    commandLine.Append(_L(" -commsresult=11000"));
+    commandLine.Append(KCommsResult);
+    commandLine.AppendNum(IPC_ADDRESS_JAVA_SIF_PLUGIN_C);
 
-    TInt err = aFileHandle.FullName(fileName);
+    TFileName fileName;
+    err = aFileHandle.FullName(fileName);
 
     // Java Installer does not have AllFiles capability.
     // So if the .jad/.jar file is in the private data cage of
@@ -509,74 +373,53 @@
     TRAP(err, CopyFilesIfNeededL(fileName));
     if (KErrNone != err)
     {
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
         TRequestStatus *statusPtr(&aStatus);
         User::RequestComplete(statusPtr, err);
         return;
     }
 
     // Check whether the file is .jad or .jar
-    RApaLsSession apaSession;
-    err = apaSession.Connect();
+    TBool isJad = EFalse;
+    err = IsJadFile(aFileHandle, aArguments, isJad);
     if (KErrNone != err)
     {
-        ELOG1(EJavaInstaller,
-              "CJavaSifPlugin::Install RApaLsSession Connect error %d", err);
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
         TRequestStatus *statusPtr(&aStatus);
         User::RequestComplete(statusPtr, err);
         return;
     }
-    TDataType jadFileMimeType(_L8("text/vnd.sun.j2me.app-descriptor"));
-    TBool isJad = EFalse;
-    err = apaSession.RecognizeSpecificData(aFileHandle, jadFileMimeType, isJad);
-    apaSession.Close();
-    if (KErrNone != err)
-    {
-        ELOG1(EJavaInstaller,
-              "CJavaSifPlugin::Install RApaLsSession RecognizeSpecificData error %d", err);
-    }
     if (isJad)
     {
         // Installation should be started from JAD file
-        commandLine.Append(_L(" -jad="));
+        commandLine.Append(KJad);
     }
     else
     {
         // from JAR file
-        commandLine.Append(_L(" -jar="));
+        commandLine.Append(KJar);
     }
     // Filename parameter must be surrounded in double quotes to
     // ensure that spaces in filename are passed correctly.
-    commandLine.Append(_L("\""));
+    commandLine.Append(KDoubleQuote);
     commandLine.Append(fileName);
-    commandLine.Append(_L("\""));
+    commandLine.Append(KDoubleQuote);
 
     // Start JavaInstaller
     std::auto_ptr<HBufC> installerProcess(
         stringToDes(java::runtime::JAVA_PROCESS));
+    RProcess rJavaInstaller;
     err = rJavaInstaller.Create(installerProcess->Des(), commandLine);
     if (KErrNone == err)
     {
-        // Destroy old Comms server if it exists
-        delete iResultsServer;
-        iResultsServer = NULL;
-        // Start new Comms server that receives component ids, sets them
-        // to aResults.
-        iResultsServer = new ResultsServer(aResults, *iDummyInfo);
-        if (NULL == iResultsServer)
-        {
-            err = KErrNoMemory;
-        }
-        else
-        {
-            // Start the server
-            err = iResultsServer->start();
-        }
+        err = StartResultsServer(aResults, *mDummyInfo);
         if (KErrNone != err)
         {
             // server cannot be started
             rJavaInstaller.Close();
             ELOG1(EJavaInstaller,
                   "CJavaSifPlugin::Install: Cannot start results server, err %d", err);
+            TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
             TRequestStatus *statusPtr(&aStatus);
             User::RequestComplete(statusPtr, err);
             return;
@@ -591,6 +434,7 @@
         rJavaInstaller.Close();
         ELOG1(EJavaInstaller,
               "CJavaSifPlugin::Install: starting JavaInstaller failed, err=%d", err);
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
         TRequestStatus *statusPtr(&aStatus);
         User::RequestComplete(statusPtr, err);
         return;
@@ -600,7 +444,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    mHandlesToClose.Append(rJavaInstaller);
 }
 
 void CJavaSifPlugin::Uninstall(
@@ -615,18 +459,26 @@
         return;
     }
 
-    RProcess rJavaInstaller;
-    TFileName fileName;
-    // Max one uid and some options -> 256 is enough
-    TBuf<256> commandLine;
+    // Allocate buffer for Java Installer command line
+    HBufC* pBufCommandLine = NULL;
+    TRAPD(err, pBufCommandLine = HBufC::NewL(KShortCmdLineLen))
+    if (KErrNone != err)
+    {
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, ELowMemory));
+        TRequestStatus *statusPtr(&aStatus);
+        User::RequestComplete(statusPtr, err);
+        return;
+    }
+    std::auto_ptr<HBufC> bufCommandLine(pBufCommandLine);
+    TPtr commandLine = pBufCommandLine->Des();
 
     // Build command line used to pass all necessary info to Java Installer
     std::auto_ptr<HBufC> installerStarterDll(
         stringToDes(java::runtime::JAVA_INSTALLER_STARTER_DLL));
     commandLine = installerStarterDll->Des();
-    commandLine.Append(_L(" uninstall"));
+    commandLine.Append(KUninstall);
 
-    commandLine.Append(_L(" -cid="));
+    commandLine.Append(KCid);
     commandLine.AppendNum(aComponentId);
 
     // Check whether this is silent uninstallation
@@ -639,24 +491,35 @@
         {
             ELOG(EJavaInstaller,
                  "CJavaSifPlugin::Uninstall The caller did not have TrustedUI capability");
+            TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, ESecurityError));
             TRequestStatus *statusPtr(&aStatus);
             User::RequestComplete(statusPtr, KErrPermissionDenied);
             return;
         }
 
-        commandLine.Append(_L(" -silent"));
+        commandLine.Append(KSilent);
     }
 
-    // No need to start iResultsServer because Uninstall() does not
-    // return anything usefull in aResults. We could return extended
-    // error code there.
-
     // start JavaInstaller
     std::auto_ptr<HBufC> installerProcess(
         stringToDes(java::runtime::JAVA_PROCESS));
-    TInt err = rJavaInstaller.Create(installerProcess->Des(), commandLine);
+    RProcess rJavaInstaller;
+    err = rJavaInstaller.Create(installerProcess->Des(), commandLine);
     if (KErrNone == err)
     {
+        err = StartResultsServer(aResults, *mDummyInfo);
+        if (KErrNone != err)
+        {
+            // server cannot be started
+            rJavaInstaller.Close();
+            ELOG1(EJavaInstaller,
+                  "CJavaSifPlugin::Uninstall: Cannot start results server, err %d", err);
+            TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
+            TRequestStatus *statusPtr(&aStatus);
+            User::RequestComplete(statusPtr, err);
+            return;
+        }
+
         // the exit status of Java Installer will be passed to
         // the asynch caller through aStatus
         rJavaInstaller.Logon(aStatus);
@@ -668,6 +531,7 @@
         rJavaInstaller.Close();
         ELOG1(EJavaInstaller,
              "CJavaSifPlugin::Uninstall: starting JavaInstaller failed, err=%d", err);
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
         TRequestStatus *statusPtr(&aStatus);
         User::RequestComplete(statusPtr, err);
         return;
@@ -675,7 +539,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    mHandlesToClose.Append(rJavaInstaller);
 }
 
 void CJavaSifPlugin::Activate(
@@ -705,7 +569,7 @@
     // Send cancel message to Java Installer
 
     // Check whether there is anything to cancel
-    if (iHandlesToClose.Count() < 1)
+    if (mHandlesToClose.Count() < 1)
     {
         // No Java Installer process running, do nothing
         WLOG(EJavaInstaller,
@@ -713,64 +577,47 @@
         return;
     }
 
-    try
-    {
-        CommsMessage message;
-        message.setModuleId(PLUGIN_ID_SAMPLE_C);
-        message.setReceiver(IPC_ADDRESS_JAVA_INSTALLER_SERVER_C);
-        message.setSender(IPC_ADDRESS_JAVA_SIF_PLUGIN_C);
-        message.setMessageId(INSTALLER_CANCEL_MESSAGE_ID);
+    CommsMessage message;
+    message.setReceiver(IPC_ADDRESS_JAVA_INSTALLER_SERVER_C);
+    message.setSender(IPC_ADDRESS_JAVA_SIF_PLUGIN_C);
+    message.setMessageId(INSTALLER_CANCEL_MESSAGE_ID);
 
-        CommsMessage replyMessage;
-        int timeout = 10; // 10 seconds
+    CommsMessage replyMessage;
+    int timeout = 10; // 10 seconds  // codescanner::magicnumbers
 
-        CommsClientEndpoint comms;
-        int err = comms.connect(IPC_ADDRESS_JAVA_INSTALLER_SERVER_C);
-        if (KErrNone == err)
-        {
-            err = comms.sendReceive(message, replyMessage, timeout);
-        }
-        else
-        {
-            // Cannot connect to Java Installer Comms end point,
-            // for example Java Installer is still starting up or
-            // already exiting
-            WLOG1(EJavaInstaller,
-                "CJavaSifPlugin:CancelOperation: Cannot connect to Java Installer "
-                "Comms end point, err %d", err);
-            return;
-        }
-        if (err != 0)
-        {
-            // Sending message to Java Installer failed.
-            ELOG1(EJavaInstaller,
-                "CJavaSifPlugin:CancelOperation: Cannot send message to Java Installer, err %d",
-                err);
-            // Ignore possible errors in disconnect
-            (void)comms.disconnect();
-            return;
-        }
-
-        // Ignore the cancel result returned in replyMessage
-        // because current SIF API does not return cancel result
-
-        // Ignore possible errors in disconnect
-        (void)comms.disconnect();
+    CommsClientEndpoint comms;
+    int err = comms.connect(IPC_ADDRESS_JAVA_INSTALLER_SERVER_C);
+    if (KErrNone == err)
+    {
+        err = comms.sendReceive(message, replyMessage, timeout);
     }
-    catch (ExceptionBase& e)
+    else
     {
-        ELOG1(EJavaInstaller,
-              "CJavaSifPlugin: Send cancel msg failed: ExceptionBase caught: %s ",
-              e.toString().c_str());
+        // Cannot connect to Java Installer Comms end point,
+        // for example Java Installer is still starting up or
+        // already exiting
+        WLOG1(EJavaInstaller,
+            "CJavaSifPlugin:CancelOperation: Cannot connect to Java Installer "
+            "Comms end point, err %d", err);
         return;
     }
-    catch (std::exception& e)
+    if (err != 0)
     {
+        // Sending message to Java Installer failed.
         ELOG1(EJavaInstaller,
-              "CJavaSifPlugin: Send cancel msg failed: Exception %s caught", e.what());
+            "CJavaSifPlugin:CancelOperation: Cannot send message to Java Installer, err %d",
+            err);
+        // Ignore possible errors in disconnect
+        (void)comms.disconnect();  // codescanner::voidparameter
         return;
     }
 
+    // Ignore the cancel result returned in replyMessage
+    // because current SIF API does not return cancel result
+
+    // Ignore possible errors in disconnect
+    (void)comms.disconnect();  // codescanner::voidparameter
+
     // It takes some time before Java Installer had really cancelled
     // the operation and exited. Wait for it to happen because this function
     // must return only after the original asynchronous call is completed.
@@ -778,14 +625,14 @@
     // This array contains process handles for all Java Installer processes
     // started from this sif plugin. The last handle is the active one.
     // Check if it is still running
-    if (iHandlesToClose[iHandlesToClose.Count()-1].ExitReason() != 0)
+    if (mHandlesToClose[mHandlesToClose.Count()-1].ExitReason() != 0)
     {
         // Process has already closed
         return;
     }
     // Wait until it exits
-    iHandlesToClose[iHandlesToClose.Count()-1].Logon(status);
-    User::WaitForRequest(status);
+    mHandlesToClose[mHandlesToClose.Count()-1].Logon(status);
+    User::WaitForRequest(status);  // codescanner::userWaitForRequest
     // Ignore the exit status of Java Installer because current SIF API
     // does not return cancel result
 
@@ -796,7 +643,7 @@
 {
     // Check if the file is in the private data cage of some process
     TInt idx = aFileName.FindF(KPrivateDataCage);
-    if ((idx != KErrNotFound) && (idx < 3))
+    if ((idx != KErrNotFound) && (idx < 3))   // codescanner::magicnumbers
     {
         // In case of device Inbox or Java Installer itself do nothing
         if ((aFileName.FindF(KInboxDataCage) != KErrNotFound) ||
@@ -811,9 +658,9 @@
         // (aFileName is <path>\<name>.<ext>, copy <path>\<name>.*
         // to Java Installer tmp dir.)
         TParse fp;
-        iRFs.Parse(aFileName, fp);
+        mRFs.Parse(aFileName, fp);
 
-        CFileMan* fm = CFileMan::NewL(iRFs);
+        CFileMan* fm = CFileMan::NewL(mRFs);
         TFileName filesToCopy = fp.DriveAndPath();
         filesToCopy.Append(fp.Name());
         filesToCopy.Append(KAnyExtension);
@@ -836,6 +683,359 @@
     return;
 }
 
+
+TInt CJavaSifPlugin::IsJadFile(
+    RFile& aFileHandle,
+    const COpaqueNamedParams& aArguments,
+    TBool& aIsJad)
+{
+    TBool mimeTypeGiven = EFalse;
+
+    TRAP_IGNORE(
+        const TDesC &desValue = aArguments.StringByNameL(KSifInParam_MimeType);
+        if (desValue.Length() > 0)
+        {
+            mimeTypeGiven = ETrue;
+            if (!desValue.Compare(KJadMimeType))
+            {
+                aIsJad = ETrue;
+            }
+            else
+            {
+                aIsJad = EFalse;
+            }
+        }
+    )
+    if (mimeTypeGiven)
+    {
+        return KErrNone;
+    }
+
+    // Mime type was not given in the input arguments, must check the contents
+    // of the file itself
+    return IsJadFile(aFileHandle, aIsJad);
+}
+
+
+TInt CJavaSifPlugin::IsJadFile(
+    RFile& aFileHandle,
+    TBool& aIsJad)
+{
+    RApaLsSession apaSession;
+    TInt err = apaSession.Connect();
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+            "CJavaSifPlugin::IsJadFile RApaLsSession Connect error %d", err);
+        return err;
+    }
+
+    TDataType jadFileMimeType(K8JadMimeType);
+    err = apaSession.RecognizeSpecificData(aFileHandle, jadFileMimeType, aIsJad);
+    apaSession.Close();
+    if (KErrNone != err)
+    {
+        // Just log the error
+        ELOG1(EJavaInstaller,
+            "CJavaSifPlugin::IsJadFile RApaLsSession RecognizeSpecificData error %d",
+            err);
+        return err;
+    }
+
+    return KErrNone;
+}
+
+
+void CJavaSifPlugin::BuildInstallCommandLine(
+    TPtr& aCommandLine,
+    const COpaqueNamedParams& aArguments)
+{
+    // KSifInParam_Drive -> -drive=install_target_drive (A, B, C, ..., Z)
+    TInt intValue = GetPositiveIntParam(KSifInParam_Drive, aArguments);
+    // Value 0 is 'A:' drive and  value 25 is 'Z:' drive
+    if ((intValue > -1) && (intValue < 26))  // codescanner::magicnumbers
+    {
+        aCommandLine.Append(KDrive);
+        TChar drive('A');
+        drive += intValue;
+        aCommandLine.Append(drive);
+    }
+
+    // KSifInParam_PerformOCSP Yes/No/AskUser -> -ocsp=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_PerformOCSP, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KOcsp);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KOcsp);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+
+    // KSifInParam_IgnoreOCSPWarnings Yes/No/AskUser -> -ignore_ocsp_warnings=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_IgnoreOCSPWarnings, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KIgnoreOcspWarnings);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KIgnoreOcspWarnings);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+
+    // KSifInParam_AllowUpgrade Yes/No/AskUser -> -upgrade=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_AllowUpgrade, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KUpgrade);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KUpgrade);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+
+
+
+    // TODO: activate this code block when KSifInParam_UpgradeData has been
+    // defined in sifcommon.h
+/*
+    // KSifInParam_UpgradeData Yes/No/AskUser -> -upgrade_data=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_UpgradeData, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KUpgradeData);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KUpgradeData);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+*/
+
+    // KSifInParam_AllowUntrusted Yes/No/AskUser -> -untrusted=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_AllowUntrusted, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KUntrusted);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KUntrusted);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+
+    // KSifInParam_AllowOverwrite Yes/No/AskUser -> -overwrite=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_AllowOverwrite, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KOverwrite);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KOverwrite);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+
+    // KSifInParam_AllowDownload Yes/No/AskUser -> -download=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_AllowDownload, aArguments);
+    if (intValue == 0) // Yes
+    {
+        aCommandLine.Append(KDownload);
+        aCommandLine.Append(KYes);
+    }
+    else if (intValue == 1) // No
+    {
+        aCommandLine.Append(KDownload);
+        aCommandLine.Append(KNo);
+    }
+    // AskUser is not supported
+
+    // KSifInParam_IAP -> -iap=IAP_ID (internet access point id)
+    intValue = GetPositiveIntParam(KSifInParam_IAP, aArguments);
+    if (intValue > -1)
+    {
+        // IAP ids are always positive
+        aCommandLine.Append(KIap);
+        aCommandLine.AppendNum(intValue);
+    }
+
+    // KSifInParam_SNAP -> -snap=SNAP_ID (service network access point id)
+    intValue = GetPositiveIntParam(KSifInParam_SNAP, aArguments);
+    if (intValue > -1)
+    {
+        // SNAP ids are always positive
+        aCommandLine.Append(KSnap);
+        aCommandLine.AppendNum(intValue);
+    }
+
+    // When this param is given, Java Installer will cancel installation
+    // before committing anything. This option is for debugging purposes only.
+    // KForceCancel -> -forcecancel
+    // The value of parameter is ignored
+    TRAP_IGNORE(
+        const TDesC &desValue = aArguments.StringByNameL(KForceCancel);
+        if (desValue.Length() > 0)
+        {
+            aCommandLine.Append(KForceCancel);
+        }
+    )
+
+    std::wstring base64EncodedArgs;
+    // KSifInParam_UserName -> -username=download_username
+    TRAP_IGNORE(
+        const TDesC &desValue = aArguments.StringByNameL(KSifInParam_UserName);
+        if (desValue.Length() > 0)
+        {
+            try
+            {
+                std::wstring value((wchar_t *)(desValue.Ptr()), desValue.Length());
+                std::wstring encodedValue = JavaCommonUtils::wbase64encode(value);
+                aCommandLine.Append(KUsername);
+                aCommandLine.Append(
+                    (const unsigned short *)encodedValue.c_str(), (int)encodedValue.length());
+                base64EncodedArgs.append(L"username,");
+            }
+            catch (std::exception& e)
+            {
+                ELOG1(EJavaInstaller,
+                    "CJavaSifPlugin::BuildInstallCommandLine Base64 encoding user "
+                    "name failed, err %s", e.what());
+            }
+        }
+    )
+
+    // KSifInParam_Password -> -password=download_password
+    TRAP_IGNORE(
+        const TDesC &desValue = aArguments.StringByNameL(KSifInParam_Password);
+        if (desValue.Length() > 0)
+        {
+            try
+            {
+                std::wstring value((wchar_t *)(desValue.Ptr()), desValue.Length());
+                std::wstring encodedValue = JavaCommonUtils::wbase64encode(value);
+                aCommandLine.Append(KPassword);
+                aCommandLine.Append(
+                    (const unsigned short *)encodedValue.c_str(), (int)encodedValue.length());
+                base64EncodedArgs.append(L"password,");
+            }
+            catch (std::exception& e)
+            {
+                ELOG1(EJavaInstaller,
+                    "CJavaSifPlugin::BuildInstallCommandLine Base64 encoding password "
+                    "failed, err %s", e.what());
+            }
+        }
+    )
+
+    // KSifInParam_SourceUrl -> -sourceurl=original (HTTP) URL of the JAD or JAR file
+    TRAP_IGNORE(
+        const TDesC &desValue = aArguments.StringByNameL(KSifInParam_SourceUrl);
+        if (desValue.Length() > 0)
+        {
+            try
+            {
+                std::wstring value((wchar_t *)(desValue.Ptr()), desValue.Length());
+                std::wstring encodedValue = JavaCommonUtils::wbase64encode(value);
+                aCommandLine.Append(KSourceUrl);
+                aCommandLine.Append(
+                    (const unsigned short *)encodedValue.c_str(), (int)encodedValue.length());
+                base64EncodedArgs.append(L"sourceurl,");
+            }
+            catch (std::exception& e)
+            {
+                ELOG1(EJavaInstaller,
+                    "CJavaSifPlugin::BuildInstallCommandLine Base64 encoding source "
+                    "url failed, err %s", e.what());
+            }
+        }
+    )
+
+    // KSifInParam_Charset -> -charset=Internet-standard character set name
+    TRAP_IGNORE(
+        const TDesC &desValue = aArguments.StringByNameL(KSifInParam_Charset);
+        if (desValue.Length() > 0)
+        {
+            try
+            {
+                std::wstring value((wchar_t *)(desValue.Ptr()), desValue.Length());
+                std::wstring encodedValue = JavaCommonUtils::wbase64encode(value);
+                aCommandLine.Append(KCharSet);
+                aCommandLine.Append(
+                    (const unsigned short *)encodedValue.c_str(), (int)encodedValue.length());
+                base64EncodedArgs.append(L"charset,");
+            }
+            catch (std::exception& e)
+            {
+                ELOG1(EJavaInstaller,
+                    "CJavaSifPlugin::BuildInstallCommandLine Base64 encoding charset "
+                    "failed, err %s", e.what());
+            }
+        }
+    )
+
+    if (base64EncodedArgs.length() > 0)
+    {
+        // Tell Java Installer which arguments have been Base64 encoded
+        aCommandLine.Append(KBase64);
+        aCommandLine.Append(
+            (const unsigned short *)base64EncodedArgs.c_str(), (int)base64EncodedArgs.length());
+    }
+
+    return;
+}
+
+TInt CJavaSifPlugin::GetPositiveIntParam(
+        const TDesC& aName,
+        const COpaqueNamedParams& aArguments)
+{
+    // Assume that the value will not be found
+    TInt intValue = -1;
+
+    // If the value can be read, intValue will be set, otherwise this function
+    // returns -1
+    TRAP_IGNORE((void)aArguments.GetIntByNameL(aName, intValue));  // codescanner::voidparameter
+
+    return intValue;
+}
+
+
+TInt CJavaSifPlugin::StartResultsServer(
+    COpaqueNamedParams& aResults,
+    CComponentInfo& aComponentInfo)
+{
+    // Destroy old Comms server if it exists
+    delete mResultsServer;
+    mResultsServer = NULL;
+
+    // Start new Comms server
+    mResultsServer = new ResultsServer(aResults, aComponentInfo);  // codescanner::nonleavenew
+    if (NULL == mResultsServer)
+    {
+        return KErrNoMemory;
+    }
+    else
+    {
+        // Start the server
+        return mResultsServer->start();
+    }
+}
+
+
 TBool CJavaSifPlugin::ExitIfJavaInstallerRunning(
     COpaqueNamedParams& aResults,
     TRequestStatus& aStatus)
@@ -902,39 +1102,4 @@
 }
 
 
-TBool CJavaSifPlugin::ExitIfJavaInstallerRunning(TRequestStatus& aStatus)
-{
-    // If Java Installer is already running, set aStatus to KErrInUse
-    // and return ETrue
-
-    RProcess proc;
-    TFindProcess finder(KJavaInstallerProcess);
-    TFullName procName;
-
-    // Java Installer process SID is 0x102033E6 and name is "Installer"
-    while (finder.Next(procName) == KErrNone)
-    {
-        if (proc.Open(finder) != KErrNone)
-        {
-            continue;
-        }
-        if (proc.SecureId() == KJavaInstallerSecureID)
-        {
-            if (proc.ExitType() == EExitPending)
-            {
-                // Java Installer process is already running
-                proc.Close();
-
-                // return error information
-                TRequestStatus *statusPtr(&aStatus);
-                User::RequestComplete(statusPtr, KErrInUse);
-                return ETrue;
-            }
-       }
-       proc.Close();
-    }
-
-    return EFalse;
-}
-
 //  End of File
--- a/javamanager/javainstaller/javasifplugin/src/proxy.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/src/proxy.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -26,7 +26,7 @@
 // CONSTANTS
 const TImplementationProxy KImplementationTable[] =
     { IMPLEMENTATION_PROXY_ENTRY(KJavaSifPluginEcomImplUid,
-                                 Java::Installer::CJavaSifPlugin::NewL)
+                                 java::installer::CJavaSifPlugin::NewL)
     };
 
 // -----------------------------------------------------------------------------
--- a/javamanager/javainstaller/javasifplugin/src/resultsserver.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/src/resultsserver.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -11,15 +11,18 @@
 *
 * Contributors:
 *
-* Description:  Comms server,
-*    part of Java platform 2.0 javarestoreconverter process
+* Description:  Comms server, part of Java Sif plugin.
+*               When started  in 'commsresult' mode from Java Sif plugin
+*               Java Installer sends the results of the operation
+*               it executes (install, uninstall or component info)
+*               to this server.
 *
 */
 
 
 #include <iostream>
 #include <unistd.h>
-#include <usiferror.h>
+#include <usif/usiferror.h>
 
 #include "comms.h"
 #include "javasymbianoslayer.h"
@@ -30,7 +33,7 @@
 using namespace std;
 
 ResultsServer::ResultsServer(COpaqueNamedParams& aResults, CComponentInfo& aInfo) :
-        iResults(aResults), iInfo(aInfo)
+        mResults(aResults), mInfo(aInfo)
 {
 }
 
@@ -45,50 +48,43 @@
 
 int ResultsServer::start()
 {
-    // Write reasonable error codes to iResults that can be used if
+    // Write reasonable error codes to mResults that can be used if
     // Java Installer never returns InstallerResultMessage.
     // If InstallerResultMessage is received the values will be overwritten.
-    TRAPD(err, iResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
+    TRAPD(err, mResults.AddIntL(KSifOutParam_ErrCategory, EUnexpectedError));
     if (KErrNone != err)
     {
         ELOG1(EJavaInstaller,
-            "ResultsServer::start iResults.AddIntL ErrCategory err %d", err);
+            "ResultsServer::start mResults.AddIntL ErrCategory err %d", err);
     }
 
-    TRAP(err, iResults.AddIntL(KSifOutParam_ErrCode, KErrUnknown));
+    TRAP(err, mResults.AddIntL(KSifOutParam_ErrCode, KErrUnknown));
     if (KErrNone != err)
     {
         ELOG1(EJavaInstaller,
-            "ResultsServer::start iResults.AddIntL ErrCode err %d", err);
+            "ResultsServer::start mResults.AddIntL ErrCode err %d", err);
     }
 
-    TRAP(err, iResults.AddIntL(KSifOutParam_ExtendedErrCode, 0));
+    TRAP(err, mResults.AddIntL(KSifOutParam_ExtendedErrCode, 0));
     if (KErrNone != err)
     {
         ELOG1(EJavaInstaller,
-            "ResultsServer::start iResults.AddIntL ExtendedErrCode err %d", err);
+            "ResultsServer::start mResults.AddIntL ExtendedErrCode err %d", err);
     }
 
-    // TODO: return also localized error message from usif
+    // TODO: return also localized error message (KSifOutParam_ErrMessage and
+    // perhaps also KSifOutParam_ErrMessageDetails) from usif
     // common localization file after the localized strings are available
 
-    iRunning = 1;
-    iComms.registerDefaultListener(this);
-    return iComms.start(IPC_ADDRESS_JAVA_SIF_PLUGIN_C);
+
+    mComms.registerDefaultListener(this);
+    return mComms.start(IPC_ADDRESS_JAVA_SIF_PLUGIN_C);
 }
 
 int ResultsServer::stop()
 {
-    if (iRunning > 0)
-    {
-        iRunning = 0;
-        iComms.unregisterDefaultListener(this);
-        return iComms.stop();
-    }
-    else
-    {
-        return 0;
-    }
+    mComms.unregisterDefaultListener(this);
+    return mComms.stop();
 }
 
 /**
@@ -145,58 +141,8 @@
 
             if (KErrNone != result)
             {
-                // return common error information
-                TRAP(err, iResults.AddIntL(KSifOutParam_ErrCode, result));
-                if (KErrNone != err)
-                {
-                    ELOG1(EJavaInstaller,
-                        "ResultsServer::processMessage iResults.AddIntL ErrCode err %d", err);
-                }
-
-                TRAP(err, iResults.AddIntL(
-                    KSifOutParam_ErrCategory, iIntPairs[L"error-category"]));
-                if (KErrNone != err)
-                {
-                    ELOG1(EJavaInstaller,
-                        "ResultsServer::processMessage iResults.AddIntL ErrCategory err %d",
-                        err);
-                }
-
-                HBufC *message = wstringToBuf(iStringPairs[L"error-message"]);
-                if (message == NULL)
-                {
-                    ELOG(EJavaInstaller,
-                          "ResultsServer::processMessage iResults.wstringToBuf returned NULL ");
-                }
-                else
-                {
-                    TRAP(err, iResults.AddStringL(KSifOutParam_ErrMessage, *message));
-                    if (KErrNone != err)
-                    {
-                        ELOG1(EJavaInstaller,
-                            "ResultsServer::processMessage iResults.AddStringL ErrMessage err %d",
-                            err);
-                    }
-                    delete message;
-                }
-
-                message = wstringToBuf(iStringPairs[L"error-details"]);
-                if (message == NULL)
-                {
-                    ELOG(EJavaInstaller,
-                          "ResultsServer::processMessage iResults.wstringToBuf 2 returned NULL ");
-                }
-                else
-                {
-                    TRAP(err, iResults.AddStringL(KSifOutParam_ErrMessageDetails, *message));
-                    if (KErrNone != err)
-                    {
-                        ELOG1(EJavaInstaller,
-                            "ResultsServer::processMessage iResults.AddStringL ErrMessageDetails "
-                            "err %d", err);
-                    }
-                    delete message;
-                }
+                // return common error information;
+                setCommonErrorInfo();
 
                 if (INSTALL_OPERATION == operation)
                 {
@@ -221,30 +167,17 @@
 
                 // Overwrite (reset) the default error values set for the case where no
                 // InstallerResultMessage is never received
-                TRAPD(err, iResults.AddIntL(KSifOutParam_ErrCategory, 0));
-                if (KErrNone != err)
-                {
-                    ELOG1(EJavaInstaller,
-                        "ResultsServer::processMessage iResults.AddIntL ErrCategory err %d", err);
-                }
-
-                TRAP(err, iResults.AddIntL(KSifOutParam_ErrCode, 0));
-                if (KErrNone != err)
-                {
-                    ELOG1(EJavaInstaller,
-                        "ResultsServer::processMessage iResults.AddIntL ErrCode err %d", err);
-                }
-
+                resetDefaultErrorValues();
 
                 if (INSTALL_OPERATION == operation)
                 {
                     // Return the component ids of the installed Java application.
                     TComponentId resultComponentId = iIntPairs[L"suite-cid"];
-                    TRAP(err, iResults.AddIntL(KSifOutParam_ComponentId, resultComponentId));
+                    TRAP(err, mResults.AddIntL(KSifOutParam_ComponentId, resultComponentId));
                     if (KErrNone != err)
                     {
                         ELOG1(EJavaInstaller,
-                              "ResultsServer::processMessage iResults.AddIntL cid error %d", err);
+                              "ResultsServer::processMessage mResults.AddIntL cid error %d", err);
                     }
                 }
                 else if (UNINSTALL_OPERATION == operation)
@@ -276,7 +209,7 @@
             reply.setMessageId(INSTALLER_RESULT_RESPONSE_MESSAGE_ID);
             reply << 0;
 
-            int err = iComms.send(reply);
+            int err = mComms.send(reply);
             if (err != 0)
             {
                 ELOG1(EJavaInstaller,
@@ -299,6 +232,95 @@
 }
 
 
+/**
+ * Set common error information.
+ * Note that the information is in member variables
+ * iIntPairs and iStringPairs
+ */
+void ResultsServer::setCommonErrorInfo()
+{
+    // return common error information
+    TRAPD(err, mResults.AddIntL(KSifOutParam_ErrCode, iIntPairs[L"error-code"]));
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+            "ResultsServer::setCommonErrorInfo mResults.AddIntL ErrCode err %d", err);
+    }
+
+    TRAP(err, mResults.AddIntL(
+        KSifOutParam_ErrCategory, iIntPairs[L"error-category"]));
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+            "ResultsServer::setCommonErrorInfo mResults.AddIntL ErrCategory err %d",
+            err);
+    }
+
+    HBufC *message = wstringToBuf(iStringPairs[L"error-message"]);
+    if (!message)
+    {
+        ELOG(EJavaInstaller,
+              "ResultsServer::setCommonErrorInfo mResults.wstringToBuf returned NULL ");
+    }
+    else
+    {
+        TRAP(err, mResults.AddStringL(KSifOutParam_ErrMessage, *message));
+        if (KErrNone != err)
+        {
+            ELOG1(EJavaInstaller,
+                "ResultsServer::setCommonErrorInfo mResults.AddStringL ErrMessage err %d",
+                err);
+        }
+        delete message;
+    }
+
+    message = wstringToBuf(iStringPairs[L"error-details"]);
+    if (!message)
+    {
+        ELOG(EJavaInstaller,
+              "ResultsServer::setCommonErrorInfo mResults.wstringToBuf 2 returned NULL ");
+    }
+    else
+    {
+        TRAP(err, mResults.AddStringL(KSifOutParam_ErrMessageDetails, *message));
+        if (KErrNone != err)
+        {
+            ELOG1(EJavaInstaller,
+                "ResultsServer::setCommonErrorInfo mResults.AddStringL ErrMessageDetails "
+                "err %d", err);
+        }
+        delete message;
+    }
+}
+
+
+/**
+ * Overwrite (reset) the default error values to 'no error'.
+ * The default error values were originally set for the case
+ * where no InstallerResultMessage is never received and we must
+ * return sensible error information.
+ */
+void ResultsServer::resetDefaultErrorValues()
+{
+    TRAPD(err, mResults.AddIntL(KSifOutParam_ErrCategory, 0));
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+            "ResultsServer::resetDefaultErrorValues mResults.AddIntL ErrCategory err %d", err);
+    }
+
+    TRAP(err, mResults.AddIntL(KSifOutParam_ErrCode, 0));
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+            "ResultsServer::resetDefaultErrorValues mResults.AddIntL ErrCode err %d", err);
+    }
+
+    // TODO: reset also localized error message KSifOutParam_ErrMessage and
+    // perhaps also KSifOutParam_ErrMessageDetails if they have been set in start()
+}
+
+
 void ResultsServer::clearData()
 {
     iIntPairs.clear();
@@ -337,7 +359,7 @@
         ss >> midletUidN;
 
         //LOG1WSTR(EJavaInstaller, EInfo,
-        //         "ResultsServer::processMessage: checking %s", midletUidN.c_str());
+        //  "ResultsServer::processMessage: checking %S", midletUidN.c_str());
 
         int uid = iIntPairs[midletUidN];
         if (uid == 0)
@@ -363,8 +385,8 @@
         CleanupStack::Pop(applicationInfo);
 
         n++;
-    }
-    while (n < 10000);  // sanity check: no suite can have 10000 midlets
+    } // sanity check: no suite can have 10000 midlets
+    while (n < 10000);   // codescanner::magicnumbers
 
     CComponentInfo::CNode *rootNode = NULL;
     rootNode = CComponentInfo::CNode::NewLC(
@@ -385,7 +407,7 @@
                );
 
     // Store whole component info tree
-    iInfo.SetRootNodeL(rootNode);
+    mInfo.SetRootNodeL(rootNode);
     CleanupStack::Pop(rootNode);
     CleanupStack::PopAndDestroy(&applications);
 }
--- a/javamanager/javainstaller/javasifplugin/tsrc/build/testsifapi.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/tsrc/build/testsifapi.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -23,7 +23,7 @@
 symbian {
     TARGET.UID2          = 0
     TARGET.UID3          = 0xE0E5E262
-    TARGET.CAPABILITY    = WriteDeviceData TrustedUI
+    TARGET.CAPABILITY    = all -tcb -drm
 
 
     LIBS +=  -lestor -lapparc -lapgrfx -lefsrv -lsif
--- a/javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -31,7 +31,16 @@
 using namespace Usif;
 
 _LIT(KTestMIDlet, "E:\\stopwatch10midp2.jad");
-//_LIT(KTestMIDlet, "C:\\data\\installs\\DS_Snow.jad");
+_LIT(KTestMIDlet2, "E:\\stopwatch11midp2.jar");
+_LIT(KTestMIDlet3, "E:\\Private\\10281e17\\SimpleRMS.jar");
+_LIT(KUserName, "user");
+_LIT(KPassWord, "password");
+_LIT(KEmptyString, "");
+_LIT(KSourceUrl, "\\sourceurl\\foo");
+_LIT(KCharSet, "charset");
+_LIT(KJadMimeType, "text/vnd.sun.j2me.app-descriptor");
+_LIT(KJarMimeType, "application/java-archive");
+
 
 /**
  * Installs a component by file name
@@ -64,6 +73,82 @@
     CleanupStack::PopAndDestroy(1);
 }
 
+
+/**
+ * This test case requires that you start Java Installer 
+ * manually before executing this one and keep it running 
+ * this test case ends.
+ *
+ *
+ * Keep the installer running until 1) installation has failed
+ * 2) uninstallation has failed and 3) getComponentInfo had failed
+ * because the installer is already running.
+ */
+static void sifInstallerAlreadyRunningL()
+{
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: Called");
+
+    RSoftwareInstall installer;
+    TInt err = installer.Connect();
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters,
+              "testsifapi: sifInstallerAlreadyRunningL: Cannot connect to RSoftwareInstall, err %d", err);
+        User::Leave(err);
+    }
+    CleanupClosePushL(installer);
+
+/*
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: Starting the first installer process");
+    TRequestStatus status;
+    installer.Install(KTestMIDlet, status);
+
+    // wait for second
+    User::After(1000000);
+*/
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: Starting the concurrent installation");
+    // Try to start concurrent installation, will fail
+    TRequestStatus status2;
+    installer.Install(KTestMIDlet2, status2, EFalse);
+    User::WaitForRequest(status2);
+    LOG1(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: The return status of concurrent install operation was %d", status2.Int());
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: Starting the concurrent uninstallation");
+    // Try to start concurrent uninstallation, will fail
+    TRequestStatus status3;
+    installer.Uninstall(15, status3, EFalse);
+    User::WaitForRequest(status3);
+    LOG1(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: The return status of concurrent uninstall operation was %d", status3.Int());
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: Starting the concurrent get component info");
+    // Try to start concurrent GetComponentInfo, will fail
+    TRequestStatus status4;
+    CComponentInfo *info = CComponentInfo::NewL();
+    installer.GetComponentInfo(KTestMIDlet, *info, status4);
+    User::WaitForRequest(status4);
+    delete info;
+    LOG1(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: The return status of concurrent GetComponentInfo operation was %d", status4.Int());
+
+/*
+    User::WaitForRequest(status);
+
+    LOG1(EJavaConverters, EInfo,
+        "testsifapi: sifInstallerAlreadyRunningL: The return status of install operation was %d", status.Int());
+*/
+
+    // free resources before returning
+    CleanupStack::PopAndDestroy(1);
+}
+
 /**
  * Installs a component by file handle using opaque arguments/results
  */
@@ -89,8 +174,9 @@
         User::Leave(err);
     }
 
+// TEMP TEST
     RFile installFile;
-    err = installFile.Open(fs, KTestMIDlet, EFileShareReadersOnly | EFileRead);
+    err = installFile.Open(fs, KTestMIDlet3, EFileShareReadersOnly | EFileRead);
     if (KErrNone != err)
     {
         ELOG1(EJavaConverters,
@@ -125,6 +211,32 @@
     // Silent installation request
     arguments->AddIntL(KSifInParam_InstallSilently, 1);
 
+    // drive E:
+    arguments->AddIntL(KSifInParam_Drive, 4);
+
+    // 0 is TSifPolicy::EUserAllowed == Yes
+    arguments->AddIntL(KSifInParam_PerformOCSP, 0);
+    arguments->AddIntL(KSifInParam_IgnoreOCSPWarnings, 0);
+
+    arguments->AddIntL(KSifInParam_AllowUpgrade, 0);
+    arguments->AddIntL(KSifInParam_AllowUntrusted, 0);
+    arguments->AddIntL(KSifInParam_AllowOverwrite, 0);
+    arguments->AddIntL(KSifInParam_AllowDownload, 0);
+
+
+// TEMP TEST prevent overflow
+//    arguments->AddStringL(KSifInParam_UserName, KUserName);
+//    arguments->AddStringL(KSifInParam_Password, KPassWord);
+
+    arguments->AddStringL(KSifInParam_SourceUrl, KSourceUrl);
+
+    arguments->AddIntL(KSifInParam_IAP, 3);
+
+    arguments->AddStringL(KSifInParam_Charset, KEmptyString);
+
+    arguments->AddStringL(KSifInParam_MimeType, KJadMimeType);
+
+
     LOG(EJavaConverters, EInfo,
         "testsifapi: sifByHandleAndArgsAndResultsInstallL: arguments created");
 
@@ -155,6 +267,90 @@
     return componentId;
 }
 
+/**
+ * Installs a component by file handle using other opaque arguments than
+ * sifByHandleAndArgsAndResultsInstallL()
+ */
+static TInt secondSifByFileAndArgsAndResultsInstallL()
+{
+    RSoftwareInstall installer;
+    TInt err = installer.Connect();
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters,
+              "testsifapi: secondSifByFileAndArgsAndResultsInstallL: Cannot connect to RSoftwareInstall, err %d", err);
+        User::Leave(err);
+    }
+    CleanupClosePushL(installer);
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: secondSifByFileAndArgsAndResultsInstallL: RSoftwareInstall connected");
+
+    TRequestStatus status;
+    COpaqueNamedParams *arguments = COpaqueNamedParams::NewL();
+    CleanupStack::PushL(arguments);
+    COpaqueNamedParams *results = COpaqueNamedParams::NewL();
+    CleanupStack::PushL(results);
+
+    // Silent installation request
+    arguments->AddIntL(KSifInParam_InstallSilently, 1);
+
+    // illegal drive number 33
+    arguments->AddIntL(KSifInParam_Drive, 33);
+
+    // 1 is No
+    arguments->AddIntL(KSifInParam_PerformOCSP, 1);
+    arguments->AddIntL(KSifInParam_IgnoreOCSPWarnings, 1);
+
+    arguments->AddIntL(KSifInParam_AllowUpgrade, 1);
+    arguments->AddIntL(KSifInParam_AllowUntrusted, 1);
+    arguments->AddIntL(KSifInParam_AllowOverwrite, 1);
+    arguments->AddIntL(KSifInParam_AllowDownload, 1);
+
+// TEMP TEST prevent overflow
+//    arguments->AddStringL(KSifInParam_UserName, KEmptyString);
+//    arguments->AddStringL(KSifInParam_Password, KEmptyString);
+
+    arguments->AddStringL(KSifInParam_SourceUrl, KEmptyString);
+
+    arguments->AddIntL(KSifInParam_SNAP, 8);
+
+    arguments->AddStringL(KSifInParam_Charset, KCharSet);
+
+    arguments->AddStringL(KSifInParam_MimeType, KJarMimeType);
+
+    // forcecancel argument value is ignored, forcecancel is set if the value length > 0
+    arguments->AddStringL(_L("-forcecancel"), KCharSet);
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: secondSifByFileAndArgsAndResultsInstallL: arguments created");
+
+    installer.Install(KTestMIDlet2, *arguments, *results, status);
+
+    User::WaitForRequest(status);
+
+    LOG1(EJavaConverters, EInfo,
+        "testsifapi: secondSifByFileAndArgsAndResultsInstallL: The return status of install operation was %d", status.Int());
+
+
+    TInt componentId = 0;
+    TBool idExisted = results->GetIntByNameL(KSifOutParam_ComponentId, componentId);
+    if ( idExisted )
+    {
+        LOG1(EJavaConverters, EInfo,
+            "testsifapi: secondSifByFileAndArgsAndResultsInstallL: Component id was %d", componentId);
+    }
+    else
+    {
+        LOG(EJavaConverters, EInfo,
+            "testsifapi: secondSifByFileAndArgsAndResultsInstallL: No component id was returned");
+    }
+
+    // free resources before returning
+    CleanupStack::PopAndDestroy(3);
+
+    return componentId;
+}
 
 static void sifUninstallL(TInt &aComponentId)
 {
@@ -296,8 +492,50 @@
         logApplicationInfo(*(info->RootNodeL().Applications()[nInd]));
     }
 
+    CleanupStack::PopAndDestroy(info);
+
+
+    User::After(1000000);
+
+    // Get component info also from jar
+    TRequestStatus status2;
+    CComponentInfo *info2 = CComponentInfo::NewL();
+    CleanupStack::PushL(info2);
+
+    installer.GetComponentInfo(KTestMIDlet2, *info2, status2);
+
+    User::WaitForRequest(status2);
+
+    LOG1(EJavaConverters, EInfo,
+        "testsifapi: sifGetComponentInfoL: The return status of get "
+        "component info operation 2 was %d", status.Int());
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifGetComponentInfoL: Logging root node (suite2)");
+
+    logComponentInfoNode(info2->RootNodeL());
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: sifGetComponentInfoL: Logging child nodes (MIDlets2)");
+
+    TInt nMIDlets2 = info2->RootNodeL().Children().Count();
+    TInt nInd2;
+    for (nInd2 = 0; nInd2 < nMIDlets2; nInd2++)
+    {
+        logComponentInfoNode(*(info2->RootNodeL().Children()[nInd2]));
+    }
+
+    nMIDlets2 = info2->RootNodeL().Applications().Count();
+    for (nInd2 = 0; nInd2 < nMIDlets2; nInd2++)
+    {
+        logApplicationInfo(*(info2->RootNodeL().Applications()[nInd2]));
+    }
+
+    CleanupStack::PopAndDestroy(info2);
+
+
     // free resources before returning
-    CleanupStack::PopAndDestroy(2);
+    CleanupStack::PopAndDestroy(1);
 }
 
 
@@ -350,6 +588,12 @@
     LOG(EJavaConverters, EInfo,
         "testsifapi: cancelFunction: Called");
 
+    // TEMP TEST
+    // This thread does not have active scheduler,
+    // create and install it
+    CActiveScheduler* as = new(ELeave) CActiveScheduler();   
+    CActiveScheduler::Install(as);
+
     // Wait for 6 seconds so that the operation to be cancelled
     // has had time to really do something already
     User::After(6000000);
@@ -359,9 +603,13 @@
 
     ((RSoftwareInstall *)installer)->CancelOperation();
 
+    LOG(EJavaConverters, EInfo, "testsifapi: cancelFunction: Starting CActiveScheduler");
+    CActiveScheduler::Start();
+
     LOG(EJavaConverters, EInfo,
         "testsifapi: cancelFunction: CancelOperation() was called");
 
+    delete as;
     return 0;
 }
 
@@ -399,6 +647,7 @@
         "testsifapi: cancelFromSameThread: CancelOperation() returned");
 }
 
+
 static void cancelInstallL()
 {
     LOG(EJavaConverters, EInfo,
@@ -438,6 +687,30 @@
 
 }
 
+static void cancelNoOperationL()
+{
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: cancelNoOperationL: Called");
+
+    RSoftwareInstall installer;
+    TInt err = installer.Connect();
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters,
+            "testsifapi: cancelNoOperationL: Cannot connect to RSoftwareInstall, err %d", err);
+        User::Leave(err);
+    }
+    CleanupClosePushL(installer);
+
+    cancelFromSameThread(installer);
+
+    LOG(EJavaConverters, EInfo,
+        "testsifapi: cancelNoOperationL: cancelFrom<X>Thread returned");
+
+    // free resources before returning
+    CleanupStack::PopAndDestroy(1);
+
+}
 
 /**
  * Create cleanup stack and run the cleaner code inside TRAP harness
@@ -445,35 +718,35 @@
  */
 TInt E32Main()
 {
-/*
-    ELOG2(EJavaConverters,
-        "testsifapi: Starting testing long long long long long long long long long long "
-        "long long long long long long long long long long long long long long long long "
-        "long long long long long long long long long long long long long long long long "
-        "long long long long long long long long long long long long long buffer %d %d", 0, 1);
-
-    LOG(EJavaConverters, EInfo,
-        "testsifapi: sifByHandleAndArgsAndResultsInstallL: Called");
-*/
-
-    __UHEAP_MARK;
+//    __UHEAP_MARK;
     CTrapCleanup* cleanupStack = CTrapCleanup::New();
 
     TInt err = KErrNone;
 
 
-    /*
-        TRAP(err, cancelInstallL());
-        if (KErrNone != err)
-        {
-            ELOG1(EJavaConverters, "testsifapi: cancelInstallL leaved with err %d", err);
-        }
+    LOG(EJavaConverters, EInfo, "testsifapi: starting cancelNoOperationL");
+    TRAP(err, cancelNoOperationL());
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters, "testsifapi: cancelNoOperationL leaved with err %d", err);
+    }
 
-        // Wait for a moment
-        User::After(500000);
-    */
+    // Wait for a moment
+    User::After(500000);
 
 
+    LOG(EJavaConverters, EInfo, "testsifapi: starting cancelInstallL");
+    TRAP(err, cancelInstallL());
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters, "testsifapi: cancelInstallL leaved with err %d", err);
+    }
+
+    // Wait for a moment
+    User::After(500000);
+
+
+    LOG(EJavaConverters, EInfo, "testsifapi: starting sifSimplestInstallL");
     TRAP(err, sifSimplestInstallL());
     if (KErrNone != err)
     {
@@ -484,8 +757,25 @@
     User::After(500000);
 
 
+
+    // This test case must be executed sepatately, while manually started 
+    // Java Installer is running
+    LOG(EJavaConverters, EInfo, "testsifapi: starting sifInstallerAlreadyRunningL");
+    TRAP(err, sifInstallerAlreadyRunningL());
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters, "testsifapi: sifInstallerAlreadyRunningL leaved with err %d", err);
+    }
+
+    // Wait for a moment
+    User::After(500000);
+
+
     TInt componentId = 0;
+    TInt componentId2 = 0;
 
+
+    LOG(EJavaConverters, EInfo, "testsifapi: starting sifByHandleAndArgsAndResultsInstallL");
     TRAP(err, componentId = sifByHandleAndArgsAndResultsInstallL());
     if (KErrNone != err)
     {
@@ -495,7 +785,22 @@
     // Wait for a moment
     User::After(500000);
 
-    // TODO: if this fails, it leaks memory
+
+    // This installation will fail because MIDlet is untrusted and installing
+    // untrusted is denied AND because charset is illegal
+    LOG(EJavaConverters, EInfo, "testsifapi: starting secondSifByFileAndArgsAndResultsInstallL");
+    TRAP(err, componentId2 = secondSifByFileAndArgsAndResultsInstallL());
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaConverters,
+            "testsifapi: secondSifByFileAndArgsAndResultsInstallL leaved with err %d", err);
+    }
+    // Wait for a moment
+    User::After(500000);
+
+
+    // if this fails, it leaks memory
+    LOG(EJavaConverters, EInfo, "testsifapi: starting sifGetComponentInfoL");
     TRAP(err, sifGetComponentInfoL());
     if (KErrNone != err)
     {
@@ -505,6 +810,7 @@
     // Wait for a moment
     User::After(500000);
 
+    LOG(EJavaConverters, EInfo, "testsifapi: starting sifActivationTestL");
     TRAP(err, sifActivationTestL(componentId));
     if (KErrNone != err)
     {
@@ -519,6 +825,7 @@
     // TODO: if this fails, it leaks memory
     if (0 != componentId)
     {
+        LOG(EJavaConverters, EInfo, "testsifapi: starting sifUninstallL");
         TRAP(err, sifUninstallL(componentId));
         if (KErrNone != err)
         {
@@ -530,8 +837,9 @@
         User::After(500000);
     }
 
+
     delete cleanupStack;
 //    __UHEAP_MARKEND;
-    __UHEAP_MARKENDC(1);
+//    __UHEAP_MARKENDC(1);
     return KErrNone;
 }
--- a/javamanager/javamanager.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javamanager.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -17,12 +17,12 @@
 SUBDIRS += preinstaller/build/javapreinstaller.pro 
 SUBDIRS += debugapi/build/debugapi.pro 
 SUBDIRS += javalauncher/build/javalauncher.pro 
+SUBDIRS += javaupgradeapp/build/javaupgradeapp.pro 
 SUBDIRS += javacaptain 
 SUBDIRS += javainstaller 
 SUBDIRS += javaregistry 
 SUBDIRS += javabackup 
 SUBDIRS += javasettings 
-BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javasidchecker/build/bld.inf\""  
 BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javarecognizer/build/bld.inf\""  
 BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javaappschemeplugin/build/bld.inf\""  
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- a/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -303,19 +303,15 @@
         AttributesL();
     }
 
-    CJavaAttribute* regAttr = NULL;
 
     for (TInt i = 0; i < iAttributes.Count(); i++)
     {
         if (0 == (iAttributes[i])->Name().Compare(aName))
         {
-            regAttr = CJavaAttribute::NewL((iAttributes[i])->Name(),
-                                           (iAttributes[i])->Value(),
-                                           (iAttributes[i])->Trusted());
-            break;
+            return iAttributes[i];
         }
     }
-    return regAttr;
+    return NULL;
 }
 
 // ---------------------------------------------------------------------------
--- a/javamanager/javaregistry/legacy/tsrc/build/testlegacyregistry.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/build/testlegacyregistry.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -20,9 +20,10 @@
 CAPABILITY all -tcb -allfiles -drm
 
 #include <../../../../../inc/java_stdcpp_support_for_exe.hrh>
-#include <domain/osextensions/platform_paths.hrh>
+#include <platform_paths.hrh>
 
-USERINCLUDE /epoc32/include/cpputest
+USERINCLUDE /epoc32/include/CppUTest    // Due to TestHarness.h et al
+
 USERINCLUDE ../src/utils
 USERINCLUDE ../../../../../inc // == (JAVA_SRC_ROOT)/inc
 USERINCLUDE ../../../../../jrt_plat/java_registry_api/inc
--- a/javamanager/javaregistry/legacy/tsrc/src/AllTests.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/src/AllTests.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#include "Platform.h"
-#include "CommandLineTestRunner.h"
+#include <CppUTest/Platform.h>
+#include <CppUTest/CommandLineTestRunner.h>
 
 int main(int ac, char** av)
 {
--- a/javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <string>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javastorage.h"
 #include "javastorageexception.h"
--- a/javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistryentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistryentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <string>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javastorage.h"
 #include "javastorageexception.h"
--- a/javamanager/javaregistry/legacy/tsrc/src/testlegacyregistry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/src/testlegacyregistry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <string>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javacommonutils.h"
 #include "javaoslayer.h"
--- a/javamanager/javaregistry/legacy/tsrc/src/testmidletentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/src/testmidletentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <string>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javacommonutils.h"
 #include "javaoslayer.h"
--- a/javamanager/javaregistry/legacy/tsrc/src/testsuiteentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/legacy/tsrc/src/testsuiteentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <string>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javacommonutils.h"
 #include "javaoslayer.h"
--- a/javamanager/javaregistry/tsrc/build/alltests.mmp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/build/alltests.mmp	Tue Jul 06 20:36:19 2010 +0300
@@ -21,12 +21,12 @@
 
 #include <../../../../inc/java_stdcpp_support_for_exe.hrh>
 #include <platform_paths.hrh>
- APP_LAYER_SYSTEMINCLUDE
-MW_LAYER_SYSTEMINCLUDE
+
+APP_LAYER_SYSTEMINCLUDE
 
-USERINCLUDE /epoc32/include/cpputest
+USERINCLUDE /epoc32/include/CppUTest    // Due to TestHarness.h et al
+
 USERINCLUDE ../src/utils
-
 USERINCLUDE ../../../../inc // == (JAVA_SRC_ROOT)/inc
 
 // Using main() as entry point
--- a/javamanager/javaregistry/tsrc/src/AllTests.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/src/AllTests.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#include "Platform.h"
-#include "CommandLineTestRunner.h"
+#include <CppUTest/Platform.h>
+#include <CppUTest/CommandLineTestRunner.h>
 
 int main(int ac, char** av)
 {
--- a/javamanager/javaregistry/tsrc/src/AllTests.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/src/AllTests.h	Tue Jul 06 20:36:19 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include "Utest.h"
+#include <CppUTest/Utest.h>
 
 //Include this in the test main to execute these tests
 IMPORT_TEST_GROUP(TestRegistry);
--- a/javamanager/javaregistry/tsrc/src/testregistry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/src/testregistry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -19,7 +19,7 @@
 #include <string>
 #include <memory>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javastorage.h"
 #include "javastorageexception.h"
--- a/javamanager/javaregistry/tsrc/src/testregistryapplicationentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/src/testregistryapplicationentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -19,7 +19,7 @@
 #include <string>
 #include <memory>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javaregistry.h"
 #include "javaregistryapplicationentry.h"
--- a/javamanager/javaregistry/tsrc/src/testregistryentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/src/testregistryentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -20,7 +20,7 @@
 #include <x509certchain.h>
 #include <memory>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javastorage.h"
 #include "javastorageexception.h"
--- a/javamanager/javaregistry/tsrc/src/testregistrypackageentry.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaregistry/tsrc/src/testregistrypackageentry.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -19,7 +19,7 @@
 #include <string>
 #include <memory>
 
-#include "TestHarness.h"
+#include <CppUTest/TestHarness.h>
 
 #include "javaprocessconstants.h"
 #include "javaregistry.h"
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -142,7 +142,7 @@
     if (mainForm)
     {        
         // do the connect for the main form
-        iPublicView->connect(mainForm, SIGNAL(activated(const QModelIndex)),
+        iPublicView->connect(mainForm, SIGNAL(itemShown(const QModelIndex)),
                              iPublicView, SLOT(_q_dataItemDisplayed(const QModelIndex)));
     
         // set the form as view's widget
@@ -231,7 +231,7 @@
     localizedSettingsNames[QString::fromStdWString(BROADCAST_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_broadcast"));
     localizedSettingsNames[QString::fromStdWString(NFC_WRITE_ACCESS_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_nfc_write_access"));
     localizedSettingsNames[QString::fromStdWString(URL_START_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_url_start"));
-    vector<IndexedSettingsName> allSecuritySettings = readFromStorage(FUNCTION_GROUP, MIDP_FUNC_GRP_SETTINGS_TABLE);
+    vector<IndexedSettingsName> allSecuritySettings = readFromStorage(FUNCTION_GROUP, MIDP_FUNC_GRP_SETTINGS_TABLE, MIDP_PERMISSIONS_TABLE);
     // sort the security settings according to how they should be displayed
     std::sort(allSecuritySettings.begin(), allSecuritySettings.end(), AscendingSort());
     QHash<QString, int> settingsIndexes;
@@ -382,10 +382,9 @@
                     == BLANKET)
             {
                 QString secWarning = SENSITIVE_SETTINGS;
-                if (settings.getName() == NET_ACCESS
-                        || highRiskList[i]->getName() == NET_ACCESS
-                        || settings.getName() == LOW_LEVEL_NET_ACCESS
-                        || highRiskList[i]->getName() == LOW_LEVEL_NET_ACCESS)
+                QString LOCAL_CONNECTIVITY = QString(hbTrId("txt_java_sett_setlabel_local_conn"));
+                if (settings.getName() != LOCAL_CONNECTIVITY
+                    && highRiskList[i]->getName() != LOCAL_CONNECTIVITY)
                 {
                     secWarning = SENSITIVE_SETTINGS_NET_USAGE;
                 }
@@ -574,15 +573,23 @@
     HbWidget * widget = (qobject_cast<HbDataFormViewItem *> 
         (mainForm->itemByIndex(dataItemIndex)))->dataItemContentWidget();
     JavaApplicationSettings* settings = findSettings(widget);
-    if (settings == NULL || settings->isConnectedToUi())
+    if (settings == NULL)
     {
+        // stop right here
         return;
     }
-    settings->connectToUi();
     switch(HbDataFormModelItem::DataItemType(itemType))
     {
         case HbDataFormModelItem::ComboBoxItem:
             comboBox = static_cast<HbComboBox*>(widget);
+            if (settings->isConnectedToUi())
+            {
+                // need to do a reconnect: disconnect followed by a connect
+                iPublicView->disconnect(comboBox, 
+                        SIGNAL(currentIndexChanged(const QString &)), 
+                        iPublicView, 
+                        SLOT(_q_settingsChanged(const QString &)));
+            }
             iPublicView->connect(comboBox,
                                  SIGNAL(currentIndexChanged(const QString &)),
                                  iPublicView, SLOT(_q_settingsChanged(const QString &)),
@@ -590,12 +597,21 @@
             break;
         case HbDataFormModelItem::ToggleValueItem:
             pushButton = static_cast< HbPushButton*>(widget);
+            if (settings->isConnectedToUi())
+            {
+                // need to do a reconnect: disconnect followed by a connect
+                iPublicView->disconnect(pushButton, 
+                        SIGNAL(clicked(bool)),
+                        iPublicView, 
+                        SLOT(_q_settingsChanged(bool)));
+            }
             iPublicView->connect(pushButton,
                                  SIGNAL(clicked(bool)),
                                  iPublicView, SLOT(_q_settingsChanged(bool)),
                                  Qt::UniqueConnection);
             break;
     }
+    settings->connectToUi();
 }
 
 void JavaApplicationSettingsViewPrivate::netConnSelected(uint netConnSelectionStatus)
@@ -965,7 +981,7 @@
     return value;
 }
 
-vector<IndexedSettingsName> JavaApplicationSettingsViewPrivate::readFromStorage(const std::wstring& aColumnName, const std::string& aTableName)
+vector<IndexedSettingsName> JavaApplicationSettingsViewPrivate::readFromStorage(const std::wstring& aColumnName, const std::string& aPrimaryTableName, const std::string& aSecondaryTableName)
 {
     vector<IndexedSettingsName> values;
     
@@ -991,7 +1007,7 @@
     settingsNamesIndexes[QString::fromStdWString(NFC_WRITE_ACCESS_SETTINGS)] = 15;
     settingsNamesIndexes[QString::fromStdWString(URL_START_SETTINGS)] = 16;
     int last_index = 16;
-
+    
     JavaStorageApplicationEntry_t query;
     JavaStorageApplicationList_t queryResult;
     JavaStorageEntry attr;
@@ -1002,8 +1018,10 @@
 
     try
     {
-        iStorage->search(aTableName, query, queryResult);
+        iStorage->search(aPrimaryTableName, query, queryResult);
+        
         JavaStorageApplicationList_t::const_iterator iterator;
+        JavaStorageApplicationList_t secondaryQueryResult;
         for (iterator = queryResult.begin(); iterator != queryResult.end(); iterator++)
         {
             std::wstring name = L"";
@@ -1011,22 +1029,32 @@
             JavaStorageEntry findPattern;
             findPattern.setEntry(aColumnName, L"");
             JavaStorageApplicationEntry_t::const_iterator findIterator =
-                entry.find(findPattern);
+                    entry.find(findPattern);
             if (findIterator != entry.end())
             {
                 name = findIterator->entryValue();
-            }
-            
+            }            
             if (name.size() > 0)
             {
-                IndexedSettingsName value;
-                value.name = name;
-                value.index = last_index + 1;
-                if (settingsNamesIndexes.contains(QString::fromStdWString(name)))
+                entry.clear();
+                query.clear();
+                attr.setEntry(ID, iSuiteUid);
+                query.insert(attr);
+                attr.setEntry(aColumnName, name);
+                query.insert(attr);
+                secondaryQueryResult.clear();
+                iStorage->search(aSecondaryTableName, query, secondaryQueryResult);
+                if (secondaryQueryResult.size() > 0)
                 {
-                    value.index = settingsNamesIndexes.value(QString::fromStdWString(name));
+                    IndexedSettingsName value;
+                    value.name = name;
+                    value.index = last_index + 1;
+                    if (settingsNamesIndexes.contains(QString::fromStdWString(name)))
+                    {
+                        value.index = settingsNamesIndexes.value(QString::fromStdWString(name));
+                    }
+                    values.push_back(value);
                 }
-                values.push_back(value);
             }
         }
     }
--- a/javamanager/javaupgradeapp/src.s60/javaupgradeapp.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/javaupgradeapp/src.s60/javaupgradeapp.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -26,6 +26,7 @@
 
 #include "exceptionbase.h"
 #include "javaoslayer.h"
+#include "javacommonutils.h"
 #include "javaprocessconstants.h"
 #include "javasymbianoslayer.h"
 #include "javauids.h"
@@ -35,10 +36,10 @@
 using namespace java::util;
 
 
-_LIT(KHexValueStart, "0x");
-_LIT(KSemiColon, ";");
-_LIT(KUidArg, "uid=");
-_LIT(KFileArg, "file=");
+_LIT8(KHexValueStart, "0x");
+_LIT8(KSemiColon, ";");
+_LIT8(KUidArg, "uid=");
+_LIT8(KFileArg, "file=");
 
 const TInt KExtraLenForLogging = 2;
 const TInt KArgumentValueMaxLen = 1568;
@@ -53,9 +54,9 @@
  * @param aArgName the name of the argument
  * @param aArgValue the value parsed from command line will be returned here
  */
-static void getArgValueL(const TPtrC &aCmdLine, const TDesC &aArgName, HBufC **aArgValue)
+static void getArgValueL(const TPtrC8 &aCmdLine, const TDesC8 &aArgName, HBufC **aArgValue)
 {
-    TBuf<KArgumentValueMaxLen> valueBuf;
+    TBuf8<KArgumentValueMaxLen> valueBuf;
     TInt argPos = aCmdLine.FindF(aArgName);
     if (argPos >= 0)
     {
@@ -81,9 +82,14 @@
         valueBuf = aCmdLine.Mid(argPos + aArgName.Length(),  argLen);
     }
 
-    // Allocate new HBufC and return it
+    // Allocate new HBufC
     HBufC *pBufValue = HBufC::NewL(valueBuf.Length() + 2);
-    *pBufValue = valueBuf;
+
+    // Convert argument from UTF8 to UCS-2 (UTF16)
+    std::wstring tmp = JavaCommonUtils::utf8ToWstring((const char *)valueBuf.PtrZ());
+
+    // Return the argument inside the new HBufC
+    *pBufValue = (const TUint16 *)(tmp.c_str());
     *aArgValue = pBufValue;
 }
 
@@ -96,7 +102,7 @@
  *  <other_args>;file=YYY;<other_args>
  * @param aFileName will contain the name parsed from command line
  */
-static void getNameFromCommandLineL(const TPtrC &aCmdLine, HBufC **aFileName)
+static void getNameFromCommandLineL(const TPtrC8 &aCmdLine, HBufC **aFileName)
 {
     TInt err = aCmdLine.FindF(KFileArg);
     User::LeaveIfError(err);
@@ -113,14 +119,14 @@
  *  uid=YYY;<other_args>
  * @param aUid will contain the Uid parsed from command line
  */
-static void getUidFromCommandLineL(const TPtrC &aCmdLine, TInt32 &aUid)
+static void getUidFromCommandLineL(const TPtrC8 &aCmdLine, TInt32 &aUid)
 {
     TInt err(KErrNone);
     TInt argPos = aCmdLine.FindF(KUidArg);
     if (KErrNotFound != argPos)
     {
-        TPtrC uidToParse = aCmdLine.Mid(argPos + KUidArg.iTypeLength);
-        TLex parseUid(uidToParse);
+        TPtrC8 uidToParse = aCmdLine.Mid(argPos + KUidArg.iTypeLength);
+        TLex8 parseUid(uidToParse);
         if (uidToParse.FindF(KHexValueStart) == 0)
         {
             parseUid.Inc(2); // skip hex prefix
@@ -163,16 +169,31 @@
  */
 void getFileAndUidL(HBufC **aFileName, TInt32 *aUid)
 {
-    HBufC *pBufCmdLine =
-        HBufC::NewLC(User::CommandLineLength() + KExtraLenForLogging);
-    TPtr cmdLineBuf = pBufCmdLine->Des();
-    User::CommandLine(cmdLineBuf);
+    CApaCommandLine* commandLine;
+
+    // CApaCommandLine command line is used when this application has been
+    // launched using AppArc APIs.
+    TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
+    if (KErrNone != err)
+    {
+        ELOG1(EUtils, "javaupgradeapp: Getting CApaCommandLine failed, err %d", err);
+        User::Leave(err);
+    }
+    CleanupStack::PushL(commandLine);
 
-    if (cmdLineBuf.Length() > 0)
+    // Get the value of _application-args_
+    TPtrC8 args = commandLine->TailEnd();
+    HBufC8 *pBufCmdLine =
+        HBufC8::NewLC(args.Length() + KExtraLenForLogging);
+    if (args.Length() > 0)
     {
-        LOG1WSTR(EUtils, EInfo,
-                 "javaupgradeapp: full java application cmd line is : %s",
-                 (wchar_t *)(cmdLineBuf.PtrZ()));
+        // Copy the arguments to the new HBufC8
+        TPtr8 cmdLineBuf = pBufCmdLine->Des();
+        cmdLineBuf = args;
+
+        LOG1(EUtils, EInfo,
+            "javaupgradeapp: full cmd line is : %s",
+            cmdLineBuf.PtrZ());
 
         // Get the midlet uid from the commandline
         TRAPD(err, getUidFromCommandLineL(cmdLineBuf, *aUid));
@@ -208,6 +229,7 @@
     }
 
     CleanupStack::PopAndDestroy(pBufCmdLine);
+    CleanupStack::PopAndDestroy(commandLine);
 }
 
 
@@ -233,7 +255,7 @@
     // be preinstalled again if the user uninstalls it
     commandLine.Append(_L(" uninstall -uid="));
     commandLine.AppendNum(aUid);
-    commandLine.Append(_L(" -forceuninstall -silent -preinstall_always"));
+    commandLine.Append(_L(" -forceuninstall -silent -resetpreinstall"));
 
     LOG1WSTR(EUtils, EInfo,
         "javaupgradeapp:uninstallJavaAppL Java Installer command line is %s",
@@ -304,7 +326,7 @@
             retryCounter--;
             if (retryCounter > 0)
             {
-                User::After(KDelayWhenWaitingAppArc);
+                User::After(KDelayWhenWaitingAppArc); // codescanner::userafter
                 continue;
             }
             else
@@ -344,22 +366,27 @@
 
     if (uid != 0)
     {
-        LOG1(
-            EUtils,
-            EInfo,
-            "javaupgradeapp uninstalling app uid %d", uid);
+        PLOG1(EUtils, "javaupgradeapp uninstalling app uid %x", uid);
         uninstallJavaAppL(uid);
     }
+    else
+    {
+        WLOG(EUtils, "javaupgradeapp: uid argument was not given");
+    }
 
     if (pBufFileName != NULL)
     {
-        LOG1WSTR(EUtils, EInfo,
+        PLOG1WSTR(EUtils,
             "javaupgradeapp: installing new app package %s",
             (wchar_t *)(pBufFileName->Des().PtrZ()));
         installAppPackageL(pBufFileName);
 
         delete pBufFileName;
     }
+    else
+    {
+        WLOG(EUtils, "javaupgradeapp: file argument was not given");
+    }
 }
 
 
--- a/javamanager/preinstaller/build/javapreinstaller.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/preinstaller/build/javapreinstaller.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -27,7 +27,9 @@
             -lPlatformEnv \
             -ljavacomms \
             -lcharconv \
-            -ljavastorage
+            -ljavastorage \
+            -lapparc \
+            -lapgrfx
 }
 
 include(../../../build/omj.pri)
--- a/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  OMJ S60 preinstaller process
+* Description:  OMJ Symbian preinstaller process
 *
 */
 
@@ -26,6 +26,8 @@
 
 #include "silentmidletinstall.h"
 #include "javacommonutils.h"
+#include "javauid.h"
+#include "javauids.h"
 #include "logger.h"
 #include "javaprocessconstants.h"
 #include "javasymbianoslayer.h"
@@ -51,6 +53,7 @@
 _LIT(KMidletName, "MIDlet-Name");
 _LIT(KMidletVendor, "MIDlet-Vendor");
 _LIT(KMidletVersion, "MIDlet-Version");
+_LIT(KMidletUid, "Nokia-MIDlet-UID-1");
 
 _LIT(KJadExtension, "*.jad");
 
@@ -96,9 +99,9 @@
  */
 void CSilentMIDletInstall::ConstructL()
 {
-    JELOG2(EJavaPreinstaller);
     iMIDletName = HBufC::NewL(KMaxBufferSize);
     iMIDletVendor = HBufC::NewL(KMaxBufferSize);
+    iMIDletUid = HBufC::NewL(KMaxBufferSize);
     iPreinstallServer = new(ELeave) PreinstallCommsServer();
 
     iNumberOfAppsToInstall = 0;
@@ -111,7 +114,6 @@
  */
 CSilentMIDletInstall::~CSilentMIDletInstall()
 {
-    JELOG2(EJavaPreinstaller);
     iJadFiles.ResetAndDestroy();
     iJadFiles.Close();
 
@@ -124,6 +126,9 @@
     delete iMIDletVendor;
     iMIDletVendor = NULL;
 
+    delete iMIDletUid;
+    iMIDletUid = NULL;
+
     delete iPreinstallServer;
     iPreinstallServer = NULL;
 }
@@ -133,7 +138,6 @@
  */
 void CSilentMIDletInstall::Start()
 {
-    JELOG2(EJavaPreinstaller);
     iState = EFindOutDeviceDrives;
 
     // Check if an explicit roll-back of a previous installation is needed
@@ -187,8 +191,6 @@
  */
 void CSilentMIDletInstall::CompleteRequest()
 {
-    JELOG2(EJavaPreinstaller);
-
     TRequestStatus *status = &iStatus;
     User::RequestComplete(status, KErrNone);
     if (!IsActive())
@@ -241,8 +243,6 @@
  */
 void CSilentMIDletInstall::RunL()
 {
-    JELOG2(EJavaPreinstaller);
-
     switch (iState)
     {
     case EFindOutDeviceDrives:
@@ -580,13 +580,12 @@
 /**
  * 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,6 +646,23 @@
          "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;
 }
@@ -727,10 +743,17 @@
     // 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++)
     {
@@ -778,8 +801,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
                 {
@@ -817,9 +840,34 @@
             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();
@@ -830,8 +878,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)
@@ -845,6 +893,11 @@
         }
     }
 
+    if (apaSessionConnected)
+    {
+        apaSession.Close();
+    }
+
     js->close();
 }
 
@@ -1165,3 +1218,53 @@
 
     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
+
--- a/javamanager/preinstaller/src.s60/silentmidletinstall.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/preinstaller/src.s60/silentmidletinstall.h	Tue Jul 06 20:36:19 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  OMJ S60 preinstaller process
+* Description:  OMJ Symbian preinstaller process
  *
 */
 
@@ -19,6 +19,7 @@
 #ifndef SILENTMIDLETINSTALL_H
 #define SILENTMIDLETINSTALL_H
 
+#include <apgcli.h> // for RApaLsSession
 #include <f32file.h>
 #include <e32base.h>
 #include <javasymbianoslayer.h>
@@ -101,6 +102,9 @@
     // Parses the application version string given in aAppVersionString
     //  and returns the corresponding Symbian TAppVersion.
     TAppVersion DesToAppVersion(const HBufC *aAppVersionString);
+    // Parses the Uid in iMIDletUid and returns ETrue if there is a native
+    // application with the same Uid installed into the device
+    TBool IsNativeAppPresent(const RApaLsSession& aApaSession);
 
 
 private:
@@ -123,6 +127,8 @@
     HBufC* iMIDletVendor;
     // Variable used for parsing midlet version from jad file
     TAppVersion iMIDletVersion;
+    // Buffer used for parsing Uid of the first midlet from jad file
+    HBufC* iMIDletUid;
 
     // Drive status info for each non-remote, non-substed drive on device
     TUint iDriveStatuses[KMaxDrives];
--- a/javamanager/subsystem.mk	Fri Jun 11 13:33:44 2010 +0300
+++ b/javamanager/subsystem.mk	Tue Jul 06 20:36:19 2010 +0300
@@ -26,23 +26,31 @@
 COMPONENTS = \
 	preinstaller/build \
 	debugapi/build \
-	javalauncher/build
+	javalauncher/build \
+	javaupgradeapp/build
 
 NONQTSUBSYSTEMS = \
-	javasidchecker/build \
 	javarecognizer/build \
 	javaappschemeplugin/build
 
 SYMBIAN_ONLY = \
 	javaregistry \
 	javalauncher/build \
+	javaupgradeapp/build \
 	javabackup \
-	javasidchecker/build \
 	javarecognizer/build \
 	preinstaller/build \
 	debugapi/build \
 	javaappschemeplugin/build
 
+ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS    
+NONQTSUBSYSTEMS += javasidchecker/build
+SYMBIAN_ONLY += javasidchecker/build
 javasidchecker/build : javaregistry
+endif
+
+# Declare that release preparation removes subdirectories not in build, except
+# listed special cases
+REMOVE_NOTBUILT_EXCLUDING = inc
 
 include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
--- a/javaruntimes/installer/starterdll/src/main.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaruntimes/installer/starterdll/src/main.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -369,7 +369,12 @@
     jvm->appendSystemProperty(
         L"-Dcom.nokia.mj.impl.rt.ui="
         L"com.nokia.mj.impl.installer.ui.eswt2.InstallerRuntimeUi");
-#else
+#ifdef __SYMBIAN32__
+#ifndef __WINS__
+    jvm->appendSystemProperty(L"-Dcom.nokia.mj.impl.installer.ui.disableui=1");
+#endif //__WINS__
+#endif // __SYMBIAN32__
+#else // RD_JAVA_S60_RELEASE_10_1_ONWARDS
     jvm->appendSystemProperty(
         L"-Dcom.nokia.mj.impl.installer.ui="
         L"com.nokia.mj.impl.installer.ui.eswt.InstallerUiEswt");
--- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java	Tue Jul 06 20:36:19 2010 +0300
@@ -31,6 +31,7 @@
 import com.nokia.mj.impl.security.midp.authorization.AccessControllerImpl;
 import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
 
+import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.Logger;
 
 /**
@@ -282,7 +283,7 @@
     }
 
 
-    private boolean showNote(String aAppName,String aConfirmationQueryId)
+    private boolean showNote(String aAppName, Id aConfirmationQueryId)
     {
         SecurityPromptMessage msg = SecurityPromptMessage.getInstance();
         String queryTxt = msg.getText(aConfirmationQueryId,null);
--- a/javatools/javacontrolpanel/controlpanel/src/javacaptain.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javatools/javacontrolpanel/controlpanel/src/javacaptain.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #endif
 
+#include <cstring>
 #include <errno.h>
 #include "logger.h"
 
--- a/javauis/amms_qt/build/javaamms.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/build/javaamms.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -25,9 +25,7 @@
 DEFINES += __JAVA_JSR234_TUNER
 
 
-INCLUDEPATH +=  /epoc32/include/mmf/common \
-                /epoc32/include/caf \
-                ../ammscontrol/inc \
+INCLUDEPATH +=  ../ammscontrol/inc \
                 ../ammscontrol/audio3D/inc \
                 ../ammscontrol/audioeffect/inc \
                 ../mmacontrol/inc \
@@ -36,8 +34,7 @@
                 ../src_tuner/native/inc \
                 ../ammscontrol/inc \
                 ../../mmapi_qt/baseline/inc \
-                ../../mmapi_qt/utils/inc \
-                 /epoc32/include/mw/Qt 
+                ../../mmapi_qt/utils/inc
 
 
 SOURCES +=  ../ammscontrol/src/*.cpp \
--- a/javauis/amms_qt/mmacontrol/inc.emc/cammspancontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammspancontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -21,7 +21,7 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <mmfstandardcustomcommands.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
 #include <midiclientutility.h>
 #include "cammscontrol.h"
 
--- a/javauis/amms_qt/mmacontrol/inc.mmf/cammspancontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/mmacontrol/inc.mmf/cammspancontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -21,8 +21,8 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <MMFStandardCustomCommands.h>
-#include <MidiClientUtility.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include <midiclientutility.h>
 #include "CAMMSControl.h"
 
 // CONSTANTS
--- a/javauis/amms_qt/mmacontrol/inc/cammscustomcommandutility.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/mmacontrol/inc/cammscustomcommandutility.h	Tue Jul 06 20:36:19 2010 +0300
@@ -22,7 +22,7 @@
 //  INCLUDES
 #include <e32base.h>
 #include <CustomCommandUtility.h>
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 
 // CLASS DECLARATION
 
--- a/javauis/amms_qt/mmacontrol/src.emc/cammsprioritycontrol.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsprioritycontrol.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -25,7 +25,7 @@
 #include <cmmaplayerevent.h>
 #include <cmmaaudioplayer.h>
 #include <cmmaemcaudioplayer.h>
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 #include <midiclientutility.h>
 
 
--- a/javauis/amms_qt/mmacontrol/src.mmf/cammsprioritycontrol.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/mmacontrol/src.mmf/cammsprioritycontrol.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -24,7 +24,7 @@
 #include "CAMMSPriorityControl.h"
 #include <CMMAPlayerEvent.h>
 #include <CMMAAudioPlayer.h>
-#include <MMFController.h>
+#include <mmf/common/mmfcontroller.h>
 #include <MidiClientUtility.h>
 
 
--- a/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -22,7 +22,7 @@
 #include <cmmaplayerevent.h>
 #include <cmmaaudioplayer.h>
 #include <cmmavideoplayer.h>
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 #include <midiclientutility.h>
 #include <cammscustomcommandutility.h>
 #include <JniEnvWrapper.h>
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java	Tue Jul 06 20:36:19 2010 +0300
@@ -649,7 +649,7 @@
     if(notifyExit) {
         // Notify MIDP runtime to watch that the MIDlet exits. 
         // For other runtime environments this does nothing. 
-        ExitNotificationWrapper.notifyExit();
+        ExitNotificationWrapper.uiDisposed();
     }
 }
 
@@ -1247,7 +1247,7 @@
         if(widget.packageProxy != null) {
             widget.packageProxy.qt_swt_event_widgetResized(widgetHandle, arg1, arg2, arg3, arg4);
         } else {
-            widget.qt_swt_event_widgetResized_pp(widgetHandle, arg1, arg2, arg3, arg4);
+            widget.qt_swt_event_widgetResized_pp(widgetHandle, arg1, arg2, arg3, arg4, true);
         }
         return false;
     case OS.QSWTEVENT_WIDGETMOVED:
@@ -1256,6 +1256,13 @@
     case OS.QSWTEVENT_BUFFERFLUSH:
         widget.qt_swt_event_bufferFlush();
         return false;
+    case OS.QSWTEVENT_SYMBIAN_WINDOW_FULLY_VISIBLE:
+    case OS.QSWTEVENT_SYMBIAN_WINDOW_PARTIALLY_VISIBLE:
+        widget.qt_swt_event_symbianWindowShow();
+        return false;
+    case OS.QSWTEVENT_SYMBIAN_WINDOW_NOT_VISIBLE:
+        widget.qt_swt_event_symbianWindowHide();
+        return false;
     default:
         return false;
     }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Shell.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Shell.java	Tue Jul 06 20:36:19 2010 +0300
@@ -12,11 +12,14 @@
  *******************************************************************************/
 package org.eclipse.swt.widgets;
 
+import java.util.Vector;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ShellListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.internal.qt.OS;
+import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
 import org.eclipse.swt.internal.qt.WidgetState;
 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
 
@@ -141,6 +144,16 @@
 WindowSurface windowSurface;
 
 /**
+ * When QMainWindow/QDialog visibility is changed, Qt may send a resize event.
+ * eSWT application may have a Shell.setVisible() call in Shell's resize event
+ * handler, which would cause an infinite loop. To prevent this suppress resize
+ * events when Shell visibility is being changed.
+ */
+boolean suppressResizeEvent;
+
+private Vector winVisibilityListeners = new Vector();
+
+/**
  * Constructs a new instance of this class. This is equivalent
  * to calling <code>Shell((Display) null)</code>.
  *
@@ -467,11 +480,15 @@
     Point size =  computeSize(area.width, area.height, true);
     size.x -= windowFrameTrim() * 2;
     size.y -= windowTitleTrim() + windowFrameTrim();
+    
+    // These values will be returned if the size is queried before the Shell
+    // is made visible (and they are not set again). 
+    OS.QWidget_resize(topHandle, size.x, size.y);
+    
     if(OS.windowServer == OS.WS_SYMBIAN_S60 && parent == null) {
         setRestoreState(OS.QT_WINDOWMAXIMIZED, false);
-    } else {
-        OS.QWidget_resize(topHandle, size.x, size.y);
     }
+
     return size;
 }
 
@@ -991,7 +1008,15 @@
     }
     
     // This shell
-    super.setVisible(visible);
+    try {
+        if (visible) {
+            suppressResizeEvent = true;
+        }
+        super.setVisible(visible);
+    } finally {
+        suppressResizeEvent = false;
+    }
+    
     if(isDisposed()) return;
         
     // Dialog shells. 
@@ -1128,10 +1153,22 @@
     return true;
 }
 
+void qt_swt_event_symbianWindowHide() {
+    notifySymbianWindowVisibilityChange(false);
+}
+
+void qt_swt_event_symbianWindowShow() {
+    notifySymbianWindowVisibilityChange(true);
+}
+
 public Rectangle internal_getDefaultBounds() {
     return defBounds;
 }
 
+void qt_swt_event_widgetResized_pp(int widgetHandle, int oldWidth, int oldHeight, int width, int height, boolean sendResizeEvent) {
+    super.qt_swt_event_widgetResized_pp(widgetHandle, oldWidth, oldHeight, width, height, !suppressResizeEvent);
+}
+
 WindowSurface getWindowSurface() {
 	checkWidget();
 	// Only top level shells have window surface
@@ -1144,4 +1181,21 @@
 	return windowSurface;
 }
 
+void addSymbianWindowVisibilityListener_pp(SymbianWindowVisibilityListener listener) {
+    if (!winVisibilityListeners.contains(listener))
+        winVisibilityListeners.addElement(listener);
 }
+
+void removeSymbianWindowVisibilityListener_pp(SymbianWindowVisibilityListener listener) {
+    if (winVisibilityListeners.contains(listener))
+        winVisibilityListeners.removeElement(listener);
+}
+
+void notifySymbianWindowVisibilityChange(boolean visible) {
+    int count = winVisibilityListeners.size();
+    for (int i = 0; i < count; i++) {
+        SymbianWindowVisibilityListener listener = (SymbianWindowVisibilityListener)(winVisibilityListeners.elementAt(i));
+        listener.handleSymbianWindowVisibilityChange(this, visible);
+    }
+}
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java	Tue Jul 06 20:36:19 2010 +0300
@@ -51,13 +51,13 @@
  */
 public abstract class Widget {
     int handle, topHandle;
-    
+
     int style, state;
     Display display;
     EventTable eventTable;
     Object data;
     PackageProxy packageProxy;
-    
+
 static final int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
     int mask = int0 | int1 | int2 | int3 | int4 | int5;
     if ((style & mask) == 0) style |= int0;
@@ -111,10 +111,10 @@
 /**
  * <p>
  * <b>IMPORTANT:</b> This constructor is <em>not</em> part of the SWT
- * public API. It should never be referenced from application code. 
+ * public API. It should never be referenced from application code.
  * </p>
  */
-protected Widget (Widget parent, int style, int extraStyle, Object packageProxy, 
+protected Widget (Widget parent, int style, int extraStyle, Object packageProxy,
         boolean isExtended) {
     checkSubclass ();
     checkParent (parent);
@@ -190,27 +190,27 @@
 
 final void checkOrientation (Widget parent) {
     style &= ~SWT.MIRRORED;
-    
+
     // If orientation explicitly specified then always use that
     if ((style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT)) == 0) {
         if (parent != null) {
             // Inherit the flag from parent
             if ((parent.style & SWT.LEFT_TO_RIGHT) != 0) style |= SWT.LEFT_TO_RIGHT;
             if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) style |= SWT.RIGHT_TO_LEFT;
-            
+
             // If the parent follows the system language direction this widget
-            // does too (unless the user explicitly specified the direction). 
+            // does too (unless the user explicitly specified the direction).
             state |= (parent.state & WidgetState.FOLLOWS_SYSLANG_DIRECTION);
         } else {
-            // Use the default determined by a system property. 
-            // Setting RIGHT_TO_LEFT flag triggers the coordinate mirroring. 
+            // Use the default determined by a system property.
+            // Setting RIGHT_TO_LEFT flag triggers the coordinate mirroring.
             if(Display.defaultOrientation != SWT.LEFT_TO_RIGHT) {
                 style |= Display.defaultOrientation;
             }
-            
-            // If there's no parent this widget follows the system language 
-            // direction if that's the default behavior configured by a system 
-            // property. 
+
+            // If there's no parent this widget follows the system language
+            // direction if that's the default behavior configured by a system
+            // property.
             if(Display.defaultOrientationIsSysLangDirection)
                 state |= WidgetState.FOLLOWS_SYSLANG_DIRECTION;
         }
@@ -299,10 +299,10 @@
 }
 
 /*
- * _pp means that some widgets want to "override" this method in another 
- * package. If this is such a widget then there is a 'package proxy' (pp) that 
- * must be called instead of the implementation in this package. 
- */ 
+ * _pp means that some widgets want to "override" this method in another
+ * package. If this is such a widget then there is a 'package proxy' (pp) that
+ * must be called instead of the implementation in this package.
+ */
 void createHandle_pp (int index) {
 }
 
@@ -313,7 +313,7 @@
         createHandle_pp (index);
     }
     // If subclasses didn't specify topHandle then it's assumed that there's
-    // only one QWidget. I.e. handle is the root widget. 
+    // only one QWidget. I.e. handle is the root widget.
     if(topHandle == 0) topHandle = handle;
     if(packageProxy != null) {
         packageProxy.hookEvents();
@@ -641,7 +641,7 @@
     if (keypad) {
         event.keyLocation = SWT.KEYPAD;
     }
-    
+
     event.keyLocation |= Display.translateKeyLocation(nativeScanCode);
 
     return event;
@@ -869,7 +869,13 @@
 void qt_swt_event_widgetPainted(int widgetHandle, int x, int y, int width, int height, int regionHandle) {
 }
 
-void qt_swt_event_widgetResized_pp(int widgetHandle, int oldWidth, int oldHeight, int width, int height) {
+void qt_swt_event_widgetResized_pp(int widgetHandle, int oldWidth, int oldHeight, int width, int height, boolean sendResizeEvent) {
+}
+
+void qt_swt_event_symbianWindowHide() {
+}
+
+void qt_swt_event_symbianWindowShow() {
 }
 
 void register_pp () {
@@ -1120,7 +1126,7 @@
 public void setData (String key, Object value) {
     checkWidget();
     if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-    
+
     if (key.equals (WidgetConstant.SET_CANVAS_STATE_KEY)) {
         boolean enabled = ((Boolean)value).booleanValue();
         if (enabled) {
@@ -1177,11 +1183,11 @@
     }
 
     if(key.equals(WidgetConstant.CSS_ID)){
-    	OS.QObject_setObjectName(handle,(String)value);
+    	OS.QObject_setObjectName(topHandle,(String)value);
     	// Do not return here and let Widget store the key
     	// value.
     }
-    
+
     int index = 1;
     Object [] table = null;
     if ((state & WidgetState.KEYED_DATA) != 0) {
@@ -1229,12 +1235,12 @@
 }
 
 final void setPackageProxy(Object packageProxy) {
-    // If the subclass is in another package then it provides a proxy object 
+    // If the subclass is in another package then it provides a proxy object
     // which implements the methods that "override" the package private
     // implementations from this package. We must call the proxy object
-    // implementations if they are provided. 
+    // implementations if they are provided.
     if(packageProxy != null) {
-        PackageProxy proxyObject = (PackageProxy)packageProxy; 
+        PackageProxy proxyObject = (PackageProxy)packageProxy;
         proxyObject.setWidget(this);
         this.packageProxy = proxyObject;
     }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri	Tue Jul 06 20:36:19 2010 +0300
@@ -54,23 +54,24 @@
 symbian {
     CONFIG += mobility
     MOBILITY += bearer
-    
+
+    CONFIG +=hb
     HEADERS += \
         swts60.h \
-    	swtmobiledevice.h \
+        swtmobiledevice.h \
         swtflipwatch.h
-    
+
     SOURCES += \
         swts60.cpp \
-    	swtmobiledevice.cpp \
+        swtmobiledevice.cpp \
         swtflipwatch.cpp
-        
+
     LIBS += \
         -leikcore \
         -lapparc \
-        -lavkon \
         -lefsrv \
         -lcone \
+        -lavkon \
         -leikcoctl \
         -lapgrfx \
         -lHWRMVibraClient \
@@ -80,5 +81,7 @@
         -lQtContacts \
         -lhal \
         -lws32 \
-        -lgdi
+        -lgdi \
+        -lHbCore \
+        -lfbscli
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eventcallback.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eventcallback.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -105,6 +105,13 @@
             {
             SWT_LOG_EVENT_2("QEvent type=%d (key event) object=%x", eventType, aObj);
             QKeyEvent *keyEvent = static_cast<QKeyEvent*>(aEvent);
+
+            // In SWT repeat is done by repeating the key-down event with no release
+            if((eventType == QEvent::KeyRelease) && keyEvent->isAutoRepeat())
+                {
+                return false;
+                }
+                
             // QString ensures that the character at position size() is always '\0'
             int character = keyEvent->text()[0].unicode();
             
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -40,17 +40,17 @@
 
 
 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1get_1windowsurface
-  (JNIEnv* aJniEnv, jclass, jint aHandle) 
-{   
+  (JNIEnv* aJniEnv, jclass, jint aHandle)
+{
     WindowSurface* ws = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         ws = gc->getWindowSurface();
     }
     GFX_CATCH
-    
+
     return POINTER_TO_HANDLE(ws);
 }
 
@@ -61,7 +61,7 @@
     GraphicsContext* gc = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         gc = GraphicsFactory::createGraphicsContext();
     }
     GFX_CATCH
@@ -70,12 +70,12 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1dispose
-  (JNIEnv* aJniEnv , jclass, jint aHandle) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);  
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->dispose();
         gc = NULL;
     }
@@ -87,7 +87,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->bindTarget(aTarget, (TTargetType)aType, static_cast<int>(aBufferFlushTargetHandle));
     }
@@ -99,7 +99,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         HANDLE_TO_POINTER(Buffer*, buffer, aBufferHandle);
         gc->render(buffer);
@@ -108,11 +108,11 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1releaseTarget
-  (JNIEnv* aJniEnv , jclass, jint aHandle) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->releaseTarget();
     }
@@ -124,10 +124,10 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         HANDLE_TO_POINTER(Image*, image, aTargetHandle);
-    
+
         gc->copyArea(image, aX, aY);
     }
     GFX_CATCH
@@ -135,10 +135,10 @@
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1copyArea__IIIIIIIZ
   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aSrcX, jint aSrcY, jint aWidth, jint aHeight, jint aDestX, jint aDestY, jboolean aPaint)
-{   
+{
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->copyArea(aSrcX, aSrcY, aWidth, aHeight, aDestX, aDestY, aPaint == JNI_TRUE ? true : false);
     }
@@ -150,7 +150,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle);
     }
@@ -162,7 +162,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawEllipse(aX, aY, aWidth, aHeight);
     }
@@ -174,7 +174,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawFocus(aX, aY, aWidth, aHeight);
     }
@@ -186,21 +186,21 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         gc->drawImage(image, aX, aY);
     }
     GFX_CATCH
 }
-                                                                                      
+
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawImage__IIIIIIIIIII
-  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle, jint aTx, jint aTy, jint aTw, jint aTh, 
+  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle, jint aTx, jint aTy, jint aTw, jint aTh,
   jint aSx, jint aSy, jint aSw, jint aSh, jint aManipulation)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         gc->drawImage(image, aManipulation, aTx, aTy, aTw, aTh, aSx, aSy, aSw, aSh);
@@ -213,7 +213,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawLine(aX1, aY1, aX2, aY2);
     }
@@ -225,7 +225,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawPoint(aX, aY);
     }
@@ -237,7 +237,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         int length = aJniEnv->GetArrayLength(aPointArray);
         int* buffer = new int[length]; // might throw bad_alloc
@@ -253,7 +253,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         int length = aJniEnv->GetArrayLength(aPointArray);
         int* buffer = new int[length]; // might throw bad_alloc
@@ -269,7 +269,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawRect(aX, aY, aWidth, aHeight);
     }
@@ -277,12 +277,12 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3IIIIIIIZI
-  (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRgbData, jint aOffset, jint aScanlength, 
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRgbData, jint aOffset, jint aScanlength,
     jint aX, jint aY, jint aWidth, jint aHeight, jboolean aProcessAlpha, jint aManipulation)
 {
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         int length = aJniEnv->GetArrayLength(aRgbData);
 
@@ -291,36 +291,36 @@
         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc
 
         gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation);
-    } 
+    }
     GFX_CATCH
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3B_3BIIIIIIII
-  (JNIEnv *aJniEnv, jclass, jint aHandle, jbyteArray aRgbData, jbyteArray aTransparencyMask, 
+  (JNIEnv *aJniEnv, jclass, jint aHandle, jbyteArray aRgbData, jbyteArray aTransparencyMask,
   jint aOffset, jint aScanLength, jint aX, jint aY, jint aWidth, jint aHeight, jint aTransform, jint aFormat)
   {
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
-        
+
         int dataLength = aJniEnv->GetArrayLength(aRgbData);
         int maskLength = aJniEnv->GetArrayLength(aTransparencyMask);
-        
+
         char* dataBuffer = new char[dataLength]; // might throw bad_alloc
         AutoRelease<char> releaseData(dataBuffer, true);
         swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); // might throw bad_alloc
-        
+
         char* maskBuffer = NULL;
         AutoRelease<char> releaseMask(NULL, true); // Will delete mask or NULL if there's no mask
-        
+
         if(aTransparencyMask)
         {
             maskBuffer = new char[maskLength]; // might throw bad_alloc
             releaseMask.reset(maskBuffer);
-            swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); // might throw bad_alloc        
+            swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); // might throw bad_alloc
         }
-        
+
         gc->drawRGB(dataBuffer, maskBuffer, dataLength, aOffset, aScanLength, aX, aY, aWidth, aHeight, aTransform, aFormat);
     }
     GFX_CATCH
@@ -332,17 +332,17 @@
  {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aImageHandle);
-        
+
         int length = aJniEnv->GetArrayLength(aRgbData);
-        
+
         short* buffer = new short[length];
         AutoRelease<short> release(buffer, true);
         ::memset(buffer, 0, sizeof(short)*length);
-        
+
         swtApp->jniUtils().GetJavaShortArrayRegionToShortArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc
-        
+
         gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation, aFormat);
     }
     GFX_CATCH
@@ -353,7 +353,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight);
     }
@@ -362,25 +362,25 @@
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawString
   (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aText, jint aX, jint aY, jint aWidth, jint aHeight,
-  jint aAlignments, jint aFlags, jboolean aIsTransparent) 
+  jint aAlignments, jint aFlags, jboolean aIsTransparent)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        const jchar* chars; // unsigned short (2 bytes) 
+        SWT_LOG_JNI_CALL();
+        const jchar* chars; // unsigned short (2 bytes)
         int length;
-    
+
         length = aJniEnv->GetStringLength(aText);
         chars = aJniEnv->GetStringChars(aText, NULL);
         AutoReleaseStringChars release(aJniEnv, aText, chars);
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->drawString(
-            (const unsigned short*)chars, 
-            aX, 
+            (const unsigned short*)chars,
+            aX,
             aY,
             aWidth,
             aHeight,
-            length, 
+            length,
             aAlignments,
             aFlags,
             aIsTransparent);
@@ -389,11 +389,11 @@
 }
 
 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawWindowSurface
-  (JNIEnv* aJniEnv, jclass, jint aHandle, jint aSurfaceHandle, jint aX, jint aY, jint aWidth, jint aHeight) 
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jint aSurfaceHandle, jint aX, jint aY, jint aWidth, jint aHeight)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         HANDLE_TO_POINTER(WindowSurface*, surface, aSurfaceHandle);
         gc->drawWindowSurface(surface, aX, aY, aWidth, aHeight);
@@ -406,7 +406,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->fillArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle);
     }
@@ -414,13 +414,13 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillEllipse
-  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
-        gc->fillEllipse(aX, aY, aWidth, aHeight);   
+        gc->fillEllipse(aX, aY, aWidth, aHeight);
     }
     GFX_CATCH
 }
@@ -430,9 +430,9 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
-        gc->fillGradientRect(aX, aY, aWidth, aHeight, aVertical, aSwapColors);  
+        gc->fillGradientRect(aX, aY, aWidth, aHeight, aVertical, aSwapColors);
     }
     GFX_CATCH
 }
@@ -442,14 +442,14 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         int length = aJniEnv->GetArrayLength(aPointArray);
-        
+
         int* buffer = new int[length]; // might throw bad_alloc
         AutoRelease<int> release(buffer, true);
         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc
-        
+
         gc->fillPolygon(buffer, length);
     }
     GFX_CATCH
@@ -460,9 +460,9 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
-        gc->fillRect(aX, aY, aWidth, aHeight);  
+        gc->fillRect(aX, aY, aWidth, aHeight);
     }
     GFX_CATCH
 }
@@ -472,7 +472,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->fillRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight);
     }
@@ -485,7 +485,7 @@
     jint bgAlpha = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         bgAlpha = static_cast<jint>( gc->getBackgroundAlpha() );
     }
@@ -499,7 +499,7 @@
     jint bgColor = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         bgColor = static_cast<jint>( gc->getBackgroundColor() );
     }
@@ -513,7 +513,7 @@
     jint charWidth = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         charWidth = static_cast<jint>( gc->getCharacterWidth(aCh, aIsAdvanced) );
     }
@@ -524,9 +524,9 @@
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getFontMetricsData
   (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aDataArray, jint aFontHandle)
 {
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
 
         int length = aJniEnv->GetArrayLength(aDataArray);
@@ -555,9 +555,9 @@
   (JNIEnv* aJniEnv , jclass, jint aHandle)
 {
     jint blendingMode = 0;
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         blendingMode = static_cast<jint>( gc->getBlendingMode() );
     }
@@ -570,16 +570,16 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);        
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         int length = aJniEnv->GetArrayLength(aClipArray);
 
         int* buffer = new int[length]; // might throw bad_alloc
         AutoRelease<int> release(buffer, true);
         ::memset(buffer, 0, sizeof(int)*length);
-        
+
         gc->getClip(buffer);
-        
+
         swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aClipArray, 0, length, buffer);
     }
     GFX_CATCH
@@ -591,7 +591,7 @@
     jint fgAlpha = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         fgAlpha = static_cast<jint>( gc->getForegroundAlpha() );
     }
@@ -600,12 +600,12 @@
 }
 
 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getForegroundColor
-  (JNIEnv* aJniEnv , jclass, jint aHandle) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle)
 {
     jint fgColor = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         fgColor = static_cast<jint>( gc->getForegroundColor() );
     }
@@ -614,28 +614,28 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getTextBoundingBox
-  (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aBoundingBox, jstring aText, 
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aBoundingBox, jstring aText,
    jint aAlignments, jint aFlags, jint aRectX, jint aRectY, jint aRectWidth, jint aRectHeight)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
-        
+
         int length = aJniEnv->GetArrayLength(aBoundingBox);
 
         int* buffer = new int[length]; // might throw bad_alloc
         AutoRelease<int> releaseBuffer(buffer, true);
         ::memset(buffer, 0, sizeof(int)*length);
-        
+
         const jchar* textPtr = aJniEnv->GetStringChars(aText, NULL);
         AutoReleaseStringChars releaseStringChars(aJniEnv, aText, textPtr);
 
         jint textLength = aJniEnv->GetStringLength(aText);
-        
+
         gc->getTextBoundingBox(
             buffer,
-            static_cast<const unsigned short*>(textPtr), 
+            static_cast<const unsigned short*>(textPtr),
             textLength,
             aAlignments,
             aFlags,
@@ -653,7 +653,7 @@
     jint strokeWidth = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         strokeWidth = static_cast<jint>( gc->getStrokeWidth() );
     }
@@ -667,7 +667,7 @@
     jint strokeStyle = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         strokeStyle = static_cast<jint>( gc->getStrokeStyle() );
     }
@@ -681,7 +681,7 @@
     jint translateX = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         translateX = static_cast<jint>( gc->getTranslateX() );
     }
@@ -695,7 +695,7 @@
     jint translateY = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         translateY = static_cast<jint>( gc->getTranslateY() );
     }
@@ -708,7 +708,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setBackgroundAlpha(aAlpha);
     }
@@ -720,7 +720,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setBackgroundColor(aArgb, aUpdateAlpha);
     }
@@ -728,11 +728,11 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBlendingMode
-  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setBlendingMode((TBlendingMode)aMode);
     }
@@ -745,7 +745,7 @@
     jboolean hasClipping = JNI_FALSE;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         hasClipping = static_cast<jboolean>( gc->hasClipping() );
     }
@@ -758,7 +758,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->cancelClipping();
     }
@@ -770,7 +770,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setClip(aX, aY, aWidth, aHeight, aIntersects);
     }
@@ -782,7 +782,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setFont(aFontHandle);
     }
@@ -794,7 +794,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setForegroundAlpha(aAlpha);
     }
@@ -806,7 +806,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setForegroundColor(aArgb, aUpdateAlpha);
     }
@@ -818,7 +818,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setStrokeWidth(aWidth);
     }
@@ -826,11 +826,11 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeStyle
-  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStyle) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStyle)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->setStrokeStyle((TStrokeStyle)aStyle);
     }
@@ -842,7 +842,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->translate(aX,aY);
     }
@@ -854,7 +854,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->scale(aX,aY);
     }
@@ -867,7 +867,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->resetTransform();
     }
@@ -879,7 +879,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->saveSettings();
     }
@@ -891,7 +891,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
         gc->restoreSettings();
     }
@@ -908,9 +908,9 @@
     Image* img = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         img = GraphicsFactory::createImage(aWidth, aHeight, aFillColor);
-    } 
+    }
     GFX_CATCH
     return POINTER_TO_HANDLE(img);
 }
@@ -921,7 +921,7 @@
     Image* newImage = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         newImage = GraphicsFactory::createImage(image, aX, aY, aWidth, aHeight);
     }
@@ -935,8 +935,8 @@
     Image* img = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        
+        SWT_LOG_JNI_CALL();
+
         int length = aJniEnv->GetArrayLength(aRgbData);
 
         int* buffer = new int[length]; // might throw bad_alloc
@@ -944,7 +944,7 @@
         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc
 
         img = GraphicsFactory::createImage(buffer, aWidth, aHeight, aHasAlpha);
-    } 
+    }
     GFX_CATCH
     return POINTER_TO_HANDLE(img);
 }
@@ -955,7 +955,7 @@
     Image* img = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();     
+        SWT_LOG_JNI_CALL();
         img = swtApp->jniUtils().CreateImage(aJniEnv, aImageData);
     }
     GFX_CATCH
@@ -968,7 +968,7 @@
     jint format = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         format = static_cast<jint>( image->getFormat() );
     }
@@ -982,7 +982,7 @@
     jint height = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         height = static_cast<jint>( image->getHeight() );
     }
@@ -991,12 +991,12 @@
 }
 
 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getWidth
-  (JNIEnv* aJniEnv , jclass, jint aImageHandle) 
+  (JNIEnv* aJniEnv , jclass, jint aImageHandle)
 {
     jint width = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         width = static_cast<jint>( image->getWidth() );
     }
@@ -1009,9 +1009,9 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        HANDLE_TO_POINTER(Image*, image, aImageHandle);   
-        
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(Image*, image, aImageHandle);
+
         int length = aJniEnv->GetArrayLength(aRgbData);
 
         int* buffer = new int[length]; // might throw bad_alloc
@@ -1020,7 +1020,7 @@
 
         // get the data (populated to data array)
         image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight);
-        
+
         // Copy data back to java
         swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRgbData, 0, length, buffer);
     }
@@ -1032,22 +1032,22 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
-        
+
         int dataLength = aJniEnv->GetArrayLength(aRgbData);
         int maskLength = aJniEnv->GetArrayLength(aTransparencyMask);
-        
+
         char* dataBuffer = new char[dataLength]; // might throw bad_alloc
         AutoRelease<char> releaseData(dataBuffer, true);
         char* maskBuffer = new char[maskLength]; // might throw bad_alloc
         AutoRelease<char> releaseMask(maskBuffer, true);
         ::memset(dataBuffer, 0, sizeof(char)*dataLength);
         ::memset(maskBuffer, 0, sizeof(char)*maskLength);
-        
+
         // get the data (populated to data array)
         image->getRgb(dataBuffer, maskBuffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat);
-        
+
         // Copy data back to Java
         swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer);
         swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer);
@@ -1059,17 +1059,17 @@
   (JNIEnv * aJniEnv, jclass, jint aImageHandle, jshortArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) {
     GFX_TRY
 {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
-        
+
         int length = aJniEnv->GetArrayLength(aRgbData);
         short* buffer = new short[length];
         AutoRelease<short> release(buffer, true);
         ::memset(buffer, 0, sizeof(short)*length);
-        
+
         // get the data (populated to data array)
         image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat);
-        
+
         // Copy data back to java
         swtApp->jniUtils().SetJavaShortArrayRegionFromShortArray(aJniEnv, aRgbData, 0, length, buffer);
     }
@@ -1079,14 +1079,14 @@
 jobject JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getImageData
   (JNIEnv* aJniEnv , jclass, jint aImageHandle)
 {
-    GFX_LOG_JNI_CALL();
+    SWT_LOG_JNI_CALL();
     jobject imageData = 0;
     GFX_TRY
     {
         ImageDataWrapper* data = NULL;
-        HANDLE_TO_POINTER(Image*, image, aImageHandle);   
+        HANDLE_TO_POINTER(Image*, image, aImageHandle);
         data = GraphicsFactory::createImageData(image);
-        AutoRelease<ImageDataWrapper> release(data, false);    
+        AutoRelease<ImageDataWrapper> release(data, false);
         imageData = swtApp->jniUtils().CreateJavaImageData(aJniEnv, *data);
     }
     GFX_CATCH
@@ -1098,7 +1098,7 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         image->transform((TTransform)aTransform);
     }
@@ -1106,11 +1106,11 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1dispose
-  (JNIEnv* aJniEnv , jclass, jint aImageHandle) 
+  (JNIEnv* aJniEnv , jclass, jint aImageHandle)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         image->dispose();
         image = NULL;
@@ -1124,7 +1124,7 @@
     jint pixmapHandle = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Image*, image, aImageHandle);
         pixmapHandle = POINTER_TO_HANDLE(image->getPixmap());
     }
@@ -1136,12 +1136,12 @@
   (JNIEnv* aJniEnv, jclass, jint aImage1PixmapHandle, jint aTransform1, jint aP1x, jint aP1y, jint aR1x1, jint aR1y1, jint aR1x2, jint aR1y2,
                             jint aImage2PixmapHandle, jint aTransform2, jint aP2x, jint aP2y, jint aR2x1, jint aR2y1, jint aR2x2, jint aR2y2)
 {
-  	jboolean collides = JNI_FALSE;
-  	GFX_TRY
+    jboolean collides = JNI_FALSE;
+    GFX_TRY
     {
-    	  GFX_LOG_JNI_CALL();
-    	  collides = gfxUtils::detectCollision(aImage1PixmapHandle, aTransform1, aP1x, aP1y, aR1x1, aR1y1, aR1x2, aR1y2,
-    	                                       aImage2PixmapHandle, aTransform2, aP2x, aP2y, aR2x1, aR2y1, aR2x2, aR2y2);
+          SWT_LOG_JNI_CALL();
+          collides = gfxUtils::detectCollision(aImage1PixmapHandle, aTransform1, aP1x, aP1y, aR1x1, aR1y1, aR1x2, aR1y2,
+                                               aImage2PixmapHandle, aTransform2, aP2x, aP2y, aR2x1, aR2y1, aR2x2, aR2y2);
     }
     GFX_CATCH
     return collides;
@@ -1156,14 +1156,14 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        jbyte* data = NULL; 
+        SWT_LOG_JNI_CALL();
+        jbyte* data = NULL;
         data = aJniEnv->GetByteArrayElements(aImageData, NULL);
         HANDLE_TO_POINTER(ImageLoader*, loader, aHandle);
         loader->append(reinterpret_cast<const char*>(data), aLenght, aOffset);
         // release arrays, don't copy back
         aJniEnv->ReleaseByteArrayElements(aImageData, data, JNI_ABORT);
-    } 
+    }
     GFX_CATCH
 }
 
@@ -1172,10 +1172,10 @@
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(ImageLoader*, loader, aHandle);
         loader->beginStream(aBufferSize);
-    } 
+    }
     GFX_CATCH
 }
 
@@ -1185,7 +1185,7 @@
     Image* image = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(ImageLoader*, loader, aHandle);
         image = loader->endStream();
     }
@@ -1194,12 +1194,12 @@
 }
 
 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1init
-  (JNIEnv* aJniEnv , jclass) 
+  (JNIEnv* aJniEnv , jclass)
 {
     ImageLoader* loader = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();        
+        SWT_LOG_JNI_CALL();
         loader = GraphicsFactory::createImageLoader();
     }
     GFX_CATCH
@@ -1207,11 +1207,11 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1dispose
-  (JNIEnv* aJniEnv , jclass, jint aHandle) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(ImageLoader*, loader, aHandle);
         loader->dispose();
     }
@@ -1219,12 +1219,12 @@
 }
 
 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1load
-  (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFileName) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFileName)
 {
     Image* image = NULL;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(ImageLoader*, loader, aHandle);
         image = loader->load(swtApp->jniUtils().JavaStringToQString(aJniEnv, aFileName));
     }
@@ -1233,11 +1233,11 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1setLoadSize
-  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight) 
+  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight)
 {
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(ImageLoader*, loader, aHandle);
         loader->setLoadSize(aWidth, aHeight);
     }
@@ -1254,7 +1254,7 @@
     jint ascent = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(QFont*, font, aFontHandle);
         QFontMetrics fm(*font);
         ascent = static_cast<jint>( fm.ascent() );
@@ -1266,20 +1266,20 @@
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2
   (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr)
 {
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr);
-        
+
         int length = aJniEnv->GetArrayLength(aRectArray);
 
         int* buffer = new int[length]; // might throw bad_alloc
         AutoRelease<int> release(buffer, true);
         ::memset(buffer, 0, sizeof(int)*length);
-        
-        HANDLE_TO_POINTER(QFont*, font, aFontHandle); 
+
+        HANDLE_TO_POINTER(QFont*, font, aFontHandle);
         QFontMetrics fm(*font);
-        
+
         buffer[0] = 0;
         buffer[1] = 0;
         buffer[2] = fm.width(string);
@@ -1294,24 +1294,24 @@
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2IIIIII
   (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr, jint /*aRectX*/, jint /*aRectY*/, jint /*aRectW*/, jint /*aRectH*/, jint /*aAlignments*/, jint /*aFlags*/)
 {
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr);
         int length = aJniEnv->GetArrayLength(aRectArray);
 
         int* buffer = new int[length]; // might throw bad_alloc
         AutoRelease<int> release(buffer, true);
         ::memset(buffer, 0, sizeof(int)*length);
- 
-        HANDLE_TO_POINTER(QFont*, font, aFontHandle); 
+
+        HANDLE_TO_POINTER(QFont*, font, aFontHandle);
         QFontMetrics fm(*font);
-        
+
         buffer[0] = 0;
         buffer[1] = 0;
         buffer[2] = fm.width(string);
         buffer[3] = fm.height();
-        
+
         // Copy changes to rectArray
         swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRectArray, 0, length, buffer);
     }
@@ -1324,8 +1324,8 @@
     jint descent = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        HANDLE_TO_POINTER(QFont*, font, aFontHandle); 
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(QFont*, font, aFontHandle);
         QFontMetrics fm(*font);
         descent = static_cast<jint>( fm.descent() );
     }
@@ -1337,10 +1337,10 @@
   (JNIEnv* aJniEnv , jclass, jint aFontHandle, jstring aStr)
 {
     int strWidth = 0;
-    GFX_TRY 
+    GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
-        HANDLE_TO_POINTER(QFont*, font, aFontHandle); 
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(QFont*, font, aFontHandle);
         QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv,  aStr);
         QFontMetrics fm(*font);
         strWidth = fm.width(string);
@@ -1359,7 +1359,7 @@
     Buffer* buffer = 0;
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         buffer = GraphicsFactory::createBuffer();
     }
     GFX_CATCH
@@ -1371,6 +1371,7 @@
 {
     GFX_TRY
     {
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Buffer*, buffer, aHandle);
         buffer->dispose();
     }
@@ -1378,18 +1379,19 @@
 }
 
 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1getInvalidRect
-  (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRect) 
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRect)
 {
     GFX_TRY
     {
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(Buffer*, buffer, aHandle);
-        
+
         int length = aJniEnv->GetArrayLength(aRect);
 
         int* intBuffer = new int[length]; // might throw bad_alloc
         AutoRelease<int> release(intBuffer, true);
         ::memset(intBuffer, 0, sizeof(int)*length);
-        
+
         buffer->getInvalidRect(intBuffer);
 
         // Copy data back to java
@@ -1408,7 +1410,7 @@
     HANDLE_TO_POINTER(QWidget*, widget, aHandle);
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         surface = GraphicsFactory::createWindowSurface(widget, aAutoRefresh);
     }
     GFX_CATCH
@@ -1421,7 +1423,7 @@
     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         wsurf->beginPaint(aX, aY, aWidth, aHeight);
     }
     GFX_CATCH
@@ -1433,7 +1435,7 @@
     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         wsurf->endPaint();
     }
     GFX_CATCH
@@ -1445,7 +1447,7 @@
     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
     GFX_TRY
     {
-        GFX_LOG_JNI_CALL();
+        SWT_LOG_JNI_CALL();
         wsurf->flush();
     }
     GFX_CATCH
@@ -1457,6 +1459,7 @@
     jint type = 0;
     GFX_TRY
     {
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
         type = static_cast<jint>( wsurf->getType() );
     }
@@ -1469,8 +1472,9 @@
 {
     GFX_TRY
     {
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
-        wsurf->dispose();       
+        wsurf->dispose();
     }
     GFX_CATCH
 }
@@ -1480,12 +1484,21 @@
 {
     GFX_TRY
     {
+        SWT_LOG_JNI_CALL();
         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
-        wsurf->refresh();       
+        wsurf->refresh();
     }
-    GFX_CATCH 
+    GFX_CATCH
 }
 
-
-
-
+void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1handleSymbianWindowVisibilityChange
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aVisible)
+{
+    GFX_TRY
+    {
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
+        wsurf->handleSymbianWindowVisibilityChange(aVisible);
+    }
+    GFX_CATCH
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h	Tue Jul 06 20:36:19 2010 +0300
@@ -349,6 +349,11 @@
     virtual CFbsBitmap* getSymbianBitmap() = 0;
 #endif    
     
+    /**
+     * Switches to software rendering if the window goes invisible
+     * and back to hardware rendering when becoming visible.
+     */
+    virtual void handleSymbianWindowVisibilityChange(bool aVisible) = 0;
 };
 
 
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/graphicscontextimpl.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/graphicscontextimpl.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -305,12 +305,12 @@
             }
             else
             {
-                Q_ASSERT(false && "CopyArea image type not recognized");
+                Q_ASSERT_X(false, "Graphics", "CopyArea image type not recognized");
             }
             break;
         }
         default:
-            Q_ASSERT(false && "Surface type not recognized");
+            Q_ASSERT_X(false, "Graphics", "Surface type not recognized");
             break;
     }
 }
@@ -446,13 +446,13 @@
             }
             else
             {
-                Q_ASSERT(false && "CopyArea image type not recognized");
+                Q_ASSERT_X(false, "Graphics", "CopyArea image type not recognized");
             }
             break;
         }
         default:
         {
-            Q_ASSERT(false && "Surface type not recognized");
+            Q_ASSERT_X(false, "Graphics", "Surface type not recognized");
         }
     }
 }
@@ -489,7 +489,7 @@
             mPainter->drawPixmap(x, y, *(aImage->getPixmap()));
             break;
         default:
-            Q_ASSERT(false && "Image type not recognized");
+            Q_ASSERT_X(false, "Graphics", "Image type not recognized");
             break;
     }
 }
@@ -513,7 +513,7 @@
             mPainter->drawPixmap(QRect(aTx ,aTy, aTw, aTh), *(aImage->getPixmap()), QRect(aSx, aSy, aSw, aSh));
             break;
         default:
-            Q_ASSERT(false && "Image type not recognized");
+            Q_ASSERT_X(false, "Graphics", "Image type not recognized");
             break;
     }
 }
@@ -1074,7 +1074,7 @@
         case QPainter::CompositionMode_Xor:
             return EXor;
         default:
-            Q_ASSERT(false && "Blendingmode not recognized");
+            Q_ASSERT_X(false, "Graphics", "Blendingmode not recognized");
             return 0;
     }
 }
@@ -1162,7 +1162,7 @@
         case Qt::DashDotDotLine:
             return EStrokeDashDotDot;
         default:
-            Q_ASSERT(false && "The stroke style is not recognized");
+            Q_ASSERT_X(false, "Graphics", "The stroke style is not recognized");
             return 0;
     }
 }
@@ -1218,7 +1218,7 @@
             mPainter->setCompositionMode(QPainter::CompositionMode_Xor);
             break;
         default:
-            Q_ASSERT(false && "Blendingmode not recognized");
+            Q_ASSERT_X(false, "Graphics", "Blendingmode not recognized");
             return;
     }
 }
@@ -1300,7 +1300,7 @@
             mPen->setStyle(Qt::DashDotDotLine);
             break;
         default:
-            Q_ASSERT(false && "The stroke style is not recognized");
+            Q_ASSERT_X(false, "Graphics", "The stroke style is not recognized");
             return;
     }
     mPainter->setPen(*mPen);
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/imageloaderimpl.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/imageloaderimpl.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -44,7 +44,7 @@
     }
 
     // validate buffer
-    Q_ASSERT((mBufferData->buffer != NULL) && "Internal buffer is null when appending");
+    Q_ASSERT_X((mBufferData->buffer != NULL), "Graphics", "Internal buffer is null when appending");
 
     // check buffer capacity and increase if needed
     if (mBufferData->capacity < (mBufferData->allocation + aLength) )
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -543,7 +543,7 @@
             flip = true;
             break;
         default:
-            Q_ASSERT(false && "Transform type not recognized");
+            Q_ASSERT_X(false, "Graphics", "Transform type not recognized");
             return;
     }
 
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/surfaceimpl.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/surfaceimpl.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -138,7 +138,7 @@
         }
         default:
         {
-            Q_ASSERT(false && "TargetType not recognized");
+            Q_ASSERT_X(false, "Graphics", "TargetType not recognized");
         }
     }
     mTargetType = aType;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -130,6 +130,10 @@
     delete this;
 }
 
+void WindowSurfaceImpl::handleSymbianWindowVisibilityChange(bool /*aVisible*/)
+{
+    // Do nothing
+}
 
 // Private methods
 void WindowSurfaceImpl::createLocalSurface(int aWidth, int aHeight)
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.h	Tue Jul 06 20:36:19 2010 +0300
@@ -52,6 +52,7 @@
     virtual void refresh();
     virtual void release();
     virtual void dispose();
+    virtual void handleSymbianWindowVisibilityChange(bool aVisible);
 
 private:
     
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -13,6 +13,8 @@
 #include <QWidget>
 #include <QPainter>
 #include <QPaintEngine>
+#include <fbs.h>
+#include <coemain.h>
 #include "windowsurfaceimpl_symbian.h"
 #include "gfxlog.h"
 
@@ -21,6 +23,7 @@
 WindowSurfaceImpl::WindowSurfaceImpl(QPaintDevice* aSurface, WindowSurfaceType aType)
 : mIsBound(false),
   mBufferedRendering(false),
+  mPreserveLocalSurface(false),
   mAutoRefresh(false),
   mPaintingStarted(false)
 {
@@ -32,6 +35,7 @@
 WindowSurfaceImpl::WindowSurfaceImpl(QWidget* aWidget, bool aAutoRefresh)
 : mIsBound(false),
   mBufferedRendering(false),
+  mPreserveLocalSurface(false),
   mAutoRefresh(false),
   mPaintingStarted(false)
 {
@@ -49,11 +53,7 @@
 WindowSurfaceImpl::~WindowSurfaceImpl()
 {
     GFX_LOG_FUNC_CALL();
-    if(mMainSurface.localSurface != NULL)
-    {
-        delete mMainSurface.localSurface;
-        mMainSurface.localSurface = NULL;
-    }
+    deleteLocalSurface();
 }
 
 void WindowSurfaceImpl::beginPaint(int aX, int aY, int aWidth, int aHeight)
@@ -68,11 +68,10 @@
         mMainSurface.qSurface->beginPaint(region);
         // In case local surface was used last round
         // and we now have Qt's window surface again
-        // delete the local surface to save memory
-        if(mMainSurface.localSurface != NULL)
-        {
-            delete mMainSurface.localSurface;
-            mMainSurface.localSurface = NULL;
+        // delete the local surface to save memory,
+        if(!mPreserveLocalSurface)
+        {    
+            deleteLocalSurface();
         }
     }
     mPaintingStarted = true;
@@ -102,23 +101,27 @@
     // Bind is not allowed if beginPaint has not been called
     if(!mPaintingStarted)
     {
-        throw GfxException(EGfxErrorIllegalState, "beginPaint() not called before bind()");
+        return;
     }
     
     switch (mMainSurface.type)
     {
         case WsTypeQtImage:
         {
-            mBufferedRendering = true;
             break;
         }
-        
         case WsTypeEglSurface:
         {
             // If caller does not support EGL surface
-            // create temp buffer to be used as target and
-            // copy pixels from window surface to temp buffer
+            // create local surface to be used as target and
+            // copy pixels from window surface to local surface
             if ((aCapabilies & WsTypeEglSurface) == 0) {
+                if(!isLocalSurfaceValid())
+                {
+                    createLocalSurface();
+                }
+                mBufferedRendering = true;
+                mPreserveLocalSurface = true;
                 // TODO copy pixels from EGL surface to 
                 // QImage created here
                 
@@ -144,7 +147,15 @@
 int WindowSurfaceImpl::getType()
 {
     GFX_LOG_FUNC_CALL();
-    return mMainSurface.type;
+    if(mBufferedRendering)
+    {
+        // only supported local buffer is QImage
+        return WsTypeQtImage;
+    }
+    else
+    {
+        return mMainSurface.type;
+    }
 }
 
 QPaintDevice* WindowSurfaceImpl::getDevice()
@@ -186,9 +197,15 @@
         return;
     }
 
+    // this means that we are using localSurface
+    // as intermediate buffer for caller due to 
+    // lacking support for the actual surface type
     if (mBufferedRendering)
     {
-        // TODO draw QImage with painter to actual target
+        mPainter.begin(mMainSurface.device);
+        mPainter.drawImage(QPoint(0,0),*mMainSurface.localSurface);
+        mPainter.end();
+        mBufferedRendering = false;
     }
     else
     {
@@ -208,6 +225,42 @@
     delete this;
 }
 
+void WindowSurfaceImpl::handleSymbianWindowVisibilityChange(bool aVisible)
+{
+    if(mPaintingStarted)
+    {
+        // TODO window getting invisible in the middle of paint
+        return;
+    }
+    
+    if (!aVisible)
+    {
+        // Switch to sw rendering
+        if(!isLocalSurfaceValid()) 
+        {
+            if(mMainSurface.localSurfaceInUse) 
+            {
+                deleteLocalSurface();
+            }
+            
+            CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
+            CleanupStack::PushL(bitmap);
+            int err = bitmap->Create(TSize(mMainSurface.widget->width(), mMainSurface.widget->height()), 
+                CCoeEnv::Static()->ScreenDevice()->DisplayMode());
+            eglCopyBuffers(mEgl.display, mEgl.readSurface, bitmap);
+            mMainSurface.localSurface = new QImage(QPixmap::fromSymbianCFbsBitmap(bitmap).toImage());
+            CleanupStack::Pop(bitmap);
+            
+            mMainSurface.qSurface = NULL;
+            mMainSurface.device = mMainSurface.localSurface;
+            mMainSurface.type = WsTypeQtImage;
+            mMainSurface.localSurfaceInUse = true;
+        }
+    }
+    
+    // Otherwise updateSurfaceData() will switch back to hw rendering
+}
+
 void WindowSurfaceImpl::saveEglState()
 {
     // Some painter needs to be active on the device
@@ -239,9 +292,9 @@
 
 // Private methods
 
-void WindowSurfaceImpl::createLocalSurface(int aWidth, int aHeight)
+void WindowSurfaceImpl::createLocalSurface()
 {
-    mMainSurface.localSurface = new QImage(aWidth, aHeight, QImage::Format_ARGB32);
+    mMainSurface.localSurface = new QImage(mMainSurface.widget->width(), mMainSurface.widget->height(), QImage::Format_RGB32/*QImage::Format_ARGB32*/);
     if(mMainSurface.localSurface->isNull()) 
     {   
         throw GfxException(EGfxErrorNoMemory, "Local Surface creation failed");
@@ -281,14 +334,14 @@
     if(mPaintingStarted)
     {
         return;
-    }   
+    }
     QWindowSurface* surface = mMainSurface.widget->windowSurface();
     
     // If window surface is null it means that the widget has been 
     // sent to background and widget's window surface has been deleted, 
     // in such case create own QImage as local surface in order to support 
     // rendering in background
-    if(surface == NULL || surface == 0)
+    if(surface == NULL)
     {
         // check if we already have local surface with valid size
         if(!isLocalSurfaceValid()) 
@@ -299,7 +352,7 @@
             {
                 deleteLocalSurface();
             }
-            createLocalSurface(mMainSurface.widget->width(), mMainSurface.widget->height());
+            createLocalSurface();
             // set info
             mMainSurface.qSurface = NULL;
             mMainSurface.device = mMainSurface.localSurface;
@@ -319,7 +372,15 @@
         // delete it as it's not used anymore
         if(mMainSurface.localSurfaceInUse)
         {
-            deleteLocalSurface();
+            // in case we have needed the local surface as temp
+            // buffer for a client, it is not deleted as we most likely
+            // will need it again. In any case the local surface 
+            // stops to be the main surface and is atleast demoted to 
+            // temp surface.
+            if(!mPreserveLocalSurface)
+            {
+                deleteLocalSurface();
+            }
         }
     }
     
@@ -357,7 +418,6 @@
             break;
         default:
             throw GfxException(EGfxErrorIllegalArgument, "Unsupported widget window surface type");
-            break;
     }
     
     // release painter
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.h	Tue Jul 06 20:36:19 2010 +0300
@@ -12,7 +12,7 @@
 #define WINDOWSURFACEQT_H_
 
 #include "graphics.h"
-#include "qwindowsurface_p.h"
+#include <QtGui/private/qwindowsurface_p.h>
 
 namespace Java { namespace GFX {
 
@@ -56,6 +56,7 @@
     virtual void release();
     virtual void dispose();
     virtual CFbsBitmap* getSymbianBitmap();
+    virtual void handleSymbianWindowVisibilityChange(bool aVisible);
 
 private:
     
@@ -63,7 +64,7 @@
      * Creates and activates local off-screen buffer for rendering 
      * in background mode
      */
-    void createLocalSurface(int aWidth, int aHeight);
+    void createLocalSurface();
     
     /**
      * Deletes local surface
@@ -110,13 +111,23 @@
         WindowSurfaceType type;
         // Indicates if local surface is used
         bool localSurfaceInUse;
+        // indicates if the local surface is used as temp 
+        // surface for some client, i.e. used even though 
+        // we are not in background
+        bool localSurfaceUsedAsTemp;
+        // counter for the local surface which 
+        // prevents it being deleted in after each frame
+        // when its used as temp buffer for client
+        int tempLocalSurfaceInactivityCounter;
         surfaceData() : qSurface(NULL),
                         device(NULL), 
                         widget(NULL),
                         localSurface(NULL),
                         symbianBitmap(NULL),
                         type(WsTypeUnknown),
-                        localSurfaceInUse(false)
+                        localSurfaceInUse(false),
+                        localSurfaceUsedAsTemp(false),
+                        tempLocalSurfaceInactivityCounter(0)
         {}
     };
     
@@ -142,7 +153,11 @@
     eglData mEgl;
     QPainter mPainter;
     bool mIsBound;
+    // Indicates that the local surface is
+    // used as temporary buffer for a client
+    // that does not support current widget surface
     bool mBufferedRendering;
+    bool mPreserveLocalSurface;
     bool mAutoRefresh;
     bool mPaintingStarted;
 };
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -77,6 +77,7 @@
 #include <QLocale>
 #include <QInputContextFactory>
 #include <QChar>
+#include <QLibrary>
 
 #ifdef __SYMBIAN32__
 #include <xqservicerequest.h>
@@ -84,6 +85,7 @@
 #include <cntservicescontact.h>
 #include <qnetworkconfigmanager.h>
 #include <qnetworkconfiguration.h>
+#include <hbinputsettingproxy.h>
 #endif
 
 #include <org_eclipse_swt_internal_qt_OS.h>
@@ -167,6 +169,29 @@
             jniUtils->Throw( aJniEnv, ESwtErrorUnspecified );
             }
         args->setParent( app );
+
+// Load qttestability plugin. Normally QApplication does this, but on Symbian it fails, so we need to
+// load the plugin manually. Will be fixed to Qt 4.7.
+#if !defined(QT_NO_LIBRARY)
+        QLibrary testLib("qttestability");
+        if (testLib.load())
+            {
+            typedef void (*TasInitialize)(void);
+            TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
+#ifdef Q_OS_SYMBIAN
+            //not found so use ordinal
+            if (!initFunction)
+                {
+                initFunction = (TasInitialize)testLib.resolve("1");
+                }
+#endif
+            if (initFunction)
+                {
+                initFunction();
+                }
+            }
+#endif
+
         }
     catch(...)
         {
@@ -11304,6 +11329,27 @@
     return strKey;
     }
 
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_extension_OS_HbInputSettingProxy_1availableHwKeyboard
+    (JNIEnv* aJniEnv, jclass)
+    {
+    jint result = 0;
+#ifdef __SYMBIAN32__
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        HbInputSettingProxy* hbisp = HbInputSettingProxy::instance();
+        QList<HbKeyboardType> keyBoards;
+        hbisp->availableHwKeyboard(keyBoards);
+        if(keyBoards.size()>0)
+            {
+            result = keyBoards[0];
+            }
+        }
+    SWT_CATCH
+#endif
+    return result;
+    }
+
 //
 // SwtApplication
 //
@@ -11467,136 +11513,215 @@
 //
 
 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1new )
+#ifdef __SYMBIAN32__
+  (JNIEnv* aJniEnv, jclass)
+#else
   (JNIEnv*, jclass)
+#endif
     {
     jint handle = 0;
 #ifdef __SYMBIAN32__
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
         handle =  swtApp->initializeMobileDevice();
+        }
+    SWT_CATCH
 #endif
     return handle;    
     }
 
 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1createFlipWatch )
 #ifdef __SYMBIAN32__
-  (JNIEnv*, jclass, jint aHandle)
+  (JNIEnv* aJniEnv, jclass, jint aHandle)
 #else
-(JNIEnv*, jclass, jint)
+  (JNIEnv*, jclass, jint)
 #endif
     {
 #ifdef __SYMBIAN32__
-    CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-    mobileDevice->CreateFlipWatchL();
-#endif
-    }
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_1( "handle=%x", aHandle );
+        CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
+        mobileDevice->CreateFlipWatchL();
+        }
+    SWT_CATCH
+#endif
+    }
+    
 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1destroy )
 #ifdef __SYMBIAN32__
-  (JNIEnv*, jclass, jint aHandle)
+  (JNIEnv* aJniEnv, jclass, jint /*aHandle*/)
 #else
-(JNIEnv*, jclass, jint)
+  (JNIEnv*, jclass, jint)
 #endif
     {
 #ifdef __SYMBIAN32__
-    swtApp->destroyMobileDevice();
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_1( "handle=%x", aHandle );
+        swtApp->destroyMobileDevice();
+        }
+    SWT_CATCH
 #endif
     }
 
 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1getUserInactivityTime )
 #ifdef __SYMBIAN32__
-  (JNIEnv*, jclass, jint aHandle)
+  (JNIEnv* aJniEnv, jclass, jint aHandle)
 #else
-(JNIEnv*, jclass, jint)
+  (JNIEnv*, jclass, jint)
 #endif
     {
     jint time=0;
 #ifdef __SYMBIAN32__
-    CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-    time = mobileDevice->GetUserInactivityTime();
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_1( "handle=%x", aHandle );
+        CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
+        time = mobileDevice->GetUserInactivityTime();
+        }
+    SWT_CATCH
 #endif
     return time;
     }
 
 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1resetUserInactivityTime )
 #ifdef __SYMBIAN32__
-  (JNIEnv*, jclass, jint aHandle)
+  (JNIEnv* aJniEnv, jclass, jint aHandle)
 #else
-(JNIEnv*, jclass, jint)
+  (JNIEnv*, jclass, jint)
 #endif
     {
 #ifdef __SYMBIAN32__
-    CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-    mobileDevice->ResetUserInactivityTime();
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_1( "handle=%x", aHandle );
+        CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
+        mobileDevice->ResetUserInactivityTime();
+        }
+    SWT_CATCH
 #endif
     }
 
 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1setLight )
 #ifdef __SYMBIAN32__
-  (JNIEnv*, jclass, jint aHandle, jint aDuration)
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jint aDuration)
 #else
-(JNIEnv*, jclass, jint, jint)
+  (JNIEnv*, jclass, jint, jint)
 #endif
     {
 #ifdef __SYMBIAN32__
-    CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-    mobileDevice->SetLights(static_cast<TInt>(aDuration));
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
+        CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
+        mobileDevice->SetLights(static_cast<TInt>(aDuration));
+        }
+    SWT_CATCH
 #endif
     }
 
 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1flashLights )
 #ifdef __SYMBIAN32__
-  (JNIEnv *, jclass, jint aHandle, jint aDuration)
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jint aDuration)
 #else
-(JNIEnv*, jclass, jint, jint)
+  (JNIEnv*, jclass, jint, jint)
 #endif
     {
     jboolean flashLights = JNI_FALSE;
 #ifdef __SYMBIAN32__
-    CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-    TRAP_IGNORE(flashLights = mobileDevice->FlashBacklightL(static_cast<TInt>(aDuration)));
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
+        CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
+        TRAP_IGNORE(flashLights = mobileDevice->FlashBacklightL(static_cast<TInt>(aDuration)));
+        }
+    SWT_CATCH
 #endif
     return ( flashLights ? JNI_TRUE : JNI_FALSE );
     }
 
 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1vibration )
 #ifdef __SYMBIAN32__
-  (JNIEnv*, jclass, jint aHandle, jint aDuration)
+  (JNIEnv* aJniEnv, jclass, jint aHandle, jint aDuration)
 #else
-(JNIEnv*, jclass, jint, jint)
+  (JNIEnv*, jclass, jint, jint)
 #endif
     {
     jboolean vibraSupport = JNI_FALSE;
 #ifdef __SYMBIAN32__
-    CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-    vibraSupport = mobileDevice->Vibrate((TTimeIntervalMicroSeconds32)static_cast<TInt>(aDuration));
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
+        CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
+        vibraSupport = mobileDevice->Vibrate((TTimeIntervalMicroSeconds32)static_cast<TInt>(aDuration));
+        }
+    SWT_CATCH
 #endif
     return ( vibraSupport ? JNI_TRUE : JNI_FALSE );
     }
 
 JNIEXPORT jint JNICALL OS_NATIVE( getScreenDeviceNumber )
+#ifdef __SYMBIAN32__
+  (JNIEnv* aJniEnv, jclass)
+#else
   (JNIEnv*, jclass)
+#endif
     {
     jint screenNumber = -1;
 #ifdef __SYMBIAN32__
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
         screenNumber = SymbianUtils::GetScreenDeviceNumber();
+        }
+    SWT_CATCH
 #endif
     return screenNumber;    
     }
 
 JNIEXPORT jint JNICALL OS_NATIVE( getColorDepth )
+#ifdef __SYMBIAN32__
+  (JNIEnv* aJniEnv, jclass)
+#else
   (JNIEnv*, jclass)
+#endif
     {
     jint colorDepth = 24;
 #ifdef __SYMBIAN32__
-    colorDepth = SymbianUtils::GetColorDepth();
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        colorDepth = SymbianUtils::GetColorDepth();
+        }
+    SWT_CATCH
 #endif
     return colorDepth;    
     }
 
 JNIEXPORT jint JNICALL OS_NATIVE( getHwInputs )
+#ifdef __SYMBIAN32__
+  (JNIEnv* aJniEnv, jclass)
+#else
   (JNIEnv*, jclass)
+#endif
     {
     jint hwInputs = 0;
 #ifdef __SYMBIAN32__
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
         hwInputs = SymbianUtils::GetHwInputs();
+        }
+    SWT_CATCH
 #endif
     return hwInputs;    
     }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h	Tue Jul 06 20:36:19 2010 +0300
@@ -64,14 +64,20 @@
 
 #ifdef SWT_ENABLE_LOGGING
 
+#ifdef Q_CC_NOKIAX86
+#define SWT_FUNC_INFO (QString(__FILE__ ":") += QString::number(__LINE__)).toLatin1().data()
+#else
+#define SWT_FUNC_INFO Q_FUNC_INFO
+#endif
+
 // Logging of a JNI native method call, JNI functions have this
-#define SWT_LOG_JNI_CALL() SwtScopeLog __swtScopeLogger(Q_FUNC_INFO, SwtLogJNIEnter, SwtLogJNIExit)
+#define SWT_LOG_JNI_CALL() SwtScopeLog __swtScopeLogger(SWT_FUNC_INFO, SwtLogJNIEnter, SwtLogJNIExit)
 
 // Logging of a function call other than the above
-#define SWT_LOG_FUNC_CALL() SwtScopeLog __swtScopeLogger(Q_FUNC_INFO, SwtLogFuncEnter, SwtLogFuncExit)
+#define SWT_LOG_FUNC_CALL() SwtScopeLog __swtScopeLogger(SWT_FUNC_INFO, SwtLogFuncEnter, SwtLogFuncExit)
 
 // Logging of a scope other than function call
-#define SWT_LOG_SCOPE_CALL() SwtScopeLog __swtScopeLogger(Q_FUNC_INFO, SwtLogScopeEnter, SwtLogScopeExit)
+#define SWT_LOG_SCOPE_CALL() SwtScopeLog __swtScopeLogger(SWT_FUNC_INFO, SwtLogScopeEnter, SwtLogScopeExit)
 
 // Logging of events
 #define SWT_LOG_EVENT_1(format, field1) SwtDataLog::LogData(format, field1, SwtLogEvent)
@@ -112,14 +118,6 @@
 // Log fatal error conditions, application will automatically terminate with return value 1 when using this
 #define SWT_LOG_FATAL_1(format, field1) SwtDataLog::LogData(format, field1, SwtLogFatal)
 
-//
-// Macros for Graphics component logging
-//
-
-// Logging of a JNI native method call, JNI functions have this
-//#define GFX_LOG_JNI_CALL() SwtScopeLog __swtScopeLogger(Q_FUNC_INFO, GfxLogJNIEnter, GfxLogJNIExit)
-
-
 /**
  * A class implementing logging of entering and leaving a scope. 
  * Additional type parameter is added for doing run time variation 
@@ -128,13 +126,13 @@
 class SwtScopeLog
 {
 public:
-	SwtScopeLog( const char* aFunctionName, const SwtLogType& aEnterType, const SwtLogType& aExitType );
-	virtual ~SwtScopeLog();
+    SwtScopeLog( const char* aFunctionName, const SwtLogType& aEnterType, const SwtLogType& aExitType );
+    virtual ~SwtScopeLog();
 protected:
-	SwtScopeLog();
+    SwtScopeLog();
 private:
-	QString* mFunctionName;
-	SwtLogType mExitLogType;
+    QString* mFunctionName;
+    SwtLogType mExitLogType;
 };
 
 /**
@@ -204,44 +202,44 @@
             }
         else
             {
-		    qDebug( "%s %s %s: %s", SWT_LOG_TIMESTAMP, logComponentName, dataDescription, aLogEntry );
-		    }
+            qDebug( "%s %s %s: %s", SWT_LOG_TIMESTAMP, logComponentName, dataDescription, aLogEntry );
+            }
+        }
+        
+    template<class T1> 
+    void LogData( const char* format, const T1& data1, const SwtLogType& type )
+        {
+        QString str;
+        DoLog( str.sprintf( format, data1 ).toLatin1().data(), type );
+        }
+        
+    template<class T1, class T2>
+    void LogData( const char* format, const T1& data1, const T2& data2, const SwtLogType& type )
+        {
+        QString str;
+        DoLog( str.sprintf( format, data1, data2 ).toLatin1().data(), type );
         }
         
-	template<class T1> 
-	void LogData( const char* format, const T1& data1, const SwtLogType& type )
-		{
-		QString str;
-		DoLog( str.sprintf( format, data1 ).toLatin1().data(), type );
-		}
-		
-	template<class T1, class T2>
-	void LogData( const char* format, const T1& data1, const T2& data2, const SwtLogType& type )
-		{
-		QString str;
-		DoLog( str.sprintf( format, data1, data2 ).toLatin1().data(), type );
-		}
-		
-	template<class T1, class T2, class T3>
-	void LogData( const char* format, const T1& data1, const T2& data2, const T3& data3, const SwtLogType& type )
-		{
-		QString str;
-		DoLog( str.sprintf( format, data1, data2, data3 ).toLatin1().data(), type );
-		}
-		
-	template<class T1, class T2, class T3, class T4>
-	void LogData( const char* format, const T1& data1, const T2& data2, const T3& data3, const T4& data4, const SwtLogType& type )
-		{
-		QString str;
-		DoLog( str.sprintf( format, data1, data2, data3, data4 ).toLatin1().data(), type );
-		}
-		
-	template<class T1, class T2, class T3, class T4, class T5>
-	void LogData( const char* format, const T1& data1, const T2& data2, const T3& data3, const T4& data4, const T5& data5, const SwtLogType& type )
-		{
-		QString str;
-		DoLog( str.sprintf( format, data1, data2, data3, data4, data5 ).toLatin1().data(), type );
-		}
+    template<class T1, class T2, class T3>
+    void LogData( const char* format, const T1& data1, const T2& data2, const T3& data3, const SwtLogType& type )
+        {
+        QString str;
+        DoLog( str.sprintf( format, data1, data2, data3 ).toLatin1().data(), type );
+        }
+        
+    template<class T1, class T2, class T3, class T4>
+    void LogData( const char* format, const T1& data1, const T2& data2, const T3& data3, const T4& data4, const SwtLogType& type )
+        {
+        QString str;
+        DoLog( str.sprintf( format, data1, data2, data3, data4 ).toLatin1().data(), type );
+        }
+        
+    template<class T1, class T2, class T3, class T4, class T5>
+    void LogData( const char* format, const T1& data1, const T2& data2, const T3& data3, const T4& data4, const T5& data5, const SwtLogType& type )
+        {
+        QString str;
+        DoLog( str.sprintf( format, data1, data2, data3, data4, data5 ).toLatin1().data(), type );
+        }
     }
 
 }}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -16,6 +16,7 @@
 #include <w32std.h>
 #include <avkon.hrh>
 #include <QVariant>
+#include <QWidget>
 #include <AknDef.h>
 #include <apgtask.h>
 #include <hal.h>
@@ -43,8 +44,8 @@
 
 static const char* const EVENT_FILTER = "swt_event_filter";
 
-// Data stored to thread/dll specific Symbian thread local storage of the UI 
-// thread. 
+// Data stored to thread/dll specific Symbian thread local storage of the UI
+// thread.
 typedef struct
     {
     JavaVM* vm;
@@ -78,13 +79,13 @@
     JavaVM* javaVM = NULL;
     jint getVMStatus = aJniEnv->GetJavaVM(&javaVM);
     if(getVMStatus < 0) return KErrNoMemory;
-    
-    // Add a global reference to callback object so that in can be used from 
-    // the UI thread. 
+
+    // Add a global reference to callback object so that in can be used from
+    // the UI thread.
     jobject globalRef = aJniEnv->NewGlobalRef(aRunner);
     if(!globalRef) return KErrNoMemory;
-    
-    // Put needed data to a stucture for TLS storing that will be done later 
+
+    // Put needed data to a stucture for TLS storing that will be done later
     // in the UI thread
     SwtTlsData* data = new (std::nothrow) SwtTlsData();
     if(!data) return KErrNoMemory;
@@ -94,7 +95,7 @@
     data->initStatus = KRequestPending;
     RThread thread;
     data->initThreadId = thread.Id();
-    
+
     // Create a new thread that will be the UI thread
     TName uiThreadName(KSwtUiThreadName);
     RThread uiThread;
@@ -106,42 +107,42 @@
         delete data;
         return createStatus;
         }
-    
-    // Resume the UI thread and wait until it reports back the initialization 
+
+    // Resume the UI thread and wait until it reports back the initialization
     // status
     uiThread.Resume();
     User::WaitForRequest(data->initStatus);
-    
+
     // Launch the support thread
     if(data->initStatus == KErrNone)
         {
         startSupportThread(reinterpret_cast<TAny*>(data));
         }
-    
+
     // Return the thread initialization status
-    return data->initStatus.Int(); 
+    return data->initStatus.Int();
     }
 
 int SymbianUtils::initUiThread(JNIEnv* aJniEnv, const TInt& aUid)
     {
-    // This thread may or may not be a UI thread started by calling startUI. 
-    // It's concluded that this thread was started by startUI if TLS is set by 
-    // this DLL. If this is already the UI thread then not much initialization 
-    // is left to do. If this isn't a UI thread then everything has to be 
-    // initialized. In the latter case the stack size has already been fixed 
-    // and that might cause problems. 
+    // This thread may or may not be a UI thread started by calling startUI.
+    // It's concluded that this thread was started by startUI if TLS is set by
+    // this DLL. If this is already the UI thread then not much initialization
+    // is left to do. If this isn't a UI thread then everything has to be
+    // initialized. In the latter case the stack size has already been fixed
+    // and that might cause problems.
     TBool isUiThread = ETrue;
     SwtTlsData* data = reinterpret_cast<SwtTlsData*>(Dll::Tls());
     if(!data) isUiThread = EFalse;
-    
+
     // If this is already initialized as a UI thread by startUI the do nothing
-    // more. Otherwise continue with the initialization. 
+    // more. Otherwise continue with the initialization.
     if(isUiThread)
         {
         return KErrNone;
         }
-    
-    // Create and set the TLS data structure. 
+
+    // Create and set the TLS data structure.
     data = new (std::nothrow) SwtTlsData();
     if(!data) return KErrNoMemory;
     data->doFreeTLSInCleanupUIThread = ETrue;
@@ -150,16 +151,16 @@
     // This is the UI thread now, store its id
     RThread uiThread;
     data->uiThreadId = uiThread.Id();
-    
+
     // Get a VM pointer using the current thread context
     JavaVM* javaVM = NULL;
     jint getVMStatus = aJniEnv->GetJavaVM(&javaVM);
     if(getVMStatus < 0) return KErrNoMemory;
     data->vm = javaVM;
-    
+
     // Store the MIDlet uid we got as a parameter
     data->uid = aUid;
-    
+
     // Launch the support thread
     startSupportThread(reinterpret_cast<TAny*>(data));
 
@@ -188,7 +189,7 @@
             {
             AutoReleaseStringChars cleaner(aJniEnv, aName, javaChars);
             jsize length = aJniEnv->GetStringLength(aName);
-            
+
             TRAPD(err, buffer = HBufC16::NewL(length));
             if (err == KErrNone)
                 {
@@ -228,24 +229,62 @@
     int swtEventType = -1;
     switch (aEvent->Type())
     {
-    case KAknShutOrHideApp: //The event is received when exit from task list, 
-                            //which terminates application straight away
+    case KAknShutOrHideApp: //The event is received when exit from task list,
+        //which terminates application straight away
         swtEventType = org_eclipse_swt_internal_qt_OS_QSWTEVENT_SYSTEMSHUTDOWN;
         break;
-     case EEventUser:
-        if ( ( *reinterpret_cast<TApaSystemEvent*>( aEvent->EventData() ) ) == EApaSystemEventShutdown )
+    case EEventUser:
+        if ((*reinterpret_cast<TApaSystemEvent*> (aEvent->EventData()))
+            == EApaSystemEventShutdown)
+        {
+            // other system exit (e.g. when out of memory).
+            if (!CEikonEnv::Static()->IsSystem())
             {
-            // other system exit (e.g. when out of memory). 
-            if( !CEikonEnv::Static()->IsSystem() )
+                swtEventType
+                    = org_eclipse_swt_internal_qt_OS_QSWTEVENT_SYSTEMSHUTDOWN;
+            }
+        }
+        break;
+    case EEventWindowVisibilityChanged:
+    {
+        CCoeControl* control =
+            reinterpret_cast<CCoeControl*> (aEvent->Handle());
+        QWidget* widget = QWidget::find(control);
+        if (widget)
+        {
+            const TWsVisibilityChangedEvent* ev = aEvent->VisibilityChanged();
+            if (ev)
+            {
+                if (ev->iFlags & TWsVisibilityChangedEvent::ENotVisible)
                 {
-                swtEventType = org_eclipse_swt_internal_qt_OS_QSWTEVENT_SYSTEMSHUTDOWN;
+                    swtEventType
+                        = org_eclipse_swt_internal_qt_OS_QSWTEVENT_SYMBIAN_WINDOW_NOT_VISIBLE;
+                }
+                else if (ev->iFlags
+                    & TWsVisibilityChangedEvent::EPartiallyVisible)
+                {
+                    swtEventType
+                        = org_eclipse_swt_internal_qt_OS_QSWTEVENT_SYMBIAN_WINDOW_PARTIALLY_VISIBLE;
+                }
+                else if (ev->iFlags & TWsVisibilityChangedEvent::EFullyVisible)
+                {
+                    swtEventType
+                        = org_eclipse_swt_internal_qt_OS_QSWTEVENT_SYMBIAN_WINDOW_FULLY_VISIBLE;
                 }
             }
-        break;
+            if (swtEventType > -1)
+            {
+                object = widget;
+            }
+        }
+
+        bool res = eventFilter(object, -1, swtEventType);
+        return res;
+    }
     default:
         break;
     }
-    return eventFilter( object, -1, swtEventType);
+    return eventFilter(object, -1, swtEventType);
 }
 
 bool SymbianUtils::eventFilter(QObject* object, const TInt aSymbianType, TInt aSwtType)
@@ -261,10 +300,10 @@
                break;
            }
         }
-    
+
     if (aSwtType > -1)
         {
-        QVariant data = object->property(EVENT_FILTER);
+        QVariant data = qApp->property(EVENT_FILTER);
         if (data.isValid())
             {
             EventCallback* filter = reinterpret_cast<EventCallback*> (data.toInt());
@@ -294,13 +333,13 @@
     HAL::Get(HALData::EKeyboard, mask);
     return mask;
     }
-	
+
 CApaApplication* SymbianUtils::NewApplication()
     {
     return new SwtQtS60MainApplication;
     }
 
-void SymbianUtils::notifyThreadInitStatus(const TInt& aStatus, 
+void SymbianUtils::notifyThreadInitStatus(const TInt& aStatus,
         TThreadId aInitThreadId, TRequestStatus* aStatusPtr)
     {
     RThread initThread;
@@ -320,10 +359,10 @@
     Dll::SetTls(aTlsData);
     data->doFreeTLSInCleanupUIThread = EFalse;
 
-    // Set the thread as process critical so that the entire process will die 
-    // if the UI thread panics. 
+    // Set the thread as process critical so that the entire process will die
+    // if the UI thread panics.
     User::SetCritical(User::EProcessCritical);
-    
+
     // Create a CleanupStack
     CTrapCleanup* cleanup = CTrapCleanup::New();
     if(!cleanup)
@@ -332,11 +371,11 @@
         freeTLSData(data);
         return KErrNoMemory;
         }
-    
-    // Attach this thread to the VM to get the JNIEnv pointer. 
+
+    // Attach this thread to the VM to get the JNIEnv pointer.
     JNIEnv* env = NULL;
     void* args = NULL;
-    jint attachStatus = data->vm->AttachCurrentThread((void**)&env, args);    
+    jint attachStatus = data->vm->AttachCurrentThread((void**)&env, args);
     if(attachStatus < 0)
         {
         notifyThreadInitStatus(KErrNoMemory, data->initThreadId, &data->initStatus);
@@ -345,58 +384,58 @@
         cleanup = NULL;
         return KErrNoMemory;
         }
-    
+
     // Obtain methodID of run() of the Java callback object
     jclass runnerClass = env->GetObjectClass(data->runner);
     jmethodID mid = NULL;
     if(runnerClass) mid = env->GetMethodID(runnerClass, "run", "()V");
-    
+
     // Check if something failed
     if(!mid)
         {
         notifyThreadInitStatus(KErrNoMemory, data->initThreadId, &data->initStatus);
-        
+
         TRAP_IGNORE(data->vm->DetachCurrentThread());
         freeTLSData(data);
         delete cleanup;
         cleanup = NULL;
-        
+
         return KErrNoMemory;
         }
-    
+
     // Notify the waiting thread that initialization has completed successfully
     notifyThreadInitStatus(KErrNone, data->initThreadId, &data->initStatus);
 
     // Call run() of the Java callback object. Inside this call the UI event
-    // loop will be executed. 
+    // loop will be executed.
     TRAPD(err, env->CallVoidMethod(data->runner, mid));
     if(err != KErrNone)
         {
-        // Something did leave. All Qt APIs are trapped so it might be a Java 
+        // Something did leave. All Qt APIs are trapped so it might be a Java
         // class library that has failed. This is a fatal error and the process
         // should die.
         User::Panic(KSwtUiThreadName, 0);
         }
-    
-    // The application allowed the UI thread to exit. Clean-up and die. 
-        
+
+    // The application allowed the UI thread to exit. Clean-up and die.
+
     // Remove the reference to the runner Java object
     TRAP_IGNORE(env->DeleteGlobalRef(data->runner));
     data->runner = NULL;
-    
+
     // Detach the UI thread from the VM
     TRAP_IGNORE(data->vm->DetachCurrentThread());
     freeTLSData(data);
     delete cleanup;
     cleanup = NULL;
-    
+
     return KErrNone;
     }
 
 /*
- * Don't trust the JNI implementation to trap everything properly but let's 
+ * Don't trust the JNI implementation to trap everything properly but let's
  * always have a top-level trap also in this thread to avoid panics such as
- * EUSER-CBase 66/69.  
+ * EUSER-CBase 66/69.
  */
 TInt SymbianUtils::supportThreadEntryPoint(TAny* aParams)
     {
@@ -410,25 +449,25 @@
 
 TInt SymbianUtils::trappedSupportThreadEntryPoint(TAny* aParams)
     {
-    // Prevent the library from getting detached when the VM closes its handle. 
+    // Prevent the library from getting detached when the VM closes its handle.
     // That would lead in the destruction of the Qt's global statics in a different
-    // thread than they were created in causing problems. Keep a handle to the 
-    // library in a thread until the process terminates. 
+    // thread than they were created in causing problems. Keep a handle to the
+    // library in a thread until the process terminates.
     RLibrary libRef;
 #ifdef _DEBUG
-    TInt addLibRef = 
+    TInt addLibRef =
 #endif
     libRef.Load(KSwtDllName);
     __ASSERT_DEBUG(addLibRef == KErrNone, User::Panic(KSwtDllName, 0));
 
-    // Store JavaVM pointer and UI thread id from the thread params. 
+    // Store JavaVM pointer and UI thread id from the thread params.
     SwtTlsData* data = reinterpret_cast<SwtTlsData*>(aParams);
-    TThreadId uiThreadId = data->uiThreadId; 
+    TThreadId uiThreadId = data->uiThreadId;
     JavaVM* vm = data->vm;
-    
+
     // Try attach using the JavaVM pointer. At this point there's a Java thread
     // waiting ensuring that the VM has not closed down and the JavaVM pointer
-    // must be valid. 
+    // must be valid.
     JNIEnv* env = NULL;
     void* args = NULL;
     jint attachStatus = vm->AttachCurrentThread((void**)&env, args);
@@ -436,8 +475,8 @@
 
     // Notify the waiting Java thread that we have attached and it can continue
     notifyThreadInitStatus(attachStatus, data->initThreadId, &data->initStatus);
-    
-    // Create a rendezvous request to detect if the UI thread dies. 
+
+    // Create a rendezvous request to detect if the UI thread dies.
     RThread uiThread;
     TInt openStatus = uiThread.Open(uiThreadId);
     __ASSERT_DEBUG(openStatus == KErrNone, User::Panic(KSwtDllName, 0));
@@ -447,8 +486,8 @@
         uiThread.Rendezvous(uiThreadRendezvous);
         }
 
-    // Wait until the process dies. If the UI thread dies notify MIDP 
-    // application management software that the MIDlet should die. 
+    // Wait until the process dies. If the UI thread dies notify MIDP
+    // application management software that the MIDlet should die.
     // This is a workaround until QTBUG-5284 is resolved.
     while(ETrue)
         {
@@ -456,21 +495,23 @@
         if(vm && openStatus == KErrNone) {
             if(uiThread.ExitType() != EExitPending)
                 {
-                // Notify once and detach the thread. 
-                notifyExitCmd(env);
+                // Notify once and detach the thread.
+                notifyUIThreadExit(env);
                 vm->DetachCurrentThread();
                 env = NULL;
                 vm = NULL;
                 }
             }
         }
-    return KErrNone;
+
+    // Because the thread is waiting until the process terminates,
+    // execution will neve reach here.
     }
 
 void SymbianUtils::startSupportThread(TAny* aParams)
     {
-    // Set the thread id that the support thread will notify when it has 
-    // attached to the VM. 
+    // Set the thread id that the support thread will notify when it has
+    // attached to the VM.
     SwtTlsData* data = reinterpret_cast<SwtTlsData*>(aParams);
     RThread initThread;
     data->initThreadId = initThread.Id();
@@ -481,28 +522,29 @@
     RThread supportThread;
     TInt createStatus = supportThread.Create(supportThreadName, SymbianUtils::supportThreadEntryPoint,
             KSwtSupportThreadStackSize, NULL, aParams);
-    
-    // If the application disposed the Display and recreated it in the same 
-    // thread then support thread already exists. 
+
+    // If the application disposed the Display and recreated it in the same
+    // thread then support thread already exists.
     if(createStatus == KErrAlreadyExists) return;
-    
+
     if(createStatus == KErrNone) supportThread.Resume();
     __ASSERT_DEBUG(createStatus == KErrNone, User::Panic(KSwtSupportThreadName, 0));
-    
-    // Wait until the support thread is attached to the VM to ensure that 
-    // the VM doesn't have a chance to unload and invalidate the VM pointer. 
+
+    // Wait until the support thread is attached to the VM to ensure that
+    // the VM doesn't have a chance to unload and invalidate the VM pointer.
     User::WaitForRequest(data->initStatus);
     }
 
-void SymbianUtils::notifyExitCmd(JNIEnv* aEnv)
+void SymbianUtils::notifyUIThreadExit(JNIEnv* aEnv)
     {
     if(!aEnv) return;
-    
+    if(aEnv->ExceptionCheck() == JNI_TRUE) return;
+
     jclass clazz = aEnv->FindClass("org/eclipse/swt/internal/ExitNotificationWrapper");
     __ASSERT_DEBUG(clazz, User::Panic(KSwtUiThreadName, 0));
     if(clazz)
         {
-        jmethodID id = aEnv->GetStaticMethodID(clazz, "notifyExit", "()V");
+        jmethodID id = aEnv->GetStaticMethodID(clazz, "uiDisposed", "()V");
         __ASSERT_DEBUG(id, User::Panic(KSwtUiThreadName, 0));
         if(id)
             {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.h	Tue Jul 06 20:36:19 2010 +0300
@@ -109,7 +109,7 @@
     static TInt supportThreadEntryPoint(TAny* aParams);
     static TInt trappedSupportThreadEntryPoint(TAny* aParams);
     static void startSupportThread(TAny* aParams);
-    static void notifyExitCmd(JNIEnv* aEnv);
+    static void notifyUIThreadExit(JNIEnv* aEnv);
 };
 
 }}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java	Tue Jul 06 20:36:19 2010 +0300
@@ -16,6 +16,7 @@
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.internal.qt.CommandArranger;
+import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
 
 /**
@@ -168,7 +169,7 @@
     w.qt_signal_abstractitemview_activated_pp(row, column);
 }
 public static void qt_swt_event_widgetResized(Widget w, int widgetHandle, int oldWidth, int oldHeight, int width, int height) {
-    w.qt_swt_event_widgetResized_pp(widgetHandle, oldWidth, oldHeight, width, height);
+    w.qt_swt_event_widgetResized_pp(widgetHandle, oldWidth, oldHeight, width, height, true);
 }
 public static void register(Widget w) {
     w.register_pp();
@@ -306,6 +307,12 @@
 public static int windowFlagsFromStyle(Shell s) {
     return s.windowFlagsFromStyle();
 }
+public static void addSymbianWindowVisibilityListener(Shell s, SymbianWindowVisibilityListener listener) {
+    s.addSymbianWindowVisibilityListener_pp(listener);
+}
+public static void removeSymbianWindowVisibilityListener(Shell s, SymbianWindowVisibilityListener listener) {
+    s.removeSymbianWindowVisibilityListener_pp(listener);
+}
 /*
  * From the class Table
  */
--- a/javauis/lcdui_qt/build.linux.j2se/build.xml	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/lcdui_qt/build.linux.j2se/build.xml	Tue Jul 06 20:36:19 2010 +0300
@@ -5,13 +5,13 @@
 	<property name="target" value="1.4" />
 	<property name="source" value="1.3" />
 	
-    <property name="eswt.basedir" value="../../eswt" />
+    <property name="eswt.basedir" value="../../eswt_qt" />
     <property name="eswt.jar.location" value="${eswt.basedir}/org.eclipse.swt.qt.linux.x86.se" />
     <property name="eswt.bin.location" value="${eswt.basedir}/org.eclipse.swt.qt.linux.x86.se/release" />
     <property name="openlcdui.basedir" value=".." />
     <property name="nokiauiapi.basedir" value="../../nokiauiapi_qt" />
     <property name="openlcdui.test.basedir" value="../tsrc" />
-    <property name="eswt.jar" value="${eswt.jar.location}/eswt-qt.jar" />
+    <property name="eswt.jar" value="${eswt.jar.location}/eswtqt.jar" />
     <property name="eswt.bin" value="${eswt.bin.location}/libeswtqt.so" />
     <property name="junit.jar" value="${openlcdui.test.basedir}/junit-3.8.1.1.jar" />
     <property name="uitestutils.location" value="${eswt.basedir}/xlibutils/java" />
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009, 2010 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"
@@ -16,9 +16,11 @@
 */
 package javax.microedition.lcdui;
 
+import java.util.Enumeration;
 import java.util.Vector;
 import java.util.Timer;
 import java.util.TimerTask;
+import javax.microedition.lcdui.game.GameCanvas;
 import javax.microedition.lcdui.EventDispatcher.LCDUIEvent;
 import org.eclipse.ercp.swt.mobile.MobileShell;
 import org.eclipse.swt.SWT;
@@ -28,6 +30,8 @@
 import org.eclipse.swt.graphics.*;
 import org.eclipse.swt.internal.extension.CompositeExtension;
 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
+import org.eclipse.swt.internal.extension.MobileShellExtension;
+import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
 
 
 /**
@@ -148,6 +152,21 @@
      */
     public static final int KEY_POUND = 35;
 
+
+    private static final int GAME_CANVAS = 1;
+    private static final int NO_BACKGROUND = 1 << 1;
+    private static final int FULLSCREEN_MODE = 1 << 2;
+
+    private static final int DISABLE_TAPDETECTION = 1 << 3;
+    private static final int SUPPRESS_GAMEKEYS = 1 << 4;
+    private static final int SUPPRESS_DRAGEVENT = 1 << 5;
+    private static final int CLEANUP_NEEDED = 1 << 6;
+    private static final int REPAINT_PENDING = 1 << 7;
+    private static final int SELECTIONKEY_COMPATIBILITY = 1 << 8;
+
+    private static final int CURRENTLY_VISIBLE = 1 << 9;
+
+
     // Listeners for various events.
     private org.eclipse.swt.events.PaintListener paintListener =
         new CanvasShellPaintListener();
@@ -155,32 +174,42 @@
     private CanvasShellMouseListener mouseListener =
         new CanvasShellMouseListener();
 
+    private CanvasShellVisibilityListener shellVisibilityListener =
+        new CanvasShellVisibilityListener();
+
     // Canvas Graphics object passed to paint(Graphics g)
     private Graphics canvasGraphics;
 
     // Graphics object for transferring return values
     // from UI thread
     private Graphics tempGraphics;
-    
+
     // Graphics command buffer for this instance
-	Buffer graphicsBuffer;
-	
+    Buffer graphicsBuffer;
+
     //On Screen Keypad
     //private Composite keypadComposite;
     private CanvasKeypad onScreenkeypad;
+    private static CanvasKeypad sharedKeypad;
     private int oskHeight;
 
     // Vector of flags that a certain key was pressed but was not released.
     // Used to implement keyRepeated since eSWT does not support
     // key repeat events.
     private Vector keysPressed;
+    private int gameKeyState;
 
-    private boolean suppressGameKeys;
-    private boolean suppressDragEvent;
-    private boolean cleanupNeeded;
+    private static int objectCount;
+    private static Shell sharedShell;
+    private Shell mShell;
+    private Composite canvasComp;
+    private Label tickerLabel;
+
+    private int mode;
+    private Object modeLock;
     private Object cleanupLock;
-    private boolean noBackground;
-    private int gameKeyState;
+    private Object repaintLock;
+    private Object flushLock;
 
     private Timer timer = new Timer();
     private CanvasTimerTask timerTask;
@@ -192,35 +221,149 @@
     private int pointerDownY;
     private int twips;
     private int timeout;
-    private boolean disableTapDetection;
 
-    private boolean repaintPending;
     private int repaintX1;
     private int repaintY1;
     private int repaintX2;
     private int repaintY2;
-    private Object repaintLock;
 
-    private boolean selectionKeyCompatibility;
-    private boolean finalMode;
+
     /**
      * Constructs <code>Canvas</code> object.
      */
     public Canvas()
     {
         super(null);
+        synchronized(this)
+        {
+            objectCount++;
+        }
+
+        modeLock = new Object();
         repaintLock = new Object();
         cleanupLock = new Object();
+        flushLock = new Object();
+        setMode(GAME_CANVAS, this instanceof GameCanvas);
         construct();
         keysPressed = new Vector();
     }
 
+    /**
+     * Disposes this instance
+     * Called when finalizer is destroying this instance.
+     */
+    void dispose()
+    {
+        ESWTUIThreadRunner.update(getClass().getName(), -1);
+        ESWTUIThreadRunner.safeSyncExec(new Runnable()
+        {
+            public void run()
+            {
+                if(graphicsBuffer != null)
+                {
+                    graphicsBuffer.dispose();
+                    graphicsBuffer = null;
+                }
+
+                synchronized(this)
+                {
+                    objectCount--;
+
+                    if((objectCount == 0) || isMode(GAME_CANVAS))
+                    {
+                        mShell.dispose();
+                        sharedShell = null;
+                        sharedKeypad = null;
+                    }
+                    else
+                    {
+                        Ticker ticker = getTicker();
+                        if (ticker != null)
+                        {
+                            ticker.removeLabel(tickerLabel);
+                        }
+                        if(tickerLabel != null)
+                        {
+                            tickerLabel.dispose();
+                        }
+
+                        canvasComp.dispose();
+                    }
+                }
+            }
+        });
+    }
+
     /* (non-Javadoc)
      * @see Displayable#eswtConstructShell(int)
      */
     Shell eswtConstructShell(int style)
     {
-        return super.eswtConstructShell(style /*| SWT.RESIZE*/);
+        if(isMode(GAME_CANVAS))
+        {
+            mShell = super.eswtConstructShell(style);
+        }
+        else
+        {
+            if(sharedShell == null)
+            {
+                sharedShell = super.eswtConstructShell(style);
+            }
+            mShell = sharedShell;
+        }
+
+        // Give the Shell the maximized size already before it becomes visible
+        // so that it will return the correct size.
+        mShell.setBounds(org.eclipse.swt.widgets.Display.getCurrent().getClientArea());
+
+        // Make the Shell maximized. On Symbian it's automatically maximized
+        // so this has no effect but on other platforms explicit maximizing
+        // might be needed.
+        mShell.setMaximized(true);
+
+        return mShell;
+    }
+
+    /**
+     * Sets ticker. If ticker is added already to other canvas(es),
+     * it continues running from position where it was. Otherwise
+     * it will start running from beginning when this method returns.
+     *
+     * @param newTicker New ticker. If null, current ticker is removed.
+     */
+    public void setTicker(Ticker newTicker)
+    {
+        super.setTicker(newTicker);
+
+        ESWTUIThreadRunner.syncExec(new Runnable()
+        {
+            public void run()
+            {
+                tickerLabel.setVisible(isMode(CURRENTLY_VISIBLE));
+            }
+        });
+    }
+
+    /**
+     * Creates singleton Label instance used by Ticker.
+     * Creates tickerLabel on shell and sets the visibility of the same.
+     */
+    Label getTickerLabel()
+    {
+        tickerLabel = super.getTickerLabel();
+
+        if (!isMode(CURRENTLY_VISIBLE))
+        {
+            ESWTUIThreadRunner.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    tickerLabel.setVisible(false);
+                }
+            });
+        }
+
+        return tickerLabel;
     }
 
     /* (non-Javadoc)
@@ -229,16 +372,16 @@
     Composite eswtConstructContent(int style)
     {
         // Get JAD attribute
-        noBackground = JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
-                                                JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND);
-        if(noBackground)
+        setMode(NO_BACKGROUND, JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
+                                                JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND));
+        if(isMode(NO_BACKGROUND))
         {
             style |= SWT.NO_BACKGROUND;
         }
 
         // Get JAD attribute for S60 Selection Key Compatibility
-        selectionKeyCompatibility = JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_S60_SELECTION_KEY_COMPATIBILITY,
-                                    JadAttributeUtil.VALUE_TRUE);
+        setMode(SELECTIONKEY_COMPATIBILITY, JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_S60_SELECTION_KEY_COMPATIBILITY,
+                                    JadAttributeUtil.VALUE_TRUE));
 
         // Get JAD attribute for MIDlet Tap Detection
         String tapAttr = JadAttributeUtil.getValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_TAP_DETECTION_OPTIONS);
@@ -266,7 +409,7 @@
 
                     if((twips == 0)  && (timeout == 0))
                     {
-                        disableTapDetection = true;
+                        setMode(DISABLE_TAPDETECTION, true);
                     }
 
                     // if any one of the value is zero, set defaults
@@ -287,8 +430,23 @@
             setDefaultTapValues();
         }
 
-        Composite canvasComp = super.eswtConstructContent(style);
+        canvasComp = super.eswtConstructContent(style);
+        canvasComp.setVisible(false);
+
+        createOnScreenKeypad();
+
+        // create graphics buffer
+        graphicsBuffer = Buffer.createInstance(this, canvasComp);
 
+        return canvasComp;
+    }
+
+    /**
+     * Creates OSK(OnScreenKeypad), shared Keypad will be created for Canvas,
+     * seperate OSK will be created for each GameCanvas.
+     */
+    CanvasKeypad createOnScreenKeypad()
+    {
         // Read the on screen keypad settings from the jad attribute
         String oskAttr = JadAttributeUtil
                          .getValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_ON_SCREEN_KEYPAD);
@@ -298,16 +456,37 @@
                      .equalsIgnoreCase(JadAttributeUtil.VALUE_GAMEACTIONS)) || (oskAttr
                              .equalsIgnoreCase(JadAttributeUtil.VALUE_NAVIGATIONKEYS))))
         {
-
             // On screen keypad is required, On devices without keyboard it can
             // be either navigation keys or navigation and game keys
-            onScreenkeypad = new CanvasKeypad(this, canvasComp, oskAttr);
+
+            if(isMode(GAME_CANVAS))
+            {
+                onScreenkeypad = new CanvasKeypad(this, oskAttr);
+                return onScreenkeypad;
+            }
+
+            if(sharedKeypad == null)
+            {
+                sharedKeypad = new CanvasKeypad(this, oskAttr);
+            }
+            onScreenkeypad = sharedKeypad;
+            return onScreenkeypad;
         }
 
-        // create graphics buffer
-        graphicsBuffer = Buffer.createInstance(this, canvasComp);
+        return null;
+    }
 
-        return canvasComp;
+    Rectangle eswtLayoutShellContent()
+    {
+        Rectangle shellArea = mShell.getClientArea();
+        int oskHeight = (onScreenkeypad != null ? onScreenkeypad.getHeight() : 0);
+        int tickerHeight = (tickerLabel != null ? tickerLabel.getBounds().height : 0);
+
+        canvasComp.setBounds(0, tickerHeight,
+                              shellArea.width, shellArea.height - tickerHeight - oskHeight);
+
+        canvasComp.setFocus();
+        return canvasComp.getClientArea();
     }
 
     /* (non-Javadoc)
@@ -315,10 +494,28 @@
      */
     void eswtHandleShowCurrentEvent()
     {
+        setMode(CURRENTLY_VISIBLE, true);
+        eswtSetTitle();
+        ((MobileShell) mShell).setFullScreenMode(isMode(FULLSCREEN_MODE));
+        if(onScreenkeypad != null)
+        {
+            if(!isMode(GAME_CANVAS))
+            {
+                onScreenkeypad.setCurrentCanvas(this);
+            }
+            onScreenkeypad.setFullScreenMode(isMode(FULLSCREEN_MODE));
+        }
+        canvasComp.setVisible(true);
+        if(tickerLabel != null)
+        {
+            tickerLabel.setVisible(!isMode(FULLSCREEN_MODE));
+        }
+        addCommands();
         super.eswtHandleShowCurrentEvent();
         getContentComp().addPaintListener(paintListener);
         getContentComp().addMouseListener(mouseListener);
         getContentComp().addMouseMoveListener(mouseListener);
+        ((MobileShellExtension)getShell()).addSymbianWindowVisibilityListener(shellVisibilityListener);
     }
 
     /* (non-Javadoc)
@@ -326,10 +523,60 @@
      */
     void eswtHandleHideCurrentEvent()
     {
+        setMode(CURRENTLY_VISIBLE, false);
+        canvasComp.setVisible(false);
+        if(tickerLabel != null)
+        {
+            tickerLabel.setVisible(false);
+        }
+        removeCommands();
         super.eswtHandleHideCurrentEvent();
         getContentComp().removePaintListener(paintListener);
         getContentComp().removeMouseListener(mouseListener);
         getContentComp().removeMouseMoveListener(mouseListener);
+        ((MobileShellExtension)getShell()).removeSymbianWindowVisibilityListener(shellVisibilityListener);
+    }
+
+    /**
+     * eSWT callback to add a Command.
+     */
+    void eswtAddCommand(Command cmd) {
+        if (isMode(CURRENTLY_VISIBLE)) {
+            cmd.eswtAddESWTCommand(mShell, false);
+        }
+        if (eswtIsShown()) {
+            cmd.eswtAddCommandSelectionListener(mShell, getCommandListener());
+        }
+    }
+
+    /**
+     * Adds the commands to this Canvas.
+     * Adds all the commands of displayable to the shell.
+     */
+    void addCommands()
+    {
+        Command cmd = null;
+        for (Enumeration e = getCommands().elements(); e.hasMoreElements();)
+        {
+            cmd = (Command) e.nextElement();
+            final Command finalCommand = cmd;
+            finalCommand.eswtAddESWTCommand(mShell, false);
+        }
+    }
+
+    /**
+     * Removes the commands from this Canvas.
+     * Removes all the commands of displayable from the shell.
+     */
+    void removeCommands()
+    {
+        Command cmd = null;
+        for (Enumeration e = getCommands().elements(); e.hasMoreElements();)
+        {
+            cmd = (Command) e.nextElement();
+            final Command finalCommand = cmd;
+            finalCommand.eswtRemoveESWTCommand(mShell);
+        }
     }
 
     /**
@@ -368,14 +615,14 @@
                 // removed from the queue but repaintPending is still true. In
                 // that case it's currently being processed and we can still
                 // add to the invalid area.
-                if(!repaintPending)
+                if(!isMode(REPAINT_PENDING))
                 {
                     EventDispatcher eventDispatcher = EventDispatcher.instance();
                     LCDUIEvent event = eventDispatcher.newEvent(
                                            LCDUIEvent.CANVAS_PAINT_MIDLET_REQUEST, this);
                     event.widget = getContentComp();
                     eventDispatcher.postEvent(event);
-                    repaintPending = true;
+                    setMode(REPAINT_PENDING, true);
                 }
             }
         }
@@ -386,18 +633,39 @@
      *
      * @param mode - true switches the Canvas to the full-screen mode.
      */
-    public void setFullScreenMode(boolean mode)
+    public void setFullScreenMode(boolean aMode)
     {
-        finalMode = mode;
+        setMode(FULLSCREEN_MODE, aMode);
         ESWTUIThreadRunner.syncExec(new Runnable()
         {
             public void run()
             {
-                ((MobileShell) getShell()).setFullScreenMode(finalMode);
-                //set the CanvasKeypad to the required mode
-                if(onScreenkeypad != null)
+                if(tickerLabel != null)
                 {
-                    onScreenkeypad.setFullScreenMode(finalMode);
+                    if(isMode(FULLSCREEN_MODE))
+                    {
+                        tickerLabel.setBounds(Integer.MIN_VALUE, 0, 0, 0);
+                    }
+                    else
+                    {
+                        tickerLabel.pack();
+                        tickerLabel.setLocation(Integer.MIN_VALUE, 0);
+                    }
+
+                    if(isMode(CURRENTLY_VISIBLE))
+                    {
+                        tickerLabel.setVisible(!isMode(FULLSCREEN_MODE));
+                    }
+                }
+
+                if(isMode(CURRENTLY_VISIBLE))
+                {
+                    ((MobileShell)mShell).setFullScreenMode(isMode(FULLSCREEN_MODE));
+                    //set the CanvasKeypad to the required mode
+                    if(onScreenkeypad != null)
+                    {
+                        onScreenkeypad.setFullScreenMode(isMode(FULLSCREEN_MODE));
+                    }
                 }
             }
         });
@@ -506,7 +774,6 @@
 
     }
 
-
     /**
      * Callback to be implemented by the application to render the
      * <code>Canvas</code>. The clip region of <code>Graphics</code> object
@@ -619,7 +886,17 @@
      */
     final void initGameCanvas(boolean suppressKeys)
     {
-        this.suppressGameKeys = suppressKeys;
+        setMode(SUPPRESS_GAMEKEYS, suppressKeys);
+    }
+
+    /**
+     * Gets composite that contains Canvas content.
+     *
+     * @return Composite.
+     */
+    Composite getContentComp()
+    {
+        return canvasComp;
     }
 
     /**
@@ -627,15 +904,15 @@
      */
     final Graphics getGameBufferGraphics()
     {
-    	tempGraphics = null;
-   		ESWTUIThreadRunner.safeSyncExec(new Runnable() 
-		{
-			public void run()
-			{
-				tempGraphics =  graphicsBuffer.getGraphics();
-			}
-		});
-    	return tempGraphics;
+        tempGraphics = null;
+        ESWTUIThreadRunner.safeSyncExec(new Runnable()
+        {
+            public void run()
+            {
+                tempGraphics =  graphicsBuffer.getGraphics();
+            }
+        });
+        return tempGraphics;
     }
 
     CanvasKeypad getCanvasKeypad()
@@ -645,7 +922,7 @@
 
     boolean IsFullScreenMode()
     {
-        return finalMode;
+        return isMode(FULLSCREEN_MODE);
     }
 
     /**
@@ -679,18 +956,23 @@
     void flushGameBuffer(final int x, final int y, final int width,
                          final int height)
     {
-    	synchronized(graphicsBuffer)
+        // This is serialized with the
+        // paint callback processing
+        synchronized(flushLock)
         {
-    		ESWTUIThreadRunner.safeSyncExec(new Runnable() 
-			{
-				public void run()
-				{
-					graphicsBuffer.sync();
-					graphicsBuffer.blitToDisplay(null, getContentComp());
-				}
-            });
+            synchronized(graphicsBuffer)
+            {
+                 ESWTUIThreadRunner.safeSyncExec(new Runnable()
+                {
+                    public void run()
+                    {
+                        graphicsBuffer.sync();
+                        graphicsBuffer.blitToDisplay(null, getContentComp());
+                    }
+                });
+            }
         }
-    }	
+    }
 
     /**
      * Called by ShellListener when shell gets activated.
@@ -704,7 +986,7 @@
 
         synchronized(cleanupLock)
         {
-            cleanupNeeded = true;
+            setMode(CLEANUP_NEEDED, true);
         }
 
         LCDUIEvent event = EventDispatcher.instance().newEvent(LCDUIEvent.CANVAS_SHOWNOTIFY, this);
@@ -728,12 +1010,12 @@
     {
         super.eswtHandleResizeEvent(width, height);
         // update new bounds to graphicsBuffer
-        // this call must not be synchronized as we 
+        // this call must not be synchronized as we
         // cannot use locking in UI thread
         graphicsBuffer.setControlBounds(getContentComp());
         synchronized(cleanupLock)
         {
-            cleanupNeeded = true;
+            setMode(CLEANUP_NEEDED, true);
         }
     }
 
@@ -753,6 +1035,26 @@
         }
     }
 
+    private void setMode(final int aMode, boolean value)
+    {
+        synchronized(modeLock)
+        {
+            if(value)
+            {
+                mode |= aMode;
+            }
+            else
+            {
+                mode &= ~aMode;
+            }
+        }
+    }
+
+    private boolean isMode(final int aMode)
+    {
+        return ((mode & aMode) != 0);
+    }
+
     /*
      * UI thread calls. Paint listener of the eSWT widget.
      */
@@ -761,12 +1063,12 @@
         public void paintControl(PaintEvent pe)
         {
             // Check if we got here from buffer flush
-        	if(graphicsBuffer.isPaintingActive()) 
-        	{
-        	    graphicsBuffer.blitToDisplay(pe.gc.getGCData().internalGc, null);
-        	}
-        	else
-        	{
+            if(graphicsBuffer.isPaintingActive())
+            {
+                graphicsBuffer.blitToDisplay(pe.gc.getGCData().internalGc, null);
+            }
+            else
+            {
                 // Native toolkit is requesting an update of an area that has
                 // become invalid. Can't do anything here because the contents
                 // need to be queried from the MIDlet in another thread by
@@ -784,7 +1086,7 @@
                 event.height = pe.height;
                 event.widget = pe.widget;
                 eventDispatcher.postEvent(event);
-        	}
+            }
         }
     }
 
@@ -834,97 +1136,104 @@
      */
     private final void doPaintCallback(final LCDUIEvent event)
     {
-        // Decide the area going to be painted by the callback.
-        final int redrawNowX;
-        final int redrawNowY;
-        final int redrawNowW;
-        final int redrawNowH;
-        // Before this thread obtains the repaintLock any repaint() calls
-        // will still be adding to the invalid area that is going to be
-        // painted by this callback.
-        synchronized(repaintLock)
+        synchronized(flushLock)
         {
-            if(event.type == LCDUIEvent.CANVAS_PAINT_NATIVE_REQUEST)
-            {
-                // Merge with possibly existing repaint() requests
-                invalidate(event.x, event.y, event.width, event.height);
-            }
-            else
-            {
-                // Need to add a new event to the queue in subsequent repaint()
-                // calls.
-                repaintPending = false;
-            }
-
-            // Store the current area to be painted
-            redrawNowX = repaintX1;
-            redrawNowY = repaintY1;
-            redrawNowW = repaintX2-repaintX1;
-            redrawNowH = repaintY2-repaintY1;
-
-
-            // After releasing the lock the repaint() calls will start with
-            // new invalid area.
-            repaintX1 = repaintX2 = repaintY1 = repaintY2 = 0;
-
-            // Don't do the callback if there's nothing to paint
-            if(!((redrawNowW > 0) && (redrawNowH > 0)))
+            // It's possible that this Canvas is sent to background
+            // right after the visibility is checked here, however
+            // it is okay as in such case we just do one extra paint
+            // callback. The visibility change cannot be synchronized with
+            // this method, since it would expose implementation to deadlock
+            if(!isMode(CURRENTLY_VISIBLE))
             {
                 return;
             }
-        }
 
-        // Create instance of Graphics if not created yet
-        if(canvasGraphics == null)
-        {
-        	 ESWTUIThreadRunner.safeSyncExec(new Runnable() 
-             {
-          	    public void run()
-         	    {
-                    canvasGraphics = graphicsBuffer.getGraphics();
-                    canvasGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
-         	    }
-             });
-        }
+            // Decide the area going to be painted by the callback.
+            final int redrawNowX;
+            final int redrawNowY;
+            final int redrawNowW;
+            final int redrawNowH;
+            // Before this thread obtains the repaintLock any repaint() calls
+            // will still be adding to the invalid area that is going to be
+            // painted by this callback.
+            synchronized(repaintLock)
+            {
+                if(event.type == LCDUIEvent.CANVAS_PAINT_NATIVE_REQUEST)
+                {
+                    // Merge with possibly existing repaint() requests
+                    invalidate(event.x, event.y, event.width, event.height);
+                }
+                else
+                {
+                    // Need to add a new event to the queue in subsequent repaint()
+                    // calls.
+                    setMode(REPAINT_PENDING, false);
+                }
 
-        // Clean the background if dirty, buffer the operations.
-        synchronized(cleanupLock)
-        {
-            if(cleanupNeeded && noBackground)
-            {
-                // UI thread can change the contentArea object reference at
-                // any time. Store the object reference locally to ensure it
-                // points to the same rectangle all the time.
-                Rectangle contentArea = getContentArea();
+                // Store the current area to be painted
+                redrawNowX = repaintX1;
+                redrawNowY = repaintY1;
+                redrawNowW = repaintX2-repaintX1;
+                redrawNowH = repaintY2-repaintY1;
+
+                // After releasing the lock the repaint() calls will start with
+                // new invalid area.
+                repaintX1 = repaintX2 = repaintY1 = repaintY2 = 0;
+
+                // Don't do the callback if there's nothing to paint
+                if(!((redrawNowW > 0) && (redrawNowH > 0)))
+                {
+                    return;
+                }
+            }
 
-                canvasGraphics.setClip(contentArea.x, contentArea.y,
-                                       contentArea.width, contentArea.height);
-                canvasGraphics.cleanBackground(contentArea);
-                cleanupNeeded = false;
+            // Create instance of Graphics if not created yet
+            if(canvasGraphics == null)
+            {
+                canvasGraphics = graphicsBuffer.getGraphics();
+                canvasGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
             }
-        }
 
-        // Clip must define the invalid area
-        canvasGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
+            // Clean the background if dirty, buffer the operations.
+            synchronized(cleanupLock)
+            {
+                if(isMode(CLEANUP_NEEDED) && isMode(NO_BACKGROUND))
+                {
+                    // UI thread can change the contentArea object reference at
+                    // any time. Store the object reference locally to ensure it
+                    // points to the same rectangle all the time.
+                    Rectangle contentArea = getContentArea();
 
-        // The callback
-        paint(canvasGraphics);
+                    canvasGraphics.setClip(contentArea.x, contentArea.y,
+                                           contentArea.width, contentArea.height);
+                    canvasGraphics.cleanBackground(contentArea);
+                    setMode(CLEANUP_NEEDED, false);
+                }
+            }
 
-        // Blit frame to display
-        synchronized(graphicsBuffer) 
-        {
-            ESWTUIThreadRunner.safeSyncExec(new Runnable() 
+            // Clip must define the invalid area
+            canvasGraphics.reset();
+            canvasGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
+
+            // The callback
+            paint(canvasGraphics);
+
+            // Blit frame to display
+            synchronized(graphicsBuffer)
             {
-         	    public void run()
-        	    {
-        		    if(event.widget.isDisposed())
-        		    {
-        			    return;
-        		    }
-        		    graphicsBuffer.sync();
-        		    graphicsBuffer.blitToDisplay(null, event.widget);
-                }
-            });
+                ESWTUIThreadRunner.safeSyncExec(new Runnable()
+                {
+                     public void run()
+                    {
+                        if(event.widget.isDisposed())
+                        {
+                            return;
+                        }
+                        graphicsBuffer.sync();
+                        graphicsBuffer.blitToDisplay(null, event.widget);
+                    }
+                });
+            }
         }
     }
 
@@ -944,11 +1253,11 @@
         Logger.method(this, "doKeyPressed", String.valueOf(keyCode));
         boolean sendCallback = false;
 
-        if(!(updateGameKeyState(keyCode, true) && suppressGameKeys))
+        if(!(updateGameKeyState(keyCode, true) && isMode(SUPPRESS_GAMEKEYS)))
         {
-            if((selectionKeyCompatibility == true) && (keyCode == -5))
+            if(isMode(SELECTIONKEY_COMPATIBILITY) && (keyCode == -5))
             {
-                if(finalMode == true)
+                if(isMode(FULLSCREEN_MODE))
                 {
                     if(!((getNumCommands() > 0) && hasCommandListener()))
                     {
@@ -964,7 +1273,7 @@
                     sendCallback = true;
                 }
             }
-            else if((selectionKeyCompatibility == false) && (keyCode == -5))
+            else if((!isMode(SELECTIONKEY_COMPATIBILITY)) && (keyCode == -5))
             {
                 sendCallback = false;
             }
@@ -996,7 +1305,6 @@
         }
     }
 
-
     /*
      * UI thread calls.
      */
@@ -1004,11 +1312,11 @@
     {
         Logger.method(this, "doKeyReleased", String.valueOf(keyCode));
         boolean sendCallback = false;
-        if(!(updateGameKeyState(keyCode, true) && suppressGameKeys))
+        if(!(updateGameKeyState(keyCode, true) && isMode(SUPPRESS_GAMEKEYS)))
         {
-            if((selectionKeyCompatibility == true) && (keyCode == -5))
+            if(isMode(SELECTIONKEY_COMPATIBILITY) && (keyCode == -5))
             {
-                if(finalMode == true)
+                if(isMode(FULLSCREEN_MODE))
                 {
                     if(!((getNumCommands() > 0) && hasCommandListener()))
                     {
@@ -1024,7 +1332,7 @@
                     sendCallback = true;
                 }
             }
-            else if((selectionKeyCompatibility == false) && (keyCode == -5))
+            else if((!isMode(SELECTIONKEY_COMPATIBILITY)) && (keyCode == -5))
             {
                 sendCallback = false;
             }
@@ -1097,10 +1405,10 @@
             e.y = event.y;
             EventDispatcher.instance().postEvent(e);
 
-            if(!disableTapDetection)
+            if(!isMode(DISABLE_TAPDETECTION))
             {
                 // Supress Drag events
-                suppressDragEvent = true;
+                setMode(SUPPRESS_DRAGEVENT, true);
 
                 pointerDownX = event.x;
                 pointerDownY = event.y;
@@ -1116,7 +1424,7 @@
             int pointerUpX = event.x;
             int pointerUpY = event.y;
 
-            if(!disableTapDetection)
+            if(!isMode(DISABLE_TAPDETECTION))
             {
                 if(timerTask != null)
                 {
@@ -1126,11 +1434,11 @@
 
                 // If Timer not expired and Mouseup is withing rectangle assign
                 // PointercDown to Pinter Up
-                if(suppressDragEvent && checkWithinRect(event.x, event.y))
+                if(isMode(SUPPRESS_DRAGEVENT) && checkWithinRect(event.x, event.y))
                 {
                     pointerUpX = pointerDownX;
                     pointerUpY = pointerDownY;
-                    suppressDragEvent = false;
+                    setMode(SUPPRESS_DRAGEVENT, false);
                 }
             }
 
@@ -1144,7 +1452,7 @@
         public void mouseMove(MouseEvent event)
         {
             // Check for timeout expiration and if PointerUp falls outside the rectangle
-            if(disableTapDetection || (!suppressDragEvent) || !checkWithinRect(event.x, event.y))
+            if(isMode(DISABLE_TAPDETECTION) || (!isMode(SUPPRESS_DRAGEVENT)) || !checkWithinRect(event.x, event.y))
             {
                 LCDUIEvent e = EventDispatcher.instance().newEvent(LCDUIEvent.CANVAS_POINTERDRAGGED,
                                javax.microedition.lcdui.Canvas.this);
@@ -1243,32 +1551,22 @@
         return valid;
     }
 
-    /**
-     * Disposes this instance
-     * Called when finalizer is destroying this instance.
-     */
-    void dispose()
-    {
-        super.dispose();
-        ESWTUIThreadRunner.safeSyncExec(new Runnable()
-        {
-            public void run()
-            {
-                if(graphicsBuffer != null)
-                {
-                    graphicsBuffer.dispose();
-                    graphicsBuffer = null;
-                }
-            }
-        });
-    }
-
     class CanvasTimerTask extends TimerTask
     {
 
         public void run()
         {
-            suppressDragEvent = false;
+            setMode(SUPPRESS_DRAGEVENT, false);
+        }
+    }
+
+    class CanvasShellVisibilityListener implements SymbianWindowVisibilityListener
+    {
+        public void handleSymbianWindowVisibilityChange(Widget widget, boolean visible) {
+            if (javax.microedition.lcdui.Canvas.this.getShell() == widget)
+            {
+                graphicsBuffer.getWindowSurface().handleSymbianWindowVisibilityChange(visible);
+            }
         }
     }
 }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java	Tue Jul 06 20:36:19 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009, 2010 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"
@@ -21,11 +21,11 @@
 
 import javax.microedition.lcdui.EventDispatcher.LCDUIEvent;
 
-import org.eclipse.ercp.swt.mobile.MobileShell;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.*;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.internal.extension.CompositeExtension;
+import org.eclipse.swt.internal.extension.MobileShellExtension;
 import org.eclipse.swt.widgets.*;
 import com.nokia.mj.impl.rt.support.ApplicationUtils;
 import com.nokia.mj.impl.rt.support.ApplicationInfo;
@@ -126,7 +126,7 @@
         {
             public void run()
             {
-                shell = eswtConstructShell(SWT.SYSTEM_MODAL);
+                shell = eswtConstructShell(SWT.SHELL_TRIM | SWT.PRIMARY_MODAL);
                 eswtSetTitle();
                 contentComp = eswtConstructContent(SWT.NONE);
                 contentArea = eswtLayoutShellContent();
@@ -166,7 +166,7 @@
      */
     Shell eswtConstructShell(int style)
     {
-        return new MobileShell(ESWTUIThreadRunner.getInstance().getDisplay(), style);
+        return new MobileShellExtension(ESWTUIThreadRunner.getInstance().getDisplay(), style);
     }
 
     /**
@@ -191,6 +191,10 @@
         if(!shell.isDisposed())
         {
             eswtUpdateSizes();
+            if(ticker != null)
+            {
+                ticker.start();
+            }
             shell.addShellListener(eswtShellListener);
             shell.addDisposeListener(eswtDisposeListener);
             shell.addControlListener(eswtControlListener);
@@ -343,6 +347,7 @@
         if(tickerLabel != null)
         {
             int tickerHeight = tickerLabel.getBounds().height;
+
             contentComp.setBounds(0, tickerHeight,
                                   shellArea.width, shellArea.height - tickerHeight);
         }
@@ -620,6 +625,26 @@
     }
 
     /**
+     * Gets the commands array.
+     *
+     * @return the commands
+     */
+    Vector getCommands()
+    {
+        return commands;
+    }
+
+    /**
+     * Gets the command listener.
+     *
+     * @return the eswt command listener.
+     */
+    final EswtCommandListener getCommandListener()
+    {
+        return eswtCommandListener;
+    }
+
+    /**
      * Gets width.
      *
      * @return Width of the Displayable in pixels.
@@ -690,10 +715,13 @@
         });
         if(ticker != null)
         {
-            // Start to scroll the ticker. Ticker may be already running
-            // if it exists in some other displayable already, but
-            // calling this again wont do any harm:
-            ticker.start();
+            if(isLcduiVisible)
+            {
+                // Start to scroll the ticker. Ticker may be already running
+                // if it exists in some other displayable already, but
+                // calling this again wont do any harm:
+                ticker.start();
+            }
         }
     }
 
@@ -746,7 +774,7 @@
     /**
      * Creates singleton Label instance used by Ticker.
      */
-    private Label getTickerLabel()
+    Label getTickerLabel()
     {
         if(tickerLabel == null)
         {
@@ -859,10 +887,14 @@
 
         public void shellActivated(ShellEvent e)
         {
-            if(!isShellActive)
+            ESWTUIThreadRunner.getInstance().getDisplay()
+            .asyncExec(new Runnable()
             {
-                handleShellActivatedEvent();
-            }
+                public void run()
+                {
+                    handleShellActivatedEvent();
+                }
+            });
         }
 
         public void shellDeactivated(ShellEvent e)
@@ -907,6 +939,7 @@
      */
     class EswtControlListener implements ControlListener
     {
+
         public void controlResized(ControlEvent e)
         {
             eswtUpdateSizes();
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -20,7 +20,6 @@
 import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Button;
 import com.nokia.mid.ui.DirectGraphics;
 import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
 import com.nokia.mj.impl.nokialcdui.ItemControlStateChangeListener;
@@ -30,11 +29,7 @@
 
     private boolean eswtReturn;
 
-    /**
-      * Constant for Soft Key Label Height
-      */
-    public static final int LABEL_HEIGHT = 30;
-
+   
     static void createInvoker()
     {
         LCDUIInvoker.setInvoker(
@@ -87,32 +82,7 @@
     */
     protected String getSoftKeyLabelLocationImpl(String softKeyId)
     {
-        String SoftKeyLabelLocation = null;
-
-        Displayable disp = javax.microedition.lcdui.Display.getDisplay().getCurrent();
-
-        if((disp != null) && (disp instanceof Canvas))
-        {
-            if(((Canvas) disp).IsFullScreenMode())
-            {
-
-                if("com.nokia.softkey1.label.location".equals(softKeyId))
-                {
-                    SoftKeyLabelLocation = "0," + String.valueOf(((Canvas) disp).getHeight()) + ","
-                                           + String.valueOf((((Canvas) disp).getWidth())/2) + ","
-                                           + String.valueOf(LABEL_HEIGHT);
-                }
-                else if("com.nokia.softkey2.label.location".equals(softKeyId))
-                {
-                    SoftKeyLabelLocation = String.valueOf((((Canvas) disp).getWidth())/2) + ","
-                                           + String.valueOf(((Canvas) disp).getHeight()) + ","
-                                           + String.valueOf((((Canvas) disp).getWidth())/2) + ","
-                                           + String.valueOf(LABEL_HEIGHT);
-                }
-            }
-        }
-
-        return SoftKeyLabelLocation;
+    	return SystemPropertyUtil.getSoftKeyLabelLocationImpl(softKeyId);
     }
 
     /*
@@ -122,30 +92,7 @@
     */
     protected String getSoftKeyLabelAnchorImpl(String softKeyId)
     {
-        String SoftKeyLabelAnchor = null;
-
-        Displayable disp = javax.microedition.lcdui.Display.getDisplay().getCurrent();
-
-        if((disp != null) && (disp instanceof Canvas))
-        {
-            if(null == ((Canvas) disp).getCanvasKeypad())
-            {
-                SoftKeyLabelAnchor = String.valueOf(Graphics.TOP | Graphics.HCENTER);
-            }
-            else
-            {
-                if("com.nokia.softkey1.label.anchor".equals(softKeyId))
-                {
-                    SoftKeyLabelAnchor = String.valueOf(Graphics.TOP | Graphics.LEFT);
-                }
-                else if("com.nokia.softkey2.label.anchor".equals(softKeyId))
-                {
-                    SoftKeyLabelAnchor = String.valueOf(Graphics.TOP | Graphics.RIGHT);
-                }
-            }
-        }
-
-        return SoftKeyLabelAnchor;
+    	return SystemPropertyUtil.getSoftKeyLabelAnchorImpl(softKeyId);
     }
 
     protected Display doGetEswtDisplay()
@@ -258,46 +205,7 @@
     
     protected String doGetDynamicProperty(String key)
     {
-        if("com.nokia.key.scancode".equals(key))
-        {
-            return String.valueOf(ESWTUIThreadRunner.getLastKeyScancode());
-        }
-        else if("com.nokia.key.modifier".equals(key))
-        {
-            return String.valueOf(ESWTUIThreadRunner.getLastKeyModifier());
-        }
-        else if("com.nokia.keyboard.type".equals(key))
-        {
-            // TODO: eSWT support required
-            /*
-            No keypad (for example a touch device without keypad)   - None
-            Standard ITU-T keypad (Phone keypad with 12 keys)       - PhoneKeypad
-            QWERTY (4x12 layout)                                    - FullKeyboard
-            QWERTY (limited, 4x10 layout)                           - LimitedKeyboard4x10
-            QWERTY (limited, 3x11 layout)                           - LimitedKeyboard3x11
-            Half QWERTY layout (aka Compact QWERTY keyboard).       - HalfKeyboard
-            Custom QWERTY layout                                    - Custom
-            Unknown layout                                          - Unknown
-            */
-            return "Unknown";
-        }
-        else if("com.nokia.softkey1.label.location".equals(key))
-        {
-            return getSoftKeyLabelLocationImpl(key);
-        }
-        else if("com.nokia.softkey1.label.anchor".equals(key))
-        {
-            return getSoftKeyLabelAnchorImpl(key);
-        }
-        else if("com.nokia.softkey2.label.location".equals(key))
-        {
-            return getSoftKeyLabelLocationImpl(key);
-        }
-        else if("com.nokia.softkey2.label.anchor".equals(key))
-        {
-            return getSoftKeyLabelAnchorImpl(key);
-        }
-        return "key not supported";
+    	return SystemPropertyUtil.doGetDynamicProperty(key);
     }
 
     protected boolean doDetectCollision(Image image1, int transform1, int p1x, int p1y,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/SystemPropertyUtil.java	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2009,2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package javax.microedition.lcdui;
+
+import org.eclipse.swt.internal.extension.OS;
+
+final class SystemPropertyUtil {
+	
+	 /**
+     * Constant for Soft Key Label Height
+     */
+   public static final int LABEL_HEIGHT = 30;
+   
+   private static final int HbKeyboardNone = 0x00000000;
+   private static final int HbKeyboard12Key = 0x00000001;
+   private static final int HbKeyboardQwerty = 0x00000001|0x00010000; 
+	
+   /*
+	* This method checks if the current Displayable exists
+	* If yes, then the current Displayable is asked for the property
+	* If no, the null is returned
+	*/
+   final static String getSoftKeyLabelLocationImpl(String softKeyId)
+	{
+	   String SoftKeyLabelLocation = null;
+
+	   Displayable disp = javax.microedition.lcdui.Display.getDisplay().getCurrent();
+	   
+	   if((disp != null) && (disp instanceof Canvas))
+	   {
+		   if(((Canvas) disp).IsFullScreenMode())
+		   {
+			   
+			   if("com.nokia.softkey1.label.location".equals(softKeyId))
+			   {
+				   SoftKeyLabelLocation = "0," + String.valueOf(((Canvas) disp).getHeight()) + ","
+				   						+ String.valueOf((((Canvas) disp).getWidth())/2) + ","
+				   						+ String.valueOf(LABEL_HEIGHT);
+			   }
+			   else if("com.nokia.softkey2.label.location".equals(softKeyId))
+			   {
+				   SoftKeyLabelLocation = String.valueOf((((Canvas) disp).getWidth())/2) + ","
+				   		+ String.valueOf(((Canvas) disp).getHeight()) + ","
+				   		+ String.valueOf((((Canvas) disp).getWidth())/2) + ","
+				   		+ String.valueOf(LABEL_HEIGHT);
+			   }
+		   }
+	   }
+	   return SoftKeyLabelLocation;
+	}
+
+   /*
+    * This method checks if the current Displayable exists
+    * If yes, then the current Displayable is asked for the property
+    * If no, the null is returned
+    */
+   final static String getSoftKeyLabelAnchorImpl(String softKeyId)
+   {
+	   String SoftKeyLabelAnchor = null;
+	   
+	   Displayable disp = javax.microedition.lcdui.Display.getDisplay().getCurrent();
+	   
+	   if((disp != null) && (disp instanceof Canvas))
+	   {
+		   if(null == ((Canvas) disp).getCanvasKeypad())
+		   {
+			   SoftKeyLabelAnchor = String.valueOf(Graphics.TOP | Graphics.HCENTER);
+		   }
+		   else
+		   {
+			   if("com.nokia.softkey1.label.anchor".equals(softKeyId))
+			   {
+				   SoftKeyLabelAnchor = String.valueOf(Graphics.TOP | Graphics.LEFT);
+			   }
+			   else if("com.nokia.softkey2.label.anchor".equals(softKeyId))
+			   {
+				   SoftKeyLabelAnchor = String.valueOf(Graphics.TOP | Graphics.RIGHT);
+			   }
+		   }
+	   }
+
+	   return SoftKeyLabelAnchor;
+   }
+	    
+   final static String doGetDynamicProperty(String key)
+   {
+	   if("com.nokia.key.scancode".equals(key))
+	   {
+		   return String.valueOf(ESWTUIThreadRunner.getLastKeyScancode());
+	   }
+	   else if("com.nokia.key.modifier".equals(key))
+	   {
+		   return String.valueOf(ESWTUIThreadRunner.getLastKeyModifier());
+	   }
+	   else if("com.nokia.keyboard.type".equals(key))
+	   {
+		   // TODO: eSWT support required
+		   /*
+	            No keypad (for example a touch device without keypad)   - None
+	            Standard ITU-T keypad (Phone keypad with 12 keys)       - PhoneKeypad
+	            QWERTY (4x12 layout)                                    - FullKeyboard
+	            QWERTY (limited, 4x10 layout)                           - LimitedKeyboard4x10
+	            QWERTY (limited, 3x11 layout)                           - LimitedKeyboard3x11
+	            Half QWERTY layout (aka Compact QWERTY keyboard).       - HalfKeyboard
+	            Custom QWERTY layout                                    - Custom
+	            Unknown layout                                          - Unknown
+		    */
+		   String keyBoard="None";
+		   int type = OS.HbInputSettingProxy_availableHwKeyboard();
+		   
+		   switch(type){
+		   case HbKeyboardNone:
+			   keyBoard="None";
+			   break;
+		   case HbKeyboard12Key:
+			   keyBoard="PhoneKeypad";
+			   break;
+		   case HbKeyboardQwerty:
+			   keyBoard="FullKeyboard";
+			   break;	
+		   default:
+			   keyBoard = "None";
+		   }
+		   return keyBoard;
+	   }
+	   else if("com.nokia.softkey1.label.location".equals(key))
+	   {
+		   return getSoftKeyLabelLocationImpl(key);
+	   }
+	   else if("com.nokia.softkey1.label.anchor".equals(key))
+	   {
+		   return getSoftKeyLabelAnchorImpl(key);
+	   }
+	   else if("com.nokia.softkey2.label.location".equals(key))
+	   {
+		   return getSoftKeyLabelLocationImpl(key);
+	   }
+	   else if("com.nokia.softkey2.label.anchor".equals(key))
+	   {
+		   return getSoftKeyLabelAnchorImpl(key);
+	   }
+	   return "key not supported";
+   }
+}
--- a/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreammetadatacontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreammetadatacontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -20,7 +20,7 @@
 #define CMMAAUDIOSTREAMMETADATACONTROL_H
 
 //  INCLUDES
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 #include <MetaDataUtility.h>
 #include <MetaDataFieldContainer.h>
 #include "cmmametadatacontrol.h"
--- a/javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudioplayer.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudioplayer.h	Tue Jul 06 20:36:19 2010 +0300
@@ -20,7 +20,7 @@
 
 //  INCLUDES
 #include "cmmaemcplayerbase.h"
-#include "mmfbase.h"
+#include <mmf/common/mmfbase.h>
 
 // CONSTANTS
 
--- a/javauis/mmapi_qt/baseline/inc/cmmaaudiometadatacontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiometadatacontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -21,7 +21,7 @@
 #define CMMAAUDIOMETADATACONTROL_H
 
 //  INCLUDES
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 
 #include "cmmametadatacontrol.h"
 
--- a/javauis/mmapi_qt/baseline/inc/cmmaframepositioningcontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/cmmaframepositioningcontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -20,8 +20,8 @@
 #define CMMAFRAMEPOSITIONINGCONTROL_H
 
 // EXTERNAL INCLUDES
-#include "mmfcontroller.h"
-#include "mmfstandardcustomcommands.h"
+#include <mmf/common/mmfcontroller.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
 
 //  INTERNAL INCLUDES
 #include "cmmacontrol.h" // base class
--- a/javauis/mmapi_qt/baseline/inc/cmmamidimetadatacontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidimetadatacontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -21,7 +21,7 @@
 #define CMMAMIDIMETADATACONTROL_H
 
 //  INCLUDES
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 
 #include "cmmamidiplayer.h"
 #include "cmmametadatacontrol.h"
--- a/javauis/mmapi_qt/baseline/inc/mmmadisplay.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/mmmadisplay.h	Tue Jul 06 20:36:19 2010 +0300
@@ -202,6 +202,12 @@
     * arg 'placeholder' is used to identify the function, to be called back from UI Thread
     */ 
     virtual void CalledBackInUiThread(TInt placeholder) = 0;
+    
+    /**
+     * To check if the Display is eSWT or not 
+     */
+    virtual TBool iseSWT() = 0;
+    virtual void SetFullscreenSize(TSize& aFullscreenSize) = 0;
 };
 
 #endif // MMMADISPLAY_H
--- a/javauis/mmapi_qt/baseline/inc/tmmaparametervalidator.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/tmmaparametervalidator.h	Tue Jul 06 20:36:19 2010 +0300
@@ -21,7 +21,7 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <mmfutilities.h>
+#include <mmf/common/mmfutilities.h>
 #include <imageconversion.h>
 // STRUCTS
 
--- a/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -468,25 +468,25 @@
         }
         InternalPlayer player =null;
         /// Implementation done for java ui 3.x req
-        // in case of AnimationPlayer, we won't be using the ProtocolFactory class.
-        //
-        Enumeration plugins = iPlugIns.elements();
-        AnimationPlayerFactory apf=null;
-        while (plugins.hasMoreElements() && (player == null))
-        {
-            PlugIn temp = (PlugIn) plugins.nextElement();
-            if (temp instanceof AnimationPlayerFactory)
-            {
-                apf = (AnimationPlayerFactory) temp;
-                break;
-            }
-        }
-        if (apf!=null)
-        {
-            player=apf.createPlayer(aLocator);
-        }
+        // in case of AnimationPlayer file protocol, we won't be using the ProtocolFactory class.
+        // We need to do this kind of work out, only if it is file protocol 
+		if (new Locator(aLocator).getProtocol().equals("file")) {
+			Enumeration plugins = iPlugIns.elements();
+			AnimationPlayerFactory apf = null;
+			while (plugins.hasMoreElements() && (player == null)) {
+				PlugIn temp = (PlugIn) plugins.nextElement();
+				if (temp instanceof AnimationPlayerFactory) {
+					apf = (AnimationPlayerFactory) temp;
+					break;
+				}
+			}
+			if (apf != null) {
+				player = apf.createPlayer(aLocator);
+			}
+		}
         ////////////////////////////////////////////////////////
         // if player is still null, try to create the native player
+		System.out.println("ManagerImpl::createPlayer(String locator )locator is "+aLocator );
         if (player==null)
             player =iProtocolFactory.createPlayer(
                         new Locator(aLocator));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationObserver.java	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AnimationObserver
+*
+*/
+package com.nokia.microedition.media.animation;
+
+public interface AnimationObserver
+{
+    void animationAdvanced(long aMediaTime);
+}
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java	Tue Jul 06 20:36:19 2010 +0300
@@ -16,10 +16,15 @@
 */
 package com.nokia.microedition.media.animation;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Timer;
+import java.util.TimerTask;
 
 import javax.microedition.media.Control;
 import javax.microedition.media.MediaException;
@@ -27,6 +32,7 @@
 import javax.microedition.media.PlayerListener;
 import javax.microedition.media.protocol.DataSource;
 
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTException;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
@@ -45,14 +51,14 @@
 import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
 import com.nokia.mj.impl.utils.Logger;
 
-public class AnimationPlayer extends PlayerBase
+public class AnimationPlayer extends PlayerBase implements ESWTinitializeListener
 {
     // GIF image information, array length will be equal to the number of frames in image
     protected ImageData [] iImageData;
     // number of times we need to repeat the animation
     // by default it's value is one
     private int iTotalLoopCount=1;
-    // this holds all control related to this player
+    // HashTable object which contains all control related to this player
     private Hashtable iControls= new Hashtable();
     // Current frame index of the Animation file
     private int iFrameIndex;
@@ -91,24 +97,33 @@
     // as user can change the size of the image later, in that case too, getSourceheight and getSourceWidth
     // of VideoControl should return the actual width and height of the image
     private Point iSourceDimension;
-    // Total time taken so far to playe the animation
+    // Current dimension of the image, MIDlet developer may change the size of VideoControl
+//    private Point iCurrentVideoDimension;
+    // Total time taken so far to player the animation, it keeps updating as player moves
     private long iMediaTime;
     // Time at which, player should be stopped
     // This will set through StopTimeControl.setTime();
-    private long iStopTime=Long.MAX_VALUE;
+    // otherwise default time is Long.MAX_VALUE
+    //private long iStopTime=Long.MAX_VALUE;
+    AnimationObserver iAnimationObserver;
 
     // Display Location, of the image
     // there won't be any use of this, in case of Form(customItem)
     private Point iDisplayLocation= new Point(0,0);
-
+    // in case of Canvas(USE_DIRECT_VIDEO) , it should be invisible by default
+    // this is handled in initDisplayMode function, if the mode is USE_DIRECT_VIDEO, we are
+    // changing it to false
     private boolean iIsControlVisible=true;
+    // we keep the background pixel in it, used while taking the snapshot of the currentframe
+    private int iBackgroundPixel=-1;
+    // Total duration of the player
+    private long iDuration=TIME_UNKNOWN;
     /**
      *
      * @param ds DataSource which contains the data to be displayed
      */
     public AnimationPlayer(DataSource ds)
     {
-        System.out.println("AnimationPlayer(DataSource ds) + ");
         iPlayerListenerImpl= new PlayerListenerImpl(this);
         //TODO check if we can do it in better way
         // this is temporary solution
@@ -129,11 +144,11 @@
             {
                 e.printStackTrace();
             }
-            //iRepeatCount=imageLoader.repeatCount;
             iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
+            iBackgroundPixel= imageLoader.backgroundPixel;
         }
         populateControl();
-        System.out.println("AnimationPlayer(DataSource ds) - ");
+
     }
 
     /**
@@ -143,15 +158,13 @@
      */
     public AnimationPlayer(String locator) throws SWTException
     {
-        System.out.println("AnimationPlayer(String locator) + ");
         iPlayerListenerImpl= new PlayerListenerImpl(this);
         ImageLoader imageLoader= new ImageLoader();
         // Following line may throw SWTException
         iImageData=imageLoader.load(locator);
-        //iRepeatCount=imageLoader.repeatCount;
         iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
+        iBackgroundPixel= imageLoader.backgroundPixel;
         populateControl();
-        System.out.println("AnimationPlayer(String locator) - ");
     }
 
     /**
@@ -159,29 +172,31 @@
      */
     protected void doClose()
     {
-        iState=CLOSED;
+        // state is already changed in playerbase.close() method
+        //      changePlayerState(CLOSED);
         iPlayerListenerImpl.postEvent(PlayerListener.CLOSED, null);
     }
 
     /**
-     * Called from the PlayerBase class
+     * Called from the PlayerBase class if the Player is in pre-fetched state
+     *
      */
     protected void doDeallocate()
     {
-        // dummy implementation
+        //when the player is in pre-fetched state, calling this
+        //function should change the state of the player to RELAIZED state
+        changePlayerState(REALIZED);
     }
 
     protected void doPrefetch() throws MediaException
     {
-        iState=PREFETCHED;
+        changePlayerState(PREFETCHED);
+        iDuration= getMediaTimeForFrame(getTotalNumberFrames());
     }
 
     protected void doRealize() throws MediaException
     {
-        iState=REALIZED;
-        // this is temporary solution implement it in proper way
-        // initialize the iImage object with first frame
-        iImage=new Image(iDisplay, iImageData[0]);
+        changePlayerState(REALIZED);
     }
 
     /**
@@ -190,7 +205,7 @@
     protected void doStop() throws MediaException
     {
         // since after stopping the player the player state will move to pre-fetched state
-        iState=PREFETCHED;
+        changePlayerState(PREFETCHED);
         iPlayerListenerImpl.postEvent(PlayerListener.STOPPED, new Long(iMediaTime * 10000));
     }
 
@@ -222,19 +237,12 @@
     }
 
     /**
-     * This function will return, total time in microseconds this player can be played
+     * This function will return total time in microseconds, this player can be played
      */
     public long getDuration()
     {
         closeCheck();
-        long time = TIME_UNKNOWN;
-        int totalNoOfFrames = iImageData.length;
-        for (int i = 0; i < totalNoOfFrames; i++)
-        {
-            time += iImageData[i].delayTime;
-        }
-        // Since we have to return it in microsecond multiply it with 1000;
-        return time * 10000;
+        return iDuration;
     }
 
     /**
@@ -242,7 +250,8 @@
      */
     public long getMediaTime()
     {
-        // Since we have to return it in microsecond multiply it with 1000;
+        closeCheck();
+        // Since we have to return it in microsecond multiply it with 10000;
         return iMediaTime*10000;
     }
 
@@ -267,60 +276,43 @@
     public void start() throws MediaException
     {
         final String DEBUG_STR = "AnimationPlayer::start()";
-        final long inTime= System.currentTimeMillis();
-        // Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR + "++++++++");
-        System.out.println(DEBUG_STR + "+++");
+        final long inTime = System.currentTimeMillis();
+
         prefetch();
         // Only prefetched player may be started. If player is already started
         // this method returns silently.
         if (getState() == PREFETCHED)
         {
-            initialize();
-            iState = STARTED;
+            //initialize();
+            changePlayerState(STARTED);
             Thread thread = new Thread("Animation")
             {
                 int loopCount = iCurrentLoopCount;
                 GC gc = null;
-
                 public void run()
                 {
+                    //changePlayerState(STARTED);
                     final int noOfFrames = iImageData.length;
-                    while (iFrameIndex < noOfFrames &&
-                            (iRepeatForeEver || (loopCount < iTotalLoopCount))&&
-                            (iState == STARTED))
+                    while (iState == STARTED)
                     {
                         final int delayTimeForNextFrame = iImageData[iFrameIndex].delayTime;
-                        // if stop time has become more than the media time
-                        // TODO This solution may not give the accurate result, if the delay
-                        // between two frames is grater than 1 second.
-                        // Do we need to implement the TimerTask only?
-                        if (iMediaTime > iStopTime)
+                        // Since we are going to display first frame, notify all
+                        // PlayerListener that Player has started
+                        if (iFrameIndex == 0)
                         {
                             iPlayerListenerImpl.postEvent(
-                                PlayerListener.STOPPED_AT_TIME, new Long(
+                                PlayerListener.STARTED, new Long(
                                     iMediaTime * 10000));
-                            break;
                         }
-
                         if (iDisplay != null)
                         {
-                            iDisplay.asyncExec(new Runnable()
+                            iDisplay.syncExec(new Runnable()
                             {
                                 public void run()
                                 {
-                                    System.out.println(DEBUG_STR+"asynchronous block +++");
-                                    // Since we are going to display first frame, notify all
-                                    // PlayerListener that Player has started
-                                    if (iFrameIndex == 0)
-                                    {
-                                        iPlayerListenerImpl.postEvent(
-                                            PlayerListener.STARTED, new Long(
-                                                iMediaTime * 10000));
-                                    }
                                     if (gc == null)
                                         gc = new GC(iImage);
-                                    Image tempImage = new Image(iDisplay,
-                                                                iImageData[iFrameIndex]);
+                                    Image tempImage = new Image(iDisplay,iImageData[iFrameIndex]);
                                     gc.drawImage(tempImage, 0, 0);
                                     tempImage.dispose();
                                     iFrameIndex = (iFrameIndex + 1) % noOfFrames;
@@ -328,55 +320,14 @@
                                     {
                                         iControl.redraw();
                                     }
-                                    // update the mediaTime, as Animation
-                                    // progress
                                     iMediaTime += delayTimeForNextFrame;
-                                    // If imageIndex becomes zero it means, all frames
-                                    // has been displayed
-                                    // So increase the loopCount
-                                    if (iFrameIndex == 0)
-                                    {
-                                        // send the END_OF_MEDIA event to all
-                                        // listener
-                                        iPlayerListenerImpl.postEvent(
-                                            PlayerListener.END_OF_MEDIA,
-                                            new Long(iMediaTime * 10000));
-                                        loopCount++;
-                                        // set iMediaTime to 0
-                                        iMediaTime = 0;
-                                    }
-                                    System.out.println(DEBUG_STR+"asynchronous block ---");
                                 }
                             });
                         }
-                        else
+                        else// if the initDisplayMode is not called yer
                         {
-                            System.out.println(DEBUG_STR+"InitDisplaymode has not been called yet");
-                            if (iFrameIndex == 0)
-                            {
-                                iPlayerListenerImpl.postEvent(
-                                    PlayerListener.STARTED, new Long(
-                                        iMediaTime * 10000));
-                            }
-                            // This else block will execute if the initDisplayMode hasn't been called yet
-                            // check if initDisplayMode has been called
-                            initialize();
                             iFrameIndex = (iFrameIndex + 1) % noOfFrames;
                             iMediaTime += delayTimeForNextFrame;
-                            // post EOM event
-                            if (iFrameIndex == 0)
-                            {
-                                // send the END_OF_MEDIA event to all
-                                // listener
-                                iPlayerListenerImpl.postEvent(
-                                    PlayerListener.END_OF_MEDIA, new Long(
-                                        iMediaTime * 10000));
-                                loopCount++;
-                                // since player is again going to start from
-                                // the first frame
-                                // so media time should be set to zero
-                                iMediaTime = 0;
-                            }
                         }
                         try
                         {
@@ -387,30 +338,53 @@
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                         }
-                        System.out.println(DEBUG_STR+"while lopp ---");
+                        // post EOM event
+                        if (iFrameIndex == 0)
+                        {
+                            loopCount++;
+                            if (!(iRepeatForeEver || (loopCount < iTotalLoopCount)))
+                            {
+                                // when this loop is getting braked, we need to change the state to pre-fetched
+                                //TODO Player should change it's state in doStop();
+                                changePlayerState(PREFETCHED);
+                            }
+                            // send the END_OF_MEDIA event to all
+                            // listener
+                            iPlayerListenerImpl.postEvent(
+                                PlayerListener.END_OF_MEDIA,
+                                new Long(iMediaTime * 10000));
+                            iMediaTime = 0;
+                        }
+                        if (iAnimationObserver!=null)
+                        {
+                            iAnimationObserver.animationAdvanced(iMediaTime*10000);
+                        }
                     }// end of while loop
                     iCurrentLoopCount = loopCount;
                     // Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo, DEBUG_STR
-                    System.out.println(DEBUG_STR
-                                       + "Came out side the while loop " + iState
-                                       + " iFrameIndex " + iFrameIndex + " loopCount "
-                                       + loopCount);
+
                 }
             };
             thread.start();
         }
         // Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR + "-");
-        System.out.println(DEBUG_STR+" Total time taken:> "+(System.currentTimeMillis()-inTime)+" ---");
     }
 
     /**
-     * This function is also being called from VideoControl class,
-     * since on each repaint event, control is getting disposed and created each time
+     * State of the player should be changed from this function only.
+     * @param aState
+     */
+    private synchronized void  changePlayerState(int aState)
+    {
+        iState=aState;
+    }
+    /**
+     * On each repaint event, control is getting disposed and created each time,
+     * So we need to call each time the Control is available
      * @param aControl
      */
-    void addPaintListener(org.eclipse.swt.widgets.Control aControl)
+    private void addPaintListener(org.eclipse.swt.widgets.Control aControl)
     {
-        System.out.println("AnimationPlayer::addPaintListener +++");
         iControl=aControl;
         if (iControl != null)
         {
@@ -422,8 +396,6 @@
                     {
                         public void paintControl(PaintEvent pe)
                         {
-                            //System.out.println("AnimationPlayer::addpaintListener paintControl "+ iImage+" iIsControlVisible "+iIsControlVisible+"current time is "+System.currentTimeMillis());
-                            System.out.println("AnimationPlayer::addPaintListener::PaintListener::paintControl");
                             if (iImage != null && iIsControlVisible)
                             {
                                 pe.gc.drawImage(iImage, iDisplayLocation.x,
@@ -434,7 +406,6 @@
                 }
             });
         }
-        System.out.println("AnimationPlayer::addPaintListener ---");
     }
 
 
@@ -530,35 +501,63 @@
      */
     public long setMediaTime(long aNow) throws MediaException
     {
-        final String DEBUG_STR="AnimationPlayer::setmediaTime()";
         long now = super.setMediaTime(aNow);
-        int totalFrames = iImageData.length;
-        int totalTime = 0;
-        for (int i = 0; i < totalFrames; i++)
+        if (iDuration == TIME_UNKNOWN)
+            iDuration=getMediaTimeForFrame(getTotalNumberFrames());
+        if (now >= iDuration)
         {
-            totalTime += iImageData[i].delayTime;
-            if (totalTime*10000 >= now)
-            {
-                iFrameIndex=i;
-                break;
-            }
+            iFrameIndex=getTotalNumberFrames()-1;
+            iMediaTime = iDuration;
         }
-        // we need to update the iMediaTime as well
-        iMediaTime=totalTime;
-        return totalTime * 10000;
+        else
+        {
+            iFrameIndex = findFrame(now);
+            iMediaTime= getMediaTimeForFrame(iFrameIndex);
+        }
+        return iMediaTime ;
     }
     //////////////////////////////////////////////////////////////////////////////////////
     // Following functions are for internal use, and not exposed to MIDlet developer//////
     /////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Before calling this function check frameIndex is in range or not, from 0 to last index
+     */
+    long getMediaTimeForFrame(int aFrameIndex)
+    {
+        long time=0;
+        for (int i=0; i < aFrameIndex; i++)
+        {
+            time+=iImageData[i].delayTime;
+        }
+        return time*10000;
+    }
+
+    /**
+     * Utility function to calculate the framNumber
+     * @param aTime
+     * @return
+     */
+    int findFrame(long aTime)
+    {
+        long time=0;
+        int frameIndex=0;
+        if (aTime > iDuration)
+            return -1;
+        else if (aTime==0)
+            return 0;
+        int totalNoOfFrame= getTotalNumberFrames();
+        while (time *10000 < aTime && frameIndex < totalNoOfFrame)
+        {
+            time += iImageData[frameIndex++].delayTime;
+        }
+        return frameIndex;
+    }
     /**
      * This function is responsible for creating all controls and adding it into Controls hashtable.
      */
     private void populateControl()
     {
-//      VideoControl videoControl = new VideoControl(this);
-//      FramePositioningControl fpc = new FramePositioningControl(this);
-//      StopTimeControl stc = new StopTimeControl(this);
-//      RateControl rc = new RateControl(this);
         // there are four control provided by AnimationPlayer
         // adding all one by one to the controlList(iControls)
         addControl(new VideoControl(this), fVideoControl);
@@ -568,35 +567,25 @@
     }
 
     /**
-     * This function initialize iControl and iDisplay object if it is null,
-     * otherwise return immediately.
-     *
-     * In case of Canvas, eSWT control will be returned immediately from VideoControl(vc.getControl()),
-     * but in case of CustomItem we need to keep polling, eSWT doesn't return the control for CustomItem
-     * until CustomItem is appended to Form.
+     *  Notified when the display object of ESWT is created
+     *  It is getting created, when initDisplayMode of VideoControl class is called.
      */
-
-    private void initialize()
+    public void notifyDisplayAvailable(Display aDisplay)
     {
-        System.out.println("AnimationPlayer::initialize +++");
-        if (iControl == null || iDisplay == null)
-        {
-            VideoControl vc = (VideoControl) getControl(fVideoControl);
-            iDisplay = vc.getiDisplay();
-            iControl=vc.getControl();
-            addPaintListener(iControl);
-            System.out.println("AnimationPlayer::initialize iDsplay "+iDisplay+" iControl "+iControl);
-            // in case of CustomItem,
-//          while ((iControl = vc.getControl()) == null) {
-//              try {
-//                  Thread.sleep(100);
-//              } catch (InterruptedException e) {
-//                  e.printStackTrace();
-//              }
-//          }
-        }
-        System.out.println("AnimationPlayer::initialize ---");
+        iDisplay= aDisplay;
+        iImage=new Image(iDisplay, iImageData[0]);
     }
+    /**
+     * Notified when the control is available
+     * @param aControl(this is eSWTControl )
+     */
+    public void notifyControlAvailable(org.eclipse.swt.widgets.Control aControl)
+    {
+        iControl=aControl;
+        addPaintListener(iControl);
+    }
+
+
 
     /**
      * This function will be called from setDisplaySize(int width, int height) of animation/VideoControl class
@@ -611,7 +600,7 @@
         {
             iImageData[i]=iImageData[i].scaledTo(width, height);
         }
-        iImage=new Image(iDisplay, iImageData[0]);
+        iImage=new Image(iDisplay, iImageData[iFrameIndex]);
     }
 
     /**
@@ -629,10 +618,22 @@
      * @param format
      */
     // This function is not implemented fully
-    javax.microedition.lcdui.Image getCurrentFrame(String format)
+    byte[] getCurrentFrame(String format)
     {
-        javax.microedition.lcdui.Image currentFrameImage= LCDUIInvoker.createLcduiImage(iImage);
-        return currentFrameImage;
+        // create a new ImageLoader object
+        ImageLoader il= new ImageLoader();
+        // create a ImageData array of length 1 and assign it to 'data' member of ImageLoader
+        il.data= new ImageData[1];
+        int currentFrameIndex= iFrameIndex;
+        // assign the current frame ImageData to image
+        il.data[0]= iImageData[currentFrameIndex];
+        il.logicalScreenWidth  = iImageData[currentFrameIndex].width;
+        il.logicalScreenHeight = iImageData[currentFrameIndex].height;
+        il.backgroundPixel= iBackgroundPixel;
+        ByteArrayOutputStream baos= new ByteArrayOutputStream();
+        il.save(baos, SWT.IMAGE_PNG);
+        //il.save(baos, SWT.IMAGE_GIF);
+        return baos.toByteArray();
     }
 
     /**
@@ -640,27 +641,25 @@
      * Called from VideoControl to get the image width and height,
      * so that Item will be created exactly of same dimension
      */
-    org.eclipse.swt.graphics.Point getImageDimension()
+    Point getImageDimension()
     {
+//      return iCurrentVideoDimension;
         return new org.eclipse.swt.graphics.Point(iImageData[0].width, iImageData[0].height);
     }
 
-    /**
-     * This returns the imageData array,
-     * called from FramePositioningControl class to calculate the frame time
-     */
-    ImageData[] getImageData()
+
+    int getTotalNumberFrames()
     {
-        return iImageData;
+        return iImageData.length;
     }
-
     /**
      *
      * @param aDisplayLocation x,y coordinate where image is to be displayed
      */
     void setDisplayLocation(int aX, int aY)
     {
-        iDisplayLocation=new Point(aX,aY);
+        iDisplayLocation.x=aX;
+        iDisplayLocation.y=aY;
     }
 
     /**
@@ -677,6 +676,7 @@
     Point getSourceDimension()
     {
         return iSourceDimension;
+        //return new Point(iImageData[0].width, iImageData[0].height);
     }
 
     /**
@@ -719,7 +719,7 @@
                 // following line will break the while loop in start method
                 // Objective here is to pause the animation, if it is in started state
                 // also we do not need to notify to the playerListener that player has been stopped or paused
-                iState=PREFETCHED;
+                changePlayerState(PREFETCHED);
             }
             else
             {
@@ -742,19 +742,30 @@
     }
 
     /**
-     * @param iStopTime the iStopTime to set
-     */
-    void setiStopTime(long iStopTime)
-    {
-        this.iStopTime = iStopTime;
-    }
-
-    /**
      * @param iIsControlVisible the iIsControlVisible to set
      */
     void setiIsControlVisible(boolean iIsControlVisible)
     {
         this.iIsControlVisible = iIsControlVisible;
     }
+    /**
+     * Called from
+     */
+    void postEvent(long aMediaTime)
+    {
+        changePlayerState(PREFETCHED);
+        iPlayerListenerImpl.postEvent(PlayerListener.STOPPED_AT_TIME, new Long(
+                                          aMediaTime));
+    }
+
+    /**
+     * @param aAnimationObserver the iAnimationObserver to set
+     */
+    void setiAnimationObserver(AnimationObserver aAnimationObserver)
+    {
+        this.iAnimationObserver = aAnimationObserver;
+    }
+
+
 }
 
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java	Tue Jul 06 20:36:19 2010 +0300
@@ -27,7 +27,6 @@
 import org.eclipse.swt.SWTException;
 
 import com.nokia.microedition.media.InternalPlayer;
-import com.nokia.microedition.media.Locator;
 import com.nokia.microedition.media.PlugIn;
 import com.nokia.mj.impl.utils.Logger;
 
@@ -36,21 +35,17 @@
  * implements PlugIn interface which is used from ManagerImpl.
  * Entire Animation playing is written using eSWT API.
  * There is no call to native.
- *
  */
 public class AnimationPlayerFactory implements PlugIn
 {
 
     // Used to recognize supported locators.
     // private static final String ANIMATION_FILE_EXTENSION = ".gif";
-
     // Used to get supported protocols and content type.
     private static final String ANIMATION_CONTENT_TYPE = "image/gif";
     private static final String ANIMATION_HTTP_PROTOCOL = "http";
     private static final String ANIMATION_HTTPS_PROTOCOL = "https";
     private static final String ANIMATION_FILE_PROTOCOL = "file";
-    // There is no need to read the first 6 byte and compare it with following string
-//  private static final String ANIMATION_GIF_HEADER="GIF89a";
 
     /**
      * From PlugIn
@@ -73,12 +68,7 @@
             {
                 player = new AnimationPlayer(aDataSource);
             }
-//          else{
-//              throw new MediaException("Content type not supported: " + contentType);
-//          }
         } //Since it was not possible to identify the player from content type, identify it from it's header
-        // Is there any need to create player through Locator?
-
         else
         {
             // We need only 6 bytes to identify whether it's GIF image data or not.
@@ -94,7 +84,7 @@
             catch (SWTException e)
             {
                 // Simply ignore the exception
-                e.printStackTrace();
+                //e.printStackTrace();
             }
         }
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"-");
@@ -102,9 +92,9 @@
     }
 
     /**
-     * @param locator
-     * @return Interplayer object
-     * @throws IOException
+     * @param locator, path of the GIF file.
+     * @return InternalPlayer object
+     * @throws IOException if it is not possible to read the file from location specified
      */
     public InternalPlayer createPlayer(String locator) throws IOException
     {
@@ -117,13 +107,23 @@
         }
         catch (SWTException e)
         {
-            // For all cases ImageLoader.load throws only SWTException
-            // here we are finding why it has throws this Exception
-            // if it is IOException we need to pass it to caller
-            if (e.getCause().toString().indexOf((IOException.class.getName()))!=-1)
-                throw new IOException();
+            Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+" SWTException thrown "+e);
+            e.printStackTrace();
+            if (e.throwable instanceof java.io.IOException)
+            {
+                // TODO remove hardcoding for checking whether it is permission
+                // related exceptioon
+                if (e.getCause().toString().indexOf("Permission") != -1)
+                    // TODO Copied the exception message from
+                    throw new SecurityException(
+                        "Application not authorized to access the restricted API");
+                // For all other remaining IOException throw it as it is
+                else
+                    // if
+                    // (e.getCause().toString().indexOf((IOException.class.getName()))!=-1)
+                    throw new IOException();
+            }
             // if exception is due to any other reason, just ignore it
-            e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"-");
         return player;
@@ -135,6 +135,7 @@
      */
     public String[] getSupportedContentTypes(String aProtocol)
     {
+        //if aProtocol is not supported, we need to return the string array of zero length
         String[] types = new String[0];
         if (aProtocol == null || aProtocol.equals(ANIMATION_HTTP_PROTOCOL)
                 || aProtocol.equals(ANIMATION_HTTPS_PROTOCOL)
@@ -151,6 +152,7 @@
      */
     public String[] getSupportedProtocols(String aContentType)
     {
+        // if aContentType is not supported, we need to return the string array of zero length
         String[] protocols = new String[0];
         if ((aContentType == null)
                 || aContentType.equals(ANIMATION_CONTENT_TYPE))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/ESWTinitializeListener.java	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ESWTinitializeListener
+*
+*/
+package com.nokia.microedition.media.animation;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+
+public interface ESWTinitializeListener
+{
+    void notifyDisplayAvailable(Display aDisplay);
+    void notifyControlAvailable(Control aControl);
+}
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/FramePositioningControl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/FramePositioningControl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -28,8 +28,7 @@
 public class FramePositioningControl extends ControlImpl implements
         javax.microedition.media.control.FramePositioningControl
 {
-
-    private ImageData[] iImagedata;
+    private int iTotalNoOfFrames;
 
     /**
      * Constructor of this Control
@@ -39,7 +38,7 @@
     FramePositioningControl(Player aPlayer)
     {
         iPlayer=aPlayer;
-        iImagedata=((AnimationPlayer)iPlayer).getImageData();
+        iTotalNoOfFrames=((AnimationPlayer)iPlayer).getTotalNumberFrames();
     }
 
     /**
@@ -49,18 +48,11 @@
     public long mapFrameToTime(int aFrameNumber)
     {
         checkState();
-        long time=0;
-        int totalNoOfFrames=iImagedata.length;
+        int totalNoOfFrames=iTotalNoOfFrames;
         // if invalid parameter is passed
-        if (aFrameNumber<0 || aFrameNumber>totalNoOfFrames)
+        if (aFrameNumber < 0 || aFrameNumber > totalNoOfFrames)
             return -1;
-        for (int i=0; i<totalNoOfFrames; i++)
-        {
-            if (i==aFrameNumber)
-                break;
-            time+=iImagedata[i].delayTime;
-        }
-        return time*10000;
+        return ((AnimationPlayer)iPlayer).getMediaTimeForFrame(aFrameNumber);
     }
 
     /**
@@ -74,19 +66,7 @@
     public int mapTimeToFrame(long aMediaTime)
     {
         checkState();
-        int frameNumber=-1;
-        int totalNoOfFrames=iImagedata.length;
-        long time=0;
-        for (int i=0; i<totalNoOfFrames; i++)
-        {
-            if (time > aMediaTime)
-            {
-                frameNumber=i-1;
-                break;
-            }
-            time+=iImagedata[i].delayTime*10000;
-        }
-        return frameNumber;
+        return ((AnimationPlayer)iPlayer).findFrame(aMediaTime);
     }
 
     /**
@@ -107,25 +87,19 @@
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR + "+");
         checkState();
         int frameNumber = aFrameNumber;
-        int totalNoOfFrames = iImagedata.length;
+        int totalNoOfFrames = iTotalNoOfFrames;
         if (aFrameNumber < 0)
         {
             frameNumber = 0;
         }
-        else
+        else if (aFrameNumber >= totalNoOfFrames)
         {
-            if (aFrameNumber > totalNoOfFrames)
-            {
-                frameNumber = totalNoOfFrames;
-            }
+            frameNumber = totalNoOfFrames-1;
         }
-        long mediaTime = mapFrameToTime(frameNumber);
-        //if the frame number is equal to total number of frames, we will seek to last frame
-        // because it's array index, so last index will be total length -1
-        frameNumber=(frameNumber == totalNoOfFrames) ? (frameNumber-1) : frameNumber;
+        long mediaTime = ((AnimationPlayer)iPlayer).getMediaTimeForFrame(frameNumber);
         try
         {
-            long mediaTime1 = iPlayer.setMediaTime(mediaTime);
+            iPlayer.setMediaTime(mediaTime);
         }
         catch (MediaException e)
         {
@@ -154,28 +128,24 @@
      */
     public int skip(int aFramesToSkip)
     {
-        final String DEBUG_STR = "FramePositionControl::skip";
-        Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"+");
+//        final String DEBUG_STR = "FramePositionControl::skip";
+        //Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"+");
         // check the state of the player, if it closed throw exception
         checkState();
-        int frameNumberToJump;
-        if (aFramesToSkip < 0)
+        //int frameNumberToJump;
+        int currentFrameIndex=((AnimationPlayer) iPlayer).getiFrameIndex();
+        //If user provides the argument as Integer.max, adding any positive value to it will make it negative
+        //Since a player can't be skipped more than the total number of frames, here we are making it restrictive.
+        if (aFramesToSkip > iTotalNoOfFrames)
         {
-            frameNumberToJump = 0;
+            aFramesToSkip = iTotalNoOfFrames;
         }
-        // storing it in local variable, so that current frame index variable will be
-        // consistent throughout this function, calling to getiFrameIndex(), each time
-        // may return the different value.
-        int currentFrameIndex=((AnimationPlayer) iPlayer).getiFrameIndex();
         // we are going to utilize the seek function here
         // just get the current frame index from player and
         // add it to the number of frame to skip
-        frameNumberToJump = currentFrameIndex + aFramesToSkip;
-        //if the frameNumberToJump > total no of frames, then skip to the last frame only
-        frameNumberToJump =frameNumberToJump > iImagedata.length ? iImagedata.length-1 : frameNumberToJump;
-        seek(frameNumberToJump);
-        Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"-");
-        return frameNumberToJump - currentFrameIndex;
+        int seeked=seek(currentFrameIndex + aFramesToSkip);
+        int numberOfFrameSkipped=seeked-currentFrameIndex;
+        return numberOfFrameSkipped;
     }
 
 }
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/StopTimeControl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/StopTimeControl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -28,7 +28,7 @@
  * <p>
  */
 public class StopTimeControl extends ControlImpl implements
-        javax.microedition.media.control.StopTimeControl
+        javax.microedition.media.control.StopTimeControl, AnimationObserver
 {
 
     private long iStopTime=RESET;
@@ -38,6 +38,7 @@
     public StopTimeControl(Player aPlayer)
     {
         this.iPlayer=aPlayer;
+        ((AnimationPlayer)iPlayer).setiAnimationObserver(this);
     }
 
     /**
@@ -101,6 +102,19 @@
                 "Player is STARTED or setStopTime() is already called successfully");
         }
         iStopTime = aStopTime;
-        ((AnimationPlayer)iPlayer).setiStopTime(iStopTime);
+        //((AnimationPlayer)iPlayer).setiStopTime(iStopTime);
+    }
+
+    /**
+     * Method of AnimationObserver
+     */
+    public void animationAdvanced(long aMediaTime)
+    {
+        if (aMediaTime >= iStopTime)
+        {
+            iStopTime=RESET;
+            ((AnimationPlayer)iPlayer).postEvent(aMediaTime);
+
+        }
     }
 }
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -96,6 +96,7 @@
     // Global??? yes because we need to remove it from player listener, while finalizer will be called
     private VideoItem iVideoItem;
 
+    ESWTinitializeListener iESWTinitializeListener;
 
     /**
      * Constructor of VideoControl
@@ -104,6 +105,7 @@
     public VideoControl(Player player)
     {
         this.iPlayer=player;
+        iESWTinitializeListener=(AnimationPlayer)iPlayer;
     }
     /**
      *
@@ -226,16 +228,23 @@
             throw new IllegalStateException(
                 "VideoControl.initDisplayMode() not called yet");
         }
-        Image image=((AnimationPlayer)iPlayer).getCurrentFrame(aImageType);
-        byte bytArry[]= null;//getByteArray(image);
-        // TODO Enable the permission check
-        // Commented out below line, because I was getting exception
-        // Check the permission here, so 'the moment' is not lost?
-        //Security.ensurePermission(PERMISSION, PERMISSION, PERM_ARGS);
+        String supportedFormat=System.getProperty("video.snapshot.encodings");
+        if (aImageType==null)
+        {
+            aImageType=supportedFormat.substring(0, supportedFormat.indexOf(' '));
+        }
+        else if (supportedFormat.indexOf(aImageType)==-1)
+        {
+            throw new MediaException("Unsupported image type: " + aImageType);
+        }
+        byte data[]=((AnimationPlayer)iPlayer).getCurrentFrame(aImageType);
+        //TODO before returning the check permissions here
+        // we are making late check here, so that moment should not be lost.
+
 //        ApplicationUtils appUtils = ApplicationUtils.getInstance();
 //        PlayerPermission per = new PlayerPermission("audio/video recording","snapshot");
 //        appUtils.checkPermission(per);
-        return bytArry;
+        return data;
     }
 
     /**
@@ -287,11 +296,13 @@
             // Following line will return the same Display object
             // Which is created in Midlet
             iDisplay =Display.getDefault();
+            iESWTinitializeListener.notifyDisplayAvailable(iDisplay);
         }
         else
         {
             // Get the Display object of ESWT
             iDisplay = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            iESWTinitializeListener.notifyDisplayAvailable(iDisplay);
         }
         if (aMode == USE_GUI_PRIMITIVE)
         {
@@ -312,6 +323,7 @@
                     // Since it is eswtControl itself so no need of LCDUIInvoker here
                     // assign it in iControl and return immediately from here
                     iControl=(Control)guiObject;
+                    iESWTinitializeListener.notifyControlAvailable(iControl);
                     // Now we will change the status, when MIDlet developer will call the setParent
                     iStatus = USE_GUI_PRIMITIVE;
                     return iControl;
@@ -348,7 +360,8 @@
             }
             iControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker
                        .getEswtControl(aArg);
-
+            //in this case Control will be provided immediately
+            iESWTinitializeListener.notifyControlAvailable(iControl);
             //If USE_DIRECT_VIDEO is set, the video by default is not
             //shown when the canvas is displayed until setVisible(true) is called
             //iIsControlVisible variable of AnimationPlayer class decides, whether
@@ -372,12 +385,9 @@
      */
     private Object initLCDUI()
     {
-        final String DEBUG_STR="VideoControl::initLCDUI()";
-        Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"+");
         iVideoItem = new VideoItem(((AnimationPlayer)iPlayer).getImageDimension());
         iPlayer.addPlayerListener(iVideoItem);
         iStatus = USE_GUI_PRIMITIVE;
-        Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"-");
         return iVideoItem;
     }
 
@@ -518,6 +528,7 @@
                 "VideoControl.initDisplayMode() not called yet");
         }
         //if this is in case of form, return silently
+        // No need to display the CustomItem in full screen mode
         //This is as per earlier NOKIA implementation,
         if (iVideoItem!=null)
         {
@@ -554,13 +565,22 @@
      */
     public void setDisplayLocation(int aX, int aY)
     {
+        if (iStatus == USE_GUI_PRIMITIVE)
+        {
+            // In USE_GUI_PRIMITIVE mode, this call will be ignored.
+            return;
+        }
+        if (iStatus != USE_DIRECT_VIDEO)
+        {
+            // This method only works when the USE_DIRECT_VIDEO mode is set.
+            throw new IllegalStateException();
+        }
         // Need to ignore this call in case of USE_GUI_PRIMITIVE
         // in case of customItem, we are getting canvasExtension as control
         // and in this case we need to ignore the setDisplayLocation call.
         // it is also possible that iControl may be null( it will be null until and unless
         // notifyControlAvailable function is not get called)
-        System.out.println("VideoControl::setDisplayLocation() curretn status is "+iStatus);
-        if (iControl==null || (iControl instanceof org.eclipse.swt.internal.extension.CanvasExtension))
+        if (iControl==null)// || (iControl instanceof org.eclipse.swt.internal.extension.CanvasExtension))
             return ;
         ((AnimationPlayer)iPlayer).setDisplayLocation(aX, aY);
     }
@@ -632,20 +652,20 @@
     /**
      *
      * @return Display object retrieved from ESWT
-     */
-    Display getiDisplay()
-    {
-        return iDisplay;
-    }
+    //     */
+//    Display getiDisplay()
+//    {
+//        return iDisplay;
+//    }
 
     /**
      *
      * @return
      */
-    Control getControl()
-    {
-        return iControl;
-    }
+//    Control getControl()
+//    {
+//        return iControl;
+//    }
     /**
      * Function of ItemStateChangeListener
      * Notified by LCDUI implementation
@@ -656,11 +676,8 @@
     {
         final String DEBUG_STR= "VideoControl::notifyControlAvailable(Control ctrl,Item item)";
         iControl=ctrl;
+        iESWTinitializeListener.notifyControlAvailable(iControl);
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo, DEBUG_STR+"Control is "+ctrl.hashCode()+ " Item is "+item);
-        //TODO is it proper here to put the below line in try/catch?, remove if we can.
-        // Otherwise it may deteriorate the performance, as in case of CustomItem on each
-        // repaint, eSWT control is getting destroyed, and reconstructed
-        ((AnimationPlayer)iPlayer).addPaintListener(iControl);
     }
     /**
      * Function of ItemStateChangeListener
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoItem.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoItem.java	Tue Jul 06 20:36:19 2010 +0300
@@ -96,16 +96,16 @@
     /**
      * This is dummy implementation of the paint method.
      */
-    int count;
+//    int count;
     protected void paint(Graphics g, int w, int h)
     {
         //TODO remove this code later
         // this is added just for testing purpose
-        System.out.println("VideoItem::paint()");
-        g.setColor(0x00a000);
-        g.fillRect(0,0,w,h);
-        g.setColor(0xFFFFFF);
-        g.drawString("paint"+(count++), w>>1, h>>1, Graphics.BASELINE|Graphics.HCENTER);
+//        System.out.println("VideoItem::paint()");
+//        g.setColor(0x00a000);
+//        g.fillRect(0,0,w,h);
+//        g.setColor(0xFFFFFF);
+//        g.drawString("paint"+(count++), w>>1, h>>1, Graphics.BASELINE|Graphics.HCENTER);
     }
 
     /**
--- a/javauis/mmapi_qt/baseline/javasrc/org/eclipse/swt/widgets/ProxyControl.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/org/eclipse/swt/widgets/ProxyControl.java	Tue Jul 06 20:36:19 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:
+* Description: ProxyControl
 *
 */
 package org.eclipse.swt.widgets;
@@ -31,43 +31,45 @@
 
 /**
  * A Proxy Class for eSWT control.
- * 
+ *
  * Since re-parenting is not supported, thats why this class were needed.
  * When user will call the setParent function of Control(means this class), this class will create
- * the actual Control, for which it will be acting like a proxy. All further call to any function of  
- * this class will be delegated to the Control object, created in the setParent method. 
- * 
- * @author d35kumar
+ * the actual Control, for which it will be acting like a proxy. All further call to any function of
+ * this class will be delegated to the Control object, created in the setParent method.
+ *
  */
-public class ProxyControl extends Control {
+public class ProxyControl extends Control
+{
+
+    /**
+     *  this is actual Control(Shell), for which this class is acting like proxy
+     */
+    Control iControl;
+
+    /**
+     * Dimesion of this shell needs to be set
+     */
+    Point iDimension;
 
-	/**
-	 *  this is actual Control(Shell), for which this class is acting like proxy
-	 */
-	Control iControl;
-	
-	/**
-	 * Dimesion of this shell needs to be set 
-	 */
-	Point iDimension;
-	
-	/**
-	 * @param aDimension Dimension to be set for the control class
-	 */
-	public ProxyControl(Point aDimension) {
-		iDimension=aDimension;
-	}
-	
-	/**
-	 * Creates the actual control
-	 * @return true if it returns properly, 
-	 * 	or false if any exception is thrown during the execution of this function   
-	 */
-	public boolean setParent(Composite aParent){
-		if (aParent == null)
+    /**
+     * @param aDimension Dimension to be set for the control class
+     */
+    public ProxyControl(Point aDimension)
+    {
+        iDimension=aDimension;
+    }
+
+    /**
+     * Creates the actual control
+     * @return true if it returns properly,
+     *  or false if any exception is thrown during the execution of this function
+     */
+    public boolean setParent(Composite aParent)
+    {
+        if (aParent == null)
         {
-			SWT.error(SWT.ERROR_NULL_ARGUMENT);
-			return false;
+            SWT.error(SWT.ERROR_NULL_ARGUMENT);
+            return false;
         }
         if (aParent.isDisposed())
         {
@@ -78,278 +80,348 @@
 //        {
 //            return true;
 //        }
-		iControl= new Shell((Shell)aParent);
-		((Shell)iControl).open();
-		iControl.setSize(iDimension);
-		return true;
-	}
-	
-	/**
-	 * Passes the call to iControl, if it is not null, otherwise return silently 
-	 */
-	public void addControlListener(ControlListener aListener){
-		if(iControl!=null){
-			iControl.addControlListener(aListener);
-		}
-	}
-	/**
-	 * 
-	 */
-	public void addFocusListener(FocusListener listener){
-		if(iControl!=null)iControl.addFocusListener(listener);
-	}
-	/**
-	 * 
-	 */
-	public void addKeyListener(KeyListener listener){
-		if(iControl!=null)iControl.addKeyListener(listener);
-	}
-	public void addMouseListener(MouseListener listener){
-		if(iControl!=null)iControl.addMouseListener(listener);
-	}
-	public void addMouseMoveListener(MouseMoveListener listener){
-		if(iControl!=null)iControl.addMouseMoveListener(listener);
-	}
-	/**
-	 * 
-	 */
-	public void addPaintListener(PaintListener aListener){
-		if(iControl!=null)iControl.addPaintListener(aListener);
-			
-	}
-	
-	public void addTraverseListener(TraverseListener listener){
-		if(iControl!=null)iControl.addTraverseListener(listener);
-	}
-	public Point computeSize(int wHint,
-            int hHint){
-		Point point=null;
-		if(iControl!=null)point=iControl.computeSize(wHint, hHint);
-		return point;
-	}
-	
-	public Point computeSize(int wHint,
-            int hHint,
-            boolean changed){
-		Point point=null;
-		if(iControl!=null)point=iControl.computeSize(wHint, hHint,changed);
-		return point;
-	}
-	
-	public Color getBackground(){
-		Color color=null;
-		if(iControl!=null)color=iControl.getBackground();
-		return color;
-	}
-	public int getBorderWidth(){
-		if(iControl!=null)return iControl.getBorderWidth();
-		else return 0;
-	}
-	public Rectangle getBounds(){
-		if(iControl!=null) return iControl.getBounds();
-		else return null;
-	}
-	public boolean getEnabled(){
-		if(iControl!=null) return iControl.getEnabled();
-		else return false;
-	}
-	public Font getFont(){
-		if(iControl!=null)return iControl.getFont();
-		else return null;
-	}
-	public Color getForeground(){
-		if(iControl!=null) return iControl.getForeground();
-		else return null;
-	}
-	
-	public java.lang.Object getLayoutData(){
-		if(iControl!=null) return iControl.getLayoutData();
-		else return null;
-	}
-	
-	public Point getLocation(){
-		if(iControl!=null) return iControl.getLocation();
-		else return null;
-	}
-	
-	public Menu getMenu(){
-		if(iControl!=null) return iControl.getMenu();
-		else return null;
-	}
-	public Composite getParent(){
-		if(iControl!=null) return iControl.getParent();
-		else return null;
-	}
-	public Shell getShell(){
-		if(iControl!=null) return (Shell)iControl;
-		else return null;
-	}
-	public Point getSize(){
-		if(iControl!=null) return iControl.getSize();
-		else return null;
-	}
-	
-	public java.lang.String getToolTipText(){
-		if(iControl!=null) return iControl.getToolTipText();
-		else return null;
-	}
-	public boolean getVisible(){
-		if(iControl!=null)  return iControl.getVisible();
-		else return false;
-	}
-	public boolean isEnabled(){
-		if(iControl!=null) return iControl.isEnabled();
-		else return false;
-	}
-	
-	public boolean isFocusControl(){
-		if(iControl!=null) return iControl.isFocusControl();
-		else return false;
-	}
-	public boolean isReparentable(){
-		if(iControl!=null) return iControl.isReparentable();
-		else return false;
-	}
-	
-	public boolean isVisible(){
-		if(iControl!=null)return iControl.isVisible(); 
-		else return false;
-	}
-	public void moveAbove(Control control){
-		if(iControl!=null) iControl.moveAbove(control);
-	}
-	public void moveBelow(Control control){
-		if(iControl!=null) iControl.moveBelow(control);
-	}
-	public void pack(){
-		if(iControl!=null) iControl.pack();
-	}
-	public void pack(boolean changed){
-		if(iControl!=null) iControl.pack(changed);
-	}
-	public void redraw(){
-		if(iControl!=null) iControl.redraw();
-	}
-	public void redraw(int x,
-            int y,
-            int width,
-            int height,
-            boolean all){
-		if(iControl!=null) iControl.redraw(x,y,width,height, all);
-	}
-	public void removeControlListener(ControlListener listener){
-		if(iControl!=null) iControl.removeControlListener(listener);
-	}
-	public void removeFocusListener(FocusListener listener){
-		if(iControl!=null) iControl.removeFocusListener(listener);
-	}
-	public void removeMouseListener(MouseListener listener){
-		if(iControl!=null) iControl.removeMouseListener(listener);
-	}
-	public void removeMouseMoveListener(MouseMoveListener listener){
-		if(iControl!=null) iControl.removeMouseMoveListener(listener);	
-	}
-	public void removePaintListener(PaintListener listener){
-		if(iControl!=null)iControl.removePaintListener(listener);	
-	}
-	public void removeTraverseListener(TraverseListener listener){
-		if(iControl!=null)iControl.removeTraverseListener(listener);	
-	}
-	public void setBounds(int x,
-            int y,
-            int width,
-            int height){
-		if(iControl!=null)iControl.setBounds(x, y, width, height);
-	}
-	public void setBounds(Rectangle rect){
-		if(iControl!=null)iControl.setBounds(rect);
-	}
-	public void setCapture(boolean capture){
-		if(iControl!=null)iControl.setCapture(capture);	
-	}
-	public void setEnabled(boolean enabled){
-		if(iControl!=null)iControl.setEnabled(enabled);
-	}
-	public boolean setFocus(){
-		if(iControl!=null) return iControl.setFocus();
-		else return false;
-	}
-	public void setFont(Font font){
-		if(iControl!=null)iControl.setFont(font);
-	}
-	public void setForeground(Color color){
-		if(iControl!=null)iControl.setForeground(color);	
-	}
-	public void setLayoutData(java.lang.Object layoutData){
-		if(iControl!=null)iControl.setLayoutData(layoutData);	
-	}
-	public void setLocation(int x,
-            int y){
-		if(iControl!=null)iControl.setLocation(x, y);	
-	}
-	
-	public void setLocation(Point location){
-		if(iControl!=null)iControl.setLocation(location);	
-	}
-	public void setMenu(Menu menu){
-		if(iControl!=null)iControl.setMenu(menu);	
-	}
-	public void setRedraw(boolean redraw){
-		if(iControl!=null)iControl.setRedraw(redraw);
-	}
-	public void setSize(int width,
-            int height){
-		if(iControl!=null) iControl.setSize(width, height);	
-	}
-	
-	public void setSize(Point size){
-		if(iControl!=null) iControl.setSize(size);
-	}
-	public void setToolTipText(java.lang.String string){
-		if(iControl!=null)iControl.setToolTipText(string);	
-	}
-	public void setVisible(boolean visible){
-		if(iControl!=null)iControl.setVisible(visible);	
-	}
-	public Point toControl(int x,
-            int y){
-		if(iControl!=null)return iControl.toControl(x, y);
-		else return null;
-	}
-	public Point toControl(Point point){
-		if(iControl!=null) return iControl.toControl(point);
-		else return null;
-	}
-	public Point toDisplay(int x,
-            int y){
-		if(iControl!=null)return iControl.toDisplay(x,y);
-		else return null;
-	}
-	public Point toDisplay(Point point){
-		if(iControl!=null)return iControl.toDisplay(point);
-		else return null;
-	}
-	public boolean traverse(int traversal){
-		if(iControl!=null)return iControl.traverse(traversal);
-		else return false;
-	}
-	public void update(){
-		if(iControl!=null)iControl.update();
-	}
-	
-	public void checkSubclass() {
-		// do nothing,sub-classing allowed
-	}
-	
-	/**
-	 * Used in toString function 
-	 * @return class name with full path
-	 */
-	String getNameText () {
-	    return "org.eclipse.swt.widgets.ProxyControl";
-	}
-	public String toString(){
-		return "org.eclipse.swt.widgets.ProxyControl";
-	}
+        iControl= new Shell((Shell)aParent);
+        ((Shell)iControl).open();
+        iControl.setSize(iDimension);
+        return true;
+    }
+
+    /**
+     * Passes the call to iControl, if it is not null, otherwise return silently
+     */
+    public void addControlListener(ControlListener aListener)
+    {
+        if (iControl!=null)
+        {
+            iControl.addControlListener(aListener);
+        }
+    }
+    /**
+     *
+     */
+    public void addFocusListener(FocusListener listener)
+    {
+        if (iControl!=null)iControl.addFocusListener(listener);
+    }
+    /**
+     *
+     */
+    public void addKeyListener(KeyListener listener)
+    {
+        if (iControl!=null)iControl.addKeyListener(listener);
+    }
+    public void addMouseListener(MouseListener listener)
+    {
+        if (iControl!=null)iControl.addMouseListener(listener);
+    }
+    public void addMouseMoveListener(MouseMoveListener listener)
+    {
+        if (iControl!=null)iControl.addMouseMoveListener(listener);
+    }
+    /**
+     *
+     */
+    public void addPaintListener(PaintListener aListener)
+    {
+        if (iControl!=null)iControl.addPaintListener(aListener);
+
+    }
+
+    public void addTraverseListener(TraverseListener listener)
+    {
+        if (iControl!=null)iControl.addTraverseListener(listener);
+    }
+    public Point computeSize(int wHint,
+                             int hHint)
+    {
+        Point point=null;
+        if (iControl!=null)point=iControl.computeSize(wHint, hHint);
+        return point;
+    }
+
+    public Point computeSize(int wHint,
+                             int hHint,
+                             boolean changed)
+    {
+        Point point=null;
+        if (iControl!=null)point=iControl.computeSize(wHint, hHint,changed);
+        return point;
+    }
+
+    public Color getBackground()
+    {
+        Color color=null;
+        if (iControl!=null)color=iControl.getBackground();
+        return color;
+    }
+    public int getBorderWidth()
+    {
+        if (iControl!=null)return iControl.getBorderWidth();
+        else return 0;
+    }
+    public Rectangle getBounds()
+    {
+        if (iControl!=null) return iControl.getBounds();
+        else return null;
+    }
+    public boolean getEnabled()
+    {
+        if (iControl!=null) return iControl.getEnabled();
+        else return false;
+    }
+    public Font getFont()
+    {
+        if (iControl!=null)return iControl.getFont();
+        else return null;
+    }
+    public Color getForeground()
+    {
+        if (iControl!=null) return iControl.getForeground();
+        else return null;
+    }
+
+    public java.lang.Object getLayoutData()
+    {
+        if (iControl!=null) return iControl.getLayoutData();
+        else return null;
+    }
+
+    public Point getLocation()
+    {
+        if (iControl!=null) return iControl.getLocation();
+        else return null;
+    }
+
+    public Menu getMenu()
+    {
+        if (iControl!=null) return iControl.getMenu();
+        else return null;
+    }
+    public Composite getParent()
+    {
+        if (iControl!=null) return iControl.getParent();
+        else return null;
+    }
+    public Shell getShell()
+    {
+        if (iControl!=null) return (Shell)iControl;
+        else return null;
+    }
+    public Point getSize()
+    {
+        if (iControl!=null) return iControl.getSize();
+        else return null;
+    }
+
+    public java.lang.String getToolTipText()
+    {
+        if (iControl!=null) return iControl.getToolTipText();
+        else return null;
+    }
+    public boolean getVisible()
+    {
+        if (iControl!=null)  return iControl.getVisible();
+        else return false;
+    }
+    public boolean isEnabled()
+    {
+        if (iControl!=null) return iControl.isEnabled();
+        else return false;
+    }
+
+    public boolean isFocusControl()
+    {
+        if (iControl!=null) return iControl.isFocusControl();
+        else return false;
+    }
+    public boolean isReparentable()
+    {
+        if (iControl!=null) return iControl.isReparentable();
+        else return false;
+    }
+
+    public boolean isVisible()
+    {
+        if (iControl!=null)return iControl.isVisible();
+        else return false;
+    }
+    public void moveAbove(Control control)
+    {
+        if (iControl!=null) iControl.moveAbove(control);
+    }
+    public void moveBelow(Control control)
+    {
+        if (iControl!=null) iControl.moveBelow(control);
+    }
+    public void pack()
+    {
+        if (iControl!=null) iControl.pack();
+    }
+    public void pack(boolean changed)
+    {
+        if (iControl!=null) iControl.pack(changed);
+    }
+    public void redraw()
+    {
+        if (iControl!=null) iControl.redraw();
+    }
+    public void redraw(int x,
+                       int y,
+                       int width,
+                       int height,
+                       boolean all)
+    {
+        if (iControl!=null) iControl.redraw(x,y,width,height, all);
+    }
+    public void removeControlListener(ControlListener listener)
+    {
+        if (iControl!=null) iControl.removeControlListener(listener);
+    }
+    public void removeFocusListener(FocusListener listener)
+    {
+        if (iControl!=null) iControl.removeFocusListener(listener);
+    }
+    public void removeMouseListener(MouseListener listener)
+    {
+        if (iControl!=null) iControl.removeMouseListener(listener);
+    }
+    public void removeMouseMoveListener(MouseMoveListener listener)
+    {
+        if (iControl!=null) iControl.removeMouseMoveListener(listener);
+    }
+    public void removePaintListener(PaintListener listener)
+    {
+        if (iControl!=null)iControl.removePaintListener(listener);
+    }
+    public void removeTraverseListener(TraverseListener listener)
+    {
+        if (iControl!=null)iControl.removeTraverseListener(listener);
+    }
+    public void setBounds(int x,
+                          int y,
+                          int width,
+                          int height)
+    {
+        if (iControl!=null)iControl.setBounds(x, y, width, height);
+    }
+    public void setBounds(Rectangle rect)
+    {
+        if (iControl!=null)iControl.setBounds(rect);
+    }
+    public void setCapture(boolean capture)
+    {
+        if (iControl!=null)iControl.setCapture(capture);
+    }
+    public void setEnabled(boolean enabled)
+    {
+        if (iControl!=null)iControl.setEnabled(enabled);
+    }
+    public boolean setFocus()
+    {
+        if (iControl!=null) return iControl.setFocus();
+        else return false;
+    }
+    public void setFont(Font font)
+    {
+        if (iControl!=null)iControl.setFont(font);
+    }
+    public void setForeground(Color color)
+    {
+        if (iControl!=null)iControl.setForeground(color);
+    }
+    public void setLayoutData(java.lang.Object layoutData)
+    {
+        if (iControl!=null)iControl.setLayoutData(layoutData);
+    }
+    public void setLocation(int x,
+                            int y)
+    {
+        if (iControl!=null)iControl.setLocation(x, y);
+    }
+
+    public void setLocation(Point location)
+    {
+        if (iControl!=null)iControl.setLocation(location);
+    }
+    public void setMenu(Menu menu)
+    {
+        if (iControl!=null)iControl.setMenu(menu);
+    }
+    public void setRedraw(boolean redraw)
+    {
+        if (iControl!=null)iControl.setRedraw(redraw);
+    }
+    public void setSize(int width,
+                        int height)
+    {
+        if (iControl!=null) iControl.setSize(width, height);
+    }
+
+    public void setSize(Point size)
+    {
+        if (iControl!=null) iControl.setSize(size);
+    }
+    public void setToolTipText(java.lang.String string)
+    {
+        if (iControl!=null)iControl.setToolTipText(string);
+    }
+    public void setVisible(boolean visible)
+    {
+        if (iControl!=null)iControl.setVisible(visible);
+    }
+    public Point toControl(int x,
+                           int y)
+    {
+        if (iControl!=null)return iControl.toControl(x, y);
+        else return null;
+    }
+    public Point toControl(Point point)
+    {
+        if (iControl!=null) return iControl.toControl(point);
+        else return null;
+    }
+    public Point toDisplay(int x,
+                           int y)
+    {
+        if (iControl!=null)return iControl.toDisplay(x,y);
+        else return null;
+    }
+    public Point toDisplay(Point point)
+    {
+        if (iControl!=null)return iControl.toDisplay(point);
+        else return null;
+    }
+    public boolean traverse(int traversal)
+    {
+        if (iControl!=null)return iControl.traverse(traversal);
+        else return false;
+    }
+    public void update()
+    {
+        if (iControl!=null)iControl.update();
+    }
+
+    public void checkSubclass()
+    {
+        // do nothing,sub-classing allowed
+    }
+
+    protected void internal_createHandle()
+    {
+        // TODO Auto-generated method stub
+
+    }
+    /**
+     * Used in toString function
+     * @return class name with full path
+     */
+    String getNameText()
+    {
+        return "org.eclipse.swt.widgets.ProxyControl";
+    }
+    public String toString()
+    {
+        return "org.eclipse.swt.widgets.ProxyControl";
+    }
 
 }
--- a/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -18,7 +18,7 @@
 
 //  Include Files
 #include <logger.h>
-#include <W32STD.H>
+#include <w32std.h>
 #include "cmmasurfacewindow.h"
 #include "cmmaplayer.h"
 
@@ -106,7 +106,15 @@
             //iDisplay->UIGetCallback(*this,
 //                                    CMMASurfaceWindow::ESetClipRect);
             // MMAPI UI 3.x req.
-            iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetClipRect);
+            TBool iseSWT = iDisplay->iseSWT();
+            if (iseSWT)
+            {
+                UICallback((TInt)CMMASurfaceWindow::ESetClipRect);
+            }
+            else
+            {
+                iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetClipRect);
+            }
         }
     }
     else if (MMMADisplay::EUiThread == aThreadType)
@@ -148,7 +156,7 @@
         // setting video draw rect and adjusting it to window
         TRect drawRect = contentRect;
         drawRect.Move(relativeParentRect.iTl);
-
+        LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetClipRect(): iRWindowRect size = %d x %d", iRWindowRect.Width(), iRWindowRect.Height());
         TRect clipRect(0,0,iRWindowRect.Width(),iRWindowRect.Height());
         TRAPD(error, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow,
                 clipRect, // new clip rect
@@ -158,8 +166,8 @@
                 0.0f, // ignore
                 EVideoRotationNone,
                 EAutoScaleBestFit,
-                EHorizontalAlignLeft,
-                EVerticalAlignTop,
+                EHorizontalAlignCenter,
+                EVerticalAlignCenter,
                 (RWindow*)iWindow));
 
         LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetClipRect -");
@@ -176,12 +184,21 @@
          aRect.iBr.iX, aRect.iBr.iY);
 
     iContentRect = aRect;
+    LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect aRect size = (%d,%d) ",iContentRect.Height(),iContentRect.Width());
     if (iDisplay)
     {
         // iDisplay->UIGetCallback( *this,
         //                         CMMASurfaceWindow::ESetDrawRect );
         // MMAPI UI 3.x req.
-        iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+        TBool iseSWT = iDisplay->iseSWT();
+        if (iseSWT)
+        {
+            UICallback((TInt)CMMASurfaceWindow::ESetDrawRect);
+        }
+        else
+        {
+            iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+        }
         LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect, after GetCallbackInUiThread");
     }
 }
@@ -202,7 +219,7 @@
         LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: no MediaClientVideoDisplay set, aborting -");
         return;
     }
-    iVisible = true;
+    //iVisible = true;
     if (iWindow)
     {
         TRect contentRect;
@@ -318,23 +335,23 @@
 
             if (aUseEventServer)
             {
-                //TInt error = StaticRedrawVideo(*this);
-                iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
-                //  if (KErrNone != error)
-                // {
-                //ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
-                //   }
+                TInt error = StaticRedrawVideo(*this);
+                if (KErrNone != error)
+                {
+                    LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
+                }
             }
-            else // in MMA thread, so switch to UI thread
+            else
             {
                 if (iDisplay)
                 {
-                    //iDisplay->UIGetCallback(*this,
-                    //                     CMMASurfaceWindow::ESetDrawRect );
-                    //MMAPI UI 3.x req.
+
+                    LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,calling GetCallbackInUiThread");
                     iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
-                    LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,GetCallbackInUiThread");
+                    LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,after GetCallbackInUiThread");
+
                 }
+
             }
         }
     }
@@ -376,7 +393,15 @@
         if (iDisplay)
         {
             // Clear the resources created within the old Display
-            iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ECleanVideoDisplay);
+            TBool iseSWT = iDisplay->iseSWT();
+            if (iseSWT)
+            {
+                UICallback((TInt)CMMASurfaceWindow::ECleanVideoDisplay);
+            }
+            else
+            {
+                iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ECleanVideoDisplay);
+            }
         }
 
         // Set the new Display
@@ -529,6 +554,7 @@
     break;
     case ERemoveSurface:
     {
+        LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::MdcUICallback, ERemoveSurface ");
         DoRemoveSurface();
     }
     break;
@@ -607,7 +633,15 @@
         // iDisplay->UIGetCallback( *this, CMMASurfaceWindow::EResetSurfaceParameters );
         //MMAPI UI 3.x req.
         LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters : switch case EUIResourcesAndSurfaceParametersSet +");
-        iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EResetSurfaceParameters);
+        TBool iseSWT = iDisplay->iseSWT();
+        if (iseSWT)
+        {
+            UICallback((TInt)CMMASurfaceWindow::EResetSurfaceParameters);
+        }
+        else
+        {
+            iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EResetSurfaceParameters);
+        }
         LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters : switch case EUIResourcesAndSurfaceParametersSet -");
         return;
     }
@@ -623,8 +657,16 @@
     {
         //iDisplay->UIGetCallback( *this, CMMASurfaceWindow::EInitVideoDisplay );
         //MMAPI UI 3.x req.
-        iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EInitVideoDisplay);
-        LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters,EUIResourcesAndSurfaceParametersSet");
+        TBool iseSWT = iDisplay->iseSWT();
+        if (iseSWT)
+        {
+            UICallback((TInt)CMMASurfaceWindow::EInitVideoDisplay);
+        }
+        else
+        {
+            LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters,EUIResourcesAndSurfaceParametersSet");
+            iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EInitVideoDisplay);
+        }
     }
 }
 
@@ -640,7 +682,15 @@
     {
         //iDisplay->UIGetCallback(*this, CMMASurfaceWindow::ESetChangedSurfaceParameters);
         LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetChangedSurfaceParameters + ");
-        iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetChangedSurfaceParameters);
+        TBool iseSWT = iDisplay->iseSWT();
+        if (iseSWT)
+        {
+            UICallback((TInt)CMMASurfaceWindow::ESetChangedSurfaceParameters);
+        }
+        else
+        {
+            iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetChangedSurfaceParameters);
+        }
         LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetChangedSurfaceParameters - ");
 
     }
@@ -648,20 +698,25 @@
 
 void CMMASurfaceWindow::RemoveSurface()
 {
+    LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RemoveSurface() +");
     if (iDisplay)
     {
         iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ERemoveSurface);
     }
+    LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RemoveSurface() -");
 }
 
 void CMMASurfaceWindow::DoRemoveSurface()
 {
+    LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::DoRemoveSurface() +");
     if (iMediaClientVideoDisplay)
     {
+        LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Removing Surface");
         iMediaClientVideoDisplay->RemoveSurface();
         LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Surface Removed");
 
     }
+    LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::DoRemoveSurface() -");
 }
 
 void CMMASurfaceWindow::DoResetSurfaceParameters()
@@ -767,8 +822,8 @@
             0.0f, // ignore
             EVideoRotationNone,
             EAutoScaleBestFit,
-            EHorizontalAlignLeft,
-            EVerticalAlignTop,
+            EHorizontalAlignCenter,
+            EVerticalAlignCenter,
             (RWindow*)iWindow);
 
 
--- a/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -36,7 +36,7 @@
         new(ELeave) CMMACanvasDisplay();
 
     CleanupStack::PushL(self);
-    self->Construct(aEventSource,obj);
+    self->Construct(aEventSource,NULL,obj);
     return self;
 }
 
--- a/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -446,7 +446,7 @@
 }
 
 
-void CMMAPlayer::PostActionCompleted(TInt aError)
+EXPORT_C void CMMAPlayer::PostActionCompleted(TInt aError)
 {
     LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted ");
     iActionCompletedEvent->SetEventData(aError);
--- a/javauis/mmapi_qt/baseline/src/cmmasnapshot.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmasnapshot.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -91,6 +91,8 @@
     // take snapshot from player. RunL is called when image is ready
     // or error occures
     iState = ETakingSnapshot;
+    LOG2(EJavaMMAPI, EInfo, "CMMASnapshot::TakeSnapshotL::iSettings->iWidth = %d, iSettings->iHeight = %d",
+         iSettings->iWidth, iSettings->iHeight);
     TSize snapshotSize(iSettings->iWidth, iSettings->iHeight);
     iEncoding = iGUIPlayer->SnapshoterL()->TakeSnapshotL(&iStatus,
                 snapshotSize,
--- a/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -129,12 +129,12 @@
                                    MMAFunctionServer* aEventSource,
                                    TInt* aDisplayHandle,
                                    CMMAEvent* aDeleteRefEvent,
-                                   TBool aGuiType)
+                                   TInt aGuiType)
 {
 
     LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL +");
 
-    if (aGuiType == true)
+    if (aGuiType == CMMAVideoControl::EDISPLAY_VIDEOITEM)
     {
         LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - aGuiType is customitem ");
         aControl->iDeleteRefEvent = aDeleteRefEvent;
@@ -145,7 +145,7 @@
         CleanupStack::Pop(itemDisplay);
         *aDisplayHandle = reinterpret_cast<TInt>(itemDisplay);
     }
-    else
+    else if (aGuiType == CMMAVideoControl::EDISPLAY_CANVAS)
     {
         LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - aGuiType is canvas ");
         aControl->iDeleteRefEvent = aDeleteRefEvent;
@@ -215,6 +215,7 @@
 
 void CMMAVideoControl::StaticInitDynamicModeL(
     CMMAVideoControl* aVideoControl,
+    JNIEnv* aJni,
     TInt* aContentHandle,
     MMAFunctionServer* aEventSource,
     jobject aGUIObject,
@@ -225,89 +226,92 @@
 
     CMMADCDisplay* dcDisplay = CMMADCDisplay::NewLC(aVideoControl->iGuiPlayer,
                                aEventSource,
+                               aJni,
                                aGUIObject);
 
-    MMMADirectContent* content = dcDisplay;
-    *aContentHandle = reinterpret_cast< TInt >(content);
+    //MMMADirectContent* content = dcDisplay;
+    *aContentHandle = reinterpret_cast< TInt >(dcDisplay);
     aVideoControl->iDisplay = dcDisplay;
     aVideoControl->iGuiPlayer->SetDisplayL(aVideoControl->iDisplay);
     CleanupStack::Pop(dcDisplay);
     LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitDynamicModeL-");
 }
 
-void CMMAVideoControl::StaticGetPropertyL(CMMAVideoControl* /*aControl*/,
-        TInt /*aPropertyType*/,
-        TInt* /*aReturnValue*/)
+void CMMAVideoControl::StaticGetPropertyL(CMMAVideoControl* aControl,
+        TInt aPropertyType,
+        TInt* aReturnValue)
 {
-    // LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL property %d",
-    //           aPropertyType);
+    LOG1(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL property %d",
+         aPropertyType);
 
 // MMAPI UI 3.x req.
 // remove the below return and uncomment the below code once  display is implemented in java
-    return;
+//    return;
 
-    /*
-     MMMADisplay* display = aControl->iDisplay;
+
+    MMMADisplay* display = aControl->iDisplay;
 
-     if (aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH &&
-             aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT &&
-             !display)
-     {
-         LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL not initialized yet");
-         // init is not done yet, returning 0
-         *aReturnValue = 0;
-         return;
-     }
+    if (aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH &&
+            aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT &&
+            !display)
+    {
+        LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL not initialized yet");
+        // init is not done yet, returning 0
+        *aReturnValue = 0;
+        return;
+    }
 
-     switch (aPropertyType)
-     {
-     case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_WIDTH:
-     {
-         *aReturnValue = display->DisplaySize().iWidth;
-         break;
-     }
-     case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_HEIGHT:
-     {
-         *aReturnValue = display->DisplaySize().iHeight;
-         break;
-     }
-     case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_X:
-     {
-         *aReturnValue = display->DisplayLocation().iX;
-         break;
-     }
-     case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_Y:
-     {
-         *aReturnValue = display->DisplayLocation().iY;
-         break;
-     }
-     case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH:
-     {
-         LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source width");
-         *aReturnValue = aControl->iGuiPlayer->SourceSize().iWidth;
-         break;
-     }
-     case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT:
-     {
-         LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source height");
-         *aReturnValue = aControl->iGuiPlayer->SourceSize().iHeight;
-         break;
-     }
-     default:
-     {
-         *aReturnValue = KErrNotFound;
-         User::Leave(KErrNotFound);
-         break;
-     }
-     }
-     */
+    switch (aPropertyType)
+    {
+    case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_WIDTH:
+    {
+        *aReturnValue = display->DisplaySize().iWidth;
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_HEIGHT:
+    {
+        *aReturnValue = display->DisplaySize().iHeight;
+        LOG1(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL aReturnValue %d",
+             *aReturnValue);
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_X:
+    {
+        *aReturnValue = display->DisplayLocation().iX;
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_Y:
+    {
+        *aReturnValue = display->DisplayLocation().iY;
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH:
+    {
+        LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source width");
+        *aReturnValue = aControl->iGuiPlayer->SourceSize().iWidth;
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT:
+    {
+        LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source height");
+        *aReturnValue = aControl->iGuiPlayer->SourceSize().iHeight;
+        break;
+    }
+    default:
+    {
+        *aReturnValue = KErrNotFound;
+        User::Leave(KErrNotFound);
+        break;
+    }
+    }
+
 }
 
 
-void CMMAVideoControl::StaticSetPropertyL(CMMAVideoControl* /*aControl*/,
-        TInt /*aPropertyType*/,
-        TInt /*aPropertyA*/,
-        TInt /*aPropertyB*/)
+void CMMAVideoControl::StaticSetPropertyL(CMMAVideoControl* aControl,
+        TInt aPropertyType,
+        TInt aPropertyA,
+        TInt aPropertyB)
 {
     //LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL property type %d",
     //          aPropertyType);
@@ -317,76 +321,86 @@
     //          aPropertyB);
 // MMAPI UI 3.x req.
 // remove the below return and uncomment the below code; once  display is implemented in java
-    return;
+    // return;
 
-    /*
-        MMMADisplay* display = aControl->iDisplay;
 
-        __ASSERT_DEBUG(display != NULL,
-                       User::Panic(_L("display not initialized"), KErrNotReady));
+    MMMADisplay* display = aControl->iDisplay;
 
-        switch (aPropertyType)
-        {
-        case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE:
-        {
-            TSize displaySize(aPropertyA, aPropertyB);
-            display->SetDisplaySizeL(displaySize);
+    __ASSERT_DEBUG(display != NULL,
+                   User::Panic(_L("display not initialized"), KErrNotReady));
 
-            // inform java side
-            if (!display->IsFullScreen())
-            {
-                aControl->iGuiPlayer->NotifyWithStringEvent(
-                    CMMAPlayerEvent::ESizeChanged, KControlName);
-            }
-            break;
-        }
-        case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_LOCATION:
+    switch (aPropertyType)
+    {
+    case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE:
+    {
+        TSize displaySize(aPropertyA, aPropertyB);
+        LOG2(EJavaMMAPI, EInfo, "CMMAVideoControl::statepropertyl %d , %d",displaySize.iHeight,displaySize.iWidth);
+        display->SetDisplaySizeL(displaySize);
+        LOG(EJavaMMAPI, EInfo, "CMMAVideoControl::SetDisplayProperty:: setDisplaySizeL Completed");
+        // inform java side
+        if (!display->IsFullScreen())
         {
-            TPoint displayLocation(aPropertyA, aPropertyB);
-            display->SetDisplayLocationL(displayLocation);
-            break;
-        }
-        case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_TRUE:
-        {
-            display->SetVisible(ETrue);
-            break;
+            aControl->iGuiPlayer->NotifyWithStringEvent(
+                CMMAPlayerEvent::ESizeChanged, KControlName);
         }
-        case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_FALSE:
-        {
-            display->SetVisible(EFalse);
-            break;
-        }
-        case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_TRUE:
-        {
-            // store old user rect to determine if SIZE_CHANGED event
-            // has to be delivered when full screen mode is turned off.
-            aControl->iOldDisplaySize = display->DisplaySize();
-
-            display->SetFullScreenL(ETrue);
-            break;
-        }
-        case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE:
-        {
-            display->SetFullScreenL(EFalse);
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_LOCATION:
+    {
+        TPoint displayLocation(aPropertyA, aPropertyB);
+        display->SetDisplayLocationL(displayLocation);
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_TRUE:
+    {
+        display->SetVisible(ETrue);
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_FALSE:
+    {
+        display->SetVisible(EFalse);
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_TRUE:
+    {
+        // store old user rect to determine if SIZE_CHANGED event
+        // has to be delivered when full screen mode is turned off.
+        aControl->iOldDisplaySize = display->DisplaySize();
+        LOG1(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL a property %d",
+             aPropertyA);
+        LOG1(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL b property %d",
+             aPropertyB);
+        //TSize fullscreenSize(aPropertyA, aPropertyB);
+        //display->SetFullscreenSize(fullscreenSize);
+        //display->SetDisplaySizeL(fullscreenSize);
+        //display->SetFullScreenL(ETrue);
+        display->SourceSizeChanged(aPropertyA, aPropertyB,0,0,TRect(0,0,0,0));
+        break;
+    }
+    case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE:
+    {
+        TSize fullscreenSize = aControl->iOldDisplaySize;
+        display->SetFullscreenSize(fullscreenSize);
+        display->SetFullScreenL(EFalse);
 
-            // Send SIZE_CHANGED event when fullscreen is turned off if
-            // size of the video display has changed. Possible position
-            // change is however disregarded
-            if (aControl->iOldDisplaySize != display->DisplaySize())
-            {
-                aControl->iGuiPlayer->NotifyWithStringEvent(
-                    CMMAPlayerEvent::ESizeChanged, KControlName);
-            }
+        // Send SIZE_CHANGED event when fullscreen is turned off if
+        // size of the video display has changed. Possible position
+        // change is however disregarded
+        /* if (aControl->iOldDisplaySize != display->DisplaySize())
+         {
+             aControl->iGuiPlayer->NotifyWithStringEvent(
+                 CMMAPlayerEvent::ESizeChanged, KControlName);
+         }*/
 
-            break;
-        }
-        default:
-        {
-            User::Leave(KErrNotFound);
-            break;
-        }
-        }
-        */
+        break;
+    }
+    default:
+    {
+        User::Leave(KErrNotFound);
+        break;
+    }
+    }
+
 }
 
 
@@ -491,7 +505,12 @@
     }
 }
 
-
+/*
+MMMAGuiPlayer* CMMAVideoControl::GuiPlayer()
+{
+    return iGuiPlayer;
+}
+*/
 /**
  * Handles a change to resources which are shared accross the environment.
  */
--- a/javauis/mmapi_qt/baseline/src/tmmaparametervalidator.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/tmmaparametervalidator.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -17,13 +17,12 @@
 
 
 //  INCLUDE FILES
-#include <logger.h>
-#include <mmfformatimplementationuids.hrh>
-#include <mmfcontrollerimplementationuids.hrh>
+#include <mmf/plugin/mmfformatimplementationuids.hrh>
+#include <mmf/plugin/mmfcontrollerimplementationuids.hrh>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "logger.h"
 #include "cmmaplayerproperties.h"
-#include <mmfcontrollerpluginresolver.h>
-
-
 #include "tmmaparametervalidator.h"
 
 // CONSTANTS
--- a/javauis/mmapi_qt/baseline/src/videocontrol.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/videocontrol.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -72,7 +72,7 @@
 
 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty
 (JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
- jint aPropertyA, jint aPropertyB, jint aPropertyType)
+ jint aPropertyA, jint aPropertyB, jint aPropertyType, jint aDisplayType)
 {
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty");
 
@@ -88,19 +88,26 @@
     __ASSERT_DEBUG(eventSource,
                    User::Panic(_L("videocontrol::eventsource is null"),
                                KErrArgument));
-
-    TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticSetPropertyL,
-                                        videoControl,
-                                        aPropertyType,
-                                        aPropertyA,
-                                        aPropertyB));
+    TInt error = 0;
+    if (aDisplayType == CMMAVideoControl::EDISPLAY_ESWT)
+    {
+        TRAP(error,CMMAVideoControl::StaticSetPropertyL(videoControl, aPropertyType, aPropertyA, aPropertyB));
+    }
+    else
+    {
+        error = eventSource->ExecuteTrap(&CMMAVideoControl::StaticSetPropertyL,
+                                         videoControl,
+                                         aPropertyType,
+                                         aPropertyA,
+                                         aPropertyB);
+    }
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty -");
     return error;
 }
 
 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty
 (JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
- jint aPropertyType)
+ jint aPropertyType, jint aDisplayType)
 {
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty");
 
@@ -117,11 +124,19 @@
                    User::Panic(_L("videocontrol::evetnsource is null"),
                                KErrArgument));
     TInt returnValue(KErrNone);
+    TInt error = 0;
 
-    TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticGetPropertyL,
-                                        videoControl,
-                                        aPropertyType,
-                                        &returnValue));
+    if (aDisplayType == CMMAVideoControl::EDISPLAY_ESWT)
+    {
+        TRAP(error,CMMAVideoControl::StaticGetPropertyL(videoControl, aPropertyType, &returnValue));
+    }
+    else
+    {
+        error = eventSource->ExecuteTrap(&CMMAVideoControl::StaticGetPropertyL,
+                                         videoControl,
+                                         aPropertyType,
+                                         &returnValue);
+    }
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty - ");
     if (error == KErrNone)
     {
@@ -131,7 +146,7 @@
 }
 
 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot
-(JNIEnv* aJni, jobject, jint aControlHandle, jint aEventSourceHandle,
+(JNIEnv* aJni, jobject, jint aControlHandle, jint /*aEventSourceHandle*/,
  jstring aProperties)
 {
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot + ");
@@ -139,20 +154,26 @@
     CMMAVideoControl* videoControl =
         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
 
-    MMAFunctionServer* eventSource =
-        reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+    //MMAFunctionServer* eventSource =
+    //   reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
 
     __ASSERT_DEBUG(videoControl,
                    User::Panic(_L("videocontrol::control is null"),
                                KErrArgument));
-    __ASSERT_DEBUG(eventSource,
-                   User::Panic(_L("videocontrol::evetnsource is null"),
-                               KErrArgument));
+//    __ASSERT_DEBUG(eventSource,
+//                   User::Panic(_L("videocontrol::evetnsource is null"),
+//                               KErrArgument));
 
     JStringUtils properties(*aJni, aProperties);
+
+    TInt error = 0;
+    TRAP(error,CMMAVideoControl::TakeSnapShotL(videoControl, (const TDesC*)&properties));
+
+    /*
     TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::TakeSnapShotL,
                                         videoControl,
                                         (const TDesC*)&properties));
+     */
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot - ");
     return error;
 }
@@ -161,20 +182,22 @@
  * Initializes dynamic display mode
  * @return handle to MMMADirectContent or error code
  */
-/*
 LOCAL_C jint InitDynamicMode(MMAFunctionServer* aEventSource,
+                             JNIEnv* aJni,
                              CMMAVideoControl* aVideoControl,
                              jobject aGUIObject,
                              CMMAEvent* aDeleteRefEvent)
 {
     TInt contentHandle = 0;
-    TInt error = aEventSource->ExecuteTrap(
-                     &CMMAVideoControl::StaticInitDynamicModeL,
-                     aVideoControl,
-                     &contentHandle,
-                     aEventSource,
-                     aGUIObject,
-                     aDeleteRefEvent);
+    /* TInt error = aEventSource->ExecuteTrap(
+                      &CMMAVideoControl::StaticInitDynamicModeL,
+                      aVideoControl,
+                      &contentHandle,
+                      aEventSource,
+                      aGUIObject,
+                      aDeleteRefEvent);
+    */
+    TRAPD(error,CMMAVideoControl::StaticInitDynamicModeL(aVideoControl, aJni, &contentHandle, aEventSource, aGUIObject, aDeleteRefEvent));
 
     // if init failed return error code
     if (error != KErrNone)
@@ -183,18 +206,17 @@
     }
     return contentHandle;
 }
-*/
 
 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode
 (JNIEnv* aJni, jobject aJavaVideoControl, jint aControlHandle, jint aEventSourceHandle,
- jobject aJavaDisplayObj, jobject aComponent,jboolean aGuiType)
+ jobject aJavaDisplayObj, jobject aComponent,jint aGuiType)
 {
     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode +");
     LOG1(EJavaMMAPI, EInfo, "aControlHandle = %d", aControlHandle);
     LOG1(EJavaMMAPI, EInfo, "aEventSourceHandle = %d", aEventSourceHandle);
 //    LOG1( EJavaMMAPI, EInfo, "aComponentHandle = %d", aComponentHandle);
 
-    TBool type = aGuiType;
+    TInt type = aGuiType;
     CMMAVideoControl* videoControl =
         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
 
@@ -231,15 +253,16 @@
         return KErrNoMemory;
     }
 
-    /*// other modes has component
-    if (aComponentHandle == 0)
+    // other modes has component
+    if (type == CMMAVideoControl::EDISPLAY_ESWT)
     {
         return InitDynamicMode(eventSource,
+                               aJni,
                                videoControl,
-                               componentRef,
+                               javaDisplayRef,
                                deleteRefEvent);
     }
-    */
+
     //  MMIDComponent* component = JavaUnhand< MMIDComponent >(aComponentHandle);
 
 
--- a/javauis/mmapi_qt/build/javamobilemedia.pro	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/build/javamobilemedia.pro	Tue Jul 06 20:36:19 2010 +0300
@@ -23,27 +23,21 @@
 DEFINES += RD_JAVA_VOLUME_CONTROL
 DEFINES += RD_JAVA_OMA_DRM_V2
 
-INCLUDEPATH +=  /epoc32/include/mmf/common \              
-#              ../animated_gif/inc \
-                ../baseline/inc \
+INCLUDEPATH += ../baseline/inc \
                 ../src_drmv2/inc \
                 ../directcontent/inc \
                 ../camerasound/inc \
                 ../volumekeys/inc \
                 ../audiostreaming/inc \
-                /epoc32/include/mw/Qt \
-								../utils/inc 
-								
-#								 ../../remconobserver_akn/inc \
+                ../utils/inc 
               
 SOURCES +=  ../baseline/src/*.cpp \
- #           ../animated_gif/src/*.cpp \
             ../camerasound/src/*.cpp \
             ../directcontent/src/*.cpp \
             ../src_drmv2/src/*.cpp \
             ../volumekeys/src/*.cpp \
             ../audiostreaming/src/*.cpp \
-	    ../utils/src/*.cpp
+    	    ../utils/src/*.cpp
             
 contains(PROJECT_DEFINES,RD_JAVA_HTTP_EMC_ENABLED) {
         INCLUDEPATH +=  ../baseline/inc.emc \
@@ -56,8 +50,8 @@
         -lMetaDataUtility \
         -lapmime\
         -lapgrfx \
-				-lapmime \
-				-lflogger 
+        -lapmime \
+        -lflogger 
 				
 }
 else{
@@ -94,8 +88,6 @@
         -lMMFControllerFramework \
         -lMediaClientAudio \
         -lMmfStandardCustomCommands \
-#        -lRemConCoreApi \
-#        -lRemConInterfaceBase \
         -lbafl \
         -lbitgdi \
         -lcaf \
@@ -116,7 +108,6 @@
         -lmidiclient \
         -lws32 \
         -lQtGui \
- #     -ljavaremconobserver \
 
 # Static libraries must use .lib, otherwise the platform build fails as
 # qmake incorrectly defaults the library to a dynamic lib.
--- a/javauis/mmapi_qt/directcontent/src/cmmadcdisplay.cpp	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/directcontent/src/cmmadcdisplay.cpp	Tue Jul 06 20:36:19 2010 +0300
@@ -35,12 +35,16 @@
 // Static constructor, leaves pointer to cleanup-stack
 CMMADCDisplay* CMMADCDisplay::NewLC(MMMAGuiPlayer* aPlayer,
                                     MMAFunctionServer* aEventSource,
+                                    JNIEnv* aJni,
                                     jobject aGUIObject)
 {
     CMMADCDisplay* self =
         new(ELeave) CMMADCDisplay(aPlayer, aEventSource, aGUIObject);
     CleanupStack::PushL(self);
     self->iRepaint = new(ELeave) CMMADCRepaintEvent(aGUIObject);
+    self->iIseSWT = ETrue;
+    self->Construct(aEventSource, aJni, aGUIObject);
+
     return self;
 }
 
@@ -75,7 +79,7 @@
         }
     }
 }
-
+/*
 // interface MMMADisplay
 void CMMADCDisplay::SetDisplaySizeL(const TSize& aSize)
 {
@@ -91,7 +95,7 @@
         iEventSource->PostEvent(event, CMMAEvent::EEventPriority);
     }
 }
-
+*/
 // interface MMMADisplay
 void CMMADCDisplay::SetDisplayLocationL(const TPoint& /*aPosition*/)
 {
@@ -110,19 +114,106 @@
 }
 
 // interface MMMADisplay
+
 void CMMADCDisplay::SetFullScreenL(TBool aFullScreen)
 {
     LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullScreenL %d", aFullScreen);
     // This method tries to set eSWT Widget size to its parent size.
     // If real full screen mode is needed parent Composite must be in
     // fullscreen mode (for example with MobileShell's setFullScreenMode method).
-    if (iContainer)
+    //if (iContainer)
+    //{
+    //    CMMADCFullScreenEvent* event =
+    //        new(ELeave)CMMADCFullScreenEvent(iGUIObject, aFullScreen);
+    //    iEventSource->PostEvent(event, CMMAEvent::EEventPriority);
+    //}
+    iFullScreen = aFullScreen;
+    if (iContainerVisible)
     {
-        CMMADCFullScreenEvent* event =
-            new(ELeave)CMMADCFullScreenEvent(iGUIObject, aFullScreen);
-        iEventSource->PostEvent(event, CMMAEvent::EEventPriority);
+        RemoveClippingRegion();
+
+        if (aFullScreen)
+        {
+            // use new scaled rect
+            // iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
+            LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullscreen iFullScreenSize.Width = %d iFullscreenSize.Height = %d",
+                 iFullScreenSize.iWidth, iFullScreenSize.iHeight);
+
+            iWindow->SetWindowRect(ScaleToFullScreen(iFullScreenSize, iSourceSize), MMMADisplay::EUiThread);
+            iWindow->SetRWindowRect(ScaleToFullScreen(iFullScreenSize, iSourceSize), MMMADisplay::EUiThread);
+            iWindow->SetDrawRectThread(ScaleToFullScreen(iFullScreenSize, iSourceSize));
+            //iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize));
+        }
+        else
+        {
+            // use size set from java
+            //iWindow->SetDrawRect(iUserRect);
+            iWindow->SetDrawRectThread(iUserRect);
+        }
+
+        AddClippingRegion();
     }
 }
+/*
+void CMMADCDisplay::SetFullScreenL(TBool aFullScreen)
+{
+    LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullscreenL() +");
+
+       //  TSize canvasSize(aJavaControlWidth, aJavaControlHeight);
+       iSourceSize = SourceSize();
+       //iSourceSize=canvasSize;
+          LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullscreenL() asourcesize %d",iSourceSize );
+        #ifdef RD_JAVA_NGA_Enabled
+        if(iWindow)
+        {
+            iWindow->SetVideoCropRegion( TRect(iUserRect.iTl, iSourceSize));
+        }
+        #endif
+       //  TSize canvasSize(aJavaControlWidth, aJavaControlHeight);
+       //chnaged
+
+       //TSize canvasSize(iFullScreenSize.iWidth, iFullScreenSize.iHeight);
+       //TSize iUser(iUserRect.Width(),iUserRect.Height());
+        //iFullScreenSize = canvasSize;
+      // iFullScreenSize=iUser;
+      // if(aFullScreen)
+       //   {
+       //        iFullScreenSize = canvasSize;
+       //   }
+        TBool sourceIsBigger = (iSourceSize.iWidth > iFullScreenSize.iWidth ||
+                                iSourceSize.iHeight > iFullScreenSize.iHeight);
+
+        if(sourceIsBigger)
+        {
+
+              iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+            iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+            iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize));
+        }
+        else
+        {
+             iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+            iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+            //iWindow->SetVideoCropRegion( TRect(iUserRect.iTl,iFullScreenSize));
+            //;iWindow->SetDrawRect( TRect(iUserRect.iTl, iSourceSize));
+            iWindow->SetDrawRect( TRect(iUserRect.iTl,iFullScreenSize));
+
+        }
+       LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()1 - %d",iUserRect.Size());
+        SetClippingRegion();
+        LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()2 -%d",iUserRect.Size());
+        if(iUserRect.IsEmpty())
+        {
+            iUserRect = iWindow->DrawRect();
+
+            if(!sourceIsBigger)
+            {
+                iUserRect = TRect(iUserRect.Size());
+            }
+        }
+        LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() -");
+        LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()3 -%d",iUserRect.Size());
+}*/
 
 // interface MMMADisplay
 void CMMADCDisplay::SourceSizeChanged(const TSize& aSourceSize)
@@ -154,8 +245,57 @@
         }
     }
 }
-void CMMADCDisplay::SourceSizeChanged(TInt /*aJavaControlWidth*/, TInt /*aJavaControlHeight*/,TInt /*x*/, TInt /*y*/, TRect /*aBoundsRect*/)
+
+
+void CMMADCDisplay::SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight,TInt /*x*/, TInt /*y*/, TRect /*aBoundsRect*/)
 {
+    LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() +");
+    LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() aJavaControlWidth=%d aJavaControlHeight=%d", aJavaControlWidth, aJavaControlHeight);
+    //  TSize canvasSize(aJavaControlWidth, aJavaControlHeight);
+    iSourceSize = SourceSize();
+    //iSourceSize=canvasSize;
+    LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() asourcesize (%d,%d)",iSourceSize.iHeight,iSourceSize.iWidth);
+#ifdef RD_JAVA_NGA_Enabled
+    if (iWindow)
+    {
+        iWindow->SetVideoCropRegion(TRect(iUserRect.iTl, iSourceSize));
+    }
+#endif
+    //  TSize canvasSize(aJavaControlWidth, aJavaControlHeight);
+    //chnaged
+    TSize canvasSize(aJavaControlWidth, aJavaControlHeight);
+    iFullScreenSize = canvasSize;
+
+    TBool sourceIsBigger = (iSourceSize.iWidth > iFullScreenSize.iWidth ||
+                            iSourceSize.iHeight > iFullScreenSize.iHeight);
+
+    if (sourceIsBigger)
+    {
+        iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+        iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+        iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize));
+    }
+    else
+    {
+        iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+        iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread);
+        //;iWindow->SetDrawRect( TRect(iUserRect.iTl, iSourceSize));
+        iWindow->SetDrawRect(TRect(iUserRect.iTl,iFullScreenSize));
+    }
+    LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()1 - %d , %d",iUserRect.Height(),iUserRect.Width());
+    SetClippingRegion();
+    LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()2 -%d , %d ",iUserRect.Height(),iUserRect.Width());
+    if (iUserRect.IsEmpty())
+    {
+        iUserRect = iWindow->DrawRect();
+
+        if (!sourceIsBigger)
+        {
+            iUserRect = TRect(iUserRect.Size());
+        }
+    }
+    LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() -");
+    LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()3 -%d , %d",iUserRect.Height(),iUserRect.Width());
 }
 
 // interface MMMADisplay
--- a/javauis/mmapi_qt/src_drmv2/inc/cmmadrmmetadatacontrol.h	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmmetadatacontrol.h	Tue Jul 06 20:36:19 2010 +0300
@@ -21,7 +21,7 @@
 #define CMMADRMMETADATACONTROL_H
 
 //  INCLUDES
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 
 #include "cmmadrmaudioplayer.h"
 #include "cmmametadatacontrol.h"
--- a/javauis/tsrc/fute/lcdui/Midp_Alert_01/src/AlertTests.java	Fri Jun 11 13:33:44 2010 +0300
+++ b/javauis/tsrc/fute/lcdui/Midp_Alert_01/src/AlertTests.java	Tue Jul 06 20:36:19 2010 +0300
@@ -156,6 +156,14 @@
                 errorAlert.setTimeout(Alert.FOREVER);
                 Display.getDisplay(parent).setCurrent(errorAlert);
             }
+            catch (IllegalArgumentException e)
+            {
+                System.out.println("Exception: " + e.toString());
+                Alert errorAlert = new Alert("Exception", e.toString(), null,
+                                             AlertType.ERROR);
+                errorAlert.setTimeout(Alert.FOREVER);
+                Display.getDisplay(parent).setCurrent(errorAlert);
+            }
         }
         else if (c == cmdExit)
         {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/java_2_2.iby	Tue Jul 06 20:36:19 2010 +0300
@@ -0,0 +1,367 @@
+/*
+* Copyright (c) 2009 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Image-description file of the Java package for ROFS1.
+*/
+
+#ifndef __JAVA_IBY__
+#define __JAVA_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+// Helper defines
+define JAVA_RES_BLD        ABI_DIR\BUILD_DIR\z\resource\java
+define JAVA_RES_IMG        RESOURCE_FILES_DIR\java
+define JAVA_VM_RES_BLD     JAVA_RES_BLD\jvm\lib\jrt
+define JAVA_VM_RES_IMG     JAVA_RES_IMG\jvm\lib\jrt
+define JAVA_POLICY_BLD     ABI_DIR\BUILD_DIR\z\resource\java\security\policies
+define JAVA_POLICY_IMG     RESOURCE_FILES_DIR\java\security\policies
+
+
+////////////////////////////
+// Java Manager collection//
+////////////////////////////
+
+// stub sis
+data=ZSYSTEM\install\java.sis    System\Install\java.sis
+
+
+// AppMngr plugin
+ECOM_PLUGIN( appmngr2midletplugin.dll, appmngr2midletplugin.rsc )
+data=ZRESOURCE\plugins\appmngr2midletplugin.rsc    ECOM_RESOURCE_DIR\appmngr2midletplugin.rsc
+
+// Captain
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_autostarter.dll             	        SHARED_LIB_DIR\javacaptain_ext_autostarter.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_btdeviceclassmanager.dll             SHARED_LIB_DIR\javacaptain_ext_btdeviceclassmanager.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_config.dll                           SHARED_LIB_DIR\javacaptain_ext_config.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_ondemand_2.dll                       SHARED_LIB_DIR\javacaptain_ext_ondemand_2.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_ondemand_7.dll                       SHARED_LIB_DIR\javacaptain_ext_ondemand_7.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_preinstallerstarter.dll              SHARED_LIB_DIR\javacaptain_ext_preinstallerstarter.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_pushregistryplugin.dll               SHARED_LIB_DIR\javacaptain_ext_pushregistryplugin.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_storageserverplugin.dll              SHARED_LIB_DIR\javacaptain_ext_storageserverplugin.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_settingslistener.dll                 SHARED_LIB_DIR\javacaptain_ext_settingslistener.dll
+file=ABI_DIR\BUILD_DIR\javacaptain.exe                                      PROGRAMS_DIR\javacaptain.exe
+
+// Registry
+file=ABI_DIR\BUILD_DIR\javaregistryclient.dll                               SHARED_LIB_DIR\javaregistryclient.dll
+file=ABI_DIR\BUILD_DIR\javasizehelperclient.dll                             SHARED_LIB_DIR\javasizehelperclient.dll
+file=ABI_DIR\BUILD_DIR\javasizehelperserver.dll                             SHARED_LIB_DIR\javasizehelperserver.dll
+
+// Installer
+ECOM_PLUGIN(ifeui.dll,ifeui.rsc)
+data=ZRESOURCE\plugins\ifeui.rsc                                            ECOM_RESOURCE_DIR\ifeui.rsc
+data=ZPRIVATE\10003a3f\apps\javainstaller_reg.rsc                           \private\10003a3f\import\apps\javainstaller_reg.rsc
+data=ZRESOURCE\apps\javainstaller_loc.rsc                                   APP_RESOURCE_DIR\javainstaller_loc.rsc
+data=ZRESOURCE\apps\javainstaller_icon.mif                                  APP_BITMAP_DIR\javainstaller_icon.mif
+file=ABI_DIR\BUILD_DIR\javainstaller.dll                                    SHARED_LIB_DIR\javainstaller.dll
+data=JAVA_VM_RES_BLD\javainstallerui.odc                                    JAVA_VM_RES_IMG\javainstallerui.odc
+file=ABI_DIR\BUILD_DIR\javainstallerui.dll                                  SHARED_LIB_DIR\javainstallerui.dll
+data=JAVA_VM_RES_BLD\javainstaller.odc                                      JAVA_VM_RES_IMG\javainstaller.odc
+file=ABI_DIR\BUILD_DIR\javainstallerstarter.dll                             PROGRAMS_DIR\javainstallerstarter.dll
+file=ABI_DIR\BUILD_DIR\javapreinstaller.dll                                 PROGRAMS_DIR\javapreinstaller.dll
+data=ZRESOURCE\java\java_app_92.mif                                         JAVA_RES_IMG\java_app.mif
+data=ZRESOURCE\java\java_trusted.png                                        JAVA_RES_IMG\java_trusted.png
+data=ZRESOURCE\java\java_untrusted.png                                      JAVA_RES_IMG\java_untrusted.png
+data=DATAZ_\private\102033E6\installer\inst_plugins.cfg           	    \private\102033E6\installer\inst_plugins.cfg
+
+// Launchers
+file=ABI_DIR\BUILD_DIR\javalauncher.exe                                     PROGRAMS_DIR\javalauncher.exe
+ECOM_PLUGIN(javaappschemeplugin.dll,javaappschemeplugin.rsc)
+data=ZRESOURCE\plugins\javaappschemeplugin.rsc                              ECOM_RESOURCE_DIR\javaappschemeplugin.rsc
+
+// SID Checker
+ECOM_PLUGIN(javasidchecker.dll,10281FBE.rsc)
+data=ZRESOURCE\plugins\javasidchecker.rsc                                   ECOM_RESOURCE_DIR\javasidchecker.rsc
+
+// Recognizers
+ECOM_PLUGIN(recjar.dll, 102031FB.rsc)
+data=ZRESOURCE\plugins\recjar.rsc                                           ECOM_RESOURCE_DIR\recjar.rsc
+
+// Backup & Restore
+file=ABI_DIR\BUILD_DIR\javabackup.exe                                       PROGRAMS_DIR\javabackup.exe
+ECOM_PLUGIN(midp2backupplugin.dll,10282474.rsc)
+data=ZRESOURCE\plugins\midp2backupplugin.rsc                                ECOM_RESOURCE_DIR\midp2backupplugin.rsc
+data=DATAZ_\private\1028246F\backup_registration.xml                        \private\1028246F\backup_registration.xml
+data=DATAZ_\private\102033E6\backup_registration.xml                        \private\102033E6\backup_registration.xml
+
+
+/////////////////////////
+// Java UIs collection //
+/////////////////////////
+
+// CoreUi
+file=ABI_DIR\BUILD_DIR\javacoreui.dll                                       SHARED_LIB_DIR\javacoreui.dll
+data=JAVA_VM_RES_BLD\javacoreui.odc                                         JAVA_VM_RES_IMG\javacoreui.odc
+
+// eSWT
+file=ABI_DIR\BUILD_DIR\eswt.dll                                             SHARED_LIB_DIR\eswt.dll
+data=JAVA_VM_RES_BLD\eswt.odc                                               JAVA_VM_RES_IMG\eswt.odc
+file=ABI_DIR\BUILD_DIR\eswtphysics.dll                                      SHARED_LIB_DIR\eswtphysics.dll
+file=ABI_DIR\BUILD_DIR\eswtapifacade.dll                                    SHARED_LIB_DIR\eswtapifacade.dll
+file=ABI_DIR\BUILD_DIR\eswtdirectcontent.dll                                SHARED_LIB_DIR\eswtdirectcontent.dll
+data=JAVA_VM_RES_BLD\eswtdirectcontent.odc                                  JAVA_VM_RES_IMG\eswtdirectcontent.odc
+data=ZPRIVATE\10003a3f\apps\eswt_reg.rsc                                    \private\10003a3f\import\apps\eswt_reg.rsc
+
+// LCDUI
+file=ABI_DIR\BUILD_DIR\javalcdui.dll                                        SHARED_LIB_DIR\javalcdui.dll
+data=JAVA_VM_RES_BLD\javalcdui.odc                                          JAVA_VM_RES_IMG\javalcdui.odc
+file=ABI_DIR\BUILD_DIR\lcdui.dll                                            SHARED_LIB_DIR\lcdui.dll
+file=ABI_DIR\BUILD_DIR\lcdgr.dll                                            SHARED_LIB_DIR\lcdgr.dll
+file=ABI_DIR\BUILD_DIR\lcdgdrv.dll                                          SHARED_LIB_DIR\lcdgdrv.dll
+file=ABI_DIR\BUILD_DIR\lcdgdrvi.dll                                         SHARED_LIB_DIR\lcdgdrvi.dll
+file=ABI_DIR\BUILD_DIR\lcduiphysicswrap.dll                                 SHARED_LIB_DIR\lcduiphysicswrap.dll
+ECOM_PLUGIN(LCDC4K.dll, 10208164.rsc)
+ECOM_PLUGIN(LCDC64K.dll, 10208162.rsc)
+ECOM_PLUGIN(LCDC16MU.dll, 10208166.rsc)
+ECOM_PLUGIN(LCDC16MA.dll, 10208168.rsc)
+data=ZRESOURCE\java\lcdgr.rsc                                               JAVA_RES_IMG\lcdgr.rsc
+data=ZPRIVATE\10003a3f\apps\lcdui_reg.rsc                                   \private\10003a3f\import\apps\lcdui_reg.rsc
+
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,lcdui)
+
+// AMMS API
+file=ABI_DIR\BUILD_DIR\javaamms.dll                                         SHARED_LIB_DIR\javaamms.dll
+data=JAVA_VM_RES_BLD\javaamms.odc                                           JAVA_VM_RES_IMG\javaamms.odc
+
+// Mobile Media API
+file=ABI_DIR\BUILD_DIR\javamobilemedia.dll                                  SHARED_LIB_DIR\javamobilemedia.dll
+data=JAVA_VM_RES_BLD\javamobilemedia.odc                                    JAVA_VM_RES_IMG\javamobilemedia.odc
+data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaCapture.wav     \System\Sounds\Digital\CamcorderJavaCapture.wav
+data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaStart.wav       \System\Sounds\Digital\CamcorderJavaStart.wav
+
+// MobInfo API
+file=ABI_DIR\BUILD_DIR\javamobinfo.dll                                      SHARED_LIB_DIR\javamobinfo.dll
+data=JAVA_VM_RES_BLD\javamobinfo.odc                                        JAVA_VM_RES_IMG\javamobinfo.odc
+
+// GlobalIndicators API
+file=ABI_DIR\BUILD_DIR\javaglobalindicators.dll                             SHARED_LIB_DIR\javaglobalindicators.dll
+data=JAVA_VM_RES_BLD\javaglobalindicators.odc                               JAVA_VM_RES_IMG\javaglobalindicators.odc
+
+// SoftNotification API
+file=ABI_DIR\BUILD_DIR\javasoftnotification.dll                             SHARED_LIB_DIR\javasoftnotification.dll
+data=JAVA_VM_RES_BLD\javasoftnotification.odc                               JAVA_VM_RES_IMG\javasoftnotification.odc
+
+// 2G API
+file=ABI_DIR\BUILD_DIR\javam2g.dll                                          SHARED_LIB_DIR\javam2g.dll
+data=JAVA_VM_RES_BLD\javam2g.odc                                            JAVA_VM_RES_IMG\javam2g.odc
+
+// 3G API
+file=ABI_DIR\BUILD_DIR\javam3g.dll                                          SHARED_LIB_DIR\javam3g.dll
+data=JAVA_VM_RES_BLD\javam3g.odc                                            JAVA_VM_RES_IMG\javam3g.odc
+
+// Nokia Sound API
+file=ABI_DIR\BUILD_DIR\javanokiasound.dll                                   SHARED_LIB_DIR\javanokiasound.dll
+data=JAVA_VM_RES_BLD\javanokiasound.odc                                     JAVA_VM_RES_IMG\javanokiasound.odc
+
+// Remote Connection Observer
+file=ABI_DIR\BUILD_DIR\javaremconobserver.dll                               SHARED_LIB_DIR\javaremconobserver.dll
+
+// Legacy utilities
+file=ABI_DIR\BUILD_DIR\javalegacyutils.dll                                  SHARED_LIB_DIR\javalegacyutils.dll
+data=JAVA_VM_RES_BLD\javalegacyutils.odc                                    JAVA_VM_RES_IMG\javalegacyutils.odc
+
+
+/////////////////////////////
+// Java Runtimes collection //
+/////////////////////////////
+
+// Runtime utilities
+file=ABI_DIR\BUILD_DIR\javaruntimeui.dll                                    SHARED_LIB_DIR\javaruntimeui.dll
+data=JAVA_VM_RES_BLD\javaruntimeui.odc                                      JAVA_VM_RES_IMG\javaruntimeui.odc
+file=ABI_DIR\BUILD_DIR\javaruntimestarterutils.dll                          SHARED_LIB_DIR\javaruntimestarterutils.dll
+
+// MIDP runtime
+file=ABI_DIR\BUILD_DIR\javamidp.exe                                         PROGRAMS_DIR\javamidp.exe
+file=ABI_DIR\BUILD_DIR\javamidpstarter.dll                                  SHARED_LIB_DIR\javamidpstarter.dll
+file=ABI_DIR\BUILD_DIR\javamidpruntime.dll                                  SHARED_LIB_DIR\javamidpruntime.dll
+data=JAVA_VM_RES_BLD\javamidpruntime.odc                                    JAVA_VM_RES_IMG\javamidpruntime.odc
+
+// An empty JVM argument modifier (to prevent 3rd parties from installing a DLL with this name)
+// To enable JVM argument modifier - comment 1st line below and uncomment 2nd line below
+file=ABI_DIR\BUILD_DIR\javajvmargsmodifier.dll                              SHARED_LIB_DIR\javajvmargsmodifier.dll
+//file=ABI_DIR\BUILD_DIR\javajvmargsmodifierfile.dll                        SHARED_LIB_DIR\javajvmargsmodifier.dll
+
+
+/////////////////////////////
+// Java Commons collection //
+/////////////////////////////
+
+// J9 JVM
+file=ABI_DIR\BUILD_DIR\j9.dll                                               SHARED_LIB_DIR\j9.dll
+file=ABI_DIR\BUILD_DIR\j9vmall23.dll                                        SHARED_LIB_DIR\j9vmall23.dll
+file=ABI_DIR\BUILD_DIR\j9mjit23.dll                                         SHARED_LIB_DIR\j9mjit23.dll
+file=ABI_DIR\BUILD_DIR\jclcldc11_23.dll                                     SHARED_LIB_DIR\jclcldc11_23.dll
+file=ABI_DIR\BUILD_DIR\jclcdc11_23.dll                                      SHARED_LIB_DIR\jclcdc11_23.dll
+file=ABI_DIR\BUILD_DIR\j9fdm23.dll                                          SHARED_LIB_DIR\j9fdm23.dll
+file=ABI_DIR\BUILD_DIR\JvmNativePort.dll                                    SHARED_LIB_DIR\JvmNativePort.dll
+data=JAVA_RES_BLD\jvm\bin\java.properties                                   JAVA_RES_IMG\jvm\bin\java.properties
+data=JAVA_RES_BLD\jvm\lib\security\java.policy                              JAVA_RES_IMG\jvm\lib\security\java.policy
+data=JAVA_RES_BLD\jvm\lib\security\java.security                            JAVA_RES_IMG\jvm\lib\security\java.security
+
+// Utilities
+file=ABI_DIR\BUILD_DIR\javautils.dll                                        SHARED_LIB_DIR\javautils.dll
+data=JAVA_VM_RES_BLD\javautils.odc                                          JAVA_VM_RES_IMG\javautils.odc
+file=ABI_DIR\BUILD_DIR\javacomms.dll                                        SHARED_LIB_DIR\javacomms.dll
+data=JAVA_VM_RES_BLD\javacomms.odc                                          JAVA_VM_RES_IMG\javacomms.odc
+file=ABI_DIR\BUILD_DIR\javaipc.dll                                          SHARED_LIB_DIR\javaipc.dll
+file=ABI_DIR\BUILD_DIR\javafileutils.dll                                    SHARED_LIB_DIR\javafileutils.dll
+data=JAVA_VM_RES_BLD\javafileutils.odc                                      JAVA_VM_RES_IMG\javafileutils.odc
+file=ABI_DIR\BUILD_DIR\javadebugapi.dll                                     SHARED_LIB_DIR\javadebugapi.dll
+
+// Security dlls
+file=ABI_DIR\BUILD_DIR\javasecurity.dll                                     SHARED_LIB_DIR\javasecurity.dll
+data=JAVA_VM_RES_BLD\javasecurity.odc                                       JAVA_VM_RES_IMG\javasecurity.odc
+ECOM_PLUGIN(javaunicertstoreplugin.dll,200213A3.rsc)
+data=ZRESOURCE\plugins\javaunicertstoreplugin.rsc                           ECOM_RESOURCE_DIR\javaunicertstoreplugin.rsc
+
+// Security certs & policies
+data=JAVA_POLICY_BLD\s60_manufacturer.ser                                   JAVA_POLICY_IMG\s60_manufacturer.ser
+data=JAVA_POLICY_BLD\s60_operator.ser                                       JAVA_POLICY_IMG\s60_operator.ser
+data=JAVA_POLICY_BLD\s60_trustedthirdparty.ser                              JAVA_POLICY_IMG\s60_trustedthirdparty.ser
+data=JAVA_POLICY_BLD\s60_untrusted.ser                                      JAVA_POLICY_IMG\s60_untrusted.ser
+data=JAVA_POLICY_BLD\msa_manufacturer.ser                                   JAVA_POLICY_IMG\msa_manufacturer.ser
+data=JAVA_POLICY_BLD\msa_operator.ser                                       JAVA_POLICY_IMG\msa_operator.ser
+data=JAVA_POLICY_BLD\msa_trustedthirdparty.ser                              JAVA_POLICY_IMG\msa_trustedthirdparty.ser
+data=JAVA_POLICY_BLD\msa_untrusted.ser                                      JAVA_POLICY_IMG\msa_untrusted.ser
+data=JAVA_POLICY_BLD\att_manufacturer.ser                                   JAVA_POLICY_IMG\att_manufacturer.ser
+data=JAVA_POLICY_BLD\att_operator.ser                                       JAVA_POLICY_IMG\att_operator.ser
+data=JAVA_POLICY_BLD\att_operatorextra.ser                                  JAVA_POLICY_IMG\att_operatorextra.ser
+data=JAVA_POLICY_BLD\att_trustedthirdparty.ser                              JAVA_POLICY_IMG\att_trustedthirdparty.ser
+data=JAVA_POLICY_BLD\att_untrusted.ser                                      JAVA_POLICY_IMG\att_untrusted.ser
+data=JAVA_POLICY_BLD\all.ser                                                JAVA_POLICY_IMG\all.ser
+
+
+// Java environment info
+file=ABI_DIR\BUILD_DIR\javaenvinfo.dll                                      SHARED_LIB_DIR\javaenvinfo.dll
+data=ABI_DIR\BUILD_DIR\Z\Resource\versions\java.txt                         RESOURCE_FILES_DIR\versions\java.txt
+
+// Storage
+file=ABI_DIR\BUILD_DIR\javastorage.dll                                      SHARED_LIB_DIR\javastorage.dll
+data=JAVA_VM_RES_BLD\javastorage.odc                                        JAVA_VM_RES_IMG\javastorage.odc
+
+// GCF base
+file=ABI_DIR\BUILD_DIR\javagcf.dll                                          SHARED_LIB_DIR\javagcf.dll
+data=JAVA_VM_RES_BLD\javagcf.odc                                            JAVA_VM_RES_IMG\javagcf.odc
+
+// Connection Manager
+file=ABI_DIR\BUILD_DIR\javaconnectionmanager.dll                            SHARED_LIB_DIR\javaconnectionmanager.dll
+data=JAVA_VM_RES_BLD\javaconnectionmanager.odc                              JAVA_VM_RES_IMG\javaconnectionmanager.odc
+
+// Http & https protocols
+file=ABI_DIR\BUILD_DIR\javahttp.dll                                         SHARED_LIB_DIR\javahttp.dll
+file=ABI_DIR\BUILD_DIR\javahttps.dll                                        SHARED_LIB_DIR\javahttps.dll
+data=JAVA_VM_RES_BLD\javahttp.odc                                           JAVA_VM_RES_IMG\javahttp.odc
+data=JAVA_VM_RES_BLD\javahttps.odc                                          JAVA_VM_RES_IMG\javahttps.odc
+
+// Socket protocol
+file=ABI_DIR\BUILD_DIR\javasocket.dll                                       SHARED_LIB_DIR\javasocket.dll
+file=ABI_DIR\BUILD_DIR\javasocketscplugin.dll                               SHARED_LIB_DIR\javasocketscplugin.dll
+data=JAVA_VM_RES_BLD\javasocket.odc                                         JAVA_VM_RES_IMG\javasocket.odc
+
+// Secure socket protocol
+file=ABI_DIR\BUILD_DIR\javassl.dll                                          SHARED_LIB_DIR\javassl.dll
+data=JAVA_VM_RES_BLD\javassl.odc                                            JAVA_VM_RES_IMG\javassl.odc
+
+
+////////////////////////////////
+// Java Extensions collection //
+////////////////////////////////
+
+// Push
+file=ABI_DIR\BUILD_DIR\javapushcontroller.dll                               SHARED_LIB_DIR\javapushcontroller.dll
+file=ABI_DIR\BUILD_DIR\javapushregistry.dll                                 SHARED_LIB_DIR\javapushregistry.dll
+data=JAVA_VM_RES_BLD\javapushregistry.odc                                   JAVA_VM_RES_IMG\javapushregistry.odc
+
+// Bluetooth
+file=ABI_DIR\BUILD_DIR\javabluecove.dll                                     SHARED_LIB_DIR\javabluecove.dll
+file=ABI_DIR\BUILD_DIR\javabluetooth.dll                                    SHARED_LIB_DIR\javabluetooth.dll
+file=ABI_DIR\BUILD_DIR\javabluetoothcommons.dll                             SHARED_LIB_DIR\javabluetoothcommons.dll
+file=ABI_DIR\BUILD_DIR\javabtgoepscplugin.dll                               SHARED_LIB_DIR\javabtgoepscplugin.dll
+file=ABI_DIR\BUILD_DIR\javabtl2capscplugin.dll                              SHARED_LIB_DIR\javabtl2capscplugin.dll
+file=ABI_DIR\BUILD_DIR\javabtsppscplugin.dll                                SHARED_LIB_DIR\javabtsppscplugin.dll
+data=JAVA_VM_RES_BLD\javabluecove.odc                                       JAVA_VM_RES_IMG\javabluecove.odc
+data=JAVA_VM_RES_BLD\javabluetooth.odc                                      JAVA_VM_RES_IMG\javabluetooth.odc
+data=JAVA_VM_RES_BLD\javabluetoothcommons.odc                               JAVA_VM_RES_IMG\javabluetoothcommons.odc
+
+// WMA
+file=ABI_DIR\BUILD_DIR\javawma.dll                                          SHARED_LIB_DIR\javawma.dll
+file=ABI_DIR\BUILD_DIR\javawmamms.dll                                       SHARED_LIB_DIR\javawmamms.dll
+file=ABI_DIR\BUILD_DIR\javacbsscplugin.dll                                  SHARED_LIB_DIR\javacbsscplugin.dll
+file=ABI_DIR\BUILD_DIR\javammsscplugin.dll                                  SHARED_LIB_DIR\javammsscplugin.dll
+file=ABI_DIR\BUILD_DIR\javasmsscplugin.dll                                  SHARED_LIB_DIR\javasmsscplugin.dll
+data=JAVA_VM_RES_BLD\javawma.odc                                            JAVA_VM_RES_IMG\javawma.odc
+data=JAVA_VM_RES_BLD\javawmamms.odc                                         JAVA_VM_RES_IMG\javawmamms.odc
+
+// Comm
+file=ABI_DIR\BUILD_DIR\javacomm.dll                                         SHARED_LIB_DIR\javacomm.dll
+data=JAVA_VM_RES_BLD\javacomm.odc                                           JAVA_VM_RES_IMG\javacomm.odc
+
+// Datagram
+file=ABI_DIR\BUILD_DIR\javadatagram.dll                                     SHARED_LIB_DIR\javadatagram.dll
+file=ABI_DIR\BUILD_DIR\javadatagramscplugin.dll                             SHARED_LIB_DIR\javadatagramscplugin.dll
+data=JAVA_VM_RES_BLD\javadatagram.odc                                       JAVA_VM_RES_IMG\javadatagram.odc
+
+// Location API
+file=ABI_DIR\BUILD_DIR\javalocation.dll                                     SHARED_LIB_DIR\javalocation.dll
+data=JAVA_VM_RES_BLD\javalocation.odc                                       JAVA_VM_RES_IMG\javalocation.odc
+
+// Sensor API
+file=ABI_DIR\BUILD_DIR\javasensor.dll                                       SHARED_LIB_DIR\javasensor.dll
+data=JAVA_VM_RES_BLD\javasensor.odc                                         JAVA_VM_RES_IMG\javasensor.odc
+
+// Web services API
+file=ABI_DIR\BUILD_DIR\javawebservices.dll                                  SHARED_LIB_DIR\javawebservices.dll
+data=JAVA_VM_RES_BLD\javawebservices.odc                                    JAVA_VM_RES_IMG\javawebservices.odc
+
+// PIM API
+file=ABI_DIR\BUILD_DIR\javapim.dll                                          SHARED_LIB_DIR\javapim.dll
+data=JAVA_VM_RES_BLD\javapim.odc                                            JAVA_VM_RES_IMG\javapim.odc
+
+// RMS API
+file=ABI_DIR\BUILD_DIR\javarms.dll                                          SHARED_LIB_DIR\javarms.dll
+data=JAVA_VM_RES_BLD\javarms.odc                                            JAVA_VM_RES_IMG\javarms.odc
+
+// SATSA API
+file=ABI_DIR\BUILD_DIR\javasatsa.dll                                        SHARED_LIB_DIR\javasatsa.dll
+data=JAVA_VM_RES_BLD\javasatsa.odc                                          JAVA_VM_RES_IMG\javasatsa.odc
+
+// File API
+file=ABI_DIR\BUILD_DIR\javafile.dll                                         SHARED_LIB_DIR\javafile.dll
+data=JAVA_VM_RES_BLD\javafile.odc                                           JAVA_VM_RES_IMG\javafile.odc
+
+// IAP Info API
+file=ABI_DIR\BUILD_DIR\javaiapinfo.dll                                      SHARED_LIB_DIR\javaiapinfo.dll
+data=JAVA_VM_RES_BLD\javaiapinfo.odc                                        JAVA_VM_RES_IMG\javaiapinfo.odc
+
+
+///////////////////
+// Miscellaneous //
+///////////////////
+
+// Generated localization file resources
+data=JAVA_VM_RES_BLD\resources.jar                                          JAVA_VM_RES_IMG\resources.jar
+
+// ODC list files
+data=ZRESOURCE\java\midpOdcList                                             JAVA_RES_IMG\midpodclist
+data=ZRESOURCE\java\installerOdcList                                        JAVA_RES_IMG\installerodclist
+data=ZRESOURCE\java\tckRunnerOdcList                                        JAVA_RES_IMG\tckrunnerodclist
+data=ZRESOURCE\java\javacontrolpanelodclist                                 JAVA_RES_IMG\javacontrolpanelodclist
+
+// trust roots list
+data=ZRESOURCE\java\security\trustroots\midprootslist                       JAVA_RES_IMG\security\trustroots\midprootslist
+
+// Utility for Services team
+file=ABI_DIR\BUILD_DIR\javaupgradeapp.exe                                   PROGRAMS_DIR\javaupgradeapp.exe
+
+#endif
--- a/rom/java_3_1.iby	Fri Jun 11 13:33:44 2010 +0300
+++ b/rom/java_3_1.iby	Tue Jul 06 20:36:19 2010 +0300
@@ -41,6 +41,7 @@
 data=DATAZ_\resource\qt\plugins\appsettings\javaapplicationsettingsview.qtplugin 		resource\qt\plugins\appsettings\javaapplicationsettingsview.qtplugin
 
 // Captain
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_autostarter.dll             	        SHARED_LIB_DIR\javacaptain_ext_autostarter.dll
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_btdeviceclassmanager.dll             SHARED_LIB_DIR\javacaptain_ext_btdeviceclassmanager.dll
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_config.dll                           SHARED_LIB_DIR\javacaptain_ext_config.dll
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_ondemand_2.dll                       SHARED_LIB_DIR\javacaptain_ext_ondemand_2.dll
@@ -48,6 +49,7 @@
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_preinstallerstarter.dll              SHARED_LIB_DIR\javacaptain_ext_preinstallerstarter.dll
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_pushregistryplugin.dll               SHARED_LIB_DIR\javacaptain_ext_pushregistryplugin.dll
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_storageserverplugin.dll              SHARED_LIB_DIR\javacaptain_ext_storageserverplugin.dll
+file=ABI_DIR\BUILD_DIR\javacaptain_ext_settingslistener.dll                 SHARED_LIB_DIR\javacaptain_ext_settingslistener.dll
 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 file=ABI_DIR\BUILD_DIR\javacaptain_ext_scrupdater.dll                       SHARED_LIB_DIR\javacaptain_ext_scrupdater.dll
 #endif
@@ -69,8 +71,9 @@
 file=ABI_DIR\BUILD_DIR\javainstallerstarter.dll                             PROGRAMS_DIR\javainstallerstarter.dll
 file=ABI_DIR\BUILD_DIR\javapreinstaller.dll                                 PROGRAMS_DIR\javapreinstaller.dll
 data=ZRESOURCE\java\java_app_92.mif                                         JAVA_RES_IMG\java_app.mif
-data=ZRESOURCE\java\java_trusted.png                                        JAVA_RES_IMG\java_trusted.png
-data=ZRESOURCE\java\java_untrusted.png                                      JAVA_RES_IMG\java_untrusted.png
+data=ZRESOURCE\java\java_3_trusted.png                                      JAVA_RES_IMG\java_3_trusted.png
+data=ZRESOURCE\java\java_3_untrusted.png                                    JAVA_RES_IMG\java_3_untrusted.png
+data=ZRESOURCE\java\javaapplicationinstaller.css                            JAVA_RES_IMG\javaapplicationinstaller.css
 data=DATAZ_\private\102033E6\installer\inst_plugins.cfg                     \private\102033E6\installer\inst_plugins.cfg
 
 // Launchers
@@ -78,10 +81,6 @@
 ECOM_PLUGIN(javaappschemeplugin.dll,javaappschemeplugin.rsc)
 data=ZRESOURCE\plugins\javaappschemeplugin.rsc                              ECOM_RESOURCE_DIR\javaappschemeplugin.rsc
 
-// SID Checker
-ECOM_PLUGIN(javasidchecker.dll,javasidchecker.rsc)
-data=ZRESOURCE\plugins\javasidchecker.rsc                                   ECOM_RESOURCE_DIR\javasidchecker.rsc
-
 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 // Usif installer plugin
 ECOM_PLUGIN(javasifplugin.dll,javasifplugin.rsc)
@@ -119,18 +118,7 @@
 // LCDUI
 file=ABI_DIR\BUILD_DIR\openlcdui.dll                                        SHARED_LIB_DIR\openlcdui.dll
 data=JAVA_VM_RES_BLD\openlcdui.odc                                          JAVA_VM_RES_IMG\openlcdui.odc
-// AMMS API
-/*
-file=ABI_DIR\BUILD_DIR\javaamms.dll                                         SHARED_LIB_DIR\javaamms.dll
-data=JAVA_VM_RES_BLD\javaamms.odc                                           JAVA_VM_RES_IMG\javaamms.odc
-*/
-// Mobile Media API
-/*
-file=ABI_DIR\BUILD_DIR\javamobilemedia.dll                                  SHARED_LIB_DIR\javamobilemedia.dll
-data=JAVA_VM_RES_BLD\javamobilemedia.odc                                    JAVA_VM_RES_IMG\javamobilemedia.odc
-data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaCapture.wav     \System\Sounds\Digital\CamcorderJavaCapture.wav
-data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaStart.wav       \System\Sounds\Digital\CamcorderJavaStart.wav
-*/
+
 // MobInfo API
 file=ABI_DIR\BUILD_DIR\javamobinfo.dll                                      SHARED_LIB_DIR\javamobinfo.dll
 data=JAVA_VM_RES_BLD\javamobinfo.odc                                        JAVA_VM_RES_IMG\javamobinfo.odc
@@ -341,6 +329,15 @@
 file=ABI_DIR\BUILD_DIR\javaiapinfo.dll                                      SHARED_LIB_DIR\javaiapinfo.dll
 data=JAVA_VM_RES_BLD\javaiapinfo.odc                                        JAVA_VM_RES_IMG\javaiapinfo.odc
 
+// MMAPI
+file=ABI_DIR\BUILD_DIR\javamobilemedia.dll                                      SHARED_LIB_DIR\javamobilemedia.dll
+data=JAVA_VM_RES_BLD\javamobilemedia.odc                                        JAVA_VM_RES_IMG\javamobilemedia.odc
+data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaCapture.wav     \System\Sounds\Digital\CamcorderJavaCapture.wav
+data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaStart.wav       \System\Sounds\Digital\CamcorderJavaStart.wav
+
+// AMMS
+file=ABI_DIR\BUILD_DIR\javaamms.dll                                      SHARED_LIB_DIR\javaamms.dll
+data=JAVA_VM_RES_BLD\javaamms.odc                                        JAVA_VM_RES_IMG\javaamms.odc
 
 ///////////////////
 // Miscellaneous //
@@ -358,4 +355,7 @@
 // trust roots list
 data=ZRESOURCE\java\security\trustroots\midprootslist                       JAVA_RES_IMG\security\trustroots\midprootslist
 
+// Utility for Services team
+file=ABI_DIR\BUILD_DIR\javaupgradeapp.exe                                   PROGRAMS_DIR\javaupgradeapp.exe
+
 #endif