Catchup to latest Symbian^4 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:31:34 +0100
branchGCC_SURGE
changeset 55 d93ef1df440d
parent 43 6d7ae91094e7 (current diff)
parent 53 3035d69b481d (diff)
Catchup to latest Symbian^4
build/properties.xml
javacommons/comms/tsrc/Makefile
javacommons/comms/tsrc/javaapi/Makefile
javamanager/javacaptain/extensionplugins/scrupdater/inc/scrupdater.h
javamanager/javacaptain/extensionplugins/scrupdater/src.s60/lookup.cpp
javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp
javamanager/javasidchecker/build/bld.inf
javamanager/javasidchecker/build/javasidchecker.mmp
javamanager/javasidchecker/data/10281FBE.rss
javamanager/javasidchecker/inc/javasidchecker.h
javamanager/javasidchecker/src/javasidchecker.cpp
javamanager/javaupgradeapp/src.s60/javaupgradeapp.cpp
javaruntimes/starter/build/java.pro
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2me/org/eclipse/swt/internal/ApplicationUidWrapper.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2me/org/eclipse/swt/internal/CommandPresentationStrategyWrapper.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/ApplicationUidWrapper.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/CommandPresentationStrategyWrapper.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/linux/org/eclipse/swt/internal/qt/s60/S60CommandPresentationStrategy.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandPresentationStrategy.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/DesktopCommandPresentationStrategy.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/s60/org/eclipse/swt/internal/qt/s60/S60CommandPresentationStrategy.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/webkit/org/eclipse/swt/internal/qt/webkit/OS_webkit.java
javauis/m3g_qt/src/jni/graphics3d.inl
javauis/m3g_qt/src/jni/interface.inl
rom/java_2_1.iby
--- a/build/Makefile.comp	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/Makefile.comp	Thu Jul 22 16:31:34 2010 +0100
@@ -119,7 +119,7 @@
 # Symbian ----------------------------------
 ifeq ($(BUILDENV),symbian)
 
-all: qmake java native
+all: qmake java native codescanner
 
 # Extract basename of current component
 BASENAME = $(basename $(PRO_FILE))
@@ -170,6 +170,12 @@
 clean_qmake:
 	-$(call RMFILES,abld.bat bld.inf* Makefile* $(BASENAME).mmp $(BASENAME)_*.mmp $(BASENAME)_*.pkg $(BASENAME)_reg.rss eabi_stl4/*)
 
+# Use Carbide CodeScanner to list high-level issues
+codescanner:
+ifneq ($(call PATHSEARCH,codescanner.exe),)
+	$(call CODESCANNER,..)
+endif
+
 # Symbian SBS ------------------------------
 ifdef USESBS
 
--- a/build/Makefile.defs	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/Makefile.defs	Thu Jul 22 16:31:34 2010 +0100
@@ -57,6 +57,7 @@
     MKDIR = if [ ! -d $(1)]; then mkdir $(1); fi
     RMDIR = if [ -d $(1)]; then rmdir $(1); fi
     DELTREE = if [ -d $(1)]; then rm -fr $(1); fi
+    PATHSEARCH = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
 
   else
     # CMD.exe definitions
@@ -74,6 +75,7 @@
     MKDIR = if not exist $(1) mkdir  $(1)
     RMDIR = if exist $(1) rmdir  $(1)
     DELTREE = if exist $(1) rmdir /S/Q $(1)
+    PATHSEARCH = $(firstword $(wildcard $(addsuffix /$(1),$(subst ;, ,$(PATH)))))
 
   endif
 
@@ -103,6 +105,7 @@
   export ANT_OPTS=
   BLDMAKE = perl -S bldmake.pl
   ABLDMAKE = set MAKELEVEL=&&set MAKEFLAGS=&&set MFLAGS=&&make -r
+  CODESCANNER = codescanner -c $(JAVA_SRC_ROOT)/build/codescanner_high.xml  -o std $(1) | perl -ne "print if /error:/;"
 
   ifdef NODEP
   # Makmake does not make dependency checks with this flag
--- a/build/Makefile.nonqt	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/Makefile.nonqt	Thu Jul 22 16:31:34 2010 +0100
@@ -43,19 +43,24 @@
 # Symbian ----------------------------------
 ifeq ($(BUILDENV),symbian)
 
-all: native
+all: native codescanner
 
 javareleasables:
 
 makestubs:
 
+codescanner:
+ifneq ($(call PATHSEARCH,codescanner.exe),)
+	$(call CODESCANNER,..)
+endif
+
 # Symbian SBS ------------------------------
 ifdef USESBS
 
 # BUILD combines commands EXPORT MAKEFILE BITMAP RESOURCE LIBRARY TARGET FINAL
 native:
 	$(PHASEINFO)
-	$(SBS) -c $(PLATFORM)_$(CFG) BUILD
+	$(SBS) -c $(PLATFORM)_$(CFG)
 
 clean_java:
 
--- a/build/Makefile.project	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/Makefile.project	Thu Jul 22 16:31:34 2010 +0100
@@ -174,13 +174,6 @@
 ifdef RD_JAVA_USIF_ENABLED
   SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK = 1
   PROJECT_DEFINES += SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
-  # Following flag enables application registrations to USIF
-  # and disables application registrations to AppArc.
-  PROJECT_DEFINES += RD_JAVA_USIF_APP_REG
-  # Following flag enables application notifications to AppArc.
-  PROJECT_DEFINES += RD_JAVA_USIF_NOTIFY_APP_ARC
-  # Following flag enables installation progress notifications through USIF.
-  PROJECT_DEFINES += RD_JAVA_USIF_NOTIFY_PROGRESS
 endif
 
 # Java proximity Listener support exsist in 9.2 only(can not be used if 5.0 untill IAD dependecy mentioned)
--- a/build/Makefile.subsystem	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/Makefile.subsystem	Thu Jul 22 16:31:34 2010 +0100
@@ -188,6 +188,11 @@
 bld.inf:
 	$(MAKE) -f subsystem.mk makestubs qmake
 
+# Use Carbide CodeScanner to list high-level issues
+codescanner:
+ifneq ($(call PATHSEARCH,codescanner.exe),)
+	$(call CODESCANNER,.)
+endif
 
 # Symbian SBS ------------------------------
 ifdef USESBS
--- a/build/bld.inf	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/bld.inf	Thu Jul 22 16:31:34 2010 +0100
@@ -50,7 +50,7 @@
 
 #else // RD_JAVA_UI_QT
 
-../rom/java_2_1.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(java.iby)
+../rom/java_2_2.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(java.iby)
 
 // Export ODC list files
 ../rom/midpodclist	     /epoc32/release/winscw/udeb/z/resource/java/midpodclist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/codescanner_high.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,61 @@
+<!--
+#
+# 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: Configuration file for the Carbine CodeScanner, to
+#              scan only high-priority issues.
+#
+-->
+<codescannerConfig>
+	<sources>
+		<!-- source files matching any of the exclude patterns below will not be scanned -->
+
+		<!-- binary files -->
+		<exclude>.*\.au</exclude>
+		<exclude>.*\.avi</exclude>
+		<exclude>.*\.bmp</exclude>
+		<exclude>.*\.dll</exclude>
+		<exclude>.*\.doc</exclude>
+		<exclude>.*\.exe</exclude>
+		<exclude>.*\.gif</exclude>
+		<exclude>.*\.jpg</exclude>
+		<exclude>.*\.mbm</exclude>
+		<exclude>.*\.mp3</exclude>
+		<exclude>.*\.mpg</exclude>
+		<exclude>.*\.png</exclude>
+		<exclude>.*\.raw</exclude>
+		<exclude>.*\.rtf</exclude>
+		<exclude>.*\.tif</exclude>
+		<exclude>.*\.wav</exclude>
+		<exclude>.*\.wbmp</exclude>
+		<exclude>.*\.wmf</exclude>
+		<exclude>.*\.xls</exclude>
+		<!-- typical test directory names -->
+		<exclude>.*\\ts_.*</exclude>
+		<exclude>.*\\tsrc\\.*</exclude>
+		<exclude>.*\\tsrc.s60\\.*</exclude>
+		<exclude>.*\\test\\.*</exclude>
+		<exclude>.*\\internal\\.*</exclude>
+		<exclude>.*\\Internal\\.*</exclude>
+		<exclude>.*\\.svn\\.*</exclude>
+		<exclude>\\tools\\.*</exclude>
+	</sources>
+	<severities>
+		<!-- Group scripts based on severity level: -->
+		<!--    enable="true" or "false" -->
+
+		<high enable="true"/>
+		<medium enable="false"/>
+		<low enable="false"/>
+	</severities>
+</codescannerConfig>
--- a/build/exports.inf	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/exports.inf	Thu Jul 22 16:31:34 2010 +0100
@@ -48,7 +48,7 @@
 
 #else // RD_JAVA_UI_QT
 
-../rom/java_2_1.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(java.iby)
+../rom/java_2_2.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(java.iby)
 
 // Export ODC list files
 ../rom/midpodclist	     /epoc32/release/winscw/udeb/z/resource/java/midpodclist
Binary file build/loc/resources.jar has changed
Binary file build/loc/resources_qt.jar has changed
--- a/build/makefile.javaversion	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/makefile.javaversion	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/omj.pri	Thu Jul 22 16:31:34 2010 +0100
@@ -73,7 +73,7 @@
       include(symbian_uids.pri)
 
       DEFINES += __SYMBIAN32__
-      DEFINES += J9EPOC32 RD_JAVA_OMJ_FSERVER
+      DEFINES += J9EPOC32
 
       LIBS += -llibpthread
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/sis/incompatible_openc.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,3 @@
+OpenC version 1.5 or later is not found. Some Java applications may not work properly. Make sure that latest device firmware is used.
+
+Continue installation?
\ No newline at end of file
--- a/build/sis/incompatible_platform.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/sis/incompatible_platform.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,1 +1,1 @@
-Unfortunately Java Runtime 2.0 Alpha is not compatible with your device. Java Runtime 2.0 Alpha works only on S60 5.0 devices.
+Java Runtime is not compatible with your device. Java Runtime requires S60 5th Edition device.
\ No newline at end of file
--- a/build/sis/java_2_0.pkg	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/sis/java_2_0.pkg	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/sis/java_3_1.pkg	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/build/symbian_uids.pri	Thu Jul 22 16:31:34 2010 +0100
@@ -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/build_defines.hrh	Tue Jun 22 09:54:11 2010 +0100
+++ b/inc/build_defines.hrh	Thu Jul 22 16:31:34 2010 +0100
@@ -15,7 +15,7 @@
 *
 */
 
-#define RD_JAVA_VERSION 2,2,1 
+#define RD_JAVA_VERSION 2,2,2 
 #define RD_JAVA_SYMBIAN_TARGET 
 #define RD_JAVA_S60_RELEASE_10_1 
 #define RD_JAVA_S60_RELEASE_10_1_ONWARDS 
@@ -27,9 +27,6 @@
 #define RD_JAVA_HTTP_EMC_ENABLED 
 #define RD_JAVA_NGA_ENABLED 
 #define SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
-#define RD_JAVA_USIF_APP_REG 
-#define RD_JAVA_USIF_NOTIFY_APP_ARC 
-#define RD_JAVA_USIF_NOTIFY_PROGRESS 
 #define RD_JAVA_PROXIMITY_LISTENER_ENABLED 
 #define RD_JAVA_OPENC_BETA_PATCH 
 #define OPENLCDUI_ENABLED 
--- a/inc/build_defines.pri	Tue Jun 22 09:54:11 2010 +0100
+++ b/inc/build_defines.pri	Thu Jul 22 16:31:34 2010 +0100
@@ -13,4 +13,4 @@
 #
 # Description: Generated file - do not edit manually
 #
-PROJECT_DEFINES *= RD_JAVA_SYMBIAN_TARGET RD_JAVA_S60_RELEASE_10_1 RD_JAVA_S60_RELEASE_10_1_ONWARDS RD_JAVA_S60_RELEASE_9_2_ONWARDS RD_JAVA_S60_RELEASE_5_0_ONWARDS RD_JAVA_UI_QT RD_JAVA_STDCPPV5 RD_JAVA_EPOCALLOWDLLDATA_FIX RD_JAVA_HTTP_EMC_ENABLED RD_JAVA_NGA_ENABLED SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK RD_JAVA_USIF_APP_REG RD_JAVA_USIF_NOTIFY_APP_ARC RD_JAVA_USIF_NOTIFY_PROGRESS RD_JAVA_PROXIMITY_LISTENER_ENABLED RD_JAVA_OPENC_BETA_PATCH OPENLCDUI_ENABLED RD_JAVA_OPENLCDUI_ENABLED RD_JAVA_INSTALLERUI_ENABLED RD_JAVA_PREWARM RD_JAVA_ADVANCED_TACTILE_FEEDBACK RD_JAVA_APPLICATION_SETTINGS_QT RD_JAVA_MIDPRMS_DB 
+PROJECT_DEFINES *= RD_JAVA_SYMBIAN_TARGET RD_JAVA_S60_RELEASE_10_1 RD_JAVA_S60_RELEASE_10_1_ONWARDS RD_JAVA_S60_RELEASE_9_2_ONWARDS RD_JAVA_S60_RELEASE_5_0_ONWARDS RD_JAVA_UI_QT RD_JAVA_STDCPPV5 RD_JAVA_EPOCALLOWDLLDATA_FIX RD_JAVA_HTTP_EMC_ENABLED RD_JAVA_NGA_ENABLED SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK RD_JAVA_PROXIMITY_LISTENER_ENABLED RD_JAVA_OPENC_BETA_PATCH OPENLCDUI_ENABLED RD_JAVA_OPENLCDUI_ENABLED RD_JAVA_INSTALLERUI_ENABLED RD_JAVA_PREWARM RD_JAVA_ADVANCED_TACTILE_FEEDBACK RD_JAVA_APPLICATION_SETTINGS_QT RD_JAVA_MIDPRMS_DB 
--- a/inc/java.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/inc/java.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,1 +1,1 @@
-2.2.1
+2.2.3
--- a/inc/project_defines.hrh	Tue Jun 22 09:54:11 2010 +0100
+++ b/inc/project_defines.hrh	Thu Jul 22 16:31:34 2010 +0100
@@ -26,9 +26,6 @@
 MACRO RD_JAVA_HTTP_EMC_ENABLED 
 MACRO RD_JAVA_NGA_ENABLED 
 MACRO SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
-MACRO RD_JAVA_USIF_APP_REG 
-MACRO RD_JAVA_USIF_NOTIFY_APP_ARC 
-MACRO RD_JAVA_USIF_NOTIFY_PROGRESS 
 MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED 
 MACRO RD_JAVA_OPENC_BETA_PATCH 
 MACRO OPENLCDUI_ENABLED 
--- a/javacommons/comms/tsrc/Makefile	Tue Jun 22 09:54:11 2010 +0100
+++ /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	Tue Jun 22 09:54:11 2010 +0100
+++ /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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/comms/tsrc/javaapi/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/comms/tsrc/javaapi/build/javacaptain_ext_ondemand_101.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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/inc.s60/connectionmanager.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/connectionmanager/inc.s60/connectionmanager.h	Thu Jul 22 16:31:34 2010 +0100
@@ -163,6 +163,7 @@
 
     static HBufC8 * PromptUserSelectNetworkAccessPointL();
     static HBufC8 * CreateDescriptorL(const int aType, const int id);
+    static bool checkIapDefaultL(TUint32 aMatchIapId, TUint32 aDestId, bool aDefault);
 
 
 
--- a/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/build/testapnsettings.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/build/testapnsettings.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/AllTests.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/connectionmanager/legacysupport/apnsettings/tsrc.s60/src/testapnsettings.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/connectionmanager/src.s60/connectionmanager.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/connectionmanager/src.s60/connectionmanager.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -65,7 +65,21 @@
 
 EXPORT_C bool ConnectionManager::isIapDefault(TUint32 aMatchIapId, TUint32 aDestId, bool aDefault)
 {
-    LOG(ESOCKET,EInfo,"+ConnectionManager::getDefualtId");
+	  LOG(ESOCKET,EInfo,"+ConnectionManager::isIapDefault");
+	  bool retVal = false;
+    TRAPD(err,retVal = checkIapDefaultL(aMatchIapId,aDestId,aDefault));
+    if(err!=KErrNone)
+    {
+        // error occured
+        return false;
+    }
+    return retVal;
+}
+
+bool ConnectionManager::checkIapDefaultL(TUint32 aMatchIapId, TUint32 aDestId, bool aDefault)
+{
+	
+    LOG(ESOCKET,EInfo,"+ConnectionManager::checkIapDefaultL");
     TUint32 id = aDestId;
     TUint32 tmpapId;
     TCmDefConnType type;
@@ -104,8 +118,9 @@
             return true;
         }
     }
-    return false;
-
+    return false;	
+	
+	
 }
 
 // ---------------------------------------------------------------------------
--- a/javacommons/fileutils/src/fileutilities.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/fileutils/src/fileutilities.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/fileutils/src/nativefileiohandler.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/fileutils/tsrc/fileutilstestinit/build/javafileutilstestinit.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/fileutils/tsrc/fileutilstestinit/build/javafileutilstestinit.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -21,7 +21,6 @@
 
 symbian {
     TARGET.CAPABILITY = all -tcb
-    INCLUDEPATH += /epoc32/include/caf
     LIBS += -lcaf -lcafutils -lefsrv -lDrmParsers -lDRMServerInterfaces
 }
 
--- a/javacommons/gcfbase/javasrc/com/nokia/mj/impl/gcf/PushRegistryPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfbase/javasrc/com/nokia/mj/impl/gcf/PushRegistryPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -115,7 +115,7 @@
      */
     public String toString()
     {
-        return "javax.microedition.io.PushRegistryPermission";
+        return "javax.microedition.io.PushRegistry";
     }
 
     /**
--- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java	Thu Jul 22 16:31:34 2010 +0100
@@ -95,7 +95,17 @@
 
     public String toString()
     {
-        return "javax.microedition.io.FileProtocolPermission";
+        if (intent.equals("read"))
+        {
+            return "javax.microedition.io.Connector.file.read";
+        }
+
+        if (intent.equals("write"))
+        {
+            return "javax.microedition.io.Connector.file.write";   
+        }
+
+        return null;
     }
 
     /**
--- a/javacommons/gcfprotocols/file/tsrc/mt/filetestinit/build/javafiletestinit.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/file/tsrc/mt/filetestinit/build/javafiletestinit.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -21,7 +21,6 @@
 
 symbian {
     TARGET.CAPABILITY = all -tcb
-    INCLUDEPATH += /epoc32/include/caf
     LIBS += -lcaf -lcafutils -lefsrv -lDrmParsers -lDRMServerInterfaces
 }
 
--- a/javacommons/gcfprotocols/http/build/javahttp.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/build/javahttp.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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/gcf/protocol/http/HttpPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/gcf/protocol/http/HttpPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -45,7 +45,7 @@
 
     public String toString()
     {
-        return "javax.microedition.io.HttpProtocolPermission";
+        return "javax.microedition.io.Connector.http";
     }
 
     public boolean implies(Permission p)
--- a/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/https/javasrc.s60/com/nokia/mj/impl/gcf/protocol/https/HttpsPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/https/javasrc.s60/com/nokia/mj/impl/gcf/protocol/https/HttpsPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -51,7 +51,7 @@
 
     public String toString()
     {
-        return "javax.microedition.io.HttpsProtocolPermission";
+        return "javax.microedition.io.Connector.https";
     }
 
     public boolean implies(Permission p)
--- a/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/gcf/protocol/ssl/SSLPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/gcf/protocol/ssl/SSLPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -55,7 +55,7 @@
 
     public String toString()
     {
-        return "javax.microedition.io.SSLProtocolPermission";
+        return "javax.microedition.io.Connector.ssl";
     }
 
     public boolean implies(Permission p)
--- a/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/ssl/SecureConnectionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/ssl/SecureConnectionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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/gcf/protocol/socket/SocketPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/gcf/protocol/socket/SocketPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -55,7 +55,7 @@
 
     public String toString()
     {
-        return "javax.microedition.io.SocketProtocolPermission";
+        return "javax.microedition.io.Connector.socket";
     }
 
     public boolean implies(Permission p)
--- a/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/javaenv/tsrc/build/alltests.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javastorage/tsrc/storageclient/build/alltests.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/javastorage/tsrc/storageclient/build/alltests.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -22,7 +22,7 @@
 #include <../../../../../inc/java_stdcpp_support_for_exe.hrh>
 #include <platform_paths.hrh>
 
-SYSTEMINCLUDE /epoc32/include 
+APP_LAYER_SYSTEMINCLUDE
 
 USERINCLUDE ../../../inc
 USERINCLUDE ../../../../../tools/cpputest/include/cpputest
--- a/javacommons/security/build/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -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/data/att_manufacturer.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/att_manufacturer.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -36,5 +36,7 @@
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/data/att_operatorextra.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/att_operatorextra.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -36,5 +36,7 @@
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
\ No newline at end of file
--- a/javacommons/security/data/msa_manufacturer.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/msa_manufacturer.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -36,5 +36,7 @@
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/data/msa_operator.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/msa_operator.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -36,5 +36,7 @@
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/data/msa_trustedthirdparty.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/msa_trustedthirdparty.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -71,6 +71,8 @@
     permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
     permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
-grant assigned {
+grant assigned "Location" {
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
 }
--- a/javacommons/security/data/msa_untrusted.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/msa_untrusted.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -60,6 +60,8 @@
     permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
     permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
-grant assigned {
+grant assigned "Location" {
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
 }
--- a/javacommons/security/data/s60_manufacturer.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/s60_manufacturer.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -36,5 +36,7 @@
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/data/s60_operator.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/s60_operator.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -36,5 +36,7 @@
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/data/s60_trustedthirdparty.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/s60_trustedthirdparty.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -72,6 +72,9 @@
     permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
     permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
-grant assigned {
+
+grant assigned "Location" {
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
 }
--- a/javacommons/security/data/s60_untrusted.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/data/s60_untrusted.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -60,6 +60,9 @@
     permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
     permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
-grant assigned {
+
+grant assigned "Location" {
     permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
 }
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicy.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicy.java	Thu Jul 22 16:31:34 2010 +0100
@@ -132,13 +132,14 @@
         int domainLength = buf[index];
         index++;
         protectionDomain = new String(buf, index, domainLength);
+        boolean activeSettings = true;
         index+= domainLength;
         int permissions = buf[index];
         index++;
         policyPermissions = new SecurityPolicyPermission[permissions];
         for (int i=0; i<permissions; i++)
         {
-            policyPermissions[i] = SecurityPolicyPermission.getFromBytes(buf);
+            policyPermissions[i] = SecurityPolicyPermission.getFromBytes(buf, activeSettings);
         }
     }
 }
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java	Thu Jul 22 16:31:34 2010 +0100
@@ -52,12 +52,13 @@
         String name,
         String target,
         String actionList,
+        int type,
         SecurityPolicyPermissionSettings settings)
     {
         this.name = name;
         this.target = target;
         this.actionList = actionList;
-        this.type = USER_TYPE;
+        this.type = type;
         this.settings = settings;
     }
 
@@ -65,13 +66,18 @@
         String name,
         String target,
         String actionList,
+        SecurityPolicyPermissionSettings settings)
+    {
+        this(name, target, actionList, USER_TYPE, settings);
+    }
+
+    public SecurityPolicyPermission(
+        String name,
+        String target,
+        String actionList,
         int type)
     {
-        this.name = name;
-        this.target = target;
-        this.actionList = actionList;
-        // Check type
-        this.type = type;
+        this(name, target, actionList, type, null);
     }
 
     public int getType()
@@ -145,7 +151,7 @@
         return oStream.toByteArray();
     }
 
-    public static SecurityPolicyPermission getFromBytes(byte[] buf)
+    public static SecurityPolicyPermission getFromBytes(byte[] buf, boolean activeSettings)
     {
         int type = buf[SecurityPolicy.index];
         SecurityPolicy.index++;
@@ -155,10 +161,12 @@
         SecurityPolicy.index += nameLen;
         String target = readString(buf);
         String actionList = readString(buf);
-        if (type == USER_TYPE)
+        if (type == USER_TYPE || type == USER_ASSIGNED_TYPE)
         {
-            return new SecurityPolicyPermission(name, target, actionList,
-                                                SecurityPolicyPermissionSettings.getFromBytes(buf));
+            return new SecurityPolicyPermission(
+                name, target, actionList, type,
+                SecurityPolicyPermissionSettings.getFromBytes(
+                buf, activeSettings));
         }
         return new SecurityPolicyPermission(name, target, actionList, type);
     }
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermissionSettings.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermissionSettings.java	Thu Jul 22 16:31:34 2010 +0100
@@ -30,15 +30,37 @@
     private String name;
     private int currentInteractionMode;
     private int[] allowedInteractionModes;
+    private boolean active;
+
+    public SecurityPolicyPermissionSettings(
+        String name)
+    {
+        this(name, UNDEFINED_INTERACTION_MODE, null, true);
+    }
 
     public SecurityPolicyPermissionSettings(
         String name,
         int currentInteractionMode,
         int[] allowedInteractionModes)
     {
+        this(name, currentInteractionMode, allowedInteractionModes, true);
+    }
+
+    public SecurityPolicyPermissionSettings(
+        String name,
+        int currentInteractionMode,
+        int[] allowedInteractionModes,
+        boolean activeSettings)
+    {
         this.name = name;
         this.currentInteractionMode = currentInteractionMode;
         this.allowedInteractionModes = allowedInteractionModes;
+        this.active = activeSettings;
+    }
+
+    public boolean isActive()
+    {
+        return active;
     }
 
     public String getName()
@@ -166,7 +188,7 @@
         return oStream.toByteArray();
     }
 
-    public static SecurityPolicyPermissionSettings getFromBytes(byte[] buf)
+    public static SecurityPolicyPermissionSettings getFromBytes(byte[] buf, boolean activeSettings)
     {
         int nameLen = buf[SecurityPolicy.index];
         SecurityPolicy.index++;
@@ -181,7 +203,7 @@
             allowedInteractionModes[i] = buf[SecurityPolicy.index];
             SecurityPolicy.index++;
         }
-        return new SecurityPolicyPermissionSettings(name, currentInteractionMode, allowedInteractionModes);
+        return new SecurityPolicyPermissionSettings(name, currentInteractionMode, allowedInteractionModes, activeSettings);
     }
 
 }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationException.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationException.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModule.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/authorization/AccessControllerImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/AccessControllerImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -21,6 +21,7 @@
 import java.util.Vector;
 import java.security.AccessControlException;
 import com.nokia.mj.impl.utils.Uid;
+import com.nokia.mj.impl.security.midp.common.PolicyBasedPermission;
 import com.nokia.mj.impl.security.midp.common.PolicyBasedPermissionImpl;
 import com.nokia.mj.impl.security.midp.common.UserPermission;
 import com.nokia.mj.impl.security.midp.common.UserSecuritySettings;
@@ -256,7 +257,7 @@
      */
     private void handleUserPermission(
         Permission checkedPermission,
-        UserPermission resolvedPermission,
+        PolicyBasedPermissionImpl resolvedPermission,
         SecurityStorage storage)
     {
         UserSecuritySettings settings = resolvedPermission
@@ -300,6 +301,14 @@
                 new java.security.AccessControlException(
                     "Permission " + checkedPermission + " not allowed"));
         }
+        
+        // if the permission was assigned or the settings were not active, 
+        // then activate the user settings
+        if (resolvedPermission.getType() != PolicyBasedPermission.USER_TYPE 
+            || !settings.isActive())
+        {
+            storage.activateUserSecuritySettings(iAppUID, resolvedPermission);
+        }
 
         // if settings have not changed, still do one check on the current
         // interaction mode: if it's blanket, mark down that the prompt in
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionResolver.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionResolver.java	Thu Jul 22 16:31:34 2010 +0100
@@ -203,7 +203,9 @@
                     // add new settings
                     newPermissionInstancesAndSettings.addElement(
                         new PermisionInstanceAndSettings(
-                            p.getPermissionInstance(), newSettings));
+                            p.getPermissionInstance(), 
+                            p.getType(),
+                            newSettings));
                 }
                 else
                 {
@@ -240,6 +242,7 @@
                     getResolvedPermission(
                         requestedPermission,
                         policyPermission,
+                        p.getType(),
                         p.getSettings(),
                         requestedPermission.getClass().getName(),
                         requestedPermission.getName(),
@@ -274,6 +277,7 @@
                             PolicyBasedPermissionImpl permission1 =
                                 getResolvedPermission(requestedPermission,
                                                       policyPermission,
+                                                      p.getType(),
                                                       p.getSettings(),
                                                       requestedPermission.getClass().getName(),
                                                       requestedPermission.getName(),
@@ -307,6 +311,7 @@
                                         // the combined actions
                                         resolvedPermissions.setElementAt(getResolvedPermission(
                                                                              permission1.getPromptDetails(),
+                                                                             p.getType(),
                                                                              p.getSettings(),
                                                                              requestedPermission.getClass().getName(),
                                                                              requestedPermission.getName(),
@@ -358,6 +363,7 @@
                 (PermisionInstanceAndSettings)tmp.elementAt(0);
             tmp.removeElementAt(0);
             Permission permission1 = (Permission)instance1.getPermissionInstance();
+            int type = instance1.getType();
             UserSecuritySettings settings1 = instance1.getSettings();
             String compositeAction = "";
             // put the individual actions into a vector so that the composite
@@ -423,6 +429,7 @@
                             getResolvedPermission(
                                 requestedPermission,
                                 permission1,
+                                type,
                                 settings1,
                                 requestedPermission.getClass().getName(),
                                 requestedPermission.getName(),
@@ -452,6 +459,7 @@
 
     private static PolicyBasedPermissionImpl getResolvedPermission(
         PermissionBase securityPromptDetails,
+        int type,
         UserSecuritySettings userSettings,
         String permissionName,
         String targetName,
@@ -479,6 +487,7 @@
                    permissionName,
                    targetName,
                    actionList,
+                   type,
                    userSettings,
                    securityPromptDetails2);
     }
@@ -486,6 +495,7 @@
     private static PolicyBasedPermissionImpl getResolvedPermission(
         Permission requestedPermission,
         Object policyPermission,
+        int type,
         UserSecuritySettings userSettings,
         String permissionName,
         String targetName,
@@ -514,6 +524,7 @@
                    permissionName,
                    targetName,
                    actionList,
+                   type,
                    userSettings,
                    securityPromptDetails);
     }
@@ -545,7 +556,8 @@
                                policyPermissions[i].getActionList());
                 policyPermissionInstancesAndSettings.addElement(
                     new PermisionInstanceAndSettings(p,
-                                                     policyPermissions[i].getUserSecuritySettings()));
+                        policyPermissions[i].getType(),
+                        policyPermissions[i].getUserSecuritySettings()));
             }
             catch (InstantiationException e)
             {
@@ -590,7 +602,8 @@
                                grantedPermission.getActionList());
                 grantedPermissionInstancesAndSettings.addElement(
                     new PermisionInstanceAndSettings(p,
-                                                     grantedPermission.getUserSecuritySettings()));
+                    grantedPermission.getType(),
+                    grantedPermission.getUserSecuritySettings()));
             }
             catch (InstantiationException e)
             {
@@ -703,11 +716,13 @@
     private static class PermisionInstanceAndSettings
     {
         private Object permissionObject;
+        private int type;
         private UserSecuritySettings settings;
 
-        public PermisionInstanceAndSettings(Object permissionObject, UserSecuritySettings settings)
+        public PermisionInstanceAndSettings(Object permissionObject, int type, UserSecuritySettings settings)
         {
             this.permissionObject = permissionObject;
+            this.type = type;
             this.settings = settings;
         }
 
@@ -720,5 +735,10 @@
         {
             return settings;
         }
+        
+        public int getType()
+        {
+            return type;
+        }
     }
 }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPromptHandler.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPromptHandler.java	Thu Jul 22 16:31:34 2010 +0100
@@ -23,6 +23,7 @@
 import com.nokia.mj.impl.security.midp.common.UserPermission;
 import com.nokia.mj.impl.security.common.PermissionBase;
 import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
+import com.nokia.mj.impl.security.utils.Logger;
 import com.nokia.mj.impl.rt.ui.RuntimeUiFactory;
 import com.nokia.mj.impl.rt.ui.RuntimeUi;
 import com.nokia.mj.impl.rt.ui.ConfirmData;
@@ -171,6 +172,12 @@
                              .getSecurityPromptQuestion(currentInteractionMode);
                 break;
             }
+            if (promptText == null)
+            {
+                // no text to show -> hande it as deny
+                Logger.logWarning("User permission was denied by platform since it did not provide any security prompt question " + userPermission);
+                return handleDenyAnswer(settings);
+            }
             // check if the two texts are equal
             if ((mostPowerfulInteractionModeText != null
                     && mostPowerfulInteractionModeText.equalsIgnoreCase(
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java	Thu Jul 22 16:31:34 2010 +0100
@@ -194,7 +194,6 @@
         PERMISSION_MAPPING_TABLE.put(
             "javax.microedition.io.Connector.vtag", new MIDPPermission(
                 "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "vtag://*", "open"));
-        // add name of MIDP3 class permissions
         PERMISSION_MAPPING_TABLE.put(
             "javax.microedition.io.SocketProtocolPermission", new MIDPPermission(
                 "com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl", "socket://*"));
@@ -229,6 +228,9 @@
             "javax.microedition.midlet.AutoStartPermission", new MIDPPermission(
                 "com.nokia.mj.impl.installer.utils.AutoStartPermission", null));
        PERMISSION_MAPPING_TABLE.put(
+            "AutoStartPermission", new MIDPPermission(
+                "com.nokia.mj.impl.installer.utils.AutoStartPermission", null));
+       PERMISSION_MAPPING_TABLE.put(
             "javax.microedition.midlet.CmdLineArgsPermission", new MIDPPermission(
                 "com.nokia.mj.impl.rt.utils.CmdLineArgsPermission", null));
        PERMISSION_MAPPING_TABLE.put(
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermission.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermission.java	Thu Jul 22 16:31:34 2010 +0100
@@ -26,6 +26,7 @@
     public static final int USER_TYPE = 1;
     public static final int ALLOWED_TYPE = 2;
     public static final int ASSIGNED_TYPE = 3;
+    public static final int USER_ASSIGNED_TYPE = 4;
 
     public String getName();
     public String getTarget();
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -33,17 +33,27 @@
         String name,
         String target,
         String actionList,
+        int type,
         UserSecuritySettings userSettings,
         PermissionBase securityPromptDetails)
     {
         super(name, target, actionList, userSettings, securityPromptDetails);
+        this.type = type;
+    }
 
-        this.type = USER_TYPE;
+    public PolicyBasedPermissionImpl(
+        String name,
+        String target,
+        String actionList,
+        int type,
+        UserSecuritySettings userSettings)
+    {
+        this(name, target, actionList, type, userSettings, null);
     }
 
     public PolicyBasedPermissionImpl(PolicyBasedPermission p)
     {
-        this(p.getName(), p.getTarget(), p.getActionList(),
+        this(p.getName(), p.getTarget(), p.getActionList(), p.getType(),
              (p.getUserSecuritySettings() != null ?
               new UserSecuritySettingsImpl(p.getUserSecuritySettings().getName(),
                                            p.getUserSecuritySettings().getCurrentInteractionMode(),
@@ -57,7 +67,7 @@
         String actionList,
         UserSecuritySettings userSettings)
     {
-        this(name, target, actionList, userSettings, null);
+        this(name, target, actionList, USER_TYPE, userSettings, null);
     }
 
 
@@ -67,10 +77,7 @@
         String actionList,
         int type)
     {
-        super(name, target, actionList, null);
-
-        // Check type
-        this.type = type;
+        this(name, target, actionList, type, null, null);
     }
 
     public int getType()
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/UserSecuritySettings.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettings.java	Thu Jul 22 16:31:34 2010 +0100
@@ -25,6 +25,7 @@
 public interface UserSecuritySettings
 {
     // interaction modes
+    public static final int UNDEFINED_INTERACTION_MODE = -1;
     public static final int ONESHOT_INTERACTION_MODE = 1;
     public static final int SESSION_INTERACTION_MODE = 2;
     public static final int BLANKET_INTERACTION_MODE = 3;
@@ -55,6 +56,7 @@
     public static final String SECURITY_WARNINGS_DEFAULT_MODE = "2";
 
     public String getName();
+    public boolean isActive();
     public int getCurrentInteractionMode();
     public int[] getAllowedInteractionModes();
     public boolean isInteractionModeAllowed(int interactionMode);
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettingsImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettingsImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/midp/storage/SecurityStorage.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -314,12 +314,13 @@
                                 StorageNames.NAME);
                 String actionList = getStorageAttributeValue(permEntries[i],
                                     StorageNames.ACTION);
-                String fgName = getStorageAttributeValue(permEntries[i],
-                                StorageNames.FUNCTION_GROUP);
-                if (fgName != null)
+                FunctionGroup fg = decodeFunctionGroup(
+                                getStorageAttributeValue(permEntries[i],
+                                StorageNames.FUNCTION_GROUP));
+                if (fg != null)
                 {
                     UserSecuritySettings cachedSettings =
-                        (UserSecuritySettings)fGroups.get(fgName);
+                        (UserSecuritySettings)fGroups.get(fg.name);
                     if (cachedSettings != null)
                     {
                         permissions.addElement(
@@ -327,6 +328,7 @@
                                 className,
                                 target,
                                 actionList,
+                                fg.type,
                                 cachedSettings));
                     }
                     else
@@ -338,7 +340,7 @@
                                                  appUID.getStringValue()));
                         fgQuery.addAttribute(new StorageAttribute(
                                                  StorageNames.FUNCTION_GROUP,
-                                                 fgName));
+                                                 fg.name));
                         fgQuery.addAttribute(new StorageAttribute(
                                                  StorageNames.ALLOWED_SETTINGS,
                                                  ""));
@@ -364,17 +366,19 @@
                                 String blanketPrompt = getStorageAttributeValue(fgEntries[0],
                                                        StorageNames.BLANKET_PROMPT);
                                 UserSecuritySettings settings = new UserSecuritySettingsImpl(
-                                    fgName,
+                                    fg.name,
                                     currentSetting,
                                     decodeAllowedSettings(allowedSettings),
-                                    ("1".equals(blanketPrompt) ? true : false));
+                                    ("1".equals(blanketPrompt) ? true : false),
+                                    fg.isActive);
                                 permissions.addElement(
                                     new PolicyBasedPermissionImpl(
                                         className,
                                         target,
                                         actionList,
+                                        fg.type,
                                         settings));
-                                fGroups.put(fgName, settings);
+                                fGroups.put(fg.name, settings);
                             }
                             catch (NumberFormatException e)
                             {
@@ -394,7 +398,10 @@
                             null));
                 }
                 // cleanup the query, so it can be used at the next interation
-                query.removeAttribute(fgName);
+                if (fg != null)
+                {
+                    query.removeAttribute(fg.name);
+                }
             }
         }
         // add the non user permissions into the set of returned permissions
@@ -483,7 +490,33 @@
                     StorageAttribute fgAttribute = new StorageAttribute(
                         StorageNames.FUNCTION_GROUP,
                         fgName);
-                    permEntry.addAttribute(fgAttribute);
+                    if (p.getType() == PolicyBasedPermission.USER_ASSIGNED_TYPE 
+                        || !settings.isActive())
+                    {
+                        // the inactive settings or the settings of assigned 
+                        // permissions with user settings should be activated 
+                        // only after the first usage of the permission. 
+                        // Otherwise it creates confusion for the user, 
+                        // like in the following use cases:
+                        // 1) the installation time dialog would include the assigned
+                        //    permissions even though the MIDlet did not request it
+                        // 2) after installing a MIDlet suite and before accessing 
+                        //    some protected functionality (which is guarder by 
+                        //    assigned permission with user setting) the user sees 
+                        //    the settings of the permissions in the MIDlet settings 
+                        //   (even though the MIDlet might never access such 
+                        //   functionality)
+                        //
+                        // disabling the settings = alter the name of the function 
+                        // group stored in PERMISSIONS table
+                        permEntry.addAttribute(new StorageAttribute(
+                            StorageNames.FUNCTION_GROUP,
+                            encodeFunctionGroup(p.getType(),fgName)));
+                    }
+                    else
+                    {
+                        permEntry.addAttribute(fgAttribute);
+                    }
                     // Do we need to check if the settings which already exist
                     // are equal to the ones which are to be inserted?
                     // This won't even happen, since all the settings are read
@@ -722,6 +755,10 @@
                                    validCerts));
         }
         int securityWarningsMode = data.getSecurityWarningsMode();
+        if (update)
+        {
+            securityWarningsMode = readSecurityWarningsMode(appUID);
+        }
         if (securityWarningsMode == GeneralSecuritySettings.DEFAULT_SECURITY_MODE
                 || securityWarningsMode == GeneralSecuritySettings.USER_SECURITY_MODE)
         {
@@ -1014,6 +1051,42 @@
             }
         }
     }
+    
+    /**
+     * Activates user security settings
+     *
+     * @param appUID       the UID of the application whose user 
+                           settings are activatesversion is read
+     * @param settingsName the name of permission whose settings 
+     *                     which are activated
+     */
+    public void activateUserSecuritySettings(
+        Uid msUID,
+        PolicyBasedPermission permission)
+    {
+        if (permission.getUserSecuritySettings() == null)
+        {
+            return;
+        }
+        StorageEntry oldEntry = new StorageEntry();
+        oldEntry.addAttribute(new StorageAttribute(
+                               StorageAttribute.ID,
+                               msUID.getStringValue()));
+        oldEntry.addAttribute(new StorageAttribute(
+                               StorageNames.FUNCTION_GROUP,
+                               encodeFunctionGroup(permission.getType(), 
+                               permission.getUserSecuritySettings().getName())));
+        StorageEntry newEntry = new StorageEntry();
+        newEntry.addAttribute(new StorageAttribute(
+                               StorageAttribute.ID,
+                               msUID.getStringValue()));
+        newEntry.addAttribute(new StorageAttribute(
+                               StorageNames.FUNCTION_GROUP,
+                               permission.getUserSecuritySettings().getName()));
+        doStorageUpdate(StorageNames.MIDP_PERMISSIONS_TABLE,
+                        newEntry,
+                        oldEntry);
+    }
 
     /**
      * Reads the value of the suite version attribute
@@ -1213,16 +1286,24 @@
                     if (oldSettings != null
                             && newSettings != null)
                     {
+                        boolean activeSettings = false;
+                        if (oldSettings.isActive() 
+                            || newSettings.isActive())
+                        {
+                            activeSettings = true;
+                        }
                         newGrantedPermissions.addElement(
                             new PolicyBasedPermissionImpl(
                                 p.getName(),
                                 p.getTarget(),
                                 p.getActionList(),
+                                p.getType(),
                                 new UserSecuritySettingsImpl(
                                     newSettings.getName(),
                                     oldSettings.getCurrentInteractionMode(),
                                     newSettings.getAllowedInteractionModes(),
-                                    oldSettings.getBlanketPrompt())));
+                                    oldSettings.getBlanketPrompt(),
+                                    activeSettings)));
                     }
                     else
                     {
@@ -1792,4 +1873,46 @@
         }
         return NOT_FOUND;
     }
+    
+    private String encodeFunctionGroup(int type, String name)
+    {
+        return (type + ";" + name);
+    }
+    
+    private FunctionGroup decodeFunctionGroup(String fg)
+    {
+        boolean isActive = true;
+        if (fg != null)
+        {
+            int sepIndex = fg.indexOf(";");
+            int type = PolicyBasedPermission.USER_TYPE;
+            if (sepIndex != -1)
+            {
+                isActive = false;
+                try
+                {
+                    type = Integer.valueOf(
+                        fg.substring(0, sepIndex)).intValue();
+                }
+                catch (NumberFormatException e)
+                {
+                }
+            }
+            return new FunctionGroup(type, fg.substring(sepIndex + 1), isActive);
+        }
+        return null;
+    }
+    
+    private class FunctionGroup
+    {
+        FunctionGroup(int type, String name, boolean isActive)
+        {
+            this.type = type;
+            this.name = name;
+            this.isActive = isActive;
+        }
+        private boolean isActive;
+        private int type;
+        private String name;
+    }
 }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPermissionTexts.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityPromptMessage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -33,8 +33,6 @@
 // Use bytepair compression to enable code paging
 PAGED
 
-systeminclude   /epoc32/include/ecom
-
 userinclude   ../../../../inc
 
 sourcepath      ../src.s60
--- a/javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss	Thu Jul 22 16:31:34 2010 +0100
@@ -18,7 +18,7 @@
 
 // INCLUDES
 
-#include <registryinfov2.rh>
+#include <ecom/registryinfov2.rh>
 #include <ct/interfaceuid.hrh>
 
 // Some defines of useful values for attributes to simplify
--- a/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/build/MIDP2SecurityPolicyV2Dll.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/build/MIDP2SecurityPolicyV2Dll.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/legacysupport/midp2userpreferences/build/midp2userpreferences.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/midp2userpreferences/build/midp2userpreferences.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -19,11 +19,7 @@
 CONFIG += omj stl
 CONFIG -= qt
 
-INCLUDEPATH += /epoc32/include/j2me/midp2/data \
-               ../../../../../inc/j2me/midp2/security \
-               ../../../../../inc/j2me/midp2/runtime \
-               ../../../../../inc/j2me/midp2/dbv2 \
-               ../../storageutils/inc
+INCLUDEPATH += ../../storageutils/inc
 
 SOURCES += ../../storageutils/src/*.cpp \
            ../src/*.cpp
--- a/javacommons/security/legacysupport/midp2userpreferences/src/MIDP2UserPreferences.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/midp2userpreferences/src/MIDP2UserPreferences.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -22,8 +22,8 @@
 #include "UserPreferencesIterator.h"
 #include "MIDletSuiteUserPreferences.h"
 #include "MIDletSuiteCustomAttributes.h"
-#include <MUserSecurityPreferencesTable.h>
-#include <MSecurityPolicyV2.h>
+#include "MUserSecurityPreferencesTable.h"
+#include "j2me/midp2/security/MSecurityPolicyV2.h"
 #include "SecurityPreferences.h"
 #include "javauid.h"
 
--- a/javacommons/security/legacysupport/tsrc/build/securitylegacysupportunittests.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/tsrc/build/securitylegacysupportunittests.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -22,11 +22,6 @@
 #include <../../../../../inc/java_stdcpp_support_for_exe.hrh>
 #include <platform_paths.hrh>
 
-SYSTEMINCLUDE /epoc32/include 
-SYSTEMINCLUDE ../../../../../inc/j2me/midp2/security
-SYSTEMINCLUDE ../../../../../inc/j2me/midp2/data
-SYSTEMINCLUDE ../../../../../inc/j2me/midp2/runtime
-
 USERINCLUDE ../../../../../tools/cpputest/include/cpputest
 USERINCLUDE ../../../../../tools/cpputest/include/platforms/symbian
 USERINCLUDE ../../../../../inc
--- a/javacommons/security/legacysupport/tsrc/src/testpermissiondb.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/tsrc/src/testpermissiondb.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -23,7 +23,7 @@
 #include "javastoragenames.h"
 #include "javauid.h"
 
-#include <midp2permissiondb.h>
+#include "j2me/midp2/security/midp2permissiondb.h"
 
 using namespace MIDP;
 using namespace java::storage;
--- a/javacommons/security/legacysupport/tsrc/src/testsecuritypolicy.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/tsrc/src/testsecuritypolicy.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -20,7 +20,7 @@
 
 #include "TestHarness.h"
 
-#include <msecuritypolicyv2.h>
+#include "j2me/midp2/security/msecuritypolicyv2.h"
 
 using namespace MIDP;
 
--- a/javacommons/security/legacysupport/tsrc/src/testuserpreferences.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/legacysupport/tsrc/src/testuserpreferences.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -25,11 +25,11 @@
 #include "javauid.h"
 #include "javasymbianoslayer.h"
 
-#include <muserpreferences.h>
-#include <mmidletsuiteuserpreferencesiterator.h>
-#include <mmidletsuiteuserpreferences.h>
-#include <mmidletsuitecustomattributes.h>
-#include <msecuritypolicyv2.h>
+#include "j2me/midp2/data/muserpreferences.h"
+#include "j2me/midp2/data/mmidletsuiteuserpreferencesiterator.h"
+#include "j2me/midp2/data/mmidletsuiteuserpreferences.h"
+#include "j2me/midp2/data/mmidletsuitecustomattributes.h"
+#include "j2me/midp2/security/msecuritypolicyv2.h"
 
 using namespace MIDP;
 using namespace java::storage;
--- a/javacommons/security/src.s60/telutils.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/src.s60/telutils.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -63,6 +63,18 @@
     }
 }
 
+signed int TelUtils::getSecureTime()
+{
+    TTime t;
+    if (t.UniversalTimeSecure())
+    {
+        t.UniversalTime();
+    }
+    TTimeIntervalSeconds sec;
+    TTime baseTime(MAKE_TINT64(0x00dcddb3 ,0x0f2f8000)); // 1st Jan 1970
+    t.SecondsFrom(baseTime, sec);
+    return sec.Int();
+}
 
 void TelUtils::ConstructL()
 {
--- a/javacommons/security/src.s60/telutils.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/src.s60/telutils.h	Thu Jul 22 16:31:34 2010 +0100
@@ -35,6 +35,7 @@
     static TelUtils* createInstance();
     void getNetworkCodes(std::string& mnc, std::string& mcc);
     void getImei(std::string& imei);
+    static signed int getSecureTime();
     virtual ~TelUtils();
 
 private: //Methods
--- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/security/tsrc/data/javasrc/invalidjars/ImplementProtectedInterface/myClass.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/javasrc/invalidjars/ImplementProtectedInterface/myClass.java	Thu Jul 22 16:31:34 2010 +0100
@@ -32,6 +32,11 @@
         return null;
     }
 
+    public boolean isActive()
+    {
+        return true;
+    }
+
     public int getCurrentInteractionMode()
     {
         return 0;
--- a/javacommons/security/tsrc/data/javasrc/invalidjars/InnerClassImplementsProtectedInterface/myClass.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/javasrc/invalidjars/InnerClassImplementsProtectedInterface/myClass.java	Thu Jul 22 16:31:34 2010 +0100
@@ -22,6 +22,11 @@
     private class myInnerClass
             implements com.nokia.mj.impl.security.midp.common.UserSecuritySettings
     {
+        
+        public boolean isActive()
+        {
+            return true;
+        }
 
         public String getName()
         {
--- a/javacommons/security/tsrc/data/policies/all.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/policies/all.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -3,5 +3,4 @@
 grant assigned {
     permission java.util.PropertyPermission "microedition.*" "read";
     permission javax.microedition.PropertyPermission "mobinfo.publicinfo" "read";
-    permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";   
 }
--- a/javacommons/security/tsrc/data/policies/test_manufacturer.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/policies/test_manufacturer.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -34,5 +34,8 @@
 }
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/tsrc/data/policies/test_operator.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/policies/test_operator.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -34,5 +34,8 @@
 }
 grant assigned {
     permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/tsrc/data/policies/test_trustedthirdparty.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/policies/test_trustedthirdparty.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -72,3 +72,9 @@
     permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
     permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
+
+grant assigned "Location" {
+    permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
+}
--- a/javacommons/security/tsrc/data/policies/test_untrusted.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/policies/test_untrusted.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -60,3 +60,9 @@
     permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
     permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
+
+grant assigned "Location" {
+    permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read";
+    permission javax.microedition.PropertyPermission "mobinfo.networkid" "read";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/tsrc/data/validpolicies/assigned_settings_only.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,4 @@
+domain operator;
+grant assigned "Settings" oneshot {
+    permission assigned.permission.invalid.settings;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/tsrc/data/validpolicies/assigned_settings_orphaned.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,4 @@
+domain operator;
+grant assigned "Settings" {
+    permission assigned.permission.orphaned;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/tsrc/data/validpolicies/validators/assigned_and_user_settings.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,3 @@
+domain=mydomain
+user_assigned?Settings:blanket:no?assigned.user.permission
+user?Settings:blanket:no?user.permission
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/tsrc/data/validpolicies/validators/assigned_settings_only.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,2 @@
+domain=operator
+user_assigned?Settings:oneshot:no?assigned.permission.invalid.settings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/tsrc/data/validpolicies/validators/assigned_settings_orphaned.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,2 @@
+domain=operator
+assigned?assigned.permission.orphaned
--- a/javacommons/security/tsrc/data/validpolicies/validators/domain_without_end_separator.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/domain_without_end_separator.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,2 +1,2 @@
 domain=operator
-allowed,javax.microedition.midlet.AutoStartPermission
+allowed?javax.microedition.midlet.AutoStartPermission
--- a/javacommons/security/tsrc/data/validpolicies/validators/identified_thirdparty_like_policy.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/identified_thirdparty_like_policy.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,17 +1,17 @@
 domain=IdentifiedThirdParty
-user,NetAccess:session:blanket:oneshot:no,javax.microedition.io.HttpProtocolPermission,http://*
-user,NetAccess:session:blanket:oneshot:no,javax.microedition.io.HttpsProtocolPermission,https://*
-user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.DatagramProtocolPermission,datagram://*
-user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.DatagramProtocolPermission,datagram://
-user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.SocketProtocolPermission,socket://*
-user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.SocketProtocolPermission,socket://
-user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.SSLProtocolPermission,ssl://*
-user,ApplicationAutoInvocation:oneshot:blanket:session:no,javax.microedition.io.PushRegistryPermission,*
-user,LocalConnectivity:session:blanket:oneshot:no,javax.microedition.io.CommProtocolPermission,comm:*
-user,MultimediaRecording:session:blanket:oneshot:no,javax.microedition.media.PlayerPermission,*,record
-user,MultimediaRecording:session:blanket:oneshot:no,javax.microedition.media.PlayerPermission,*,snapshot
-assigned,java.util.PropertyPermission,microedition.*,read
-assigned,javax.microedition.event.EventPermission,*.*,read
-assigned,javax.microedition.event.EventPermission,*.*,register
-assigned,javax.microedition.event.EventPermission,*.*,post
+user?NetAccess:session:blanket:oneshot:no?javax.microedition.io.HttpProtocolPermission,http://*
+user?NetAccess:session:blanket:oneshot:no?javax.microedition.io.HttpsProtocolPermission,https://*
+user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.DatagramProtocolPermission,datagram://*
+user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.DatagramProtocolPermission,datagram://
+user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.SocketProtocolPermission,socket://*
+user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.SocketProtocolPermission,socket://
+user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.SSLProtocolPermission,ssl://*
+user?ApplicationAutoInvocation:oneshot:blanket:session:no?javax.microedition.io.PushRegistryPermission,*
+user?LocalConnectivity:session:blanket:oneshot:no?javax.microedition.io.CommProtocolPermission,comm:*
+user?MultimediaRecording:session:blanket:oneshot:no?javax.microedition.media.PlayerPermission,*,record
+user?MultimediaRecording:session:blanket:oneshot:no?javax.microedition.media.PlayerPermission,*,snapshot
+assigned?java.util.PropertyPermission,microedition.*,read
+assigned?javax.microedition.event.EventPermission,*.*,read
+assigned?javax.microedition.event.EventPermission,*.*,register
+assigned?javax.microedition.event.EventPermission,*.*,post
 
--- a/javacommons/security/tsrc/data/validpolicies/validators/ignore_interaction_modes_for_allowed_group.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/ignore_interaction_modes_for_allowed_group.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,3 +1,3 @@
 domain=Manufacturer
-allowed,javax.microedition.io.HttpProtocolPermission,http://*
+allowed?javax.microedition.io.HttpProtocolPermission,http://*
 
--- a/javacommons/security/tsrc/data/validpolicies/validators/manufacturer_like_policy.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/manufacturer_like_policy.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,23 +1,23 @@
 domain=Manufacturer
-allowed,javax.microedition.io.HttpProtocolPermission,http://*
-allowed,javax.microedition.io.HttpsProtocolPermission,https://*
-allowed,javax.microedition.io.DatagramProtocolPermission,datagram://*
-allowed,javax.microedition.io.DatagramProtocolPermission,datagram://
-allowed,javax.microedition.io.SocketProtocolPermission,socket://*
-allowed,javax.microedition.io.SocketProtocolPermission,socket://
-allowed,javax.microedition.io.SSLProtocolPermission,ssl://*
-allowed,javax.microedition.io.PushRegistryPermission,*
-allowed,javax.microedition.io.CommProtocolPermission,comm:*
-allowed,javax.microedition.media.PlayerPermission,*,record
-allowed,javax.microedition.media.PlayerPermission,*,snapshot
-allowed,java.util.PropertyPermission,*,read
-allowed,javax.microedition.event.EventPermission,*,read
-allowed,javax.microedition.event.EventPermission,*,register
-allowed,javax.microedition.event.EventPermission,*,post
-allowed,javax.microedition.midlet.ActionsDeniedPermission
-allowed,javax.microedition.midlet.AutoStartPermission
-assigned,java.util.PropertyPermission,microedition.*,read
-assigned,javax.microedition.event.EventPermission,*.*,read
-assigned,javax.microedition.event.EventPermission,*.*,register
-assigned,javax.microedition.event.EventPermission,*.*,post
+allowed?javax.microedition.io.HttpProtocolPermission,http://*
+allowed?javax.microedition.io.HttpsProtocolPermission,https://*
+allowed?javax.microedition.io.DatagramProtocolPermission,datagram://*
+allowed?javax.microedition.io.DatagramProtocolPermission,datagram://
+allowed?javax.microedition.io.SocketProtocolPermission,socket://*
+allowed?javax.microedition.io.SocketProtocolPermission,socket://
+allowed?javax.microedition.io.SSLProtocolPermission,ssl://*
+allowed?javax.microedition.io.PushRegistryPermission,*
+allowed?javax.microedition.io.CommProtocolPermission,comm:*
+allowed?javax.microedition.media.PlayerPermission,*,record
+allowed?javax.microedition.media.PlayerPermission,*,snapshot
+allowed?java.util.PropertyPermission,*,read
+allowed?javax.microedition.event.EventPermission,*,read
+allowed?javax.microedition.event.EventPermission,*,register
+allowed?javax.microedition.event.EventPermission,*,post
+allowed?javax.microedition.midlet.ActionsDeniedPermission
+allowed?javax.microedition.midlet.AutoStartPermission
+assigned?java.util.PropertyPermission,microedition.*,read
+assigned?javax.microedition.event.EventPermission,*.*,read
+assigned?javax.microedition.event.EventPermission,*.*,register
+assigned?javax.microedition.event.EventPermission,*.*,post
 
--- a/javacommons/security/tsrc/data/validpolicies/validators/missing_end_bracket_for_permissions.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/missing_end_bracket_for_permissions.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,3 +1,3 @@
 domain=operator
-allowed,javax.microedition.midlet.AutoStartPermission
+allowed?javax.microedition.midlet.AutoStartPermission
 
--- a/javacommons/security/tsrc/data/validpolicies/validators/missing_start_bracket_for_permissions.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/missing_start_bracket_for_permissions.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,3 +1,3 @@
 domain=operator
-allowed,javax.microedition.midlet.AutoStartPermission
+allowed?javax.microedition.midlet.AutoStartPermission
 
--- a/javacommons/security/tsrc/data/validpolicies/validators/operator_like_policy.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/operator_like_policy.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,22 +1,22 @@
 domain=Operator
-allowed,javax.microedition.io.HttpProtocolPermission,http://*
-allowed,javax.microedition.io.HttpsProtocolPermission,https://*
-allowed,javax.microedition.io.DatagramProtocolPermission,datagram://*
-allowed,javax.microedition.io.DatagramProtocolPermission,datagram://
-allowed,javax.microedition.io.SocketProtocolPermission,socket://*
-allowed,javax.microedition.io.SocketProtocolPermission,socket://
-allowed,javax.microedition.io.SSLProtocolPermission,ssl://*
-allowed,javax.microedition.io.PushRegistryPermission,*
-allowed,javax.microedition.io.CommProtocolPermission,comm:*
-allowed,javax.microedition.media.PlayerPermission,*,record
-allowed,javax.microedition.media.PlayerPermission,*,snapshot
-allowed,java.util.PropertyPermission,*,read
-allowed,javax.microedition.event.EventPermission,*,read
-allowed,javax.microedition.event.EventPermission,*,register
-allowed,javax.microedition.event.EventPermission,*,post
-allowed,javax.microedition.midlet.ActionsDeniedPermission
-allowed,javax.microedition.midlet.AutoStartPermission
-assigned,java.util.PropertyPermission,microedition.*,read
-assigned,javax.microedition.event.EventPermission,*.*,read
-assigned,javax.microedition.event.EventPermission,*.*,register
-assigned,javax.microedition.event.EventPermission,*.*,post
+allowed?javax.microedition.io.HttpProtocolPermission,http://*
+allowed?javax.microedition.io.HttpsProtocolPermission,https://*
+allowed?javax.microedition.io.DatagramProtocolPermission,datagram://*
+allowed?javax.microedition.io.DatagramProtocolPermission,datagram://
+allowed?javax.microedition.io.SocketProtocolPermission,socket://*
+allowed?javax.microedition.io.SocketProtocolPermission,socket://
+allowed?javax.microedition.io.SSLProtocolPermission,ssl://*
+allowed?javax.microedition.io.PushRegistryPermission,*
+allowed?javax.microedition.io.CommProtocolPermission,comm:*
+allowed?javax.microedition.media.PlayerPermission,*,record
+allowed?javax.microedition.media.PlayerPermission,*,snapshot
+allowed?java.util.PropertyPermission,*,read
+allowed?javax.microedition.event.EventPermission,*,read
+allowed?javax.microedition.event.EventPermission,*,register
+allowed?javax.microedition.event.EventPermission,*,post
+allowed?javax.microedition.midlet.ActionsDeniedPermission
+allowed?javax.microedition.midlet.AutoStartPermission
+assigned?java.util.PropertyPermission,microedition.*,read
+assigned?javax.microedition.event.EventPermission,*.*,read
+assigned?javax.microedition.event.EventPermission,*.*,register
+assigned?javax.microedition.event.EventPermission,*.*,post
--- a/javacommons/security/tsrc/data/validpolicies/validators/permission_without_end_terminator.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/permission_without_end_terminator.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,5 +1,5 @@
 domain=operator
-allowed,javax.microedition.midlet.AutoStartPermission
-allowed,javax.microedition.midlet.OtherAutoStartPermission
+allowed?javax.microedition.midlet.AutoStartPermission
+allowed?javax.microedition.midlet.OtherAutoStartPermission
 
 
--- a/javacommons/security/tsrc/data/validpolicies/validators/unidentified_third_party_like_policy.txt	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/data/validpolicies/validators/unidentified_third_party_like_policy.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -1,16 +1,16 @@
 domain=UnidentifiedThirdParty
-user,NetAccess:oneshot:session:no,javax.microedition.io.HttpProtocolPermission,http://*
-user,NetAccess:oneshot:session:no,javax.microedition.io.HttpsProtocolPermission,https://*
-user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.DatagramProtocolPermission,datagram://*
-user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.DatagramProtocolPermission,datagram://
-user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.SocketProtocolPermission,socket://*
-user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.SocketProtocolPermission,socket://
-user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.SSLProtocolPermission,ssl://*
-user,ApplicationAutoInvocation:oneshot:session:no,javax.microedition.io.PushRegistryPermission,*
-user,LocalConnectivity:session:blanket:oneshot:no,javax.microedition.io.CommProtocolPermission,comm:*
-user,MultimediaRecording:session:oneshot:no,javax.microedition.media.PlayerPermission,*,record
-user,MultimediaRecording:session:oneshot:no,javax.microedition.media.PlayerPermission,*,snapshot
-assigned,java.util.PropertyPermission,microedition.*,read
-assigned,javax.microedition.event.EventPermission,*.*,read
-assigned,javax.microedition.event.EventPermission,*.*,register
-assigned,javax.microedition.event.EventPermission,*.*,post
+user?NetAccess:oneshot:session:no?javax.microedition.io.HttpProtocolPermission,http://*
+user?NetAccess:oneshot:session:no?javax.microedition.io.HttpsProtocolPermission,https://*
+user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.DatagramProtocolPermission,datagram://*
+user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.DatagramProtocolPermission,datagram://
+user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.SocketProtocolPermission,socket://*
+user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.SocketProtocolPermission,socket://
+user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.SSLProtocolPermission,ssl://*
+user?ApplicationAutoInvocation:oneshot:session:no?javax.microedition.io.PushRegistryPermission,*
+user?LocalConnectivity:session:blanket:oneshot:no?javax.microedition.io.CommProtocolPermission,comm:*
+user?MultimediaRecording:session:oneshot:no?javax.microedition.media.PlayerPermission,*,record
+user?MultimediaRecording:session:oneshot:no?javax.microedition.media.PlayerPermission,*,snapshot
+assigned?java.util.PropertyPermission,microedition.*,read
+assigned?javax.microedition.event.EventPermission,*.*,read
+assigned?javax.microedition.event.EventPermission,*.*,register
+assigned?javax.microedition.event.EventPermission,*.*,post
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/OMJSecurityTests.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/OMJSecurityTests.java	Thu Jul 22 16:31:34 2010 +0100
@@ -740,7 +740,27 @@
                                                                                                                          UserSecuritySettings.SESSION_INTERACTION_MODE})),
                                                     new PolicyBasedPermissionImpl("java.util.PropertyPermission", "microedition.*", "read", null),
                                                     new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.publicinfo", "read", null),
-                                                    new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.cellid", "read", null),
+                                                    new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.cellid", "read",
+                                                                                  new UserSecuritySettingsImpl("Location",
+                                                                                                               UserSecuritySettings.SESSION_INTERACTION_MODE,
+                                                                                                               new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.NO_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.ONESHOT_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.SESSION_INTERACTION_MODE})),
+                                                    new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.countrycode", "read",
+                                                                                  new UserSecuritySettingsImpl("Location",
+                                                                                                               UserSecuritySettings.SESSION_INTERACTION_MODE,
+                                                                                                               new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.NO_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.ONESHOT_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.SESSION_INTERACTION_MODE})),
+                                                    new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.networkid", "read",
+                                                                                  new UserSecuritySettingsImpl("Location",
+                                                                                                               UserSecuritySettings.SESSION_INTERACTION_MODE,
+                                                                                                               new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.NO_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.ONESHOT_INTERACTION_MODE,
+                                                                                                                         UserSecuritySettings.SESSION_INTERACTION_MODE})),
                                                     new PolicyBasedPermissionImpl("com.nokia.ext2.internal.Ext2Perm", "ext2.target4", "ext2.action4", null),
                                                 }));
         // getBlanketPermissions: while installing V1 the permissions are not put to blanket, while installing V2 there are some blanket permissions returned
@@ -779,6 +799,8 @@
                                          StorageNames.VALUE,
                                          "MIICWDCCAcECBEhQwOgwDQYJKoZIhvcNAQEEBQAwczELMAkGA1UEBhMCZmkxEjAQBgNVBAgTCVBpcmthbm1hYTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9raWExDTALBgNVBAsTBEphdmExHzAdBgNVBAMMFkpQX1RoaXJkX1BhcnR5X1RydXN0ZWQwHhcNMDgwNjEyMDYyMzM2WhcNMTgwNjEwMDYyMzM2WjBzMQswCQYDVQQGEwJmaTESMBAGA1UECBMJUGlya2FubWFhMRAwDgYDVQQHEwdUYW1wZXJlMQ4wDAYDVQQKEwVOb2tpYTENMAsGA1UECxMESmF2YTEfMB0GA1UEAwwWSlBfVGhpcmRfUGFydHlfVHJ1c3RlZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArAesh03rswICRUjexWMoIH9ZZqUtlx+tfhZhuzuYhiL6cLdhxNlU8yuIdw4f17XP3yxVIB8rz1EEagCMd0Y5ZleNFZ992ReLcf9VH13RxaZ88PRxBLLROm1jcwTknYSS6AxGMup77DMwwFSN8XPnOHWt4aLGUrecMeUyI2c5UbsCAwEAATANBgkqhkiG9w0BAQQFAAOBgQAylJ+3aSq6a7AAL7UM8V8JhGZlLneErF7A/BJGDi7Vmr5gmlGyf6RCJJIg4qCp+J3Tv3eCRNNuphQaSRdFpaulwCmtfCzSZNtvZg0VhMOVsZqTwQgmP6NzKoIbqqzlgm5U+yUJw8FmX17vgdeSEdJ/oL/WT4AKrWFJYl8MdQ9ZnQ=="));
         session.write(StorageNames.APPLICATION_PACKAGE_ATTRIBUTES_TABLE, appPackageEntry);
+        permissionGranter.cleanup();
+        PermissionResolver.testClearCache();
         allAttributes.clear();
         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICWDCCAcECBEhQwOgwDQYJKoZIhvcNAQEEBQAwczELMAkGA1UEBhMCZmkxEjAQBgNVBAgTCVBpcmthbm1hYTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9raWExDTALBgNVBAsTBEphdmExHzAdBgNVBAMMFkpQX1RoaXJkX1BhcnR5X1RydXN0ZWQwHhcNMDgwNjEyMDYyMzM2WhcNMTgwNjEwMDYyMzM2WjBzMQswCQYDVQQGEwJmaTESMBAGA1UECBMJUGlya2FubWFhMRAwDgYDVQQHEwdUYW1wZXJlMQ4wDAYDVQQKEwVOb2tpYTENMAsGA1UECxMESmF2YTEfMB0GA1UEAwwWSlBfVGhpcmRfUGFydHlfVHJ1c3RlZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArAesh03rswICRUjexWMoIH9ZZqUtlx+tfhZhuzuYhiL6cLdhxNlU8yuIdw4f17XP3yxVIB8rz1EEagCMd0Y5ZleNFZ992ReLcf9VH13RxaZ88PRxBLLROm1jcwTknYSS6AxGMup77DMwwFSN8XPnOHWt4aLGUrecMeUyI2c5UbsCAwEAATANBgkqhkiG9w0BAQQFAAOBgQAylJ+3aSq6a7AAL7UM8V8JhGZlLneErF7A/BJGDi7Vmr5gmlGyf6RCJJIg4qCp+J3Tv3eCRNNuphQaSRdFpaulwCmtfCzSZNtvZg0VhMOVsZqTwQgmP6NzKoIbqqzlgm5U+yUJw8FmX17vgdeSEdJ/oL/WT4AKrWFJYl8MdQ9ZnQ=="));
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionGranterTests.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionGranterTests.java	Thu Jul 22 16:31:34 2010 +0100
@@ -218,6 +218,7 @@
         IMPL_PERMISSION_MAPPING_TABLE = PermissionMappingTable.setMappingTable(TestPermissionMappingTable.getMappingTable());
         SecurityPolicyModule.policiesDir = TEST_DATA_DIR;
         SecurityPolicyModule.policiesFileNamePrefix = "test_";
+        String[] blanketPermissions = null;
         // data structures used in tests
         AuthenticationStorageData authData = null;
         AuthenticationCredentials[] authCredentials = null;
@@ -823,7 +824,6 @@
                    },
                    getAssignedPermissions("IdentifiedThirdParty")));
         // 19. getBlanketPermissions - null appUID
-        String[] blanketPermissions = null;
         storage.removeAuthenticationStorageData(appUID);
         permissionGranter.removeSecurityData(session, appUID);
         blanketPermissions = permissionGranter.getBlanketPermissions(null);
@@ -975,7 +975,7 @@
                 ((PolicyBasedPermission)grantedPermissions.elementAt(i));
             UserSecuritySettings settings =
                 permission.getUserSecuritySettings();
-            if (settings != null)
+            if (settings != null && settings.getName() == UserSecuritySettings.LOCAL_CONNECTIVITY_SETTINGS)
             {
                 assertTrue(settings.getCurrentInteractionMode() == UserSecuritySettings.BLANKET_INTERACTION_MODE);
             }
@@ -1041,7 +1041,8 @@
                     && findString(policyPerms[i].getName(), permissionNameFilter) != -1)
                     || permissionNameFilter == null) && (permissionTypeFilter == null
                                                          || (permissionTypeFilter.equals("assigned")
-                                                             && policyPerms[i].getUserSecuritySettings() == null)))
+                                                             && (policyPerms[i].getType() == PolicyBasedPermission.ASSIGNED_TYPE 
+                                                             || policyPerms[i].getType() == PolicyBasedPermission.USER_ASSIGNED_TYPE))))
             {
                 vPermissions.addElement(new MIDPPermission(policyPerms[i].getName(), policyPerms[i].getTarget(), policyPerms[i].getActionList()));
             }
@@ -1087,10 +1088,12 @@
 
     private static MIDPPermission[] getDefaultPermissions()
     {
-        MIDPPermission[] defaultPerms = new MIDPPermission[3];
+        MIDPPermission[] defaultPerms = new MIDPPermission[5];
         defaultPerms[0] = new MIDPPermission("java.util.PropertyPermission", "microedition.*", "read");
         defaultPerms[1] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.publicinfo", "read");
         defaultPerms[2] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.cellid", "read");
+        defaultPerms[3] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.countrycode", "read");
+        defaultPerms[4] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.networkid", "read");
         return defaultPerms;
     }
 
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java	Thu Jul 22 16:31:34 2010 +0100
@@ -39,111 +39,115 @@
 
     static final SecurityPolicyPermission[] MANUFACTURER_PERMS =
     {
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", null),
-        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,PolicyBasedPermission.ALLOWED_TYPE),
     };
     static final SecurityPolicyPermission[] OPERATOR_PERMS =
     {
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", null),
-        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,PolicyBasedPermission.ALLOWED_TYPE),
     };
     static final SecurityPolicyPermission[] IDENTIFIED_THIRD_PARTY_PERMS =
     {
@@ -189,18 +193,18 @@
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write",
                                      new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send",
                                      new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send",
                                      new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts",
                                      new SecurityPolicyPermissionSettings("Read User Data Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
@@ -219,7 +223,7 @@
         new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos",
                                      new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null),
+        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*", "staticregistration",
                                      new SecurityPolicyPermissionSettings("Application Auto Invocation",UserSecuritySettings.BLANKET_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE})),
@@ -265,8 +269,16 @@
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null,
                                      new SecurityPolicyPermissionSettings("Net Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE,
+                                     new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.SESSION_INTERACTION_MODE,
+                                                                          new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.USER_ASSIGNED_TYPE,
+                                     new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.SESSION_INTERACTION_MODE,
+                                                                          new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE,
+                                     new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.SESSION_INTERACTION_MODE,
+                                                                          new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null, null,
                                      new SecurityPolicyPermissionSettings("Url start",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
@@ -315,18 +327,18 @@
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write",
                                      new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send",
                                      new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send",
                                      new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts",
                                      new SecurityPolicyPermissionSettings("Read User Data Access",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
@@ -345,7 +357,7 @@
         new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos",
                                      new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null),
+        new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE),
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*", "staticregistration",
                                      new SecurityPolicyPermissionSettings("Application Auto Invocation",UserSecuritySettings.BLANKET_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE})),
@@ -385,8 +397,16 @@
         new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null,
                                      new SecurityPolicyPermissionSettings("Net Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
                                                                           new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
-        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE,
+                                     new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
+                                                                          new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.USER_ASSIGNED_TYPE,
+                                     new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
+                                                                          new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
+        new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE,
+                                     new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
+                                                                          new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
     };
 
     // Begin j2meunit test framework setup
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/tools/security/midp/PolicyEditorTests.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/tools/security/midp/PolicyEditorTests.java	Thu Jul 22 16:31:34 2010 +0100
@@ -336,7 +336,7 @@
         initBoolArray(permsChecked);
         for (int i=0; i<perms1.size(); i++)
         {
-            String[] permTokens = Tokenizer.split((String)perms1.get(i), ",");
+            String[] permTokens = Tokenizer.split((String)perms1.get(i), "?");
             int currentToken = 0;
             int type = getType(permTokens[currentToken]);
             currentToken++;
@@ -344,7 +344,7 @@
             String name = null;
             String target = null;
             String actionList = null;
-            if (type == PolicyBasedPermission.USER_TYPE)
+            if (permTokens.length == 3)
             {
                 String[] settingsProps = Tokenizer.split(permTokens[currentToken],":");
                 String settingsName = settingsProps[0];
@@ -361,30 +361,33 @@
                 settings = new UserSecuritySettingsImpl(settingsName, currentInteractionMode, allowedInteractionModes);
                 currentToken++;
             }
-            name = permTokens[currentToken];
+            String[] permDetails = Tokenizer.split(permTokens[currentToken], ",");
+            currentToken = 0;
+            name = permDetails[currentToken];
             MIDPPermission mappedPerm = PermissionMappingTable.get(name);
             if (mappedPerm != null)
             {
                 name = mappedPerm.getName();
             }
             currentToken++;
-            if (permTokens.length > currentToken)
+            if (permDetails.length > currentToken)
             {
-                target = permTokens[currentToken];
+                target = permDetails[currentToken];
                 currentToken++;
             }
-            if (permTokens.length > currentToken)
+            if (permDetails.length > currentToken)
             {
-                actionList = permTokens[currentToken];
+                actionList = permDetails[currentToken];
                 actionList = actionList.replace(':',',');
             }
-            PolicyBasedPermissionImpl perm1 = new PolicyBasedPermissionImpl(name, target, actionList, settings);
+            PolicyBasedPermissionImpl perm1 = new PolicyBasedPermissionImpl(name, target, actionList, type, settings);
             for (int j=0; j<perms2.length; j++)
             {
                 PolicyBasedPermissionImpl perm2 = new PolicyBasedPermissionImpl(
                     perms2[j].getName(),
                     perms2[j].getTarget(),
                     perms2[j].getActionList(),
+                    perms2[j].getType(),
                     (perms2[j].getUserSecuritySettings() != null ?
                      (new UserSecuritySettingsImpl(
                           perms2[j].getUserSecuritySettings().getName(),
@@ -420,6 +423,10 @@
         {
             return PolicyBasedPermission.ASSIGNED_TYPE;
         }
+        else if (sType.equalsIgnoreCase("user_assigned"))
+        {
+            return PolicyBasedPermission.USER_ASSIGNED_TYPE;
+        }
         return -1;
     }
 
--- a/javacommons/utils/build/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -30,6 +30,7 @@
                    com.nokia.mj.impl.properties.common.Locale,
                    com.nokia.mj.impl.properties.common.Platform,
                    com.nokia.mj.impl.utils.Formatter,
+                   com.nokia.mj.impl.utils.InstallerErrorMessage,
                    com.nokia.mj.impl.utils.ResourceLoader"/>
 
   <target name="system.properties">
--- a/javacommons/utils/build/bwins/javautilsu.def	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/build/bwins/javautilsu.def	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/build/eabi/javautilsu.def	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/inc/javacommonutils.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/rt/support/ApplicationUtils.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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.
      *
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java	Thu Jul 22 16:31:34 2010 +0100
@@ -260,6 +260,18 @@
         }
         return toString();
     }
+    /**
+     * Applies convertion from european digits into arabic-indic digits 
+     * based on existing language settings
+     *
+     * @param str String which might contain european digits
+     * @return A string identical with the provided string but with the 
+     *         european digits (if any) converted to arabic-indic digits
+     */
+    public static String formatDigits(String str)
+    {
+        return _formatDigits(str);
+    }
 
     /*** ----------------------------- PRIVATE ---------------------------- */
 
@@ -358,4 +370,14 @@
      *
      */
     private native String _formatDate(long timeInMilliSecs);
+
+    /**
+     * Applies convertion from european digits into arabic-indic digits
+     * based on existing language settings
+     *
+     * @param str String which might contain european digits
+     * @return A string identical with the provided string but with the 
+     *         european digits (if any) converted to arabic-indic digits
+     */
+    private static native String _formatDigits(String str);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Id.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/LocalizedTextProvider.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/src.s60/formatternative.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/src/javacommonutils.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javainifileutils.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/src/javainifileutils.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -157,9 +157,9 @@
         }
         rewind(iniFile);
         data = new char[len+1];
-        data[len] = 0;
         if (data != 0)
         {
+            data[len] = 0;
             fread(data, sizeof(char), len, iniFile);
         }
         fclose(iniFile);
--- a/javacommons/utils/src/logger.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javacommons/utils/src/logger.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -148,7 +148,7 @@
     TPtrC8 uuidDes(uuidBytes, uuidByteLength);
     TRAPD(err, uuid.SetL(uuidDes));
 
-    delete uuidBytes;
+    delete[] uuidBytes;
     uuidBytes = NULL;
 
     if (KErrNone != err)
@@ -205,7 +205,7 @@
             char *fileName = java::util::JavaCommonUtils::wstringToUtf8(
                                  persistentFileName);
             persistentRecFd = open(fileName, O_RDONLY);
-            delete fileName;
+            delete[] fileName;
         }
         catch (ExceptionBase ex)
         {
@@ -618,7 +618,7 @@
             write(mSrvRecFd, (char *) &aDeviceServiceClasses,
                   sizeof(aDeviceServiceClasses));
 
-            delete fileName;
+            delete[] fileName;
         }
         catch (ExceptionBase ex)
         {
@@ -1286,7 +1286,7 @@
             char *fileName =
                 java::util::JavaCommonUtils::wstringToUtf8(persistentFileName);
             persistentRecFd = open(fileName, O_RDONLY);
-            delete fileName;
+            delete[] fileName;
         }
         catch (ExceptionBase ex)
         {
@@ -1310,7 +1310,10 @@
     unsigned int devServClass = 0;
     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
     if (ret <= 0)
+    {
+        delete srvRecPopulator;
         return;
+    }
 
     elementBuilder = srvRecPopulator->SetDeviceServiceClass(devServClass);
 
--- a/javaextensions/comm/javasrc/com/nokia/mj/impl/gcf/protocol/comm/CommPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/comm/javasrc/com/nokia/mj/impl/gcf/protocol/comm/CommPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -47,7 +47,7 @@
 
     public String toString()
     {
-        return "javax.microedition.io.CommProtocolPermission";
+        return "javax.microedition.io.Connector.comm";
     }
 
     public boolean implies(Permission p)
--- a/javaextensions/datagram/datagram/build/javadatagram.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/datagram/datagram/build/javadatagram.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/datagram/UDPDatagramConnectionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javasrc/com/nokia/mj/impl/gcf/protocol/datagram/DatagramPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/gcf/protocol/datagram/DatagramPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -56,7 +56,7 @@
 
     public String toString()
     {
-        return "javax.microedition.io.DatagramProtocolPermission";
+        return "javax.microedition.io.Connector.datagram";
     }
 
     public boolean implies(Permission p)
--- a/javaextensions/datagram/datagram/src/datagramconnectionjni.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/datagram/datagram/src/datagramconnectionjni.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/location/position/src/cpositioner.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/midprms_db/javasrc/com/nokia/mj/impl/rms/RmsFileInfo.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RmsFileInfo.java	Thu Jul 22 16:31:34 2010 +0100
@@ -71,7 +71,7 @@
 
     private long getSize()
     {
-        long size = 0;
+        long size = -1;
         try
         {
             size = iFile.fileSize();
@@ -82,6 +82,7 @@
         }
         if (size < 0)
         {
+            Logger.WLOG(Logger.EMidpRms, "fileSize = " + size);
             size = 0;
         }
         return size;
@@ -102,18 +103,19 @@
 
     private long getFreeSpace()
     {
-        long size = 0;
+        long size = -1;
         try
         {
             size = iFile.availableSize();
         }
         catch (Exception e)
         {
-            Logger.ELOG(Logger.EMidpRms, "availableSize()" , e);
+            Logger.ELOG(Logger.EMidpRms, "availableSize() failed" , e);
         }
         if (size < 0)
         {
-            size = 0;
+            Logger.WLOG(Logger.EMidpRms, "availableSize = " + size);
+            size = MAX_RMS_SIZE;
         }
         return size;
     }
--- a/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoPermission.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoPermission.java	Thu Jul 22 16:31:34 2010 +0100
@@ -28,6 +28,8 @@
     private static final String IMSI_TARGET_NAME = "mobinfo.imsi";
     private static final String MSISDN_TARGET_NAME = "mobinfo.msisdn";
     private static final String CELLID_TARGET_NAME = "mobinfo.cellid";
+    private static final String COUNTRYCODE_TARGET_NAME = "mobinfo.countrycode";
+    private static final String NETWORKID_TARGET_NAME = "mobinfo.networkid";
     private static final String PUBLIC_INFO_TARGET_NAME = "mobinfo.publicinfo";
 
     private String iTarget = null;
@@ -40,7 +42,9 @@
         if (IMSI_TARGET_NAME.equals(aUri)
                 || MSISDN_TARGET_NAME.equals(aUri)
                 || CELLID_TARGET_NAME.equals(aUri)
-                || PUBLIC_INFO_TARGET_NAME.equals(aUri))
+                || PUBLIC_INFO_TARGET_NAME.equals(aUri)
+                || COUNTRYCODE_TARGET_NAME.equals(aUri)
+                || NETWORKID_TARGET_NAME.equals(aUri))
         {
             // aUri contains a known target name -> save it as such
             iTarget = aUri;
@@ -62,6 +66,14 @@
             {
                 iTarget = CELLID_TARGET_NAME;
             }
+            else if (MobileInfoProperties.COUNTRY_CODE.equals(aUri))
+            {
+                iTarget = COUNTRYCODE_TARGET_NAME;
+            }
+            else if (MobileInfoProperties.NETWORK_ID.equals(aUri))
+            {
+                iTarget = NETWORKID_TARGET_NAME;
+            }
             else
             {
                 iTarget = PUBLIC_INFO_TARGET_NAME;
@@ -78,6 +90,14 @@
      */
     public String getSecurityPromptQuestion(int aInteractionMode)
     {
+        if (CELLID_TARGET_NAME.equals(iTarget) 
+            || COUNTRYCODE_TARGET_NAME.equals(iTarget) 
+            || NETWORKID_TARGET_NAME.equals(iTarget))
+        {
+            return SecurityPromptMessage.getInstance().getText(
+                SecurityPromptMessage.QUESTION_ID_READING_LOCATION_DATA,
+                null);
+        }
         return null;
     }
 
@@ -91,6 +111,18 @@
         {
             return "com.nokia.mid.Mobinfo.MSISDN";
         }
+        else if (CELLID_TARGET_NAME.equals(iTarget))
+        {
+            return "com.nokia.mid.Mobinfo.cellid";
+        }
+        else if (COUNTRYCODE_TARGET_NAME.equals(iTarget))
+        {
+            return "com.nokia.mid.Mobinfo.countrycode";
+        }
+        else if (NETWORKID_TARGET_NAME.equals(iTarget))
+        {
+            return "com.nokia.mid.Mobinfo.networkid";
+        }
         return null;
     }
 
--- a/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java	Thu Jul 22 16:31:34 2010 +0100
@@ -51,7 +51,7 @@
 
     private static final String BATTERY_LEVEL = "com.nokia.mid.batterylevel";
 
-    private static final String COUNTRY_CODE = "com.nokia.mid.countrycode";
+    static final String COUNTRY_CODE = "com.nokia.mid.countrycode";
 
     private static final String IMEI = "com.nokia.mid.imei";
 
@@ -59,7 +59,7 @@
 
     private static final String NETWORK_AVAILABILITY = "com.nokia.mid.networkavailability";
 
-    private static final String NETWORK_ID = "com.nokia.mid.networkid";
+    static final String NETWORK_ID = "com.nokia.mid.networkid";
 
     private static final String NETWORK_SIGNAL = "com.nokia.mid.networksignal";
 
--- a/javaextensions/wma/mms/pushplugin/build/eabi/javammsscpluginu.def	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/wma/mms/pushplugin/build/eabi/javammsscpluginu.def	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/wma/mms/pushplugin/src.s60/s60mmsserverconnection.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -55,7 +55,7 @@
     return mmsConn;
 }
 
-S60MmsServerConnection::~S60MmsServerConnection()
+OS_EXPORT S60MmsServerConnection::~S60MmsServerConnection()
 {
     JELOG2(EWMA);
     delete mOpenMonitor;
--- a/javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -790,8 +790,6 @@
         {
             // get cc length
             aHeaderLengths[KCcFieldIndex] = ReadIntL(aReadStream);
-            if (div == 0)
-                break;
             mmsMap = div;
         }
         break;
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javaextensions/wma/sms_cbs/pushplugin/sms/src.s60/smsserverconnection.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaextensions/wma/sms_cbs/pushplugin/sms/src.s60/smsserverconnection.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -211,6 +211,7 @@
         mIoctlBuf() = KSockSelectRead;
         mSocket.Ioctl(KIOctlSelect, iStatus, &mIoctlBuf, KSOLSocket);
         SetActive();
+        pthread_mutex_unlock(&mMutex);
         return;
     }
     switch (mState)
@@ -276,6 +277,7 @@
         pthread_cond_signal(&mCondVar);
         mIsRunning = EFalse;
         CActiveScheduler::Stop();
+        break;
     }
     default:
     {
--- a/javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javabackupcore/build/javabackup.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javabackup/javabackupcore/build/javabackup.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -43,12 +43,14 @@
 SOURCE                  jsbcactive.cpp
 SOURCE                  jsbcdataowner.cpp
 
+#ifdef RD_JAVA_S60_RELEASE_5_0
+SYSTEMINCLUDE	/epoc32/include/connect    // Due to abclient.h in S60 5.0
+#endif
+
 USERINCLUDE             ../src.s60
 USERINCLUDE             ../../inc.s60
 USERINCLUDE             ../../../../inc
 
-SYSTEMINCLUDE           /epoc32/include/connect
-
 LIBRARY                 ecom.lib
 LIBRARY                 abclient.lib
 LIBRARY                 javastorage.lib
--- a/javamanager/javabackup/javabackupcore/src.s60/jsbcdataowner.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javabackup/javabackupcore/src.s60/jsbcdataowner.h	Thu Jul 22 16:31:34 2010 +0100
@@ -19,7 +19,7 @@
 #ifndef JSBCDATAOWNER_H
 #define JSBCDATAOWNER_H
 
-#include <abclient.h>
+#include <connect/abclient.h>
 
 namespace java
 {
--- a/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/autostarter/build/javacaptain_ext_autostarter.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/autostarter/inc/autostarter.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/autostarter/src.s60/autostarter.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/boot/src/booteventprovider.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/config/src/configextensionplugin.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/build/javasmartcardcertsunittests.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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>
--- a/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/build/testsmartcardtokenplugin.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/build/testsmartcardtokenplugin.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -29,9 +29,6 @@
 CAPABILITY      CAP_ECOM_PLUGIN
 VENDORID        VID_DEFAULT
 
-systeminclude   /epoc32/include
-systeminclude   /epoc32/include/ecom
-
 sourcepath      ../src
 
 source          testsmartcardtokenplugin.cpp
--- a/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/src/101F5B72.rss	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/tsrc.s60/src/101F5B72.rss	Thu Jul 22 16:31:34 2010 +0100
@@ -14,7 +14,7 @@
 * Description: 
 *
 */
-#include <RegistryInfoV2.rh>
+#include <ecom/RegistryInfoV2.rh>
 #include <ct/InterfaceUID.hrh>
 
 // True
--- a/javamanager/javacaptain/extensionplugins/scrupdater/inc/scrupdater.h	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* 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
-{
-
-namespace captain
-{
-
-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& eventProvider,
-                       java::comms::CommsMessage& aMsg);
-
-    // ExtensionPluginInterface methods
-    virtual EventConsumerInterface* getEventConsumer();
-
-private:
-    void removeScrPresencesL(driveInfo *aInfo);
-    void addScrPresencesL(driveInfo *aInfo);
-    void initializeScrPresenceInfoL();
-
-    Usif::RSoftwareComponentRegistry *createScrL();
-
-
-    CoreInterface* mCore;
-};
-
-} // namespace captain
-} // namespace java
-
-#endif // SCRUPDATER_H
--- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/lookup.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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,
-             "scrupdater extensionplugin findDllMethod() funcName == null");
-    }
-    return ptr;
-}
--- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,705 +0,0 @@
-/*
-* 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"
-
-// Enable notifying AppArc for USIF Phase 2.
-//#define RD_JAVA_USIF_NOTIFY_APP_ARC
-
-
-using namespace Usif;
-
-/**
- * Return pointer to ExtensionPluginInterface implementation for this
- * extension dll
- */
-java::captain::ExtensionPluginInterface* getExtensionPlugin()
-{
-    return new java::captain::ScrUpdater();
-}
-
-namespace java
-{
-namespace captain
-{
-
-using java::fileutils::driveInfo;
-using java::fileutils::DriveListenerInterface;
-
-/**
- * Empty contructor
- */
-ScrUpdater::ScrUpdater() : mCore(0)
-{
-}
-
-/**
- * Empty destructor
- */
-ScrUpdater::~ScrUpdater()
-{
-}
-
-/**
- * Implement PluginInterface method
- */
-void ScrUpdater::startPlugin(CoreInterface* core)
-{
-    LOG(EJavaCaptain, EInfo, "ScrUpdater plugin started");
-
-    mCore = core;
-}
-
-/**
- * Implement PluginInterface method
- */
-void ScrUpdater::stopPlugin()
-{
-    mCore = 0;
-}
-
-/**
- * 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& eventProvider,
-                       java::comms::CommsMessage& aMsg)
-{
-    if (eventProvider == 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 (eventProvider == 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;
-    CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
-    pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
-
-    pScr->GetComponentIdsL(componentIdList);
-    CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
-    CleanupClosePushL(componentIdList);
-
-    // 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))
-    {
-        // 'A' - 'Z'
-        removedDrive -= 65;
-    }
-    else if ((removedDrive > 96) && (removedDrive < 123))
-    {
-        // 'a' - 'z'
-        removedDrive -= 97;
-    }
-    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);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
-    // TEMP TEST
-    TBool fPresenceChange = EFalse;
-    RArray<TApaAppUpdateInfo> removedApps;
-    CleanupClosePushL(removedApps);
-#endif
-
-    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]);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
-            fPresenceChange = ETrue;
-
-            // 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;
-                (void)removedApps.Append(appInfo);
-            }
-            CleanupStack::PopAndDestroy(&appsInComponent);
-#endif
-        }
-
-        CleanupStack::PopAndDestroy(pEntry);
-    }
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
-    // Tell AppArc which applications are no longer present
-    while (fPresenceChange)
-    {
-        if (removedApps.Count() == 0)
-        {
-            ELOG(EJavaCaptain, "removeScrPresencesL: Uids of the removed apps are not known");
-            break;
-        }
-
-        RApaLsSession apaSession;
-        TInt err = apaSession.Connect();
-        if (KErrNone != err)
-        {
-            ELOG1(EJavaCaptain, "removeScrPresencesL: Error %d when connecting AppArc", err);
-            break;
-        }
-        else
-        {
-            CleanupClosePushL(apaSession);
-            apaSession.UpdateAppListL(removedApps);
-            CleanupStack::PopAndDestroy(); // closes apaSession
-            fPresenceChange = EFalse;
-        }
-    }
-
-    CleanupStack::PopAndDestroy(); // Close removedApps
-#endif
-    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;
-    CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
-    pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
-
-    pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
-    CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
-    CleanupClosePushL(componentIdList);
-
-
-    // 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))
-    {
-        // 'A' - 'Z'
-        addedDrive -= 65;
-    }
-    else if ((addedDrive > 96) && (addedDrive < 123))
-    {
-        // 'a' - 'z'
-        addedDrive -= 97;
-    }
-    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);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
-    TBool fPresenceChange = EFalse;
-    RArray<TApaAppUpdateInfo> addedApps;
-    CleanupClosePushL(addedApps);
-#endif
-
-    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],_L("Media-Id"));
-        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]);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
-                fPresenceChange = ETrue;
-
-                // 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;
-                    (void)addedApps.Append(appInfo);
-                }
-                CleanupStack::PopAndDestroy(&appsInComponent);
-#endif
-            }
-        }
-
-        CleanupStack::PopAndDestroy(pMediaIdProperty);
-        CleanupStack::PopAndDestroy(pEntry);
-    }
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
-    // Tell AppArc which 'new' applications are now present
-    while (fPresenceChange)
-    {
-        if (addedApps.Count() == 0)
-        {
-            ELOG(EJavaCaptain, "addScrPresencesL: Uids of the 'new' apps are not known");
-            break;
-        }
-
-        RApaLsSession apaSession;
-        TInt err = apaSession.Connect();
-        if (KErrNone != err)
-        {
-            ELOG1(EJavaCaptain, "addScrPresencesL: Error %d when connecting AppArc", err);
-            break;
-        }
-        else
-        {
-            CleanupClosePushL(apaSession);
-            apaSession.UpdateAppListL(addedApps);
-            CleanupStack::PopAndDestroy(); // closes apaSession
-            fPresenceChange = EFalse;
-        }
-    }
-
-    CleanupStack::PopAndDestroy(); // Close addedApps
-#endif
-    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;
-    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;
-            driveMediaId[nInd] = volumeInfo.iUniqueID;
-            // 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;
-                }
-            }
-        }
-        else if (KErrNotReady == err)
-        {
-            // no volume in this drive
-            drivePresent[nInd] = EFalse;
-            driveMediaId[nInd] = 0;
-        }
-        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],_L("Media-Id"));
-        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])
-        {
-            // Check also the media id
-            if (driveMediaId[installationDrive] == pMediaIdProperty->IntValue())
-            {
-                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;
-    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/lookup.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/javacaptain.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/src/rtc.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javacaptain/subsystem.mk	Thu Jul 22 16:31:34 2010 +0100
@@ -22,6 +22,7 @@
     extensionplugins/config/build \
     extensionplugins/javacertstore/build \
     extensionplugins/storageserver/build \
+    extensionplugins/settingslistener/build \
     $(LINUX_ONLY)
 
 
--- a/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -52,8 +52,6 @@
 USERINCLUDE     ../inc
 USERINCLUDE     ../../../../inc
 
-SYSTEMINCLUDE   ../../../../inc
-
 // Libraries
 LIBRARY         charconv.lib
 LIBRARY         cone.lib
--- a/javamanager/javainstaller/installer/build/javainstaller.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/build/javainstaller.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -61,11 +61,7 @@
 
     contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
         CONFIG += hb
-        LIBS += -lxqservice
-    }
-
-    contains(PROJECT_DEFINES,RD_JAVA_USIF_NOTIFY_PROGRESS) {
-        LIBS += -lsifnotification
+        LIBS += -lsifnotification -lxqservice
     }
 
     MMP_RULES += \
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java	Thu Jul 22 16:31:34 2010 +0100
@@ -107,19 +107,15 @@
         iIconDir = aIconDir;
         iComponentIcon = aComponentIcon;
 
-        if (iHandle == 0)
-        {
-            InstallerException.internalError(
-                "SifNotifier.notifyStart: notifier has not been initialized");
-        }
+        checkHandle();
         int ret = _notifyStart(
                       iHandle, aGlobalComponentId, aComponentName,
                       aApplicationNames, aApplicationIcons,
                       aComponentSize, aIconDir, aComponentIcon);
         if (ret < 0)
         {
-            Log.logError("Notifying SIF start failed with code " + ret +
-                         ", " + getInfoString());
+            Log.log("Notifying SIF start failed with code " + ret +
+                    ", " + getInfoString());
             InstallerException.internalError(
                 "Notifying SIF start failed with code " + ret);
         }
@@ -138,11 +134,7 @@
     public void notifyEnd(
         int aErrCategory, int aErrCode, String aErrMsg, String aErrMsgDetails)
     {
-        if (iHandle == 0)
-        {
-            InstallerException.internalError(
-                "SifNotifier.notifyEnd: notifier has not been initialized");
-        }
+        checkHandle();
         if (aErrCategory == 0 && iLastProgressSent < MAX_PROGRESS)
         {
             // Before sending end notification, update progress to max if
@@ -162,8 +154,8 @@
             ", ErrMsgDetails: " + aErrMsgDetails;
         if (ret < 0)
         {
-            Log.logError("Notifying SIF end failed with code " + ret +
-                         ", " + getInfoString() + ", " + logMsg);
+            Log.log("Notifying SIF end failed with code " + ret +
+                    ", " + getInfoString() + ", " + logMsg);
             InstallerException.internalError(
                 "Notifying SIF end failed with code " + ret);
         }
@@ -184,11 +176,7 @@
         {
             return;
         }
-        if (iHandle == 0)
-        {
-            InstallerException.internalError(
-                "SifNotifier.notifyProgress: notifier has not been initialized");
-        }
+        checkHandle();
         if (aSubOperation == SUB_OP_NO)
         {
             iLastProgressSent = aCurrent;
@@ -202,8 +190,8 @@
             ", Total: " + aTotal;
         if (ret < 0)
         {
-            Log.logError("Notifying SIF progress failed with code " + ret +
-                         ", " + getInfoString() + ", " + logMsg);
+            Log.log("Notifying SIF progress failed with code " + ret +
+                    ", " + getInfoString() + ", " + logMsg);
             InstallerException.internalError(
                 "Notifying SIF progress failed with code " + ret);
         }
@@ -221,11 +209,7 @@
      */
     public void destroy()
     {
-        if (iHandle == 0)
-        {
-            InstallerException.internalError(
-                "SifNotifier.destroy: notifier has not been initialized");
-        }
+        checkHandle();
         int ret = _destroy(iHandle);
         if (ret < 0)
         {
@@ -265,6 +249,19 @@
     /*** ----------------------------- PRIVATE ---------------------------- */
 
     /**
+     * Checks if notifier instance has been initialized.
+     * @throws InstallerException if notifier has not been initialized
+     */
+    private void checkHandle()
+    {
+        if (iHandle == 0)
+        {
+            InstallerException.internalError(
+                "SifNotifier.destroy: notifier has not been initialized");
+        }
+    }
+
+    /**
      * Returns notification info string used in logging.
      */
     private String getInfoString()
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java	Thu Jul 22 16:31:34 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 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"
@@ -60,6 +60,14 @@
     }
 
     /**
+     * Returns SIF specific error category from given error id.
+     */
+    public static int getErrorCategory(int aErrorId)
+    {
+        return _getErrorCategory(aErrorId);
+    }
+
+    /**
      * Launches the application view. If launching application view
      * fails this method does not throw exception but produces an
      * error log entry.
@@ -157,7 +165,7 @@
         if (ret < 0)
         {
             InstallerException.internalError(
-                "Creating session failed with code " + ret);
+                "Creating SIF session failed with code " + ret);
         }
         //Log.log("SifRegistrator session started");
         iSessionHandle = ret;
@@ -176,36 +184,18 @@
      */
     public void registerSuite(SuiteInfo aSuiteInfo, boolean aIsUpdate)
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
+        checkSession();
         Log.log("SifRegistrator registering application suite " +
                 aSuiteInfo.getGlobalId());
 
-        if (_getUsifMode() > 0)
+        // Register suite as a component.
+        registerComponent(aSuiteInfo, aIsUpdate);
+        registerLocalizedComponentName(aSuiteInfo, -1);
+        // Register applications within the component.
+        Vector apps = aSuiteInfo.getApplications();
+        for (int i = 0; i < apps.size(); i++)
         {
-            // USIF Phase 2 registration.
-            // Register suite as a component.
-            registerComponent(aSuiteInfo, aIsUpdate);
-            registerLocalizedComponentName(aSuiteInfo, -1);
-            // Register applications within the component.
-            Vector apps = aSuiteInfo.getApplications();
-            for (int i = 0; i < apps.size(); i++)
-            {
-                registerApplication(aSuiteInfo, i);
-            }
-        }
-        else
-        {
-            // USIF Phase 1 registration.
-            // Register each application in the suite.
-            Vector apps = aSuiteInfo.getApplications();
-            for (int i = 0; i < apps.size(); i++)
-            {
-                registerComponent(aSuiteInfo, i, aIsUpdate);
-                registerLocalizedComponentName(aSuiteInfo, i);
-            }
+            registerApplication(aSuiteInfo, i);
         }
         registerLocalizedProperties(aSuiteInfo);
     }
@@ -221,29 +211,12 @@
      */
     public void unregisterSuite(SuiteInfo aSuiteInfo)
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
+        checkSession();
         Log.log("SifRegistrator unregistering application suite " +
                 aSuiteInfo.getGlobalId());
 
-        if (_getUsifMode() > 0)
-        {
-            // USIF Phase 2 unregistration.
-            // Unregister suite as a component.
-            unregisterComponent(aSuiteInfo);
-        }
-        else
-        {
-            // USIF Phase 1 unregistration.
-            // Unregister each application in the suite.
-            Vector apps = aSuiteInfo.getApplications();
-            for (int i = 0; i < apps.size(); i++)
-            {
-                unregisterComponent(aSuiteInfo, i);
-            }
-        }
+        // Unregister suite as a component.
+        unregisterComponent(aSuiteInfo);
     }
 
     /**
@@ -256,15 +229,11 @@
      */
     public void commitSession()
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
-
+        checkSession();
         int err = _commitSession(iSessionHandle);
         if (err < 0)
         {
-            InstallerException.internalError("Commiting session failed with code " + err);
+            InstallerException.internalError("Commiting SIF session failed with code " + err);
         }
         // Current session has been closed
         iSessionHandle = 0;
@@ -279,17 +248,13 @@
      */
     public void rollbackSession()
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
-
+        checkSession();
         int err = _rollbackSession(iSessionHandle);
         // Session is closed always when rollback is called
         iSessionHandle = 0;
         if (err < 0)
         {
-            InstallerException.internalError("Rolling back the session failed with code " + err);
+            InstallerException.internalError("Rolling back SIF session failed with code " + err);
         }
         //Log.log("SifRegistrator session rolled back");
     }
@@ -305,7 +270,6 @@
         {
             return;
         }
-
         _closeSession(iSessionHandle);
         // Current session has been closed
         iSessionHandle = 0;
@@ -322,11 +286,7 @@
      */
     public ComponentId getComponentId(String aGlobalId)
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
-
+        checkSession();
         ComponentId result = new ComponentId();
         int ret = _getComponentId(iSessionHandle, aGlobalId, result);
         if (-1 == ret)
@@ -354,11 +314,7 @@
      */
     public ComponentId getComponentId(Uid aAppUid)
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
-
+        checkSession();
         ComponentId result = new ComponentId();
         int ret = _getComponentIdForApp(
                       iSessionHandle, ((PlatformUid)aAppUid).getIntValue(), result);
@@ -384,15 +340,12 @@
      */
     public void logComponent(String aGlobalId)
     {
-        if (0 == iSessionHandle)
-        {
-            InstallerException.internalError("No valid SIF session.");
-        }
-
+        checkSession();
         int ret = _logComponent(iSessionHandle, aGlobalId);
         if (ret < -1)
         {
-            Log.logError("SifRegistrator logComponent failed with code " + ret);
+            Log.logError("SifRegistrator logComponent for " + aGlobalId +
+                         " failed with code " + ret);
         }
     }
 
@@ -400,120 +353,19 @@
     /*** ----------------------------- PRIVATE ---------------------------- */
 
     /**
-     * Registers one Java application to S60 USIF as a component.
-     * Used with USIF Phase 1.
-     *
-     * @param aSuiteInfo Information needed to register the application
-     * @param aIndex index of the application in the suite
-     * @param aIsUpdate true in case of an update, false in case of a new
-     * installation
-     * @throws InstallerException if registration cannot done or
-     *  startSession has not been called successfully
-     * @see startSession
-     * @see SuiteInfo
+     * Checks if SifRegistrator session has been started.
+     * @throws InstallerException if SifRegistrator session has not been started
      */
-    private void registerComponent(
-        SuiteInfo aSuiteInfo, int aIndex, boolean aIsUpdate)
+    private void checkSession()
     {
-        String globalId = aSuiteInfo.getGlobalId(aIndex);
-        if (globalId == null)
-        {
-            Log.logWarning("SifRegistrator: Application with index " + aIndex +
-                           " not found from " + aSuiteInfo.getGlobalId());
-            return;
-        }
-        ApplicationInfo appInfo =
-            (ApplicationInfo)aSuiteInfo.getApplications().elementAt(aIndex);
-        String suiteName = aSuiteInfo.getName();
-        String vendor = aSuiteInfo.getVendor();
-        String version = aSuiteInfo.getVersion().toString();
-        String name = appInfo.getName();
-        int uid = ((PlatformUid)appInfo.getUid()).getIntValue();
-        String[] componentFiles = getComponentFiles(aSuiteInfo);
-        long componentSize = aSuiteInfo.getInitialSize();
-        String attrValue = aSuiteInfo.getAttributeValue("Nokia-MIDlet-Block-Uninstall");
-        boolean isRemovable = !(attrValue != null && attrValue.equalsIgnoreCase("true"));
-        boolean isDrmProtected = (aSuiteInfo.getContentInfo() == aSuiteInfo.CONTENT_INFO_DRM);
-        boolean isOriginVerified = aSuiteInfo.isTrusted();
-        String midletInfoUrl = aSuiteInfo.getAttributeValue("MIDlet-Info-URL");
-        String midletDescription = aSuiteInfo.getAttributeValue("MIDlet-Description");
-        String downloadUrl = aSuiteInfo.getAttributeValue("Nokia-MIDlet-Download-URL");
-        ComponentId componentId = new ComponentId();
-        int err = _registerComponent(
-                      iSessionHandle, uid,
-                      getScrString(suiteName), getScrString(vendor),
-                      getScrString(version), getScrString(name),
-                      getScrString(globalId), componentFiles,
-                      componentSize, isRemovable, isDrmProtected,
-                      isOriginVerified, aIsUpdate, aSuiteInfo.getMediaId(),
-                      getScrString(midletInfoUrl),
-                      getScrString(midletDescription),
-                      getScrString(downloadUrl),
-                      componentId);
-        if (err < 0)
+        if (iSessionHandle == 0)
         {
-            InstallerException.internalError(
-                "Registering component " + globalId +
-                " failed with code " + err);
-        }
-        else
-        {
-            appInfo.setComponentId(componentId);
-            Log.log("SifRegistrator registered component " + globalId +
-                    " with id " + componentId.getId());
-        }
-    }
-
-    /**
-     * Unregisters one Java application from being S60 USIF component.
-     * Used with USIF Phase 1.
-     *
-     * @param aSuiteInfo Information needed to unregister the application,
-     * @param aIndex index of the application in the suite
-     * @throws InstallerException if unregistration cannot done or
-     *  startSession has not been called successfully
-     * @see startSession
-     * @see SuiteInfo
-     */
-    private void unregisterComponent(SuiteInfo aSuiteInfo, int aIndex)
-    {
-        String globalId = aSuiteInfo.getGlobalId(aIndex);
-        if (globalId == null)
-        {
-            Log.logWarning("SifRegistrator: Application with index " + aIndex +
-                           " not found from " + aSuiteInfo.getGlobalId());
-            return;
-        }
-        ComponentId componentId = getComponentId(globalId);
-        if (componentId == null)
-        {
-            Log.logWarning(
-                "SifRegistrator unregistration failed, application " +
-                globalId + " does not exist");
-            return;
-        }
-        // Save component id to ApplicationInfo.
-        ApplicationInfo appInfo =
-            (ApplicationInfo)aSuiteInfo.getApplications().elementAt(aIndex);
-        appInfo.setComponentId(componentId);
-        // Unregister application.
-        int err = _unregisterComponent(iSessionHandle, componentId.getId());
-        if (err < 0)
-        {
-            InstallerException.internalError(
-                "Unregistering component " + globalId +
-                " failed with code " + err);
-        }
-        else
-        {
-            Log.log("SifRegistrator unregistered component " + globalId +
-                    " with id " + componentId.getId());
+            InstallerException.internalError("No valid SIF session.");
         }
     }
 
     /**
      * Registers Java application suite to S60 USIF as a component.
-     * Used with USIF Phase 2.
      *
      * @param aSuiteInfo Suite information
      * @param aIsUpdate true in case of an update, false in case of a new
@@ -529,7 +381,6 @@
         String suiteName = aSuiteInfo.getName();
         String vendor = aSuiteInfo.getVendor();
         String version = aSuiteInfo.getVersion().toString();
-        String name = null; // Set name to null so that suite name will be used.
         int uid = ((PlatformUid)aSuiteInfo.getUid()).getIntValue();
         String[] componentFiles = getComponentFiles(aSuiteInfo);
         long componentSize = aSuiteInfo.getInitialSize();
@@ -540,17 +391,20 @@
         String midletInfoUrl = aSuiteInfo.getAttributeValue("MIDlet-Info-URL");
         String midletDescription = aSuiteInfo.getAttributeValue("MIDlet-Description");
         String downloadUrl = aSuiteInfo.getAttributeValue("Nokia-MIDlet-Download-URL");
+        String updateUrl = aSuiteInfo.getAttributeValue("Nokia-Update");
         ComponentId componentId = new ComponentId();
         int err = _registerComponent(
                       iSessionHandle, uid,
                       getScrString(suiteName), getScrString(vendor),
-                      getScrString(version), getScrString(name),
-                      getScrString(globalId), componentFiles,
-                      componentSize, isRemovable, isDrmProtected,
-                      isOriginVerified, aIsUpdate, aSuiteInfo.getMediaId(),
+                      getScrString(version), getScrString(globalId),
+                      componentFiles, componentSize,
+                      isRemovable, isDrmProtected,
+                      isOriginVerified, aIsUpdate,
+                      aSuiteInfo.getMediaId(),
                       getScrString(midletInfoUrl),
                       getScrString(midletDescription),
                       getScrString(downloadUrl),
+                      getScrString(updateUrl),
                       componentId);
         if (err < 0)
         {
@@ -568,7 +422,6 @@
 
     /**
      * Unregisters Java application suite from being S60 USIF component.
-     * Used with USIF Phase 2.
      *
      * @param aSuiteInfo suite information
      * @throws InstallerException if unregistration cannot done or
@@ -610,7 +463,6 @@
      * from given SuiteInfo object. The SuiteInfo must already have
      * been registered to USIF as a component with registerComponent()
      * method before this method is called.
-     * Used with USIF Phase 2.
      *
      * @param aSuiteInfo information needed to register the application
      * @param aIndex index of the application in the suite
@@ -816,51 +668,41 @@
         // Register Domain-Category property.
         String protectionDomainProperty = "Domain-Category";
         String protectionDomainName = aSuite.getProtectionDomainName();
-        if (protectionDomainName != null)
+        err = _setLocalizedComponentProperty(
+            iSessionHandle, cid, protectionDomainProperty,
+            getProtectionDomainPropertyValue(protectionDomainName),
+            UNSPECIFIED_LOCALE);
+        if (err < 0)
         {
-            err = _setLocalizedComponentProperty(
-                iSessionHandle, cid, protectionDomainProperty,
-                getProtectionDomainPropertyValue(protectionDomainName),
-                UNSPECIFIED_LOCALE);
-            if (err < 0)
-            {
-                InstallerException.internalError(
-                    "Adding property " + protectionDomainProperty +
-                    " value " + protectionDomainName + " for component " +
-                    cid + " failed with code " + err);
-            }
-        }
-        else
-        {
-            Log.logWarning(
-                "SifRegistrator.registerLocalizedProperties: " +
-                protectionDomainProperty + " not set");
+            InstallerException.internalError(
+                "Adding property " + protectionDomainProperty +
+                " value " + protectionDomainName + " for component " +
+                cid + " failed with code " + err);
         }
     }
 
     /**
      * Returns the "Domain-Category" property value which contains
      * the text id and text file name for the localized domain category
-     * text.
+     * text. This method must never return null.
      */
     private String getProtectionDomainPropertyValue(String aProtectionDomain)
     {
-        String textId = null;
-        if (aProtectionDomain.equals("Manufacturer"))
-        {
-            textId = "txt_java_inst_setlabel_cert_domain_val_manufacturer";
-        }
-        else if (aProtectionDomain.equals("Operator"))
+        String textId = "txt_java_inst_setlabel_cert_domain_val_untrusted_third_party";
+        if (aProtectionDomain != null)
         {
-            textId = "txt_java_inst_setlabel_cert_domain_val_operator";
-        }
-        else if (aProtectionDomain.equals("IdentifiedThirdParty"))
-        {
-            textId = "txt_java_inst_setlabel_cert_domain_val_trusted_third_party";
-        }
-        else if (aProtectionDomain.equals("UnidentifiedThirdParty"))
-        {
-            textId = "txt_java_inst_setlabel_cert_domain_val_untrusted_third_party";
+            if (aProtectionDomain.equals("Manufacturer"))
+            {
+                textId = "txt_java_inst_setlabel_cert_domain_val_manufacturer";
+            }
+            else if (aProtectionDomain.equals("Operator"))
+            {
+                textId = "txt_java_inst_setlabel_cert_domain_val_operator";
+            }
+            else if (aProtectionDomain.equals("IdentifiedThirdParty"))
+            {
+                textId = "txt_java_inst_setlabel_cert_domain_val_trusted_third_party";
+            }
         }
         return textId + ",javaapplicationinstaller";
     }
@@ -894,6 +736,13 @@
                             "SifRegistrator ignored unknown locale: " +
                             name + ": " + localizedName);
                     }
+                    else if (localizedName.getName() == null ||
+                             localizedName.getName().length() == 0)
+                    {
+                        Log.logWarning(
+                            "SifRegistrator ignored empty localized text: " +
+                            name + ": " + localizedName);
+                    }
                     else
                     {
                         Log.log("SifRegistrator found localized text " +
@@ -1015,7 +864,6 @@
      * @param aSuiteName
      * @param aVendor
      * @param aVersion
-     * @param aName
      * @param aGlobalId
      * @param aComponentFiles
      * @param aComponentSize
@@ -1027,17 +875,19 @@
      * @param aMidletInfoUrl
      * @param aMidletDescription
      * @param aDownloadUrl
+     * @param aUpdateUrl
      * @param aComponentId upon successful execution contains the
      * component id for the registered component
      * @return 0 if registration succeeded or Symbian error code
      */
     private static native int _registerComponent(
         int aSessionHandle, int aUid, String aSuiteName, String aVendor,
-        String aVersion, String aName, String aGlobalId,
+        String aVersion, String aGlobalId,
         String[] aComponentFiles, long aComponentSize,
         boolean aIsRemovable, boolean aIsDrmProtected,
         boolean aIsOriginVerified, boolean aIsUpdate, int aMediaId,
-        String aMidletInfoUrl, String aMidletDescription, String aDownloadUrl,
+        String aMidletInfoUrl, String aMidletDescription,
+        String aDownloadUrl, String aUpdateUrl,
         ComponentId aComponentId);
 
     /**
@@ -1145,4 +995,9 @@
      * @return 1 if application data should be registered to USIF, 0 otherwise
      */
     private static native int _getUsifMode();
+
+    /**
+     * Returns SIF specific error category from given error id.
+     */
+    private static native int _getErrorCategory(int aErrorId);
 }
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/SysUtil.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/SysUtil.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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"
@@ -359,11 +359,12 @@
                                              " drives failed with code " + ret);
         }
         // Save the drives so that next time they are not fetched again.
-        iUserVisibleDrives = new Vector();
+        Vector drivesVector = new Vector();
         for (int i = 0; i < aVisibleDrives.size(); i++)
         {
-            iUserVisibleDrives.addElement(aVisibleDrives.elementAt(i));
+            drivesVector.addElement(aVisibleDrives.elementAt(i));
         }
+        iUserVisibleDrives = drivesVector;
     }
 
     /**
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/GetComponentInfo.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/GetComponentInfo.java	Thu Jul 22 16:31:34 2010 +0100
@@ -480,6 +480,15 @@
                         suiteUid, null,
                         iSecurityAttributes.getAuthenticationAttributes());
 
+                if (authenticationCredentials != null)
+                {
+                    for (int i = 0; i < authenticationCredentials.length; i++)
+                    {
+                        String domain = authenticationCredentials[i]
+                            .getProtectionDomainCategory();
+                        Log.log("Protection domain: " + domain);
+                    }
+                }
                 if (iJarFilename != null)
                 {
                     // Authenticate jar.
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/Installer.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java	Thu Jul 22 16:31:34 2010 +0100
@@ -99,6 +99,11 @@
      */
     static final int RET_NO_SYSTEM_EXIT = 100;
 
+    /** Id for installer cancel Comms message. */
+    private static final int INSTALLER_CANCEL_MESSAGE_ID = 603;
+    /** Id for installer cancel Comms response message. */
+    private static final int INSTALLER_CANCEL_RESPONSE_MESSAGE_ID = 604;
+
     // ThreadDumper instance.
     private static ThreadDumper iThreadDumper = null;
 
@@ -1235,6 +1240,8 @@
             "  -commsresult=endpoint         In the end of operation, send\n"+
             "                                InstallerResultMessage to specified comms\n"+
             "                                endpoint.\n"+
+            "  -base64=base64options         Comma separated list of base64 encoded\n"+
+            "                                options.\n"+
             "\n"+
             "Either -jad or -jar must be specified, other options are optional.\n";
 
@@ -1264,10 +1271,13 @@
             "  -captainmsgs=yes|no           If set to no, JavaInstaller will not send\n"+
             "                                any messages to JavaCaptain during\n"+
             "                                uninstallation. Default is yes.\n"+
+            "  -resetpreinstall              Reset preinstall state.\n"+
             "  -skipotastatus                Skip OTA status handling.\n"+
             "  -commsresult=endpoint         In the end of operation, send\n"+
             "                                InstallerResultMessage to specified comms\n"+
             "                                endpoint.\n"+
+            "  -base64=base64options         Comma separated list of base64 encoded\n"+
+            "                                options.\n"+
             "\n"+
             "The -uid option must be specified, other options are optional.\n";
 
@@ -1466,7 +1476,7 @@
                 if (aMessage.hasPermission(CommsPermission.INSTALL_APPLICATION))
                 {
                     int msgId = aMessage.getMessageId();
-                    if (msgId == 603)
+                    if (msgId == INSTALLER_CANCEL_MESSAGE_ID)
                     {
                         Installer.cancel();
                         result = ERR_NONE;
@@ -1479,7 +1489,7 @@
                 }
                 CommsMessage response = new CommsMessage();
                 response.replyTo(aMessage);
-                response.setMessageId(604);
+                response.setMessageId(INSTALLER_CANCEL_RESPONSE_MESSAGE_ID);
                 response.write(result);
                 iInstallerServer.send(response);
                 Log.log("InstallerListener sent " + response);
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/CheckJarPackages.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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"
@@ -73,7 +73,7 @@
         // Application touch support detection is not needed
         // if Nokia-MIDlet-On-Screen-Keypad has been defined.
         boolean touchDetection = true;
-        if (ball.getAttributeValue("Nokia-MIDlet-On-Screen-Keypad") != null)
+        if (ball.iSuite.getOnScreenKeypad() != SuiteInfo.OSK_UNDEFINED)
         {
             touchDetection = false;
         }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java	Thu Jul 22 16:31:34 2010 +0100
@@ -304,7 +304,14 @@
 
                 if (ball.iSifRegistrator.getSifMode() > 0 && launchApp)
                 {
-                    ball.iSifRegistrator.launchAppView();
+                    ball.getInstallerUi().syncExec(new Runnable()
+                    {
+                        // launchAppView() must be called in the UI thread.
+                        public void run()
+                        {
+                            ball.iSifRegistrator.launchAppView();
+                        }
+                    });
                 }
                 else
                 if (ball.iCaptainMsgs && launchApp &&
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/HandleCustomAttributes.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/HandleCustomAttributes.java	Thu Jul 22 16:31:34 2010 +0100
@@ -56,7 +56,7 @@
     {
         if (aBall.iApplicationRegistrator.isOnDeviceKeypadNeeded())
         {
-            // default value when on-screen-keypad is needed
+            // Default value when on-screen-keypad is needed.
             aBall.iSuite.setOnScreenKeypad(SuiteInfo.OSK_GAMEACTIONS);
 
             String attrName = "Nokia-MIDlet-On-Screen-Keypad";
@@ -77,13 +77,16 @@
                 }
                 else
                 {
-                    Log.logWarning("Invalid " + attrName + " value " + attrValue);
+                    // Ignore on-screen-keypad attribute with invalid value.
+                    aBall.iSuite.setOnScreenKeypad(SuiteInfo.OSK_UNDEFINED);
+                    Log.logWarning("Ignoring invalid " + attrName +
+                                   " value " + attrValue);
                 }
             }
         }
         else
         {
-            // If the device does not need on-screen-keypad, the value is not set at all
+            // If the device does not need on-screen-keypad, the value is not set at all.
             aBall.iSuite.setOnScreenKeypad(SuiteInfo.OSK_UNDEFINED);
         }
 
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/StartProgressNotifications.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/GetFromStorage.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/GetFromStorage.java	Thu Jul 22 16:31:34 2010 +0100
@@ -54,6 +54,15 @@
         // Check if debug attribute has been defined for this suite.
         ball.setDebug(ball.iSuite.getAttributeValue("Nokia-MIDlet-Install-Debug"));
 
+        // Check from arguments if preinstall state should be reset.
+        String arg = ball.iArgs.get("resetpreinstall");
+        if (arg != null)
+        {
+            ball.iSuite.setResetPreinstall(true);
+            ball.log("ResetPreinstall set");
+        }
+
+
         // Log all suite info.
         //ball.log(ball.iSuite.toString());
     }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/UninstallBall.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/UninstallBall.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandler.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/storagehandler/SuiteInfo.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/SuiteInfo.java	Thu Jul 22 16:31:34 2010 +0100
@@ -73,6 +73,9 @@
     private String iAccessPoint = null;
     // Flag telling if application suite is trusted
     private boolean iTrusted = false;
+    // Flag telling if preinstallation state should be
+    // reseted in uninstallation.
+    private boolean iResetPreinstall = false;
 
     /** Flag telling if default icon should be used. */
     private boolean iUseDefaultIcon = false;
@@ -783,6 +786,24 @@
     }
 
     /**
+     * Get the flag telling if preinstallation state should be reset.
+     * Used only in uninstallation.
+     */
+    public boolean getResetPreinstall()
+    {
+        return iResetPreinstall;
+    }
+
+    /**
+     * Set the flag telling if preinstallation state should be reset.
+     * Used only in uninstallation.
+     */
+    public void setResetPreinstall(boolean aResetPreinstall)
+    {
+        iResetPreinstall = aResetPreinstall;
+    }
+
+    /**
      * Calculates initial size from MIDlet-Data-Size and
      * MIDlet-Jar-Size attributes, or if they are not present
      * from jar file size.
@@ -865,6 +886,7 @@
         buf.append("  MediaId: ").append(getMediaId()).append("\n");
         buf.append("  InitialSize: ").append(getInitialSize()).append("\n");
         buf.append("  PreinstallState: ").append(iPreinstallState).append("\n");
+        buf.append("  ResetPreinstall: ").append(getResetPreinstall()).append("\n");
         buf.append("  OnScreenKeypad: ").append(getOnScreenKeypad()).append("\n");
         buf.append("  ConvertedIcon: ").append(getConvertedIconPath()).append("\n");
         buf.append("  Group: ").append(getInstallationGroup()).append("\n");
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/Args.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/Args.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/installer/utils/AutoStartPermission.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/AutoStartPermission.java	Thu Jul 22 16:31:34 2010 +0100
@@ -67,7 +67,7 @@
      */
     public String toString()
     {
-        return "javax.microedition.midlet.AutoStartPermission";
+        return "AutoStartPermission";
     }
     
     /**
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/applicationregistrator.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -51,6 +51,7 @@
 // NAMESPACE DECLARATION
 using namespace java;
 
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 /**
  * MIDP Stub SIS file UID. The application type Uid for MIDlets in S60
  */
@@ -80,14 +81,6 @@
                           jboolean aBackground);
 
 /**
- * Internal helper method for checking whether Application Shell is already running
- * Used JNI method ...1startAppShellUi
- *
- * @return ETrue if AppShell is running
- */
-TBool isAppShellUiRunning();
-
-/**
  * Internal helper method for checking whether this code is executing in
  * a device that has correctly working version of
  * RApaLsSession::ForceCommitNonNativeApplicationsUpdatesL()
@@ -95,6 +88,15 @@
  * @return ETrue if force commit works well
  */
 TBool isForceCommitSupported();
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+/**
+ * Internal helper method for checking whether Application Shell is already running
+ * Used JNI method ...1startAppShellUi
+ *
+ * @return ETrue if AppShell is running
+ */
+TBool isAppShellUiRunning();
 
 /**
  * Internal helper method for starting menu application
@@ -129,7 +131,7 @@
         return err;
     }
 
-#ifndef RD_JAVA_USIF_APP_REG
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
     // Delete any pending (un)registrations (possible if
     // e.g. device rebooted before commit).
     // This call does nothing if there is no pending registrations.
@@ -144,7 +146,7 @@
         pApaSession->Close();
         return err;
     }
-#endif // RD_JAVA_USIF_APP_REG
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 
     // Return handle to session. Utilize the fact that in Symbian
     // all pointer addresses are MOD 4 so the last 2 bits are 0
@@ -168,7 +170,7 @@
  * @param[in] aBackground
  * @return 0 if registration succeeded or Symbian error code
  */
-#ifdef RD_JAVA_USIF_APP_REG
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1registerApplication
 (JNIEnv */*aEnv*/, jclass /*aClass*/, jint /*aSessionHandle*/, jint /*aUid*/, jstring /*aGroupName*/,
  jstring /*aMIDletName*/, jstring /*aTargetDrive*/, jstring /*aIconFileName*/,
@@ -176,7 +178,7 @@
 {
     return KErrNone;
 }
-#else
+#else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1registerApplication
 (JNIEnv *aEnv, jclass aClass, jint aSessionHandle, jint aUid, jstring aGroupName,
  jstring aMIDletName, jstring aTargetDrive, jstring aIconFileName,
@@ -343,7 +345,6 @@
 
     return err;
 }
-#endif // RD_JAVA_USIF_APP_REG
 
 
 /**
@@ -475,6 +476,7 @@
 
     return err;
 }
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 
 
 /**
@@ -484,13 +486,13 @@
  * @param[in] aUid The Uid of the application to be unregistered..
  * @return 0 if unregistration succeeded or Symbian error code
  */
-#ifdef RD_JAVA_USIF_APP_REG
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1unregisterApplication
 (JNIEnv *, jclass, jint /*aSessionHandle*/, jint /*aUid*/)
 {
     return KErrNone;
 }
-#else
+#else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1unregisterApplication
 (JNIEnv *, jclass, jint aSessionHandle, jint aUid)
 {
@@ -503,7 +505,7 @@
     TRAPD(err, pApaSession->DeregisterNonNativeApplicationL(appUid));
     return err;
 }
-#endif // RD_JAVA_USIF_APP_REG
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 
 
 /**
@@ -524,7 +526,7 @@
 
     TInt err = KErrNone;
 
-#ifndef RD_JAVA_USIF_APP_REG
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
     if (aSynchronous)
     {
         // Make synchronous commit
@@ -552,12 +554,12 @@
         // Use always this synchronous commit when running in emulator
         // to make writing autotest cases easier.
         TRAP(err, pApaSession->CommitNonNativeApplicationsUpdatesL());
-#else
+#else // __WINS__
         // asynchronous commit
         TRAP(err, pApaSession->ForceCommitNonNativeApplicationsUpdatesL());
 #endif // __WINS__
     }
-#endif // RD_JAVA_USIF_APP_REG
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 
     if (KErrNone == err)
     {
@@ -582,9 +584,9 @@
         reinterpret_cast<RApaLsSession*>(aSessionHandle<<2);
 
     TInt err = KErrNone;
-#ifndef RD_JAVA_USIF_APP_REG
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
     err = pApaSession->RollbackNonNativeApplicationsUpdates();
-#endif // RD_JAVA_USIF_APP_REG
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
     pApaSession->Close();
     delete pApaSession;
 
@@ -925,6 +927,7 @@
 }
 
 
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 /**
  * Internal helper method for checking whether this code is executing in
  * a device that has correctly working version of
@@ -969,3 +972,4 @@
         return EFalse;
     }
 }
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/installer/src.s60/applicationregistrator/sifregistrator.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -24,6 +24,7 @@
 #include <w32std.h>
 
 #include "com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator.h"
+#include "com_nokia_mj_impl_utils_InstallerErrorMessage.h"
 #include "javacommonutils.h"
 #include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL
 #include "logger.h"
@@ -33,19 +34,15 @@
 
 #include <usif/scr/scr.h>
 #include <usif/scr/screntries.h>
-#ifdef RD_JAVA_USIF_APP_REG
 #include <usif/scr/appreginfo.h>
-#endif // RD_JAVA_USIF_APP_REG
+#include <usif/usiferror.h>
 #include <xqappmgr.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);                      \
+    {                                                                 \
+        std::wstring ws((wchar_t*)tdescParam.Ptr(), tdescParam.Length()); \
+        LOG1(compIdParam, logLevelParam, msgParam, ws.c_str());       \
     }
 
 // NAMESPACE DECLARATION
@@ -55,21 +52,19 @@
 IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
 
 // 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(KUpdateURL, "Update-URL");
 _LIT(KSettingsPlugin, "SettingsName");
 _LIT(KSettingsPluginValue, "javaapplicationsettingsview");
 
-#ifdef RD_JAVA_USIF_APP_REG
 // Symbian file path separator.
 _LIT(KPathSeperator, "\\");
 // Postfix for the fake application name generated for AppArc.
 _LIT(KAppPostfix, ".fakeapp");
-#endif // RD_JAVA_USIF_APP_REG
 
 /**
  * Internal helper method for checking if specified application
@@ -179,7 +174,6 @@
  * See JNI method __1notifyAppChange.
  * This method makes calls that may leave (the actual registering).
  */
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
 void NotifyAppChangeL(JNIEnv *aEnv, jintArray aAppUids, jint aAppChange)
 {
     RApaLsSession apaSession;
@@ -212,11 +206,6 @@
     CleanupStack::PopAndDestroy(&apaSession);
     LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed");
 }
-#else
-void NotifyAppChangeL(JNIEnv *, jintArray, jint)
-{
-}
-#endif // RD_JAVA_USIF_NOTIFY_APP_ARC
 
 /*
  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
@@ -227,12 +216,6 @@
 (JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange)
 {
     TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange));
-    if (KErrNone != err)
-    {
-        ELOG1(EJavaInstaller,
-              "notifyAppChange: notifying AppArc failed, error %d",
-              err);
-    }
     return err;
 }
 
@@ -257,14 +240,21 @@
     QUrl openRecentView("appto://20022F35?activityname=AppLibRecentView");
     XQApplicationManager applicationManager;
     XQAiwRequest *request = applicationManager.create(openRecentView);
-    if (request) {
+    if (request)
+    {
+        LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib");
         bool result = request->send();
-        if (!result) {
+        if (!result)
+        {
             int error = request->lastError();
             ELOG1(EJavaInstaller,
                   "launchAppView: launching AppLib failed, error %d", error);
             err = KErrGeneral;
         }
+        else
+        {
+            LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib succeeded");
+        }
         delete request;
     }
 
@@ -354,12 +344,6 @@
     TRAPD(err, pScr->RollbackTransactionL());
     pScr->Close();
     delete pScr;
-    if (KErrNone != err)
-    {
-        ELOG1(EJavaInstaller,
-              "rollbackSession: Rolling back transaction failed, error %d",
-              err);
-    }
     return err;
 }
 
@@ -389,9 +373,9 @@
         HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue);
         aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf);
         //LOG_TDESC_L(EJavaInstaller, EInfo,
-        //            "SetComponentPropertyL: name %s", aName);
+        //            "SetComponentPropertyL: name %S", aName);
         //LOG_TDESC_L(EJavaInstaller, EInfo,
-        //            "SetComponentPropertyL: value %s", valueBuf->Des());
+        //            "SetComponentPropertyL: value %S", valueBuf->Des());
         CleanupStack::PopAndDestroy(valueBuf);
     }
 }
@@ -402,23 +386,14 @@
  */
 TComponentId RegisterComponentL(
     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid,
-    jstring aSuiteName, jstring aVendor, jstring aVersion,
-    jstring aName, jstring aGlobalId,
+    jstring aSuiteName, jstring aVendor, jstring aVersion, jstring aGlobalId,
     jobjectArray aComponentFiles, TInt64 aComponentSize,
     TBool aIsRemovable, TBool aIsDrmProtected,
     TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId,
-    jstring aMidletInfoUrl, jstring aMidletDescription, jstring aDownloadUrl)
+    jstring aMidletInfoUrl, jstring aMidletDescription,
+    jstring aDownloadUrl, jstring aUpdateUrl)
 {
-    HBufC *name = NULL;
-    if (NULL == aName)
-    {
-        // If name is not specified, use suite name.
-        name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName);
-    }
-    else
-    {
-        name = CreateHBufCFromJavaStringLC(aEnv, aName);
-    }
+    HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName);
     HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
     HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion);
     HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
@@ -445,14 +420,10 @@
     aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue());
     //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set");
 
-    if (NULL != aName)
-    {
-        // If name is specified, store suite name as property.
-        SetComponentPropertyL(aEnv, aScr, componentId, KMIDletName(), aSuiteName);
-    }
     SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl);
     SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription);
     SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl);
+    SetComponentPropertyL(aEnv, aScr, componentId, KUpdateURL(), aUpdateUrl);
 
     CleanupStack::PopAndDestroy(globalId);
     CleanupStack::PopAndDestroy(version);
@@ -478,21 +449,22 @@
  */
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent
 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName,
- jstring aVendor, jstring aVersion, jstring aName, jstring aGlobalId,
+ jstring aVendor, jstring aVersion, jstring aGlobalId,
  jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable,
  jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate,
  jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription,
- jstring aDownloadUrl, jobject aComponentId)
+ jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId)
 {
     __UHEAP_MARK;
     RSoftwareComponentRegistry *pScr =
         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
     TComponentId componentId = -1;
     TRAPD(err, componentId = RegisterComponentL(
-                                 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId,
+                                 aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId,
                                  aComponentFiles, aComponentSize, aIsRemovable,
                                  aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId,
-                                 aMidletInfoUrl, aMidletDescription, aDownloadUrl));
+                                 aMidletInfoUrl, aMidletDescription,
+                                 aDownloadUrl, aUpdateUrl));
     __UHEAP_MARKEND;
     if (KErrNone == err)
     {
@@ -515,9 +487,7 @@
     RSoftwareComponentRegistry *pScr =
         reinterpret_cast<RSoftwareComponentRegistry*>(aSessionHandle<<2);
     TInt err = KErrNone;
-#ifdef RD_JAVA_USIF_APP_REG
     TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId));
-#endif // RD_JAVA_USIF_APP_REG
     if (KErrNone == err)
     {
         TRAP(err, pScr->DeleteComponentL(aComponentId));
@@ -530,7 +500,6 @@
  * See JNI method __1registerApplication.
  * This method makes calls that may leave.
  */
-#ifdef RD_JAVA_USIF_APP_REG
 void RegisterApplicationL(
     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr,
     jint aComponentId, jint aAppUid,
@@ -598,47 +567,36 @@
     RPointerArray<HBufC> captionsArray;
     CleanupResetAndDestroyPushL(captionsArray);
     TInt langCount = aEnv->GetArrayLength(aLanguages);
-    TInt captionCount = aEnv->GetArrayLength(aAppNames);
-    if (langCount == captionCount)
+    jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL);
+    for (TInt i = 0; i < langCount; i++)
     {
-        jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL);
-        for (TInt i = 0; i < langCount; i++)
-        {
-            TLanguage tmpLanguage = (TLanguage)languages[i];
-            HBufC *tmpCaption =
-                CreateHBufCFromJavaStringLC(
-                    aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
-            captionsArray.AppendL(tmpCaption);
-            CleanupStack::Pop(tmpCaption);
-            //LOG1(EJavaInstaller, EInfo,
-            //     "RegisterApplicationL: language %d", tmpLanguage);
-            //LOG_TDESC_L(EJavaInstaller, EInfo,
-            //            "RegisterApplicationL: caption %s", tmpCaption->Des());
-            CCaptionAndIconInfo *tmpCaptionAndIconInfo =
-                CCaptionAndIconInfo::NewLC(
-                    /*aCaption=*/ *tmpCaption,
-                    /*aIconFileName=*/ KNullDesC,
-                    /*aNumOfAppIcons=*/ 0);
-            CLocalizableAppInfo *tmpLocAppInfo =
-                CLocalizableAppInfo::NewLC(
-                    /*aShortCaption=*/ KNullDesC,
-                    /*aApplicationLanguage=*/ tmpLanguage,
-                    /*aGroupName=*/ KNullDesC,
-                    /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo,
-                    /*aViewDataList=*/ viewDataList);
-            localizableAppInfoList.AppendL(tmpLocAppInfo);
-            CleanupStack::Pop(tmpLocAppInfo);
-            CleanupStack::Pop(tmpCaptionAndIconInfo);
-        }
-        aEnv->ReleaseIntArrayElements(aLanguages, languages, 0);
+        TLanguage tmpLanguage = (TLanguage)languages[i];
+        HBufC *tmpCaption =
+            CreateHBufCFromJavaStringLC(
+                aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
+        captionsArray.AppendL(tmpCaption);
+        CleanupStack::Pop(tmpCaption);
+        //LOG1(EJavaInstaller, EInfo,
+        //     "RegisterApplicationL: language %d", tmpLanguage);
+        //LOG_TDESC_L(EJavaInstaller, EInfo,
+        //            "RegisterApplicationL: caption %S", tmpCaption->Des());
+        CCaptionAndIconInfo *tmpCaptionAndIconInfo =
+            CCaptionAndIconInfo::NewLC(
+                /*aCaption=*/ *tmpCaption,
+                /*aIconFileName=*/ KNullDesC,
+                /*aNumOfAppIcons=*/ 0);
+        CLocalizableAppInfo *tmpLocAppInfo =
+            CLocalizableAppInfo::NewLC(
+                /*aShortCaption=*/ KNullDesC,
+                /*aApplicationLanguage=*/ tmpLanguage,
+                /*aGroupName=*/ KNullDesC,
+                /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo,
+                /*aViewDataList=*/ viewDataList);
+        localizableAppInfoList.AppendL(tmpLocAppInfo);
+        CleanupStack::Pop(tmpLocAppInfo);
+        CleanupStack::Pop(tmpCaptionAndIconInfo);
     }
-    else
-    {
-        WLOG2(EJavaInstaller,
-              "RegisterApplicationL: localisation not made because language " \
-              "count does not match to caption count (%d != %d)",
-              langCount, captionCount);
-    }
+    aEnv->ReleaseIntArrayElements(aLanguages, languages, 0);
 
     // Create application registration data objects.
     TApplicationCharacteristics appCharacteristics;
@@ -674,13 +632,6 @@
     CleanupStack::PopAndDestroy(caption);
     __UHEAP_MARKEND;
 }
-#else
-void RegisterApplicationL(
-    JNIEnv *, RSoftwareComponentRegistry *, jint, jint, jstring,
-    jstring, jstring, jstring, jint, jintArray, jobjectArray)
-{
-}
-#endif // RD_JAVA_USIF_APP_REG
 
 /*
  * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
@@ -710,19 +661,13 @@
     JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId,
     jstring aName, jstring aVendor, jint aLanguage)
 {
-    if (NULL != aName)
-    {
-        HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
-        aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage);
-        CleanupStack::PopAndDestroy(name);
-    }
+    HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
+    aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage);
+    CleanupStack::PopAndDestroy(name);
 
-    if (NULL != aVendor)
-    {
-        HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
-        aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage);
-        CleanupStack::PopAndDestroy(vendor);
-    }
+    HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
+    aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage);
+    CleanupStack::PopAndDestroy(vendor);
 }
 
 /*
@@ -827,7 +772,6 @@
  * Method:    _getComponentIdForApp
  * Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I
  */
-#ifdef RD_JAVA_USIF_APP_REG
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
 (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId)
 {
@@ -847,13 +791,6 @@
     }
     return err;
 }
-#else
-JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
-(JNIEnv *, jclass, jint, jint, jobject)
-{
-    return KErrNone;
-}
-#endif // RD_JAVA_USIF_APP_REG
 
 /**
  * See JNI method __1getuid.
@@ -866,20 +803,8 @@
     CleanupClosePushL(*pScr);
     TInt uid = 0;
     CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid());
-    if (NULL != property)
-    {
-        if (property->PropertyType() == CPropertyEntry::EIntProperty)
-        {
-            uid = ((CIntPropertyEntry*)property)->IntValue();
-        }
-        else
-        {
-            ELOG2(EJavaInstaller,
-                  "GetUidL: Incorrect property type %d for cid %d",
-                  property->PropertyType(), aCid);
-        }
-        delete property;
-    }
+    uid = ((CIntPropertyEntry*)property)->IntValue();
+    delete property;
     // Close and delete the temporary RSoftwareComponentRegistry.
     CleanupStack::PopAndDestroy(pScr);
     delete pScr; // For some reason PopAndDestroy does not delete this.
@@ -916,23 +841,16 @@
     HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
     CComponentEntry *componentEntry =
         aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage);
-    if (NULL == componentEntry)
-    {
-        //LOG_TDESC_L(EJavaInstaller, EInfo,
-        //            "Component not found for GlobalId %s", globalId->Des());
-        CleanupStack::PopAndDestroy(globalId);
-        return;
-    }
     CleanupStack::PopAndDestroy(globalId);
 
     // Log component entry.
     TComponentId componentId = componentEntry->ComponentId();
-    LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %s", componentEntry->GlobalId());
+    LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %S", componentEntry->GlobalId());
     LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId);
-    LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %s", componentEntry->SoftwareType());
-    LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %s", componentEntry->Name());
-    LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %s", componentEntry->Vendor());
-    LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %s", componentEntry->Version());
+    LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %S", componentEntry->SoftwareType());
+    LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %S", componentEntry->Name());
+    LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %S", componentEntry->Vendor());
+    LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %S", componentEntry->Version());
     LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize());
     LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState());
     LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected());
@@ -960,42 +878,37 @@
         switch (propertyEntry->PropertyType())
         {
         case CPropertyEntry::EBinaryProperty:
-            LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %s",
+            LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %S",
                         propertyEntry->PropertyName());
             break;
         case CPropertyEntry::EIntProperty:
-            LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %s",
+            LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %S",
                         propertyEntry->PropertyName());
             LOG2(EJavaInstaller, EInfo, "  = 0x%x (%d)",
                  ((CIntPropertyEntry*)propertyEntry)->IntValue(),
                  ((CIntPropertyEntry*)propertyEntry)->IntValue());
             break;
         case CPropertyEntry::ELocalizedProperty:
-            LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %s",
+            LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %S",
                         propertyEntry->PropertyName());
-            LOG_TDESC_L(EJavaInstaller, EInfo, " = %s",
+            LOG_TDESC_L(EJavaInstaller, EInfo, " = %S",
                         ((CLocalizablePropertyEntry*)propertyEntry)->StrValue());
             break;
         }
     }
     CleanupStack::PopAndDestroy(&properties);
 
-#ifdef RD_JAVA_USIF_APP_REG
     // Log uids of applications associated to component.
     RArray<TUid> appUids;
     CleanupClosePushL(appUids);
     aScr->GetAppUidsForComponentL(componentId, appUids);
-    if (appUids.Count() == 0)
-    {
-        LOG(EJavaInstaller, EInfo, "No component appUids found from SCR");
-    }
+    LOG1(EJavaInstaller, EInfo, "Number of AppUids found: %d", appUids.Count());
     for (TInt i = 0; i < appUids.Count(); i++)
     {
         LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)",
              appUids[i].iUid, appUids[i].iUid);
     }
     CleanupStack::PopAndDestroy(&appUids);
-#endif // RD_JAVA_USIF_APP_REG
 }
 
 /**
@@ -1047,11 +960,51 @@
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUsifMode
 (JNIEnv *, jclass)
 {
-#ifdef RD_JAVA_USIF_APP_REG
     return 1;
-#else
-    return 0;
-#endif // RD_JAVA_USIF_APP_REG
+}
+
+/*
+ * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
+ * Method:    _getErrorCategory
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory
+(JNIEnv *, jclass, jint aErrorId)
+{
+    int errorCategory = Usif::EUnexpectedError;
+    switch (aErrorId)
+    {
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_MEM:
+        errorCategory = Usif::ELowDiskSpace;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_NET:
+        errorCategory = Usif::ENetworkUnavailable;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CORRUPT_PKG:
+        errorCategory = Usif::ECorruptedPackage;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_COMPAT_ERR:
+        errorCategory = Usif::EApplicationNotCompatible;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHORIZATION_ERR:
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHENTICATION_ERR:
+        errorCategory = Usif::ESecurityError;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_PUSH_REG_ERR:
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_UNEXPECTED_ERR:
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_UNEXPECTED_ERR:
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_OTHER_UNEXPECTED_ERR:
+        errorCategory = Usif::EUnexpectedError;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CANCEL:
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_CANCEL:
+        errorCategory = Usif::EUserCancelled;
+        break;
+    case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_NOT_ALLOWED:
+        errorCategory = Usif::EUninstallationBlocked;
+        break;
+    }
+    return errorCategory;
 }
 
 #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
@@ -1127,9 +1080,9 @@
  * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I
  */
 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent
-(JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, jstring,
- jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, jstring,
- jstring, jstring, jobject)
+(JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring,
+ jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint,
+ jstring, jstring, jstring, jstring, jobject)
 {
     return KErrNone;
 }
@@ -1233,4 +1186,15 @@
     return 0;
 }
 
+/*
+ * Class:     com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
+ * Method:    _getErrorCategory
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory
+(JNIEnv *, jclass, jint)
+{
+    return 0;
+}
+
 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
--- a/javamanager/javainstaller/installer/tsrc/build/jiut.bat	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/build/jiut.bat	Thu Jul 22 16:31:34 2010 +0100
@@ -1,5 +1,5 @@
 @rem
-@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 @rem All rights reserved.
 @rem This component and the accompanying materials are made available
 @rem under the terms of "Eclipse Public License v1.0"
@@ -16,8 +16,8 @@
 rem Script for running JavaInstaller unit tests from S60 eshell
 rem Start SifServer before running any tests
 sifserver
-rem javainstaller test -mainclass=com.nokia.mj.impl.installer.downloader.NotificationPosterTest
-rem javainstaller test -mainclass=com.nokia.mj.impl.installer.downloader.DownloaderTest
+javainstaller test -mainclass=com.nokia.mj.impl.installer.downloader.NotificationPosterTest
+javainstaller test -mainclass=com.nokia.mj.impl.installer.downloader.DownloaderTest
 javainstaller test -mainclass=com.nokia.mj.impl.installer.storagehandler.OtaStatusHandlerTest
 javainstaller test -mainclass=com.nokia.mj.impl.installer.integrityservice.IntegrityServiceTest
 javainstaller test -mainclass=com.nokia.mj.impl.installer.jadjarmatcher.JadJarMatcherTest
@@ -34,4 +34,7 @@
 javainstaller test -mainclass=com.nokia.mj.impl.installer.utils.AttributeReaderTest
 javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerResultMessageTest
 javainstaller test -mainclass=com.nokia.mj.impl.installer.GetComponentInfoTest
-rem javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest
+javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run1
+javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run2
+javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run3
+javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run4
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/GetComponentInfoTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/GetComponentInfoTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -856,15 +856,11 @@
         try
         {
             String value = aMsg.getStringValue(aName);
-            assertTrue("Unexpected value " + aName + "=" + value, false);
-        }
-        catch (IllegalArgumentException iae)
-        {
-            // Expected exception.
+            assertTrue("Unexpected value " + aName + "=" + value, value == null);
         }
         catch (Throwable t)
         {
-            assertTrue("Incorrect exception for string value " + aName +
+            assertTrue("Unexpected exception for string value " + aName +
                        ": " + t, false);
         }
 
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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"
@@ -52,6 +52,8 @@
     {
         TestSuite suite = new TestSuite(this.getClass().getName());
 
+        String runIndex = System.getProperty("com.nokia.mj.impl.installer.test.param1");
+
         if (Platform.isLinux())
         {
             // In S60 this would be interactive test, so disable it there.
@@ -64,6 +66,8 @@
             }));
         }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run1"))
+        {
         // Run 1
         suite.addTest(new InstallerEngineTest("testMidletMessageOk", new TestMethod()
         {
@@ -104,7 +108,11 @@
                 ((InstallerEngineTest)tc).test3AppsOk();
             }
         }));
+        }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run2"))
+        {
+        // Run 2
         suite.addTest(new InstallerEngineTest("testDownloadJadOk", new TestMethod()
         {
             public void run(TestCase tc)
@@ -113,7 +121,6 @@
             }
         }));
 
-        // Run 2
         suite.addTest(new InstallerEngineTest("testDownloadJarOk", new TestMethod()
         {
             public void run(TestCase tc)
@@ -217,7 +224,11 @@
                 ((InstallerEngineTest)tc).testNoJavaBinRoot();
             }
         }));
+        }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run3"))
+        {
+        // Run 3
         suite.addTest(new InstallerEngineTest("testBlockUninstall", new TestMethod()
         {
             public void run(TestCase tc)
@@ -241,8 +252,11 @@
                 ((InstallerEngineTest)tc).testApplicationInfo();
             }
         }));
+        }
 
-        // Run 3
+        if (runIndex == null || runIndex.equalsIgnoreCase("run4"))
+        {
+        // Run 4
         suite.addTest(new InstallerEngineTest("testInstallOptions", new TestMethod()
         {
             public void run(TestCase tc)
@@ -258,6 +272,7 @@
                 ((InstallerEngineTest)tc).testInstallAuthAndBig();
             }
         }));
+        }
 
         com.nokia.mj.impl.utils.OmjTestRunner.run(suite);
     }
@@ -313,6 +328,15 @@
     }
 
     /**
+     */
+    public String getTestServer()
+    {
+        String server = System.getProperty("com.nokia.mj.impl.installer.test.server");
+        assertNotNull("-server=<address>:<port> argument required.", server);
+        return server;
+    }
+
+    /**
      * Makes installation, update and uninstallation for given application.
      * Does the following steps:
      * install with cancellation and check that app is not installed,
@@ -413,12 +437,12 @@
         assertNoIsDir();
 
         // List.
-        Log.logOut("InstallerEngineTest.doInstallUninstall: list -v");
-        result = Installer.mainWithResult(new String[] { "list", "-v" });
-        assertResult(result, Installer.ERR_NONE);
-        Log.logOut("InstallerEngineTest.doInstallUninstall: list -otastatus");
-        result = Installer.mainWithResult(new String[] { "list", "-otastatus" });
-        assertResult(result, Installer.ERR_NONE);
+        //Log.logOut("InstallerEngineTest.doInstallUninstall: list -v");
+        //result = Installer.mainWithResult(new String[] { "list", "-v" });
+        //assertResult(result, Installer.ERR_NONE);
+        //Log.logOut("InstallerEngineTest.doInstallUninstall: list -otastatus");
+        //result = Installer.mainWithResult(new String[] { "list", "-otastatus" });
+        //assertResult(result, Installer.ERR_NONE);
 
         // Update with cancellation.
         Log.logOut("InstallerEngineTest.doInstallUninstall: update with cancellation " + aFilename);
@@ -573,38 +597,38 @@
     public void testDownloadJadOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJadOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/omjserver/resources/omj/T00000900_JBenchmark2_gcf.jsp", true, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/HelloWorld_ota.jad", true, iDefaultOptions);
     }
 
     public void testDownloadJarOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJarOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/omjserver/resources/omj/JBenchmark2.jar", false, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/HelloWorld.jar", false, iDefaultOptions);
     }
 
     public void testDownloadJadHttpRedirectOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJadHttpRedirectOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/RedirectServlet/redirect?name=JBenchmark2.jad&count=5", true, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld_redirect", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/redirect?name=HelloWorld_redirect.jad&count=5", true, iDefaultOptions);
     }
 
     public void testDownloadJarHttpRedirectOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJarHttpRedirectOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/RedirectServlet/redirect?name=JBenchmark2.jar", false, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld_redirect", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/redirect?name=HelloWorld_redirect.jar", false, iDefaultOptions);
     }
 
     public void testDownloadJadHttpAuthOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJadHttpAuthOk begins");
-        SuiteInfo suite = new SuiteInfo("DS_Snow_http_auth", "DS_Effects");
+        SuiteInfo suite = new SuiteInfo("HelloWorld_http_auth", "Nokia");
         iDefaultOptions.addElement("-username=guest");
         iDefaultOptions.addElement("-password=guest");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/httpauth/DS_Snow_http_auth.jad", true, iDefaultOptions);
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/httpauth/HelloWorld_http_auth.jad", true, iDefaultOptions);
     }
 
     public void testDownloadJadHttpAuthNok()
@@ -614,7 +638,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/httpauth/DS_Snow_http_auth.jad",
+            "-jad=http://" + getTestServer() + "/installertest/httpauth/HelloWorld_http_auth.jad",
         };
         int result = Installer.mainWithResult(args);
         // Check result code.
@@ -637,7 +661,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/RedirectServlet/redirect?name=JBenchmark2.jad&count=6",
+            "-jad=http://" + getTestServer() + "/installertest/redirect?name=HelloWorld_redirect.jad&count=6",
         };
         int result = Installer.mainWithResult(args);
         // Check result code.
@@ -680,7 +704,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/omjserver/resources/omj/T00000900_JBenchmark2_8mb_gcf.jsp",
+            "-jad=http://" + getTestServer() + "/installertest/HelloWorld_8mb.jad",
         };
         Log.log("InstallerEngineTest.testDownloadJadCancel: installation starts");
         int result = Installer.mainWithResult(args);
@@ -1109,10 +1133,10 @@
     {
         Log.logOut("InstallerEngineTest.testInstallAuthAndBig begins");
         // Do first installation with doInstallUninstall helper
-        SuiteInfo suite = new SuiteInfo("DS_Snow_http_auth", "DS_Effects");
+        SuiteInfo suite = new SuiteInfo("HelloWorld_http_auth", "Nokia");
         iDefaultOptions.addElement("-username=guest");
         iDefaultOptions.addElement("-password=guest");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/httpauth/DS_Snow_http_auth.jad", true, iDefaultOptions);
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/httpauth/HelloWorld_http_auth.jad", true, iDefaultOptions);
 
         // Then start installation which downloads a large file.
         Log.log("InstallerEngineTest.testInstallAuthAndBig begin to install big app");
@@ -1120,7 +1144,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/omjserver/resources/omj/T00000900_JBenchmark2_8mb_gcf.jsp",
+            "-jad=http://" + getTestServer() + "/installertest/HelloWorld_8mb.jad",
         };
         int result = Installer.mainWithResult(args);
         // Check result code.
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/SifRegistratorTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/SifRegistratorTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -203,11 +203,23 @@
         {
             SuiteInfo si = getTestSuite();
             ComponentId cid = getComponentId(si.getGlobalId());
+
             // Check for USIF Phase 2 registration.
             Uid uid = sifReg.getUid(cid.getId());
             assertTrue("Suite uid " + si.getUid() + " does not match" +
                        " to uid " + uid + " from SCR",
                        si.getUid().equals(uid));
+
+            Uid appUid = PlatformUid.createUid("[e0001001]");
+            sifReg.startSession(false);
+            ComponentId cidForApp = sifReg.getComponentId(appUid);
+            sifReg.closeSession();
+            assertTrue("Null component id from SCR for application uid " +
+                       appUid, cidForApp != null);
+            assertTrue("Component id " + cid + " does not match" +
+                       " to uid " + cidForApp + " from SCR",
+                       cid.getId() == cidForApp.getId());
+
             // Check for USIF Phase 1 registration.
             //Vector apps = si.getApplications();
             //for (int i = 0; i < apps.size(); i++)
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -212,18 +212,18 @@
 
         String drive = (String)value.firstElement();
         assertTrue("PossibleInstallationDrives is null", (drive != null));
-        assertTrue("First PossibleInstallationDrive is not C:", drive.equals("C:"));
+        assertTrue("First PossibleInstallationDrive is not C:, it is " + drive, drive.equals("C:"));
         // second possible drive
         drive = (String)value.get(1);
         assertTrue("PossibleInstallationDrives is null", (drive != null));
-        assertTrue("Second PossibleInstallationDrive is not E:", drive.equals("E:"));
+        assertTrue("Second PossibleInstallationDrive is not E:, it is " + drive, drive.equals("E:"));
 
         value = cust.getIntegerProperty(CustomisationProperties.PossibleInstallationDrives);
         assertTrue("PossibleInstallationDrives value is null", (value != null));
         assertTrue("PossibleInstallationDrives value does not contain any integers", (value.size() > 0));
 
         Integer idrive = (Integer)value.get(1);
-        assertTrue("Second PossibleInstallationDrive is E:", idrive.intValue() == 4);
+        assertTrue("Second PossibleInstallationDrive is not E:, it is " + idrive, idrive.intValue() == 4);
     }
 
     public void testTypesOfPossibleInstallationDrives()
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/DownloaderTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/DownloaderTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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"
@@ -37,8 +37,8 @@
  */
 public class DownloaderTest extends TestCase implements InstallerMain
 {
-    private static final String TEST_URL = "http://195.134.231.83:7070/java-server/resources/DS_Snow.jar";
-    private static final int TEST_URL_SIZE = 10241; // test data file size
+    private static final String TEST_URL = "/installertest/HelloWorld.jar";
+    private static final int TEST_URL_SIZE = 1511; // test data file size
 
     // Begin j2meunit test framework setup
 
@@ -172,10 +172,15 @@
     public void testBasicDownload(Downloader downloader,
                                   TestDlListener listener)
     {
+        String server = System.getProperty(
+                            "com.nokia.mj.impl.installer.test.server");
+        assertNotNull("-server=<address>:<port> argument required.", server);
+
         try
         {
             String filename = "test.dat";
-            DownloadInfo dlInfo = new DownloadInfo(TEST_URL, filename);
+            DownloadInfo dlInfo = new DownloadInfo("http://" + server
+                                                   + TEST_URL, filename);
             downloader.start(dlInfo);
             downloader.waitForCompletion();
             assertTrue("Result DlInfo is null",
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPosterTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPosterTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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"
@@ -36,7 +36,7 @@
  */
 public class NotificationPosterTest extends TestCase implements InstallerMain
 {
-    private static final String TEST_URL = "http://195.134.231.83:7070/java-server/getresult.jsp?phone=CE0CBA106ADB77A9298A143E5136CD2B&tID=900_success";
+    private static final String TEST_URL = "/installertest/notify?tID=900_success";
 
     // Begin j2meunit test framework setup
 
@@ -361,13 +361,18 @@
         testNotifyPendingFailureLimit(poster);
     }
 
-    private static OtaStatusNotification createNotification(int aIndex)
+    private OtaStatusNotification createNotification(int aIndex)
     {
+        String server = System.getProperty(
+                            "com.nokia.mj.impl.installer.test.server");
+        assertNotNull("-server=<address>:<port> argument required.", server);
+
         OtaStatusNotification notification = new OtaStatusNotification
         (PlatformUid.createUid(Integer.toString(aIndex)),
          System.currentTimeMillis(),
          OtaStatusNotification.TYPE_INSTALL, OtaStatusCode.SUCCESS,
-         TEST_URL + aIndex, System.currentTimeMillis(), 0);
+         "http://" + server + TEST_URL + aIndex, System.currentTimeMillis(),
+         0);
         return notification;
     }
 
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java	Thu Jul 22 16:31:34 2010 +0100
@@ -167,6 +167,41 @@
             }
         }));
 
+        if (Platform.isS60())
+        {
+        suite.addTest(new SysUtilTest("testGetProcessState", new TestMethod()
+        {
+            public void run(TestCase tc)
+            {
+                ((SysUtilTest)tc).testGetProcessState();
+            }
+        }));
+
+        suite.addTest(new SysUtilTest("testDriveGetters", new TestMethod()
+        {
+            public void run(TestCase tc)
+            {
+                ((SysUtilTest)tc).testDriveGetters();
+            }
+        }));
+
+        suite.addTest(new SysUtilTest("testGetScreenSize", new TestMethod()
+        {
+            public void run(TestCase tc)
+            {
+                ((SysUtilTest)tc).testGetScreenSize();
+            }
+        }));
+
+        suite.addTest(new SysUtilTest("testIsoToLang", new TestMethod()
+        {
+            public void run(TestCase tc)
+            {
+                ((SysUtilTest)tc).testIsoToLang();
+            }
+        }));
+        }
+
         com.nokia.mj.impl.utils.OmjTestRunner.run(suite);
     }
 
@@ -198,11 +233,11 @@
     {
         try
         {
-            // Test PS keys defined in ScreensaverInternalPSKeys.h
-            Uid uid = PlatformUid.createUid("0x101F8771");  // KPSUidScreenSaver
-            int key = 0x00000001; // KScreenSaverPreviewMode
+            // Test PS keys defined in hwrmpowerstatesdkpskey.h
+            Uid uid = PlatformUid.createUid("0x10205041");  // KPSUidHWRMPowerState
+            int key = 0x00000003; // KHWRMChargingStatus
             int value = SysUtil.getPropertyValue(uid, key);
-            assertTrue("KScreenSaverPreviewMode(!=0): " + value, value == 0);
+            assertTrue("KHWRMChargingStatus(!=0): " + value, value == 0);
         }
         catch (InstallerException ie)
         {
@@ -215,8 +250,8 @@
     {
         try
         {
-            // Test PS keys defined in ScreensaverInternalPSKeys.h
-            Uid uid = PlatformUid.createUid("0x101F8771");  // KPSUidScreenSaver
+            // Test PS keys defined in hwrmpowerstatesdkpskey.h
+            Uid uid = PlatformUid.createUid("0x10205041");  // KPSUidHWRMPowerState
             int key = 0x00000010; // Undefined key
             int value = SysUtil.getPropertyValue(uid, key);
             assertTrue("Getting undefined property value did not fail", false);
@@ -573,4 +608,51 @@
             // OK, expected exception.
         }
     }
+
+    public void testGetProcessState()
+    {
+        int state = SysUtil.getProcessState(PlatformUid.createUid("[102033e6]"));
+        assertTrue("installer process state is " + state +
+                   ", not " + SysUtil.PROC_STATE_ALIVE,
+                   SysUtil.PROC_STATE_ALIVE == state);
+        state = SysUtil.getProcessState(PlatformUid.createUid("[e0001001]"));
+        assertTrue("nonexisting process state is " + state + ", not 0",
+                   0 == state);
+    }
+
+    public void testDriveGetters()
+    {
+        int defMem = SysUtil.getDefaultPhoneMemory();
+        int defMassStorage = SysUtil.getDefaultMassStorage();
+        Log.log("testDriveGetter: defaultPhoneMemory = " + defMem);
+        Log.log("testDriveGetter: defaultMassStorage = " + defMassStorage);
+    }
+
+    public void testGetScreenSize()
+    {
+        int screenWidth = SysUtil.getScreenWidth();
+        int screenHeight = SysUtil.getScreenHeight();
+        Log.log("testGetScreenSize: screenWidth = " + screenWidth);
+        Log.log("testGetScreenSize: screenHeight = " + screenHeight);
+        assertTrue("screenWidth <= 0", screenWidth > 0);
+        assertTrue("screenHeight <= 0", screenHeight > 0);
+    }
+
+    public void testIsoToLang()
+    {
+        testIsoToLang("unknown", -1); // unknown locale is indicated with -1
+        testIsoToLang("fi", 9); // ELangFinnish, Finnish
+        testIsoToLang("fi_FI", 9); // ELangFinnish, Finnish
+        testIsoToLang("sv", 6); // ELangSwedish, Swedish
+        testIsoToLang("sv_FI", 85); // ELangFinlandSwedish, Finland Swedish
+        testIsoToLang("en", 1); // ELangEnglish, UK English
+        testIsoToLang("en_US", 10); // ELangAmerican, American
+        testIsoToLang("en_AU", 20); // ELangAustralian, Australian English
+    }
+
+    private void testIsoToLang(String aLocale, int aLang)
+    {
+        assertTrue("SysUtil.isoToLang " + aLocale + " != " + aLang,
+                   SysUtil.isoToLang(aLocale) == aLang);
+    }
 }
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000019.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000046.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000058.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000070.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000090.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000150.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000172.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000175.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000182.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000189.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000250.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000305.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000390.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000500.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000582.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000618.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000703.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/3DSpaceShooter.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,18 @@
+
+MIDlet-1: 3DSpaceShooter, /icon.png, Sapce3D
+
+
+MIDlet-Jar-Size: 240229
+    
+	
+MIDlet-Jar-URL: 3DSpaceShooter.jar
+MIDlet-Name: 3DSpaceShooter
+MIDlet-Vendor: Innovative Ideas From Outer Space Ltd.
+
+
+
+
+	                 
+MIDlet-Version: 1.0.4
+Nokia-MIDlet-Original-Display-Size: 176,208
+Nokia-MIDlet-On-Screen-Keypad:	 	navigationkeys	    	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/800_x_N97_64GB_fr_speed_v5_32_01.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,99 @@
+RepositoryContentType: text/plain
+UserAgent: NokiaN95/J2ME-IMPS
+ShowStatusTextInCL: 0
+SpaceBetweenFriendsNameAndHisIcon: 3
+ShowDomain: 0
+MIDlet-Icon: /img/App.png
+NormalPollRate: 12000
+TCPCIREnabled: 1
+Images: http://download.ko.mysite.fr/koi/j2me/enc/1111/
+SpecialKeys: -12
+Host: koi.ko.mysite.fr
+TCPPingRate: 1560000
+EnableCommunitySelector: 1
+BackgoundImgPos: 0
+ScrollBarWidth: 5
+MIDlet-Vendor: Vodafone
+BillingURL: http://koi.ko.mysite.fr/koi/sq.dll/awo_buy
+UseTemplate: 1
+MaxFriendsNumber: 150
+StopTCPCIR: 1
+MIDlet-Version: 4.5.27
+SelectCommand: 1
+KeepAlive: 1500000
+SMSCIREnabled: 1
+MultiTrans: 5
+DefaultDomain: gmaeam1.com
+EnableBackgroundImage: 0
+MicroEdition-Profile: MIDP-2.0
+TermsAndConditions: 1
+SeamlessLogin: 0
+GlobalMsgLength: 600
+MIDlet-Push-1: sms://:3716, ui.Main, *
+RegisterConnection: 1
+ViewType: 0
+HTTPCIREnabled: 1
+IsTabFontBold: 1
+AboutNaming: PrerryLake_h_N97_fr_speed_v4_5_27
+InitMessage: 1
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-Jar-URL: 800€_x_N97_64GB_fr_speed_v5_32_01.jar
+AnimationRate: 300
+Multitask: 0
+EnableSemitransparentHighlight: 0
+CheckContentType: 1
+MaxMsgNumber: 30
+Port: 80
+LoginURL: http:/koi.ko.mysite.fr/koi/sq.dll/dsw_daas
+UseKeepAlive: 0
+MIDlet-Install-Notify: http://download.ko.mysite.fr/InstallNotify?c=
+SelfUpgrade: 1
+MIDlet-Data-Size: 500
+AnimationEnabled: 1
+TitleUpdateRate: 7000
+EnableRenameFriend: 0
+SystemMessageUserTimeout: 25000
+Help: http://download.ko.mysite.fr/koi/j2me/enc/help/fr/
+UseDeviceTimeForIncomingMsg: 1
+TCPCIRReconnectCount: 3
+DefaultLanguage: de
+MIDlet-1: Messenger,/img/App.png,ui.Main
+MsgListHeightTuner: 8
+MIDlet-Name: Messenger
+FontSize: 0
+WVExtension: /web/wv.dll/msn_imgw
+RefreshChoiceOnStateChange: 0
+MIDlet-Permissions: javax.microedition.io.Connector.http,javax.microedition.io.Connector.https,javax.microedition.io.Connector.socket,javax.microedition.io.Connector.sms,javax.wireless.messaging.sms.receive,javax.microedition.io.PushRegistry,javax.microedition.media.control.VideoControl.getSnapshot,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.file.write
+MaxConversations: 20
+SubscribePresence: 1
+PersistencyEnabled: 1
+RepositoryAlertMessage: Error loading application data. Please try again later.
+GlobalMaxCharCount: 5000
+EnableEmoticonsSelector: 1
+IdleMode: 1
+SpacerHeight: 5
+TCPCIRReconnectRate: 3000
+MIDlet-Jar-Size: 502719
+BackgroundEnabled: 1
+IsCaseInsensitive: 1
+AlertToneMsg: http://download.ko.mysite.fr/koi/j2me/enc/dingdong.mp3
+NormalNoPollTransition: 1800000
+AlertToneContact: http://download.ko.mysite.fr/koi/j2me/enc/alalal.mp3
+NoPollStateEnabled: 0
+Device: 3
+SupportCustomUTF8: 0
+MIDlet-Info-URL: www.koikoikoi.com
+MsgListWidthTuner: 15
+CommandsType: 1;4;2;4;3;8;5;4;6;2;8;2;9;7;10;4;11;8;23;4;24;3;37;2;68;2;69;7;76;4;80;2;86;6;87;1
+IdleModeTimeOut: 900000
+ShowAboutLogo: 1
+TopMarginFriendName: 2
+ContentLanguage: fr
+FastPollRate: 7000
+NokiaTimeOut: 100
+FastNormalTransition: 20000
+EnableShortProfile: 1
+RepositoryVersion: 1
+MIDlet-Jar-RSA-SHA1: QhSjP7F1q3TGmmNC45cUGclVWB537GtcMLpplIJGe+TyDwJ1Mx5VssNHpp3Qs3C1WHLycvcfOkDT0CscStI0lV/5Xy33z192qEHIT5lkGVz1Rd1nfBHqrIBqv77H7dHW1tdU6RiVajx8jrYYXz+Yh/7U2kskmGXd0bLSYq2cuZZgkiT9YDOLa8OJ1Xn2U4/AYzonM1tjGQvkOniCvwqv0DXDW3GAial5w7hzB4txSopBgWiCO7sEPgkssJIvWQ2dsuLnwb3nU8gsUYWuRqidSI5Dm8mSOEA0zjRoREjTJjkqRZXX3r27rtp+omYh+VNCkXDneiNcaihWpkW5TgMhVg==
+MIDlet-Certificate-1-1: MIIEOTCCAyGgAwIBAgILAQAAAAABFIeLkAEwCQYJKoZIhvcNAQEFBQAwUDELNAkGA1UEBhMCVVsxFzAVBgNVBAoIDlZvZGFmb25lIEdyb3VwMSgwJgYDVQQDEx9Wb2RhZm9uZSAoVHJ1c3RlZCBBcHBsaWNhdGlvbnMpMB4XDTA3MDgyMTA4MzA0NFoXDTEyMDgyMTA4MzA0NFowTzELMAkGA1UEBhMCU0cxFDASBgNVBAoTC05ldXN0YXIgTkdNMSowKAYDVQQDEyFNb2JpbGUgSW5zdGFudCBNZXNzYWdpbmcgMjEuMDguMDcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCFfdEngntebK38dtsdODIkNzMiYsngpTwgnDPqV23m/OtsCX1+1E3+ns9v7EPQVqeTuPYUbUiQRXAYE2NpnUjzNd4bKIXBlk18YpXftMxKv4XRvtVa273O/nbKigtR9IuJx2Pz/x/zWbDpc4ZitRQaRTHy0oA1W+htVI1BBzO8cFC3kf4DTNEXjeYHGF5U7deGp/KuN8qfN7QPJ5gtYyUcwYtrV9imc7P2idLFfYGejm7/s/R3qh9o3bIvqLSHUQbwTQNz7bA7QzpBYkSgaQqzif8+ZYRZuLApjbhpoM5XRFUwQCu6KXx7ZPMKoCKVjof20LWlilUiBrVIXMIwHq0tAgMBAAGjggETMIIBDzAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwUgYDVR0fBEswSTBHoEWgQ4ZBaHR0cDovL2NybC52b2RhZm9uZS1wa2kuY29tL2NybC52L1ZvZGFmb25lVHJ1c3RlZEFwcGxpY2F0aW9ucy5jcmwwOAYIKwYBBQUHAQEELDAqMCgGCCsGAQUFBzABhhxodHRwOi8vb2NzcC52b2RhZm9uZS1wa2kuY29tMBoGA1UdIAQTMBEwDwYNKoY6AAHv9U8BAQMBAzAfBgNVHSMEGDAWgBQ7En6Wl4emCf8AlmWvsw/TeSSR9DAdBgNVHQ4EFgQUadzkP7g69+F/NQGoOfvOG1PC6YowDQYJKoZIhvcNAQEFBQADggEBAK2Z4qE4EFlXYL3ELnsbV/Ri6igPgdXgSZalaw8IKorw19TX7ERpL2tCiyDqisEJygNLW2iok9Nn3DUsmJTr0CoSZFGZc88hkJ9mlDTCQnNa9Hx9XQhp3Ig0uo1Eoei+12kF9j1kVlQJl6QkOPrbdmBbGpv7NFTM29zkPN/4wt3uUvoLZ/ZlbB4NjufZ6gVL77Bt2+UNwKLM4wF39Dy3zTD6qcJPuitGGSss0X4SYX6AzTtNRM+CtTPkFby10pHmmr4ClSfGtOZnXmbGizOIUh/lgOgv/nG9Q+dRDUGDTkhnDwMs1b0reQ0rGE1jFayCJ6Rmn/03FIN5N1SKfgkSeBE=
+MIDlet-Certificate-1-2: MIIECjCCAvKgAwIBAgIFAwEAAzANBgkqhkiG9w0BAQUF8DBLMQswCQYDVQQGEwJVSzEXNBUGA1UEChMOVm9kYWXvbmUgR3JvdXAxIzAhBgNVBAMTGlZvZGFmb25lIChPcGVyYXRvciBEb21haW4pMB4XDTA1MDYxMzExMDAwMFoXDTIxMTIzMTEyMDAwMFowUDELMAkGA1UEBhMCVUsxFzAVBgNVBAoTDlZvZGFmb25lIEdyb3VwMSgwJgYDVQQDEx9Wb2RhZm9uZSAoVHJ1c3RlZCBBcHBsaWNhdGlvbnMpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvfev7oXJy+WKdRjmc2i+Y8vMI3ey/LggGtOhGhY7w1oH1puYttgAjwPP7Ff2qObaJyfFnX81aCopQWeymGzpJtcIv/Z5sZRayBw9ceNIqI7WrwS3Ht//4uqUIH0p6VtPuRukNAnJewbFGgImowwZI4sizQ5Idqxx14lUoOTw8EaE0ygwXSJefS1w/5vuShyujd22F3wHpQnjo/lf05y14x43Uf+PpfFoVzvKm8q/n4VMtzMwi04vkgPjkflT2yay8WWtEpxU6rw8j32EWM/A2+kd4YbTE50I9/XFmIitHajaPVB3piwsChSt4d89UyIP/a+xGkPMultznEdH23SptQIDAQABo4HwMIHtMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBQ7En6Wl4emCf8AlmWvsw/TeSSR9DAZBgNVHSAEEjAQMA4GDCqGOgAB7/VPAQEDATBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLnZvZGFmb25lLXBraS5jb20vY3JsLnYvVm9kYWZvbmVPcGVyYXRvckRvbWFpbi5jcmwwHQYDVR0lBBYwFAYIKwYBBQUHAwMGCCsGAQUFBwMJMB8GA1UdIwQYMBaAFEjdPe/gPJzfErEw/ZHhwen7l9wIMA0GCSqGSIb3DQEBBQUAA4IBAQCaehJEHzna6onjE8bCCsi7A5NxcQ2Cx85PYs67yxQZ0wMQq1khzxsOJPB7H4SoXlceNMvIxpgPFm/ZcLNdeyjoYOQccH+aS6GRSerYX3COdbtWA4Gjq/sB6ghoUZ74+VbXD3t9Rhrnt7fOMe1llWOcf/eoMmvOrJOrBPrC3ZxZEwyHAgyqEJDn2Z8KXTMUr41jge3KyhxRehflRcYhdXzwmE+8LOHaN7xLEZauOuafyBEVpjVN5UaaOm/v8mTn0TymV2j9R7D8Nycbz1gVeMrOhNW2GODxjvu5IoEHQh/myul28EecKGx05Xprcodr0a8Q6LKJg+ihJMxMrS3YEylp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,10 @@
+MIDlet-Jar-URL: https://uljava.gjmptw.de/midlets/harmonized/Local%20Connectivity%20(BT%20and%20IrDa)/BCExchanger/BCExchanger.jar
+MIDlet-Install-Notify: https://uljava.gjmptw.de/Index/Index.php/BCExchanger.jad?installed=BCExchanger_harmony
+MIDlet-1: BCExchangerMIDlet, /icon.png, bcexchanger.BCExchangerMIDlet
+MIDlet-Description: Demonstrates the usage of the JSR-82 Bluetooth OBEX API by exchanging business cards between devices.
+MIDlet-Jar-Size: 29967
+MIDlet-Name: BCExchanger
+MIDlet-Vendor: Forum Nokia
+MIDlet-Version: 1.0.0
+MicroEdition-Configuration: CLDC-1.1
+MicroEdition-Profile: MIDP-2.0
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/DevCertTestMIDlet.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,14 @@
+MIDlet-1: DevCertTestMIDlet, , com.nokia.midp.test.devcerttests.DevCertTestMIDlet
+MIDlet-Jar-Size: 3152
+MIDlet-Jar-URL: DevCertTestMIDlet.jar
+MIDlet-Name: DevCertTestMIDlet
+MIDlet-Permissions: javax.microedition.pim.ContactList.read,javax.microedition.pim.ContactList.write,javax.microedition.io.Connector.http
+MIDlet-Permissions-Opt: javax.microedition.io.Connector.https
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+httpUrl: http://www.google.com
+httpsUrl: https://www.google.com
+MIDlet-Certificate-1-1: MIJs7jCCbFegAwIBAgIJAPNUaScSr5cxMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9EZXZpY2VfTWFudWZhY3R1cmVyMB4XDTA5MDkxNjExNDk1M1oXDTEwMDkxNjExNDk1M1owNTELMAkGA1UEBhMCRkkxEDAOBgNVBAcTB1RhbXBlcmUxFDASBgNVBAMTC0phdmFEZXZDZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXZ/GCV/N8foAkCQJfoiwGlwHO+f1lV9zloo0r0zosGtVqItLXKrvXEKylpOVWBygRVVrkl30Y1Cxess4aS1UmZ1rcvwL0jcvwlkZGacJazjtHE4UQuYJz9WRbYOaQxR2SVS/wU2Ptu/mr0ZgqFhgaJ1FzCuBdNaWzx2mGV9az/QIDAQABo4JqxjCCasIwKQYDVR0gBCIwIDAOBgwrBgEEAV4BMQEBAwQwDgYMKwYBBAEqAm4CAgICMA4GA1UdDwEB/wQEAwIHgDAXBgNVHSUEEDAOBgwrBgEEAV4BMQECAgMwgmpqBgwrBgEEAV4BMQECAgcBAf8EgmpVMIJqUQwPMDA0NDAxMDE1MDc2OTU5DA8xNDM3MjU3ODc0MDc3MzAMDzAwNDQwMTEwNDIzNjk4NQwPODUxODA4MzAxNzgwMzcwDA84MzYwMTU2MDMxNDY4MjgMDzM2ODYxNzM4NzAzNzM4MAwPNzY2NjI2NTYyMDM3MzI4DA84NjgwMjIwNjUxODczMTgMDzQ3NTEzNTQ0MzEwMzQwNAwPNDY0NTI4NzEzODY1MDY1DA84NjEyMTU3NzIwMDczODUMDzQwNzQ3NTAzMTI1NjYxOAwPNzQxMDY1MDUxNDE1ODI2DA81MzI1MTM4NTc4MzM1NTMMDzA4ODQ1NDM0Mjg4ODg2NQwPMTY1MTEwMDA3ODE1NTE2DA83NzYwMTU4NDUzNDgyODgMDzIyNTUzNTY4NjA4ODYwNQwPNDUzNTUyMTc2Mzc2MjcyDA8zNTAwNTM1MjQxMzMyMDYMDzg4NzU3ODg4NzM2MTM0NwwPNzgxODA1MjY0ODE0MzQyDA8yNTM4ODg2NzUzNzUxMjgMDzMyODczMzE2Nzc1MDg1OAwPMjA2Mzg1NDYyMTM4MjUyDA82NTA1NTIwNDcyMjIzNDMMDzA2MjQ4NzM2NTAxMzMyNgwPMzM4NjAxODY2NTcwMzcwDA8yNzcwMTgyMTEyODYzMzYMDzA3MDE2MzQ1MzQ3MzExMwwPMDM3MDI1ODcxMzE3ODc3DA81MjMyNDMzODgyMDA0NDIMDzg1NTcwODIzMzAyNjQzMQwPNTQzNDU4MzEzMzc1ODI1DA80MDgwMzUwNTQxODIxNzcMDzcxNjYyMjEzMzMzMjEzNAwPMTAzNzY1NTEwNDcwODQ3DA80NjAxNzgwODEwMTQ0NjYMDzMxMDYxMTQzNzY2NDUyMAwPMDQwMjM1MTMxMDE3NjI0DA8xNTIyMzUzNjA1MDg1NDQMDzc1NjU3Mjc2NDI1ODE3NQwPNjcwNjcyMTIyMzAzMjU3DA83NzUyNjU0NzQ3MjgwMjMMDzQyMTgwMzg1MjE0MjE2NQwPODE0MTcxODU0NjQ4MjcyDA80Mzg2MTIwNDczMDY2MzUMDzY2ODA4ODQ1MjM3NDAxNAwPMjMwMDgyNjEzNDYzNTM2DA8yODA4MTYyMjMyMTExMTYMDzc4MjM3MzE2NzgwMTgwMwwPMDYyNjU3NTgwODMxODMxDA82NzI0Njg2NDc0NTUwNTYMDzgyNTUyODAzMjY0NzQ0MwwPNDU2MzAxNTA4NzEwMDMzDA8xODgzMTg4MjAzNjI0NTcMDzQ4NDM3NjExMDUzNDQyMgwPMjMyMzU0MTQzNDE1NTU4DA84NDc2NzAxNzc3MDI0MTAMDzc4NDIzMTY3MDE3NDY1NQwPNDc2Nzg0NDI1MDE1MTMyDA81MTEzMTU3ODA1NjcxNDMMDzA1MDUxNjgyNDg1Mzc3NQwPNDUxNTA1NjA0MTE3NjQ3DA8wNzc3MzU0MTc0NzcwNzcMDzQ4ODQ3NzYzNTE3MTU1NgwPMTQ4NjM0MzM1MDgzNTgzDA8yMjMxMzE0NzI1Mzc0NzcMDzY1ODQ4ODQ2NzI0MjA1NQwPMzYwMTU2NDYwODU1ODM1DA8zNDc1MTczMjM2NDMwNDYMDzMwNTE3MDA0NDQyNjQ4MQwPMDg4NzMzMjAyMzUzNzQwDA8zNDY2NzY1MjY4MDA1MDMMDzUwODQ1MDEwNjM3MzY1NgwPMjAxNzM2NzEyMDUwNDg3DA80MDMwMDg1ODMwMzE1NTIMDzM4NTUyMDQ2ODA2ODAxMgwPNzIwNDc3Njc4NjM2NDg3DA84MTM4MTc1NDQzNTY3MzAMDzgyNzIyMzc3MzY1NTEzNQwPNjQ3MDEwNTUyMDA3ODY2DA8xODAzMjExMTg4ODY2NzIMDzc0MjEzMzg4MzgxNDIzNQwPNTc1MzU1NzQ4NTMwODgwDA8zMTAzNzAxMTY1NDcyNDMMDzQ0NDQ4NTU1Mzg0NTE3NQwPNzQzNzc1NzA4MjM2NDM3DA8yMzc1MjQxNTg3MTUxMTMMDzI3NzQwNTUzMDE2MzAyMAwPMTgyMzA3MTU2Mzg3MzM2DA8xMDMwMzA2NjIyNjA0NzAMDzE0MTYyMTU3MDI1MzI0NAwPNDY0MDcyMjc2NjQ1ODM3DA80NTUxNzc3NDczMDQ1NTcMDzI2NzYwODgyNjY3ODY0NgwPMzQwNjM1NjMyNTc3NDg0DA8wMTUxNzcwMzI2NjM4MDUMDzgwNzI2ODcwNzY3NjQwNQwPMjA1NzQ2NTE1NTQzMDIzDA82NDU3MzA4MTUxNjcwMzUMDzAzNDEzNjM0Mjc3NTAxNwwPNTc4ODAyODAyNDYzMzYyDA84NDA1MDUzMjE4MjM2MjcMDzA3NzEyNzYxMTEyNjUyNgwPMDE4NzU0NDgwMDM3NDM4DA8wMjEyNTgwNzAzNDE1NzgMDzg2MzAyNjcxNDcwMDYyNAwPMDU2NjQ0MjQ2NjA1MTEzDA8xMjIyMDMxNTcwNTg2MjEMDzgxMDY3NjQ2MjU0MDU1MwwPMTUxMzM1NzUyNTI3NDc0DA8wNjA3MzQyODg0MTgzNTQMDzEyNzYxMjI2NjE0MjUxMAwPODY2MTI0NDU3NzE2NDQxDA8zNDAwNjI0ODY3ODE2NjYMDzA1NzcyMjMwNTE4MzQ4MgwPODMzMzU2NTI3NDI3ODc2DA8zMTA2MjI0NjI0MTM0MzQMDzQ3NDYwODY1MzEyNjA2NAwPMDQzMzIyNzg1MDgxNzM2DA8zNzY0MTAzNzcyODQ2NTIMDzYxNDg3MzQxNDY4MTA3NQwPNjM2NDc1NTgzMDgxNTE4DA8zNzIzODAxMjgzNDAwMzUMDzcxMzEwNzAyNzIwNDcwMQwPNTU2MDA4MTY1MDg4MDMzDA83MjQ4MzQ4MTgyNjY2NTcMDzA2ODA2MTMwNDcyMzg0NgwPMTMzMzY1MjMwODQ1MDUyDA81NDQ2MDI1NjQzNzU0MjgMDzQ4MTM0ODQ3ODAwMjEwMAwPNDExMzA0MTUzMDA0NjcyDA83NTYyMzUxNzc3MDEzNTAMDzIwMTI3NTg3ODMzMTc0NwwPNTg2MTQ4NTYyMzM2NjgzDA84MDQ3Mzc1MjM0NTgzMjYMDzMyODYxNjI3NzQwMjAwOAwPNjU1ODMwNTExNTEwNTA4DA8wNDgwMDc1Nzg2NzIyODUMDzM1ODM2MTM4NDEyMDcwNQwPNTg1MzA2NzU1MjUwMDI3DA81MDU3NjQ3MjQ2MTExNjcMDzQ2NjU2MTc0NTMxMDU3NAwPNDU1MTUwMjI4NjQ3MTc3DA8yNDM1NDY0NTY1MDI4MzAMDzUyMDI4NjUzNDE0MTQ0MQwPMTUzNDA4MDc0NzAzMDE0DA81NjUwNjE1MTEwMjM2MTAMDzQ4MDExNDMwNzIwMTc1MwwPMjQ1Mjc2ODc3MTg3ODY2DA80MDY3MDgxMjM1NzExODQMDzQxMzU2MTA4NTY2MTAxNgwPNDIyMjI2NjEwMDcyMzgwDA8yMTEwNDE3MjU1MjM2MzYMDzU3ODM1NDE2MjQ3MzIzMwwPMDU4MTExMDQ3NzQxMjEwDA82NDUyMTAyMDAxNzI2NDgMDzA0MzEzMTc1MDE0NDA4MgwPODc3NTIxODg2NjE3NzU4DA80NjYxNTgyNTA2MTUzNjgMDzg3NTY4MzA4NjE2MjExMQwPMDQ4NjQzNjM1NzEwODUwDA8wNzg1NzY2NTYzODE4MzUMDzE4NTQzNTU4NTE3MjU3NAwPNDMxNjYxMjc4NTUwNDU0DA8yNTgwNzQ4NjU3MjM1MzAMDzM0MDc4ODYzODA2NzQ2NQwPNjE4NDIzNjMwMTM0NzczDA8yNjgwODQyNzQ0NzAzMjAMDzI4MDgxNDMxMjA2NzM1NQwPNDEyNjUxMTA4MzAxMTYzDA80NTE4ODIxODc4NTcyMjAMDzQ3NTYwODc2ODE0NzY2NgwPMDU3MDAzMjcxMTUyODI3DA8yNjAwMDYzODg2MjExNjYMDzM1MDg3NDQxMDUyMTMwOAwPODM1MDAwMzUzNTcxMTQwDA81MTU3MjAzMDYxMjg3NTYMDzA1ODgzNzY0ODQwNDg1NQwPNDA4NDg2NjQ0NDMzNDM2DA82NTg0ODM0MTIxMjM2NzcMDzU4ODA0NzA1NTM0MDYzOAwPNTA3NDMzMTMwMDY3MDY1DA8yNjQwNjcxNzc3NDc4NTgMDzQ4NTEwMTM4MTY1NjE1MAwPMzEwNzYzMzY2MjIxNDU1DA83NzIzMjMyMTEyMTQyMjQMDzU0ODg4MTU0Mzg4MTY0NwwPNDc2NTYyNTE3NzIzMTE2DA8wMTAwMTQ0NjEyODE4MDYMDzUwNzM1NzA3MDM4MDUyNwwPNTg3NDQ3ODIyMTExNTA2DA81MzY2NTExMjI2ODc0NzIMDzIxNDc0NTAwNjU0NTcyOAwPMjg2MTY2NzUxMTA2MzA4DA8xNjg3NzA1NDQ1MTIyMTcMDzM1MjU3MzcwMzQxMzU0MwwPMzAxNDEwODc4NDI2MjE1DA8zNDY2ODQxODUwNjgxMjMMDzUzMzA2NTMyMzEzNjI0NQwPNjA1MDE3ODUyNzU1NDM1DA80NzcxMzg3NTc0MjM2NjgMDzY2NzA4Mjc1NDUwNTUyMgwPODczMjQ1MTM4MTAwNDAwDA81NTc1MDI0ODczMjQ1NzEMDzI1MTEwNDAzMTcyNjI1NAwPNjI4MTA0NTEyMTU0MDAxDA80NzQzMDM1MTExMjI1NDUMDzQ4NDY4ODc1MDg2MTI4MgwPNTMxNjY0ODAxMjA3NjY0DA80NDc3NjA0MDUzMjM1NDcMDzgxODA2NjQ0MjgyMzQxMQwPNDg0NzQ1NzUzNTcxNTAyDA83MDM1NDE4Mjg3NjUwNzgMDzA0NDAwODczMTEyNTY0NAwPNTM0NTAzNjE4NTA3MDczDA83MDQ0NzE4NTE4MzQ1NDYMDzM0ODEwNjMzMTUyMDg0MgwPNzY0MDY3NTYyMjM1MjA0DA80NzQwMzEyNTI1ODE3NDUMDzU2NzQzNzQ4MzY2MjQ0NgwPNTIyNzM0NTg4MTY2NjE4DA8zNDU1NTQ0NzA0ODgwMjIMDzAzMjMzMjAyMzYyNjQzMAwPNjUwMDg0NDc1NTU1ODYyDA82ODE0ODA1NTM3NzM0NzcMDzM0NzMyMDI1NjE3NDg3MgwPMTA0NTIxNjY2Njg2NjI4DA81Njc2NDg1MTM3MjMzNzMMDzU4NzUxNzg4NDA2MzAzNAwPMjI1NTI3MDAxMTYyNDU1DA8zNTc2MjQzNDc1Nzc0NTAMDzY3NjQyNjQzODc2NzI0MAwPNDg2ODM0MTAwODA4NzU3DA8xNTg1NjY0NDM3MDA2ODUMDzY0NDY2ODE4MDU0NzY0MwwPMDQyMzU3MTQ3MTgyNjY0DA80NTA3NTQzODQyMzA2MzEMDzA1ODA3Mjc4MjIyODI4MwwPNTY1NjE1NjEwMzQxNzYwDA84NzIzNzIyODc0ODIzNTIMDzYzMDE2NzY0ODE1Njg4NgwPNjEwNDAzMzg2MDUzMTY4DA8zODA1ODQyMTE0ODEwNjUMDzExMzg0NTM0NDY3MjI1NgwPMjY2NDY1MzEzNTUzMjg4DA80MDExNTc2NzMyODAyMDcMDzc2NzI3NTQ2NjM0MzA3MgwPNDczMjY2NDY3MTU3NjA3DA8wMjY2NTQ2MzA1MzEyMjUMDzYxMzU2NjgxNjExMzg0MgwPNzE1MTE2MjE2NDI1NzcxDA8wMjY4MzcyMTQ2MDMyMzMMDzE2NjM2MzY1MzE3ODUwNAwPNjgyNDAwNjExMzQ0NTM3DA80MDE3NDM0MzMwNDI1NDYMDzY0MDc0MDMyNDg4MDgzNQwPNDU2MTQ0ODM1MTg2MTYyDA8xODI0NTYyNjI0NTcwMjQMDzQwMzEzNjc4ODY1NzI0NgwPNzUyMjE3NjI3NTQxMTIxDA8zMTcyMTQxNTgyMTYxMzgMDzM2MDI3ODA3MjA3MTA0OAwPMDU4MjA4MDgzMjg4NzIwDA80MTgxNDgwMDUyNzc2NTgMDzM0MTg1ODQyMjgwODYzNwwPNTU1MzIxMDI3MjMyNTE3DA83MjYyNjY3NTQ2Mjc2MzUMDzQwODc2NTg0NDExMzQ1NAwPMzAzMzc2ODIyODg0MTc4DA80MDE3MDI0NTMyMDYyNzQMDzIxMTcwNDc2NTE3MTIzNAwPMTg0NzEwMDY3NzgyMjAzDA8yNjIwMDAyMDQ1MjI1NjQMDzg4NDI0Nzg4NDI3Mzg4MAwPMTIzODAyMTI0Njc1NDA4DA8zMTczMDYyMjY4ODIwODQMDzQxMzc2NzQ4MzEyMjQ2MwwPMjc3MDU0NDI0MDQ3MzgyDA8xMTYwODA4NzU2NjE0NzEMDzE2MzY3MTIzNzg4NzIyMwwPODc0ODI1NjYxMTczNTU2DA80MjU1MTg0NjA2NTI2NzIMDzA1NzMyNzU0NTgxNTE2MAwPNDIwMzU0MzA3MzI2MzQwDA83NjQzMjYxMTc0MTQxMzcMDzQxNDEzODIyNzQ1MTc3OAwPNDE0MjE4MjQ3MzI4NzEzDA81NTAwNzE0MjIyMTE1MTAMDzE2MjcxODUwNzQ1NjYyMQwPNzE0NDc3MjI4MjAzMzE0DA80NzgwODAwMDAwNTg0MzcMDzI1NjQ4MTY1ODQzMzQ0MAwPNjYyODU0MzU2NjY4MzQ1DA8yNDE2ODY2NzY1NzI1NzgMDzUwMzIxNDE1MDU1MTU1MgwPNjAwNDU0MTI1MDU4MTc3DA83MjYxNjQ2NzY3MjMyMTgMDzUyNjMxMDMwMjMyNDA4MgwPNjgwNTEwMzE1NzI3ODgyDA80MjY4NzgzODE1MTcxMjgMDzQ3MzQ3NzI2MzM1NjAyNwwPNDgxODE4MDg3NTMxNjE4DA82NTIzMTY3NjY1MDg1MzIMDzM0NjgxNTI1NTcxNjc4MgwPNTcyNTY1ODQ4ODM2MzA2DA81MzMzNjQ3MzAyNjM3MzcMDzAwNTI1MjQ2ODEyODA2MAwPNzYxODIzNjM0NjA2NTQ0DA8yMDY4NDA1MzQ1MDE2MjUMDzgyNjg3MDExMTA4NzQ1MAwPNzcwNjUzNDE4MjE3NDU4DA83NjM0MzY4MTI4NDg3MjgMDzA2MjYzMjQyNjM1NTI0MAwPNTUzMDY1MzQ2NTU0MjQ2DA8zMDE3NjQyMjQ3MzA2MDEMDzM3MTUxMTM2MjQxMjA3MwwPMDgyMDg3MTc0MDA2NjA4DA8zMTg1NzQwNjA4NjA1MTgMDzQ4MjQ1MjIxMTUwNzIxMQwPNTQwNTAwNTQ2NzcyMDI2DA8xNjczNTAwMDQ2NzAzNDYMDzQzNTExMzIyMjE2NTExNgwPNjY3ODMzMTY0MTM0MTYwDA81MTI2MzYxNDEyNjIyNjcMDzcxMjA2ODA3NzUyMzMzNQwPNjY4MDMxMDc1MzU1NzU2DA82NTM3ODgxMzI1MDUxNjgMDzg2NjIyNTgxNzI3ODMzNgwPMjg2NTg3NDc2NjM0NzMzDA80NTQ2MTQ0MzU2MzY2NjIMDzQxMzU3ODEzMjMyNzgyMAwPNjMxMzQ1MzA2Nzc1NTQ0DA81ODA0NDczNDUzMjgzNTgMDzY1NTI1NTU4NzYxMzQ4NwwPMjUwMjAzODUyMTM3Mjg0DA81Mjg3NDYzNjg1MjAwNDgMDzIxNjE1NzQzODM0ODA3NgwPMjEzMzAzMTE1MzEwNzM0DA8zNzUwNzg0NDgwNDcwODAMDzM3Nzc1MTE3MzExMDc3NQwPODE0MDAyNjIxMjIyNDUyDA81NzY0MzM2NjAyNjMyNTAMDzIzNDAyMTI0MDExODA1NgwPODg3NjE1Nzg3NzEyMTAzDA84NTUzNTYxODA3NDE2NjgMDzc3NjA4NzgwNzgyMjE3MwwPNjU3MTg1NjcxMjIwMTI4DA8wNTU2NDAyNTQ4NzU3MTEMDzcyMDMyMDE0MjI3NjU1MAwPNjE2NTgzMDcxODIyNTc0DA81MTEwNDQ0MzEwNjg0MTAMDzgzMDg1NTM2MTAwMTQ1NwwPODAwMjA0NDAzMzAxMDI2DA8wNDM0NjIxNjg3NTE3NzUMDzI2MjYyMTc4NzgxNjQzMgwPNTc1NTU1MTQ2MTIwODY4DA8zNDEzODI1MTYwMjI0MzUMDzE2NTgzNzE2NDM2ODAyMgwPNzY3Njg0NzI2MTE3NDA1DA8yNjM1MzU4NDExNTEzNzAMDzAyMzAyMDE3NjM4MTI2NwwPNTg1MTI2MjgyMzgwMDQ3DA81MzgxNDI2MTgyMDM2MzQMDzczNDM1NjA1NTEwODIwNwwPNjA2NTA3MzE1MTE2NjE3DA8xMTgyMjA2MzYxNjEzODUMDzQ2NjY4MjE1NzIzNjg4MQwPNDUwNTc3MzI0Nzc4NzQ3DA80NjE1MzAwNTIxMDAzMjUMDzM1MTc4NjY1MzQ2NTYyOAwPNjIwMDE0NDM4NzMzNTM0DA8yODQ1MjA2NTE4NjM3MjAMDzUwODA1NTQwMzM3MDEzMgwPMzIzMjI2NzM3NzY4MTY1DA8wMTQyNDcyMTM2NDA0ODEMDzI0MDYxNzgzMDc4MjU3NQwPNDc2Mzc2NTY4NTQ4MDcwDA8yMzY4MzI4ODMwMTYzMDcMDzIzODYzODI3NjIzNzA2OAwPNTA3NzYxNDc1NDQ4MzUwDA83MjgxMDAwMzAzNzY3NzgMDzU2NjMxNDU3MDU1NTA2MAwPODY4NzExNjIzMTc0MzMwDA84MTQxMDgxNzU2NTI3MjMMDzIyMTc0MjQzMjY1NzM2MQwPNjA3NjgxMzYxNTgxMDU1DA83MzMwMDE0MDE2NzQ4MzgMDzY0MDQwMDUwMzA2MjI1NwwPMTI3NDI0MjQ0NTc4MzMwDA8xMDcwNjM1MTc3NzIwMjUMDzQ1MDUyODE3MzU1Mzg4NwwPNzE1NTExNDYyMDE2NzczDA8zNjQ4NzcxMzAzODExMjgMDzEzNDAwMTQ3MDI0MTE2MAwPODAzNjQ2NTE1NTIzMTUwDA8wODcxNDI3ODc1MTA3NjAMDzM0MjI3ODcxMjM3MjEwNgwPMzc0MDA3ODMwNjcxNzU2DA83NDY1MzE1MDAzMDU4NjcMDzEyNjM2MjQ4MzUzMzA1OAwPMjMzMjIwMDI3MTE1NTE1DA80MTQzNjMwMzc3NzA1NjYMDzM1NTE1MjEyNDAwMDg2MgwPODQwNzczNDU1Nzg1MTgwDA80NTc2NDQyMDExMjIzNDYMDzEzMzg3ODMyMjgyODU4MQwPNzM0NDQ3NTMyNTAzNTIwDA8zMTAwNDQyODYyNzczMTEMDzI4MTY3MDY2MTIyMzE0OAwPNTAyMDI2ODE1NzE4NDI3DA8wMzA3Njg1ODE1ODI2NDEMDzI4MjQ4MDYxNDU1NzMxMwwPNDU3Njc0NTU0MzI0NDA1DA84MTc0MTc2ODI4NTcwODEMDzMwNDE0ODI1MjEyMDY2NQwPNTEzMzExNDMzNzA1Njc2DA83NzUzNDI0Njg0MTI3ODEMDzM0NzgyNTczODc3NzA0OAwPNzIzODQ3NDYzMDQwNTI4DA8zNTI0MzA3MDc2MDYxNTIMDzc3ODgzNDU4MTI0NzQxMQwPMzQwNjIyMjMxMDg1MjM4DA83MzQyODIwMzU1NjA4MjEMDzgxMzgxMjY2NTI4NzQwMQwPMjI4MDI4NTExODUwMzI1DA8yNzgwNzE0ODE4MDIzODAMDzM4ODg0NTU0NTcwMzIzMgwPMDgwMDE0MzUxNDM1NTEzDA8wNzQzODUxNjcwNTUwMDcMDzQ2MzQxODM0MTUyNzAwMgwPODAzMDcyMTM2NDI0ODg3DA80NjAxMjMwNjgzNTIyMTcMDzMxNzAwNjU1MDE0Njg1MwwPMTcwMzIyODAxMTY2NTgwDA83MTM2NDU4MjI2Mjg4ODMMDzA3NTA0ODc2NzgyNjg3OAwPMDQ2MjA2ODYyNDY4NTgzDA8wMjc3ODM2MjgzMzgyNDYMDzIzMTY3MjA0NzAzNjc1NQwPMTUzMzIxMTQ1MzAwODQwDA83MTIyNTMyODQyNTExNTMMDzYzMDMyNjcyMjU3MzQzNwwPNzY0MTIwMjEyNTc2NzUwDA82MzUyMjczNzYxMTU2ODYMDzI3NDc2NDYzMzc3MTcyMAwPMzM0ODIzMjM0NTY2MjE4DA8yODYwNTg1NDAyNzM4NjQMDzA3NTg2MDMxODE3ODIyNgwPMTE3MzY3MzIzNTg0NjgwDA80MjI2ODg0MDc2NTE0MjQMDzQyODgxNjA2MjE0MzI0NQwPNjEyMDY3NTU1NzUxMjMzDA8yMTcyODM3MDg4NDY4NDYMDzc4MzgwMDI2NzcyMzE0MwwPNTc3NzY1MTI2MDI3ODU2DA8wODAwMDM3ODIzMjA3MDcMDzM3MzM3NTA1MzY1MDQzMAwPMzg1MjI0MDY0MDU3MzUzDA84ODQ4MjMxMzg0MDA4NzAMDzA3NzQ0NjYwNDEwMjMwNgwPNzM4MjgwMjM1NzYxNjg4DA83NzM2ODAxODU1NjIzMzMMDzU3MDY1MjYwMDQyNTMzMQwPMjQyNjQxNTcwMjg3MTMwDA8wNTc0NjczNDc3NDc1NjUMDzczODIzNjU3MzgwNDU0MAwPMDU1MzIxMzE3ODgzNDgzDA8zNTEzMjc1MDMwMzQwNDYMDzA2MjMxNTQ4NjY3NzI1NwwPMDc0MDEwNDMwMTI2MTY0DA83MDQ4MDE1NDI1ODI1NDQMDzE2Mjc3MjQyNTg2MTgzOAwPNTY4ODgyNzI1NzY3MTcxDA8wNzgyNTQ1NDE2NDM2NDYMDzY3MzE3NzI3ODM4MTgyNwwPNzEwNzU0Mzg0Mzg3MDg1DA8yMzEyNjg1NjA0NzIzNTYMDzIzMDYyNjgzODQxNTg2OAwPODcxMjIyMzI4MDY4NTQwDA80NTg3ODUxMTIyMzY4MjAMDzQxMjQyMzYyNTE1MDYyMAwPMjUwODUzNzExMjAzNDQ3DA82MDExNTcwMzg3NzUzMjcMDzM2NTQ2NDM3MjE2Nzg4NAwPMTU2MjAyMDgyMjQyMTQzDA84MjYwMDQwMzc3NTcyODAMDzIxNTQ1MDIzMjA4NjE1NAwPNTY3MDE4NTI3MDc2NjI1DA8yNDUyMjc0NjUxNjYzMDQMDzc4ODI4MTAyMDQ0MDQ1MQwPNDc2ODQ3MDI4ODg0MTYwDA83NzE0NDY1MjY1NTA3MzUMDzc1NDIyMzg1NTYzNjAxNwwPMTQ0NjE1NTA4MzQwMjA4DA83MjcxNjUwODMwNzgwMDUMDzEyNjQ1MzIyMjMwNjY3NwwPMjU3NTExNzY3ODQwMjgwDA8yNTg4MTA3MzYzNTAwNjAMDzE1Mjg1MjM0ODcxNjU0MgwPMzE0NDE1NzcyODc1NzA0DA83NjE3NzU3MDUwNjg4MzgMDzA0MzU2NzE4NjI0ODI4OAwPMDMzNTc0MjI3NzE3Mzc0DA81MDIyMDY4NjM1NTY0MzcMDzgxODM3ODMzNzE2NDQzMwwPMzExNDI4ODQyNTQxNDEwDA83ODYxNzQyNTE0MDc1NDMMDzM1NDg2ODQxNTAwNzQyNAwPNzg4Njg0Njc4Nzc4NTc0DA8wODc3MjAyMDUyMjA2NzQMDzIzNzQyMTcxODA2NTU2NAwPNjQzNjIwNzU1Mjc0MzM1DA81MTg0MDMyMDY0NzIxNzgMDzA1NzIzMzQ3MjUwNDQyNQwPNTgxMzI2NDY1MjY3NjYxDA8yNzc3ODM1NzM1MDc3NTUMDzg4NTAwMjA0ODc3MDAxMAwPNDczNzIzNjcxMjgzMzE3DA8yMTQzMTgxMjcwODE4MTAMDzA4NDU2ODg2NTAwMjcxMAwPNDc2NjE1MTg4NjAzNjMxDA83MDcwMDcxNzQ1ODM3MTAMDzYxMTUyNjcwMTEzNzEwMwwPMjEyMTczNzM1MDI3ODA2DA8wODgyMzgzMzEzMjA1NDUMDzU1NjEzODEyMjYyNjU4NgwPNTU4NDQyNzQ1ODI4NDI4DA8wNDQwMDIxNDUzMTAwNDMMDzU4MjQ1NzM0Mzc3MTY0NgwPMDg3NTM3NTY4NTMyNTQ4DA81MDI0NjU3NjA4ODg0NDcMDzE1MTUwMzYyMjE2NjM4NwwPMzQ0NzQxMjI2NDU3MTIyDA8yODIzMDU3ODI0NjY2MzQMDzYyNDMwNjE1NTAxMTU2MAwPMzA2NTE2NDUyNjI3NzUyDA81NDMxODc4MTg0Mjc1NDgMDzQwMTE4NzA2NTgxMDcxMgwPODc4MTgzNjE3NDUyMDE3DA8xNTI0NzgzMjY3NjUyNTUMDzEwNDIzNjgyMDY3NzEyMgwPMjM2MDM4MDczNTU3ODU1DA84NjAwMDI2NTczODQ1MzcMDzcxMjQ2NjAzMzAxMzI0NgwPNjU4NDcyMzM0NzgyNDUyDA82Mzg3ODY0MjMzMzg1NDIMDzUyODA4NzA0NjYxNzQxNAwPMjM4NjMwMTM2NzY1ODczDA80NjM1NTc0MTM2Nzg1MjUMDzAxMTQzODU3NzQxMTUxMgwPODYwNzQwMTg0Mjg0MDc1DA8xNzQyNTgzMDEwMzU0MDMMDzc0NzYyNjI3NDg2MzA2MwwPMTcxMDY2NTMwNTg1NjEzDA8zMDYyNDU0MTcwMzUyNDUMDzQ2ODUwMTA2MjEwNzUxNwwPODQ3Mzc1NjUxNzcwNTMxDA8zMDM2NjM3MzY4MzAxNjYMDzc3MDQ2MjY0MTMwNzg4MAwPMDcxNTUxNTMxNDYzMzIwDA81NzAxNTgyMjMyODcwMzgMDzE4NzA4NDUyNTUyNjM4MAwPMjY2NTE1MzAxODgzNTc2DA8yNDc2ODY4NjcxMzYzNjEMDzcxODM2ODAyMTIzNjQwMAwPMDIyNzUzMjcwMDAyODg1DA82MDMxMTgxNjA2NzY2ODQMDzY1Nzg2Njc1NDU2NTM2OAwPMDgyMjE1MjQyMDcyMzEwDA8wMDYwMDM1NDQyMDA1MzcMDzMwNzU2NTUxMzEzNzYxMAwPNTY0MjIyMTA3MjI1MzE1DA82ODQyODIxODg0NTYzNzIMDzQ4NzY1MDYwMTQ4NDMwMAwPNTU4MDYyMjgwMzE4NzQ1DA82NDM0ODMzNjE0NjI0MzIMDzY4MTY4MDExODUwNzg2NAwPMjU3MDMwMjQxNTA0ODY4DA82ODg0MDQ2NDU0NDEyMjMMDzMyMjQ4ODIyMzI1MTA1NAwPMTQ1MzcxODMyMDUxMDQ0DA8yNjQ2MDYzMDMzNjAxMDEMDzg4NDgyMzQ0ODM0ODgwNAwPMTQxMzgzODEyNDU0NTIwDA8wNjA2MTU3NzUwNTM2MjUMDzc3NDQwNjAzMzQ1NjI0NgwPMTQ4MzM3MzE2MTQwNTA0DA81MDU0MzI3NDU3MzY1ODMMDzQwMjEzNzU1MTI0NzY2MgwPNzQwNjI1NDg4NDcwNjYxDA80NDIxMjc2MjQ4ODc2MTgMDzA4NDgxNDgxODMyMTg1MgwPMTg1MDg2MjEwNTY3ODE2DA8xMjUwMjQxMzUwNTcxNzEMDzQwMzg2ODQ2NzMyNjQ0NgwPMjY1MTgyNzQyNjM1ODU4DA80ODczODUxNDczNjA4NTcMDzIwMzU2MjQzMTQ3NzQ1NgwPMzA3NzA2NTg3MTY2ODU0DA80NzQ3NTI3MzE3MzEzNjUMDzQzNjQwNzgxNTgwNTI1OAwPNjYxNjI0MTQ2NDI4NDMxDA80MTI2MjE0NjU2MTMyNTgMDzQ1ODc1NTI2NDY1MDM3MAwPMjcxODczNDE3MTU0NTMwDA83NjM0NTMyMzE2NTA0MTMMDzU3ODYxMzM2MjM1NDI3NQwPMDcyMjc1MzUyNjcyMDU0DA83NzM0NjE1MTQ1NzQyMzQMDzI3MDQ4Njg2MjIyNzI3MAwPNjE3NTYxNDA2NzcyNjQ0DA83NDc3MDc3NjIyMzg1NjEMDzA3NDYwMzA4NzE0NzA0MgwPODU1Njg1NDA1MjQ0NTQ0DA80NTM0NzMyODM1NDU3NzgMDzQ4NTU2Mzc0NTIxNTI0MAwPODEyMDg4MTM2NTY3NDA3DA8xMTU2NzEyMDgzODcwNzUMDzgxMTI0MjE0ODczMDA1MAwPODIyNzU4MTEwNjYxMzUwDA8xNzcxNjU0NTIxNzIyMDEMDzczODM3MjIxMDYyNDc1NgwPMzUzNzY4NjE1NzY3NDM0DA84NTg4NzMwMzU0MTA4NTYMDzcxMDYwMTc1MzczNzMwNAwPMTU4ODAzMTA2NjU4MTIzDA84NTc3MDY4MzQwNzc3MjAMDzI2ODI2Nzc1NjQ2Mzg2NgwPODgxMzUyNjE0NzU4MDgwDA80ODc2MzQwNDE3NTg3NDgMDzQ2MzAxODU2MjQwNzEwNAwPNzg2NTA1ODQ3MzY0NDM2DA8wNzg4MTE3MzEwNTUwNTEMDzQwMjYxNjQyNDAzNzg3NQwPMjMzMDMxNTMzMDE3NDA2DA8xNzMxNTE4NjYzNzc2ODIMDzE1MTc0MzE1MzExNjc0NwwPNTIyNjE2NzM1MzMwMTMzDA82NTQ3MjAwODc2NjA1MTgMDzQ3NTgwMDM1MTIyNzMwNwwPNzExMjYxNTgwMjAxMjQzDA80ODYwODMwMjAyNjQ4NjAMDzE1NjIyMTAzNTIxMDc3NAwPNjEyNjMyNTgxMDQyMDY2DA84MDU2NjM3MzUwMTQ0MDMMDzc2MTQ1MzcwODU0MzI2NgwPMTI4NjE1NDg1NzI0NDIxDA81MjExNDY3NDU1Mzg2NTMMDzAwODM1MzAxNzE2NDgwNgwPNTgxNDQyMTIzMTAyODU0DA8zNjIxMTYxNTcxNjAyMTAMDzMwMzg3MzUxNTAzODc0NQwPNDU4NDU3NzQ2MjIxNjQ0DA81NTIyMjA0NDAxMDY1MzcMDzgxNDI3NDcwNTI4MDMzNAwPMDQ4NjA1NjI2NjU3MDg3DA82NjMwNTUyNzc1MTg0NDIMDzg3NTAxNDA3MTc2NzYwMwwPMzI3ODUyMTgyNzc0NTQ1DA8wNDQ4NzU0MjM2NTE4MTcMDzI4MTExNTcxNDMwNjAzNQwPNDgxNTY1MzU3NTE3NjgwDA8wMTEyMzE3NDI3NTQzMDgMDzIyMTg0MjY4MTUzNTEwMAwPMDYyNzQyMDMzODgwNzUzDA81ODUxMzAzMDUwNzEwNjcMDzM1MTI4Nzg1MDA1NjcwNQwPMjcyODEwODQ1MzI4MDYyDA8zNTg1MzQ4MTAzMzgyMjMMDzQzMDM1NjY2MjAyMzIxNAwPMzY1NjM1NDY4ODM1NjM2DA81MDA0MzY3NjMwMzQ2NTQMDzAyMTE0MDg0MDQwMDYwOAwPMzEzMTMzNjg0ODM1NDgyDA81MTA0NjI3MTgyMjU3NzQMDzc3NTE2MjMzMTY4MTIwNwwPNjQ2MTU0NDQzNzU1ODM4DA8wODUzNzAzMTAzODI0NTUMDzU3Nzc2ODM1NDc2ODg3NwwPMjQ4ODQyNzIzNDU2Mjc0DA8yMDU4NjY2NjE4ODA2MjYMDzE3NTI4ODQxMzU3MjE2MAwPNTA0MzQyMTU1NjIyMzcxDA81ODY2MDE4NzY4MjY1NjYMDzEzMjUxODYyNTgxMTUxMwwPNDIzMDc4NDIzNjcyMzUyDA8xMTQ0NzczMTI1ODY2NDEMDzU2NDU4NTM0MTgyNDgyOAwPMjU0MTE4NzY1NjQzNjI0DA81NjA1MjAxNDUwNTUwNzAMDzg4ODQyODI0NTcwODIwNgwPNDM1NzY2MTE0MTc3NTQxDA8zNjY4MDQwODQ3Njc0MzMMDzE2NTgzODY2NTU2NDU0OAwPNzA1NjgzMTg4NzU1MTczDA84Njc3MzEwODMwNDAwMDIMDzA0MTg2MTg2MTQ3NDA4MwwPODIxODQ1NDAzNDA3MTUzDA81MzExNTQ4NTcxNDMzNjEMDzA0MTgwMTUwNDQ1MTAxNgwPMDAzNDUyNDc2MDYyNzc2DA82ODE1MjMwMTAwODYwODYMDzMyNTAzMTUyNDM1NTY1MgwPMTczMTI2NDAyODQ3MzAzDA8yMDMzNzc2MTU0ODM0NjEMDzUzMDIzODA3MDQ3NTQwNwwPNjYwNDUxODIwNTMwNDE4DA83Mzc0NzQ1NTQ2NjQyNzgMDzAyNjAzNjc2ODgzMzMzMgwPNjA1NDIxNjg2MDYzODAxDA8wMTYwNzI3MjUyNTIyNDQMDzg3MDYzMDQ3MjMwNTQzNAwPMDMyODAwMzQ3MzE0MTgzDA8wNDg0NzY3Njc2NDY4MTIMDzM1MDMxMjEwMDE2MDA0NgwPMTU3MzM0NTg3NTQzNjUwDA8zMjExMTExNjQxODQ0MDUMDzI3NTU3MDA1MzI1MjA2NAwPMjU3NjMwMTAyNDg1NjE3DA82NDU3NDYzNTgxMDYwNzAMDzM3NzgzMjIxMjM3NjQ2MAwPMjE2MTc2MTE0MTUyNjM1DA80NjgyNDMwNTQ4NTM4MTMMDzc4MTM2MDEzNTI1NTU2NQwPODcwNDEzMTcwMjg1NzU2DA83MTE3NDQ0NDE2MzQwNzEMDzEzNjE0MDAwNDU2MDIxNgwPNDA4MjQ4MjEyNDg4MTUwDA8yMjY1MDU3NTE1MjgyODgMDzY0NzU4MzcwNTAzMjYyNwwPNjUzMjQ1NDMwMzg4MDUzDA8wMTQ4NjUwMDMwNDUxMjAMDzIwNDA2MDA0MjY0NDAzNAwPMDM0MjM4MTUzMTg4MjQ0DA8yMjg1MjQyNjcyMTU4NjAMDzQ0MzE4MDgwNDI2ODUxMAwPMzM0ODA1NzUxMzg4MjU3DA81ODAyNDA1NzY2MDY4ODcMDzg0MzAwMDQ1ODY4NTA1MAwPNTY4Nzc4NjY3ODExMjcyDA8zMTUxMTcxNTIxMzQ2NjEMDzg0NTQ3NDMxMjQyMTYxNwwPNDYxMDIzNjQyMDgzODMyDA8yMTQ3MDM2MTg0NjM2NTIMDzM0NTQyNTIyMDU1MjQ3NwwPODMwMDUzODczMTA2NjcyDA8wMDUyMjEwMjc4NTE2NDgMDzE1MjY0Nzc1MTE1MTM2NAwPNzI2NDQxNjM2MDYwNzMzDA82ODU3MTgzMTIwNTA1MzEMDzI2NDM1MDIzODI0NjI4MAwPNTA0NDU0MzYwMTMyNDUyDA84Mzg0Mzc1NDI1NzA2MjQMDzQyNzQ2MDQ2NTE1NDAwMwwPMDQzODExMjEzNTM3NzYxDA84MTE4NDc3MzA4NjE0NjgMDzUxNTI1Mzc0ODEzMTQwOAwPMDQ1NDU0MDg4NDYyMTUwDA82MzE2Nzc4MTYwNTE2MjUMDzU4MzI4MjcwMTEyMTY0NAwPMzgzNTg0NzQ3NTM0MDE2DA8xMDIwNDY0MjUwMjU0MjQMDzU3MDA2NjIxNDQ4NTE1NwwPNDU4ODY4MTg1NjI4NDA4DA81ODUyNTg4NjYzNDY3NzgMDzUyNzQwNTYxODY2NDc0MAwPMjc0MjY4MTczODA3MTE3DA83NzY2MzcwNDY2NDA3NTQMDzUzNTEzMzMzMTM2NDA1MwwPMTA1MDYzMDAxMjIxNjUwDA81ODMzMTY2MjA2NDc3NzcMDzQzMzM3NDYzMDMyMTU2NAwPNDcxMjA0MzgzODAxODg3DA81NjUwNTIxMjU1MzUxMDYMDzM2NTMxODEzNzA2NzMwNgwPMjQzMjg4NzgzMjY3NzI3DA8zNzQxMDg2MjYxMDAxMjQMDzc4MjA4NDIyNzUwMDM3MQwPMzU0NzU3MjYzNjAzMzg1DA83NDM3MTU2MzAwODAwODYMDzM4MzIzNzc3NzMzMTE3NwwPMzU2MjIyMzUwMDc2MTE3DA84MDIwMzQxNjcwMjU1NzcMDzU1ODE1NTI1MjM0NDQzMwwPODE4ODcxMTQ0MDQxNDY3DA8yODQzNDI1NjAyMjg1NzcMDzA0NTQyMDcxNjEzODAwMAwPNzQ4MzgxMDQyMzIxMzgxDA8zNzE1MjA4NjI3MzMyODgMDzMxMjgzMjQwNjYxMzA1NQwPODA1ODgzMDUzNDIzMzUzDA8zODEzNzQ0NzI1MDQ4MjYMDzU2Mzc0ODE0NDI3MjU0NgwPNjE2MTA3Nzg1MTcwMjg1DA8wODQ4NjY2MzI1MTEyODAMDzMxNjEyNzE4NjUxNzgzMwwPMTAwMjQ2MTE1MDU0NzgzDA84NzQ3MTgwNzEzMzc0NDcMDzA1MzQ3NzgwMTEyNDEzNQwPNzcwNjM0MjQ1MzM4MTM0DA82MTQ2NzUyMjY1MzcwNDYMDzU1NjA4MTM4MDMzMTQ0NgwPNTgyMzI1NzU1MjU0MjM2DA8zMzAyMTI1NDcyNjQ0MTMMDzE1NDg3MDE0ODcwNzMyMQwPNTI3Njc3ODIyNTUxNjE1DA82ODY0MDgzNDE2MTQzNTAMDzQyNTAyNzM4NjAxMTc4OAwPMDg0MDExNDg4NzQ4ODY1DA81NTgxMjUyNjg0MzYwNzYMDzE0NzEyODE3NjczNzUwNgwPMzEwNzAzMjI2MTQwODE3DA8yNjA2NjAwODQ0NzQ2MjYMDzEyMjMxNjgzNjUwODE4MQwPNTAzMjA2ODI0MTc1NDY1DA8xMDY3MzIzNDE1NTg0ODcMDzgyMzI4NDcxMjIwMjg0NgwPNTIwMjUxMTIyMTU0MDM3DA80NzE2NTIyMTMxMTgyMTEMDzYwNzAzMjU4MzAxNTM4NQwPNzM4NjU2NjUwMzYyNTQwDA81NjQyNzUwMTg0MTI4MzUMDzU4MDIwNDM4NDg2NzM1MQwPMzYxNjA2NTgxNDU4NzczDA84MTAwNTg0NjA0MDY3MzgMDzA1ODA0MDAyMzMxMjE0MgwPNjg0NDY0MzQzNzg0MjQ3DA8xNjU1NTgxNjIzODQwNzEMDzU0ODA1MDgzMTY0NDczNQwPODU1NjY2NTI4ODM2NTUyDA82NjE0NjcyNjMwNDYwNDgMDzYwMzUzNTMxODEyNjAxOAwPMDE0MjM2MjU1MDM2NzEzDA84NDQ1MjQyNzYzNDc1MTQMDzY3MDc4MzY3MjYyMzYxMAwPMjY4MjU1NjgzMDcyNDc3DA8xNzUyMTY1MzgyODg4MDEMDzg2NjQxMTI0MDc1MzM4MgwPNDg1Mzc4MDgyNTQ4NTY3DA84ODU3Nzc2NTcxNzc1MzAMDzgxNzQyMjcwMjQwNDYyMwwPMzI2MzcxMzYwODcxNDAwDA8yNDcyNDg1MDA0MDY4MzcMDzA2MDE1NzIwNTQwMTIzMgwPNjgxNDMwNDEyMTA4MDE3DA82ODQwNzM0Mzg4MjgxNTgMDzU0MTI4MzQ3ODQyMTE4OAwPNjM2NDI1ODYyNTgxODg0DA84NzM4NjQ4MTc2MDA3NDcMDzM2MTg4MTcyNjQwMTUwNAwPMTM4NTY3ODI4ODAwNjEzDA8wNDE2NDI1MDM2MjUzNzUMDzUxODEzMTQwODg3MDgxMgwPMjcxNTM4ODc2NTEzNzM4DA8xODY4Mjc2MzU0MTEyODEMDzUyMzU4MjQ0ODU4MDUwOAwPMzg1MTg1MTg2ODE1NTMxDA84MjU4MzUzMTc2NDMwNDIMDzU4MzAzNTY0NTgwMzg2NwwPODQ1NTMxMzQ3MTg4ODMxDA84MDUyNzYyODA0MzI0ODIMDzQyMzcwMjAxMDQ4NjUyOAwPMjEwODIwMDA1ODU4MTQ4DA83MzQ3MTA3MjMzNTAwNTYMDzc1NjA2NDYyNTA3NDQzNwwPMjcwMjY1MDMyMTQzMDcyDA8wNjY2NDcxNTQ4MjA2NzQMDzU2NTAxNTE3MzQ3NTMxNQwPNjQ1MjQ3NDEyNTM3NTUwDA81MDY3MjAwODY2NTY4MjgMDzc2MTEwNTQ3NTUxMDYyMgwPNjY4NjMyODg2NzMxNTA4DA82NDE2NzI1ODQxNDUzNjAMDzY2NjcxMjIxODQwNzQ2NQwPNTg0MTIyMTM3MDAxMzIxDA84NDgyMzc1NTQzODgwMjcMDzc1NTg4NzI3MzYxMzI4NgwPMjY1MjI0NDAyNDM2ODExDA83MzMyNjMwMzg3NzAxMzUMDzE4Mjc1MDExMDE0Njc3MwwPNTgwNTUzMzA2MDgxMjA1DA80NzQ2MzMwNTIyMzUzNTYMDzg4NTgxMDYyMjIxNjQzMQwPMjQ1Mzc4ODQ2MzE0MjgwDA8zMzEwODIzNjg2MTM3MDYMDzA4MzQzMTA0NjYyNzE0OAwPMTc3NzgwNTQ2MjQyNzI1DA84NTIyNjYyMDU3MjI0NzYMDzM2NTgxMjg3ODMyMzQ1MQwPNzAzNDA3MTU1MzEzMDcyDA84NzgyODIxMjQwMTAwNjMMDzI1MjU4ODA0Mjc2NDYwNQwPMDIzODAyNjg2NzUyNjI1DA82NDQyMDI4MDUxMjA2ODEMDzE1NzAxMjU1ODU4NjU2MQwPMDM4ODAzNDUyNTU1MTI4DA82Mzc1MjMzNTUxNjUwMTAMDzQ2MjQxNjg3NTI2MjI3MQwPMDEzNjUzODAzODc0MjI0DA8wMTUyNzE0NDI0MzQ4MDcMDzI3NTc4NjcxNjc3MzYwMgwPODA2NDM0MTQ0MzEzMDczDA81NjMzMDEzNTY3NTIwMjMMDzcyMTc3NDI4NzAwMjIzNgwPMTg4ODQzNjEwMzQ2MDEyDA8zNTMyMTE1ODYxNTA2MDMMDzQxMDQyMDA0MzcxNTg2NAwPNTAzODY0NDIxMTg4MDEzDA83NTUwNDI3ODE4MTA2MTQMDzAxODQ4NzI0NjYyMzQwMgwPMDg2MDUxMzIwNDI4MTM1DA84ODcyMDc1NDU1NjA3NDMMDzg4NDQwNTIxMjExNzA2OAwPMDg2MjY4NDY0Mzg3NjA2DA8zODIwMzY2MzQ4NDEyNDYMDzI0NzI1MDExMTI2NTQ2NAwPNDA0ODQzNTIxNjg3NzAwDA8zNjg3MDEwNjcxNDM0ODMMDzgwODA3MjY0NDI2MTE4MwwPNTYzNTEzMDgwNTIzODI3DA82ODExMjczODg0NzY1NzUMDzY3MjI3MTcwMzQxNTcyMAwPMTA3NzcxNzAyMjU1NDY4DA8yMzc1MTQxNzY0MjMwMjYMDzQ4ODgxMzM2MjcyNjMwMgwPMzYwMDAyNTUyNzYwMzE4DA8yMTA0MzgxMDAwNzM0ODYMDzUzNjU2NDY2MDIyNTEwMwwPNDU3NjcxMjM0MDUwNjYxDA84Njg2NjY3Nzc3MDAyNjUMDzI2NzExNTEwMzQ0MjY4NgwPODc2MjYwMzUwNDExNzE2DA8wNjY2MjUxNTExNDMyMTcMDzIzNTI3MTMyMzM0MzUwOAwPMjg1MTgxNjI2NTU2NDAyDA82MDA0NzAwNzE2NzcxMzYMDzE3NDc3Njg0MDA1MTc3MgwPODY4ODczODUyNDI4NjgyDA81NjE2ODQ3ODYyNjczODYMDzMzNTI4MDA0NzMxNjg4MgwPMDM4Mzg3ODMzMzY1NjU4DA8wMzc1MDMxMjc3NTU3NzcMDzc4NzA2NTAwNzE1MDI0NAwPMzcyMjUxMzEyNzYwNjI3DA8wMTcxMjIxMTc0Mzc3MjIMDzM3ODMwMjA0NDU0MDc3NQwPNDgyNzY2NDYyNTYxNzE3DA8xMDY4MDY4MTE3MTg2NjgMDzEyODM3NzQ4NDA3MDE2MgwPMzE1ODUwNDYzMDY1MzIxDA84MjAxNTEwMzQxNjcyNTcMDzY3NzQ0NTQ1NjAzNTcxNAwPNTY0MTQwMjY2Mzc4NzM2DA84ODc3NTc4MzU1NTMxMTQMDzQzMTUyNTcxODI0MjYxNAwPMTAxNTIyNjEzMTIwNTg4DA83MzUyNTczODcyMzIwMzQMDzAyMzQ4NTg2MDQyNzE2OAwPMjUyNDUwNDgzNzU4NjU0DA83MzQ4MjE4MTQzNzcwNjUMDzg4MDgzMTA3ODU3Mjg1MwwPNzUyMDE1MDgxMTQxNTcwDA8zNzc4ODYxMTU4NzMzNTcMDzEwNTgzODcxNDI4NjY0MQwPMjg3NzEzMzE4ODE4NzEyDA8wMzUwODg3NDU4MDI1MTAMDzc2NTU4NTMxMzM0MzI4MAwPNzg1NzAzNjExMjczNjgzDA80MjQ2ODcxMDc0NTM4NTcMDzQ3MTc2MTQ3NzUyMjQwOAwPMTIxODY4NzM3NzY2MTAxDA8zNzg2NzAwMTY1MTQ2NjQMDzg4MDE1MDY2ODIyNzA2MwwPMzQ3NjM2MzI1NzI2MDYxDA83NzUzMTY0ODQ0MzU3ODAMDzU3MjMxODI1ODY2NTcyMAwPNzQzODI2MzIxODg0NjE1DA84ODU4MjQ1NjQ0ODczNDYMDzc1NjA0NjYwODU3NDE2OAwPMjIzNTI2Nzg0MDI0ODM2DA82NjQzMDA3NzQxODA1ODYMDzYwNDAxMDcyNTUwNDQ2NQwPNzY0MDE4Nzg3NjAyNTUxDA8xNDI1MzMyNTQyODczMjAMDzEzNDU3ODYxMTgzODU0MAwPNzM3NDU1MDcxMzEwMDU1DA8zMDMwMDg4MTI0MjU3MzMMDzc0ODU3MzU3MDIwNjcwMAwPNDIxNTAxMjA2MjU0MTE2DA80ODMzNjg0Njc1NDgwNjQMDzUyMTIyMzU4ODYwNzAzMgwPNTUyNjg3NTAxODI2MTY1DA80MTM2MjQwMjUwNzYyNDUMDzU2NjI3NzYwNjMwNzUzMgwPNzgwNTc4MzMzMjgwODA2DA84ODIxNjMwODc1MzIwMjUMDzI1ODI0NTc4NjU3NTcyNQwPNjMwNjIxNzEzMzQxNDU4DA83MjQxMjA1NTU2MzY2ODgMDzUwNzE4MDUwODU1NzA1NwwPNDQzMTY1MTc4ODA2ODMyDA84NDYzNTE2NTc1MDgzMTgMDzM0MDEyNTIwMDQ4ODY2NgwPNzg4MjcwODE2MDEwNjQ4DA82ODEyMjczMDQ2MzE2NTcMDzU0ODYxMDEzODMxNDgyMAwPNDI4NjA0Mzg2MTc2MTIyDA8wNDU2ODQ2MzU1NzcyNTgMDzU3MTEzNTMyMjg4NzIzNAwPNTQ2MzMzMjYzMzU3ODc4DA8zMDgyNzY2NTY0NzM0MDUMDzU0ODQ3MTMzNTM2NTYxOAwPNjY3NjM0MjIyMDE0MTQzDA8yNTMwNTcwMDI2ODY2MDcMDzc0NDUxNDgzNDc3NTA0NAwPNzMxODY2MzA0MDgxNTc1DA82MjU3NjcxNDgwNTc2MjcMDzY4NjQ2NzI4NDI4Mjc3MwwPNDAzMDUwMDM4NTQwMjAzDA8xNTQ3NDYzNzIyNzY1ODcMDzEzMTY1NTc3Nzg2MTE0NgwPMzY4Njc2MDMwMjQyMDMyDA8zMDY2MjM4MzYzNDY1MzMMDzUzNDgxMDc2NzI4MjI2NQwPNjYwMDEyNDA0MjI1NDU0DA8zMTg0MDc1ODYwNzgwMzYMDzMzMjQzMzc1MDg0NDUxMgwPNTA1MjMyMTE0NjgyMDA0DA8xMjYyNjcyNDM2NzQ0NTIMDzQ3NDQzNDYyNjAwMDA4NgwPNTY1MzI1NjMzNjcyNTQyDA8zMjc3MjMwNjUxNDcyMTgMDzcxNjQ2NzEzMDg2Mzg1MwwPMDQ1MDI3ODgzMzQ0NDYwDA8wNDQ3Mjg1MTA0MDE2MzUMDzU4ODgxNDYwNDg1Mjc1MwwPNDgzMzY0ODIzMzYyNjUwDA82NDMzMTUzMTcwMDgxNjQMDzAzNzQwNjEzNjM3Njc1MwwPODYzMjg2MjQ0MzgwMzQzDA80NjMyNzUzODMxNDMwMzcMDzM2NTQ3MzU2MDc0NjMyMgwPODc4MzM2NjY3NzI3NTQ3DA8zMDU2NDYzMzcwNjczNzEMDzM3MDA4MzE1MjY4NjE1NwwPODg4NTM1NzY3ODg3MzAwDA8zMzYwNzUyMTIxMjI3NjIMDzUwMDgzNTM0MTExMTQwNAwPMDQzNjg4NDg4Njc3MTE3DA82NDY0MzIyODM2MTAyNzQMDzE3MTIyMjA3ODIyNDgwMAwPMjUzMDEyMjg0NTg2MjUyDA80MzYyODIxMTg0NzU3MDQMDzgzMDQxNDU4NDM2MjQzMAwPNzY2ODIzNjYzMTI1MDI4DA8xMjAzODEyNjI3ODE3MTEMDzAxNjM1Nzg2NTg3MTQ3MQwPMDMyNzM3Nzg2MjgyMzY4DA8wMjYzMzAwMzcxNDUzMjEMDzgwODcyMzU1ODQ0MTgxMgwPNDI4MjMzMzI1MjQ1MDgyDA8xODgwMzAyMTczODA4MjcMDzI1MjYwMzI0NzcxNjg0MgwPMDE4MzM1MjA4NDAyMDczDA8zODgzNDQxMzMwNjU4ODgMDzAxODUxMjAwMTE1MTY2MQwPMDgzMjgzMTM2NjY1NjcyDA84NjMzODU3ODU0MTIwODgMDzgxNzg0MjQ2MjUxNTA3MQwPNTM2ODA1ODIyNzgxODU1DA8xNDA0NjYzNzY3MzQyMjQMDzMxNDUxMjgwODQzNjEzNgwPNzUzNjY3NTAxMjgzNTE1DA8zMjQ4MzM1MTMyMzEyMDcMDzc0NTMwMTY4NjI1MTg2NwwPMjE2NjMwNzM3NjEzNjM2DA81NzgxODUxNjY2Nzg1NzUMDzc0MjI0MDQ1NjI2MzU3NQwPODA2NDUyMDQyMzI1NDg2DA81NTAwMTExMDgyNzg4MjMMDzQxNTIwNzM3MjM4NDc1NAwPNjIwNTA4NTUxNTMyNDEwDA80NTM4NTYwNzA1NjgyNDAMDzE1NzY1MDIwNDM2NjUyOAwPMjcwNDUyNjc3Mjc1MDc1DA8wMTgyNzE2NTIwMDU1MjMMDzU2Nzg0NjA0NDI0MDEyNQwPNDYwNTgxMDUwNDg1MjM3DA80NjM1NTQwNzgxNjMxMzYMDzQ3ODAwMTAyNTAxMzU4NAwPNDc3NzUwMzEyMDg4NzYwDA84MDU1MzQwMTYwNzUyMDEMDzg1Mjg2MTcxNjQyNzExOAwPNzU2NjA3MzEyMzcwNTg2DA81NTQ3MTQ4NTAwNTQ2NTAMDzEzMzI2ODQ2MzMwMDMwNQwPMjYyNTU0MTYyNTU3NTMyDA80Mjg3NjI4NTc2NDE0MDMMDzg1MzQ1MzEyMTgzNDY0MAwPNDAzMTgyMjU4MDU0NDQ2DA84MzYzODAwNTczODY4MjgMDzIzNDAwODQxMzIzMDIzMQwPNDg4MzE1NzA2MDQ0ODAyDA82MzY4MjI3ODQzMTczNjUMDzg2ODg1MTU3NTA1Njg3NgwPNjY0NDAzMzA4NDIxNzMwDA8zMzI4MTQyNjA0NDExNTEMDzYyNTY3NjcyMjI4MjM1NwwPNTc1NzYwNDAyNjE2NzQyDA8xODQ1NTg4MzE4MzI4MzYMDzg3MDIxMDMxNjM0MjczMwwPNjg1NzQyMDg1MjYwNDExDA83NTY4ODU3NjUzMjczMzYMDzA0NjU3MzQ4MzU2MzYwOAwPNjE3MDQyMTU1ODEwMDgyDA84NTU4NDU4NzIxMjExNTgMDzc1MzYzNzI4MDgyNDIyNwwPNTM3MzAzNzU0MzYzMTI3DA81MzYyNjU4NjQ0MzcwMjIMDzc3MjcxODU4ODcxNDI0MwwPMDUwNjY2MDAwNTgyMzE3DA81MjE1NDY3MDYwMzYzMTAMDzczODQ1ODcyNzU1NTY1MgwPMTE1NTUwNzYxNjcwNzQ4DA82NzcwMDcyNjgwMTQzNTEMDzI4ODU3NTgzNTA1NzI1NwwPMzcxNjIzMjQyMjgwNzQ3DA8zNTU2Njg2NDAwMzgwNzQMDzQxNzExMzQ4ODQ0MDc1NAwPNzY2MzAwMjU4MTI2NzcyDA8xODU1ODE0NDUwMTM2NzMMDzg1ODIzMDY1NjYxNzY2NQwPMzIyNjQ2NzA3Njc3NjU3DA83ODg4ODU2MTAxODczNzIMDzc2MDgyNDcyMDI4NzcxNwwPNTc4Mjc0MTMzNDM3MTgwDA8yNDEyMzMzNDE4NzEyNTIMDzcyMjg3MjQ4MzY4MjA1MwwPNTQ0MDQyNDIzMzU2NDQ3DA83MjI2MDg3NTUwNjQ4MTEMDzM1NTE2NDU4NTcxMzcyNQwPNTE1NDI4NTQwNTQ0NzU0DA8yODUyNzU4NTE3MDc4NDcMDzY0Njc0NjUwMTEwNzQ2MAwPMDA3MDczMTQ1NjU1NTgwDA8wNTIzMTc1ODA0MDQ2NjQMDzUwNTAwMTY3NTg2MjU2MAwPMzEwMzQ4ODA0NDQxNzM1DA8wNzE0NzI1NzA4MTYyNTAMDzYzMjA4Mjg0NDY4MzE3NQwPNjUxNjY2MTgzNDY3MDI4DA8zNDgxMjA0ODI1NzM2NDgMDzE3MjUwODIxMDUxMTg2NgwPMzg2MTI2NTYxMzM3NzMzDA81NjAxMzU2MDYwMjE2ODcMDzI4MjY2NzgzNDUwMTI1MgwPMDIzMjY4NzIxODYxNDEwDA8xNDE4NjgyODg1MTQyNjgMDzcwNjMyMDQ4MDYyNTQ2NQwPNTA0NDMwNzE1MTA4NzQxDA8xNTQ4MTAwMjU4NDMzNTAMDzgxMTY4NjYyMTEwNTY0NwwPODY4NDM0MzU4MDY0MTA2DA82MzE2ODQ2MjMzMDA3NjgMDzgxODc0MzgxMDc2NjY3OAwPMTE0MzQyNDI0NTYwMzE2DA8wODU0MDQ3NjM4NTc4NjEMDzM1MTAyMjcyMjE4NzI0NgwPNzc2Njc4MzE3NDMyNDAwDA82MzIwNDE4Mjc2NzEyMzEMDzc2NDA3MjEzODMxNjEyMAwPNjMxNTUxODMzMTc2NjA2DA8yMzIwNDA4NzQ1NDc1MzcMDzI2NTA2MjExMjEyNjEyOAwPMjc0NDM1MDgyNzIzODYyDA80MDI0NjA0MjAwMzIyNzgMDzgwODg0MTI0ODExODYwMwwPMzAxMDM0NDE0NjUwNjcxDA8wNTc4NTM0ODc1NTg2MDIMDzc2MDYxNTMxNjU4MzAxNgwPNzgxMTgyNDIxNzUwNTA4DA8yMTEzNzY3MDczNDExNjYMDzc0MzM0NzQxNDgxNzI4NwwPMjg4NjE3NTM4MDQ0MjY2DA80MDMwODExMjE0MzE2MDEMDzc3NDU1MDgxNDQwMjYzNwwPNjc2NDQ2NDEyMjUzMzUxDA80NjE4ODQwNDgyMjI0MTMMDzQ2ODcwNDc1MDEyMzM1MwwPNTA4MzM0Njc3NjI1ODYyDA82NTY2MzEzNjQzMDE3MzIMDzcxMzI2NTgyNTUyMDIwMgwPNjIzMTQ2ODM0Mjg3NzI0DA8zODIwNTg3Mjc2Njg4NjcMDzA3MjcwNjYwNzc1MTUyMAwPNDg1NzY3NDI2NDU0MDE4DA84NTI0MDAzNTE2NDY1MjIMDzIyODEwNTgzMDY0MTM3NgwPMDAzNDczMTIzNTYwODcyDA8yMDA1ODA0Njg1NzY0NDIMDzc2MDg3MTc2NzUzNDUyNAwPNzg2MDI4Mzg2NTAyNDE4DA8xMzY4NTAwMTg1NDA4MzMMDzIyMzY1MzA3Nzg0MjQ1OAwPMTI4NzM4MDg3MjcxMzQyDA8xMjA4Mzc2MjQwMjQ0MzIMDzA3NTE3NTgxMzA2MDc0NAwPNjM4NTY0MTAyNTEyMzMzDA8wMjE4MjcyMzA3NDQ3MzUMDzAzMjAyNTQzMjc1ODUwMgwPMDY3Nzc1MTc1MDAzMjMwDA8wNzc1NDc0ODgwMTg0NzIMDzc0NjcwNjczNTAwMzMyMQwPODQ4MzgwODA0MjAxNDExDA8zMTQ4NTYwNTI0MzQ4NjAMDzI4ODAzNDUyNDI4MjQ0NQwPMDIyNTI4NTExNzg2NDQwDA82MDQwNjgxMDg1NzA1MjMMDzY1NTYyMjY3ODcwNTE2MgwPNTY0NDIxMDIyNTI3NzQzDA8wMjE1MjE3MDI1MDI4ODQMDzYzNzgwMTY1NTA0MDc2NwwPMzA3MTE4NDExMTc2NTU3DA8wMDYxNzI3NTM0NDQxMjAMDzU1MzgxNzI4Nzg4MDA3OAwPMzI2MjU2NjQ0MTIyNDc3DA8zNTgyNjQ0NDI2NzQ1NzcMDzQyMTg3MDg3MjMyNDIwNQwPNTE3NTMzMzE4ODY1NTE1DA81MDQ1Mjc3NjI1ODQ3NzAMDzcxNDAyNDQxMjEyNzgzOAwPNTIzMTYxODE4Mzg1NTEwDA8wMDI3Nzg2MzEyMDQ0ODQMDzMzNTUxMDcxMTYxODAwOAwPNDU1MDYwODMzMzMyMjM4DA80NTM4NzExNjE1MDg1MDMMDzQ0MzQ3MjUxNzM4MDU2NwwPNjIwMDM1MDg1MzU0NDcxDA81NjE4NjMzNTE2MjU0MDUMDzE1Mzc4NjYwMDgxNDM2NAwPNzgwMDgyNjEzODc2MzgzDA81Njc0Nzg1NTg0ODczMjcMDzM1NTIwNDg4NTMwMTM3NAwPNDA4MDAwNzU3MDQzODYxDA81NjgxNjQ1ODcyMzIwMTgMDzQ4MTUzMjMxODUyNzM0MAwPMzE0NDI0NjY4Mjc4NDg2DA81NDc3NzIwODcwMDU4NjMMDzMzMjExMTUwODMzODI2MgwPNDU3MjI4MzM3NjAzNzAwDA80ODQyODAzODQyNjg1NTYMDzEzMjMxMjQ3Nzc3ODQ2NAwPNjI3NjQyMDY2NTA0MzUzDA82NTAwNjEyMTIxNjY2MzcMDzE1MTA3ODY0MTc3NDUwMAwPNDEwODIyNDIwNzcyMDg0DA83NjEyMjY3ODYxODU4MjcMDzcxMDMyNTE1MjcwNDIxNAwPODY2NjU4MzA4MjEwMjcyDA80MjI3ODc4NDg1NTg3NDcMDzgzNzcxNDQ4MTI2MTg1NwwPNjM1ODY2MTA1MTIxMTcxDA83NDU2MDExNTM2MzAzNzUMDzg1MjUyNjE3MjM1MDUyOAwPNjI1MDM3NzY2MTc1MDc0DA84NzAyNDIyMjMyMjAyMzUMDzQ0MzQwMDMxNTYyNTY0NAwPODUzNDUyNzgyODAwMzcxDA8xMDM1MTY3NTY0NDgzNTYMDzQyMzUxMzYwNjcwMjUzOAwPMTcyMTAxNDg2MjcyNDUxDA80MzIzNDI0NDg3NjUwMDUMDzc1NjI4MDAxNDU1ODQxNAwPMTE1NjU2ODE2NzAwMDM0DA8wMjc4MjQ0MDc3MzU4NTIMDzM1NzYxNTgxMDYyNTA4MAwPMTIwNTQ4NjUzNTgwNTgxDA80MTI2MDg3NzAzMjI4NzMMDzYwMzgwNjQ4NjIxNTY0NQwPODQxNzE1NjIyMzQ4NjczDA82ODI0MjQ0MDIzNjUwMzcMDzQ0NzQwNTU0ODI1NjI3MgwPMTEwNDQwMTMwMjIyODM0DA8xNTQ0NDMzNzU1NjgzMTYMDzI3MTExNDU4MTYwNjM3OAwPNDIyNjU0MzI0MzM2NjA3DA83NjQ0MTQ1MDcyNDg0NDYMDzE3MzU3NzgxMjE1NDQ2MwwPNzcwNjAwMzAxMzgwNzAxDA80NTM0MzYzNjQwNzIwMjEMDzgzNzIyNTQ1NTUyMjAyMgwPNjAyMzQ2MjIwMjUyODA3DA84MzAyMDExMDQwNjA2MjIMDzUyODQ4NTgzMzg2MDI4MwwPMTc1NDc2NTA0NDQxMDQwDA83MTM1NDE2Njc3NDE2NzYMDzIwODU2NDcwMzYyNDU3NwwPMDA4NDcwMDIxMjg4MDU3DA8zMDAwMDA1ODIwODQ4NzYMDzE4MzI0NzEwNDIwNTQxNQwPMzEzODY2NTA3NTM0NjI1DA8zNzcwMDcyMDgxMjgzMTMMDzIyNzQ2ODIyMjE0MDIzMAwPODE2MjU3MDEyMDI0MjE3DA83NjAyMDMwMDY4MTM3MTEMDzQxMjgyNTE0NTQzMzIzOAwPMzI2MzU2MTE4Njg2NjQ3DA82NTM2NDIwMTcwMzI0MzMMDzEwODQ3MjYzMDAxODc1MAwPNzM3MDI3ODI4NDUzNzQzDA8xODQ4NzI1MjI1NDg1NzIMDzgxNTQ3NTA1MzYxNDEzNwwPNzUyMTg2ODY3MzYzMzMwDA82NTM0MzgyNjU0MTQyODUMDzIwMjQyMjI1MTA1NzQ1MQwPNzE1MzQ1MDI2MDY0MTIwDA8xNTcwNjc0MzM4MzA1NjUMDzcxNDcyNjIzODQ4MTA2NwwPMjg0NjM4NTY3MjM1MDYwDA8yNzQ3NjAzNDc3NTMwMzEMDzIyMTYzNjgwNTE3NDAzNQwPNjgzMjI2MTEzMTUxODA1DA82NTgwMzE2NDIyMzU0NzQMDzYyNjQwNzYyODAyMjAzMwwPMjIxMzgxNDgzMTMyMzI3DA8xNjU2NzEwNTI3ODI1NDgMDzY1ODgyMTU2ODU2ODY2NAwPMzY3MTU3NDUxMjIxNzU3DA8zNzMzMzUyNTE0MDgzODYMDzcwNDYwNjYwNTEyNzA3MwwPMjgzODg0ODU2ODI1MzA3DA8wODQzNzIyMzgwMTYxNzMMDzM3ODAyODExNzgyMjE3MgwPMzU3MjQ1MDI3MDQ1MDM2DA82NDUxNzAzNjg2NDQ3NzUMDzE1MDQyNTY0MDAxMTUwMQwPODYyMDMzNDQwNDgxNDcwDA82NzE4MDgwMTU1MDUxNDUMDzQ0NDI1NjQ3MjA1MTQ1MQwPNTU0MjM1MzI1NTg2MTIzDA84MzQ1NDUwODgyMjA3MjEMDzc4NjU1MjIxODYwODIxNQwPMzgyMDU1NjIyNTE0ODMwDA81MDMyNTMzMzExNDcyNjcMDzAxNDc2ODA4MzA0MDgzMQwPNTE0MzY4ODgxNDQxNTI0DA84ODMyMTUzMDMyNTQxMjUMDzAyNDQyNzE2MTIyMjg0MQwPNjI1NTYyMTQ3NDc2NDA2DA84NzM4NTA2MTgxNzc3MTMMDzIyNjM2NzU0MDczNjAxMQwPMzYzNjA4NDQ0Njg4MDEyDA80NzMzNzYzNTAwNzc2ODUMDzY3NTA1ODUxMDY3NDgwOAwPNTc1MDM1NDYxMzg2NDEyDA80NjU4Mjg0Mzg0NjY4MTgMDzIwNjE2NTg4NjU1NTczMAwPMjUzNjQxNDQzMTEyMjA0DA8xODE1MTE0MDI3NTA4MzMMDzU2NDYxNDQ1MTAxNTM3MgwPMDEyODQ2MzI2NjM2MjUxDA8zNjUzMDg2ODgwNTY3MjYMDzg4Njg2NjA2ODEzNDQ1MwwPNjM4ODMwMzEyNDA4MzgwDA81NTUzNzA4MDc2NTI0MDcMDzE2NDY0MTI3NzE1MjM2MwwPMzg3MTA2NTg4NDQ2NjEwDA8xNTIxMTc4ODY2NjI1MjYMDzU0MTU3ODIyMzQ1MjEwNAwPMDQ3MTMwODYwMzU0NDA2DA84MzQ2NDA3NTI4MDQ1NTcMDzExMDc4NjcxNDQ0NjI1NwwPMzUwMjEyMzAzNjgwMTQ0DA8xODc4ODI4ODQ3NDIyNzYMDzg1MzU1NDg4NTg0NTMxMgwPMTQ2NzY3MjI0Njc1MTY1DA84MTY1MjEwMjU0MjIwMTUMDzM1Nzg2NzMzNTczMTc1OAwPNzQwMjUwNTgyMDI3MzM0DA84MDcwNzA0NzUyNDA3MTQMDzcyMDA0MDI1MTgwMzczNwwPMDMyMjI4NzU1ODA3NDcwDA8zNDY0NTQyNzA1NDIxNTEMDzQ0MTMxODAyNzA4NzMzMAwPNjg2NjEyMDgyNjEwODg3DA8wMzUwNTY4NDQwNjA4NzMMDzUzMTc1NTQ4NDg4MTQ2MwwPNTc0ODA4NDUyMzU0MjU0DA8zODQyMDUwMjU1MTUwNTEMDzgxNTU1NDAwMjg4ODgyMwwPNjg0MDMzMDYwMTc4MzYzDA8yNTE3NDc3MjU2MTEwMTIMDzUzODQ0NDcwNDgzMjUwNAwPMDY2MzUyNTQzNjQwNTI2DA8xNjY0NzU1MTAzNjAwMjIMDzMwODE3ODA0NjI3MDQ2NgwPNTEyODQwMTI2MzUzMjYzDA82NTU3NjY3NzE0NDU2NDYMDzIyNDc3NjQ4MDE3NTc1NQwPNDc2MTAwMjYyMDMwNzQzDA8xMjE1NTExMDc3MjYxNDcMDzExNDc2NTMyMDU0MDEyNQwPNzY1Mjc2Njg0MTE1MjQ1DA80NDc1Nzg1NDgwMzEwODAMDzQ0MzgyMDY0ODQ0MDYwNgwPMDg3MDAwMDgzNjIyMDMwDA8yNjg4NDM3MzYxNDM2MDUMDzgzMjMxNTM4MTQ3MzE0NgwPMzI2Njg1MjI4MjYzNDM3DA81ODgxODAxMzUwNTEwNTAMDzQ0NTEzNDYwMDUxMDA1OAwPMzI3NzQxNjUxNjU3MTU1DA80MTYwMTgyNTQwMjg1NDUMDzQ3MDE2MDE3MTE0Mzc3OAwPNzYwNjAxMjU3NzgwNjgwDA80NjE1MzQ4NDU1NTU3NjcMDzU2MjIzMzYxMzAxMTcyNgwPMTQzNzE2ODMxMTg4MjI0DA8wNDM3ODQ3MzU2NDYzMzEMDzg1MDU3MzQ4ODEyMTYwMAwPMzEzMTA3MjIwMjM0MjMxDA83NTczMDcyNjE2NTMzODIMDzE2MTEwODYyNjY1Nzg2NAwPNTUyNzUxMzAyNDA3ODg1DA8yNDA2MTg2MDc1NjEwMzgMDzA0NTA2MzcwNzQyODQ0MgwPODUzNzA1NTIwNTYwNzY2DA8yNTI4NTI3NDU2NTQ4NDUMDzMyNzE3ODIxMjMwMjc1NAwPMjMxMzA4MTE0MzU3MjE3DA8zNDQ3NDU3ODY4MzIxNzQMDzI0NzM0NDc3MTI4ODE4NwwPMzM2ODEzODAxMTUxMzg3DA8xMTU4MjU1MDAxMzg2MjIMDzQxMTcxNDQ4MjAwMjAyNQwPMjQ0NDU1MjYyNjA4NjIyDA8wMDUzNDgzMzg3MjI1NzYMDzY1NzM2NzExMTc4NjYyMQwPMDE2MDU0MTIxODY3NDcwDA8xNDU2ODcwNDY4MDEzMjAMDzIwNTg1MjYyODE1NzA4NwwPNTIyNDY4MjQxMTQ2MTU1DA8zMzY2MjMyNTY4MzczMjUMDzAxMTMzNzg3Nzc0ODU3MgwPMTE0ODU4MDEzMjE4NTIzDA84Nzg1MDc0MjYwMDgwMTIMDzQ2MzM2NDE4NzE1NjYyMQwPNTcwMzMyMDYxMzI1MDUzDA83Nzg1MzA4ODQ2NTMyNjgMDzMzNjgxMjIxNDQ0Mjg3NwwPNjIxODI1MjYxMzMxODQzDA8yNTc1NzU3MTc3MzI1MDIMDzYyNDQ4MjU3NTI4NTAyMAwPMzQ4NDA1NjU2MTUyMjI3DA83NjY3MDAxMzU1MTQ1NzIMDzYzODM0NDE1MjUzMTcyNgwPNjAzMjEwODA1NzIyNzU1DA84NzAxNjcxMTM2ODU3MzYMDzYyMjI4NjQ0NjIyNTM4NgwPODcwNTgyNzYyNTg1MzUzDA8wNDMzNTg2MzAzMjU2ODcMDzc1ODI2NTA4NDQzNTA0MQwPMDM4MjM4NzI3ODUwNTQ2DA83MjYxMzQyMDgzMzYyMTEMDzU2ODM3NTIxMjU1MDgxMwwPNzM0MDQyMzExNDMwNzQ2DA83MDU3NDIwNTcyODU3MDQMDzg4NTA3NzAxNDYxMDc0MQwPODExNDI3NTA4NDgxMTIyDA80MzM2MzQ0NjQxNDU3NjQMDzc0MDAxMzY3NTc4MzE2MwwPODg1MzUwMzI2MTcwMDc4DA84NDQwMzY3MDI4MzYxMzQMDzc0ODA4NzY4NjA2NTcxMAwPODA3NDg3MTU2NzcyNjg3DA82NDY4NzIzNzU1MDU2NjcMDzI4NTE2Nzc0NTgyMDY1MwwPNDY2ODczNDUxODI0MzE4DA81NDg2NzIzMzA3MDgxODQMDzcyNjQ1NjgwMzI2MDI3NwwPMzE1MDM4ODAyMDY1NDgzDA83NjEzMjczNjM2NjM4ODEMDzQ2NjUzMzYyMzg1MjcwNAwPMTQ4ODE4MTQ4ODcxODE1DA82ODQzMDIzNDc2ODU4MDYMDzUzNjEyODQzMzMwMDgzNwwPNDAxMzQ4Njc0ODg3NzE0DA84NjQ1NzU4MDI4MTg4ODYMDzc2NTQ3NzIwMzIzMDEwMQwPMDA4MTI2MjA1Mzc2NzA0DA8wNjM4NjAwNTI4MjY0MTQMDzY4MDg0MTc0Mzc3MTQ2MwwPNDUyMzg3ODU4NjEzNzA4DA80MjYyMjA2NTMwNTIwNTMMDzc3NzM1NDE1ODQzMzg1NQwPODcyNDc2ODQyMzY4NjI3DA82NTQ3NDQ3NjMwNTMyNzUMDzg0NjU2MjMxMTYxNjYwOAwPNzEzMTUzNzM3MTE1MDMwDA8yMDQ2Nzg2MjczMTEzNjUMDzU4MTYwNDcxNzIwNjY0MQwPMTYxODIzMDIzMTUzNjEyDA83MTgwMDM4MDEwMzc4NjAMDzA2ODQyNDc0NTQwNjIzMQwPMzU0NzQyMzc2NDQ4MDU4DA8wODc4MzUyMjc4MTc3MTcMDzQ4ODYzNDEyNjExNjMxNAwPMDA0NDAxMDE1MDc2OTc1DA8wMDQ0MDEwMTE0Mzg0MDEMDzAwNDQwMTAxMTQxOTc0MAwPNjUxODAxNjc4NjQ1MDA0DA8zNjgyMDMwMDY0MDIzMjgMDzAwMDAwNTA2MTY2NTYwMAwPMzczNjczMTAyMjE1ODY3DA81NTAwNjE2NjQzNDcxNzAMDzI3MjgzODQ4NDUzNjcxNgwPMTUyMTM4MDIxNTg0MTAxDA8yMDMxMTA1NjM2MzM3MTgMDzQzNDI3MDYyNzMzODEwOAwPMzY4MTUxODcyMjE0Mzg0DA80NzI3MjI4NzExNTg4ODQMDzYxMzMxMjMwNjQ2MTA1MAwPODgxODgxNzEwNjI2NzI0DA8xNTIxNTE3MjA2MzEyMTcMDzA0MzUwNzIyNzU1NjQyNQwPMTY3ODAxMzIwNjIwMDQ4DA83MDQwMzU4MzEyNTQzMjIMDzQ3Mzg4MDM2MDg3ODE2MgwPMTE3NTQxODEwMDM2NTg1DA83NDIxMjQyMDUxNzYxMzIMDzEzMzg4MTI4NDM1MTUxMQwPNDE1ODcyMjUwNDg4MjYwDA8yMzUwNjIzNjcyODMzMzYMDzQyMTU3Mzc4MjMxMzcxNwwPODU2MjIxNjM2NTQyODM4DA82Mzc1NDI2MTI3MDUxMTcMDzg4ODU2NDAyODYzMTA3MQwPNzg4NDc3MjM1Njg0MjEzDA8zMzA0MjQxMjQ0ODM0MTgMDzI3NTQzNzExMTQ0NzIzNgwPNTMwNjQwNjM3ODIzMjQyDA8xMjExNDIzMjE1ODI0NDUMDzMxNDY2MzMzNjQxMDUzMgwPNzI1NzE2NDI4NDIzNTIwDA8zNjM4NTYyMDI0MjYxMTQMDzIzNTUxNTY2MzI0NDMwMwwPNjI4NzYxMjE4MDA4MjY4DA8xMzg0MDcxNzM0ODY3MTYMDzYzNjYxMzI2MTM3NjU4MgwPNTg3MTE2MjcyMDcxMTEwDA8yNDA1NDAzMDQzMjc3NDgMDzM0MTYxNDI2MDMxMDI3NAwPNDQwNTc4NzE0NDM1NjI0DA82MTc3NzY0MTYwNzUwMTMMDzA1NDE1MTAzNzI3NzYxNgwPNjMzNDU2MzM0NTQ0NjE2DA8wNjU3NzY1NTE4NDQzODIMDzIxMzMzMTU4NTY2ODE1NgwPNTgxNTAwMjY2ODY3NTIwDA81NDMzNDI4NDYwNzc0MzcMDzAzNjM3NTcyNzgwNjc1MAwPMDcyMzQ2ODg0NTU3MDg0DA8yMjcyNzYzNzIzODcyODYMDzEwNDg3NjUwNzUxNTU4MAwPODIxMDY1MTIzNjM4MjU1DA83MjMwNzc1ODA2MTE1MzEMDzI2MDYxNjMzNDIwNzU0NAwPMzU2NTY0NjM4MDYxNzQxDA8yNDY4NzMzNTA3MjgyODAMDzIyNTgwMjIwODI0NzcxMwwPNDQ4MTQ3MzEzNzAwODM0DA82MTYwMzg4NTgzODYxMDMMDzc4NjcyODgzODg2MjA3NQwPNjgwMTczNTYxNzgwMjg0DA81NjA4MzA4NDcyMDgxMDAMDzYyMjM0ODI0NjIzNTY3NAwPNDA3NDc4Mzg0MTExMzQxDA8xNDgxMDI1NzU3MzA3MjEMDzY1MDY1ODI2MTQ1MzE3MQwPMDgyMzU0MjIwNzQ2NzU3DA82MjQ4MjY2NDc4MTE1ODIMDzI3MjI2MTI3Mjc0NDA0NAwPNTIwMjIwNzgwMTc2MTY2DA81MDE1MzI4MDE0MDgxMjUMDzI1NDMwMzcwMDQyODgyOAwPNjc0NDc4ODY4MzQ4MjgxDA80NjMzMTY3NDU1MjcyNzUMDzQ3MTE4NTQ1MDIwMzEyMgwPNjM1NDgwMjg2MTEzNjUyDA82MTM0MzE4MjI4NTI3NzMMDzIyMTYzNDczNDg2MTA4NgwPNjE4NjU3NDcxNzUyMTE0DA8zMjg1MjU1MTIzMTgwNzAMDzQ2MTAzMTQ0NDAzMDMyNAwPNTc2ODU4NDI3MjE0MTg2DA82NjU0MDAwNjgwMjgxMzEMDzMwNTcyMzIxODQ0MTgxMwwPNTQ1MTg0NDYwMDg4NTQ2DA82ODExMDczNDM4Njg3MzgwDQYJKoZIhvcNAQEFBQADgYEAQq6zHN8SP8w71Yyq+cwwNQ2VZ4UMPRw/9JkW8ZUJWC4gae2lOfeyyjtN3akXaT+p+vETtfoPuCpPjvzPYoN1RZieyJnpSVzUrNw/lM6kSP5DjGg5K/WKWYad0VkQg56Kynp2YVX4yKUhBydd7iBeSGP900LAHRWCR++xq+r98mI=
+MIDlet-Jar-RSA-SHA1: PRpjLFh81oAjHdPSZ/9lTe64ICSSHOk/MQMdRSqwsoGMSPID91mBRFEYOIQ/5nocEscacSi81o089Y0gMpEIP8V/EWBD7WDP6xqjC0gSyac+QjZm1Bu7Pzav+JC5J3KEkKOGy4wgQKJx02bArR/P9LhYAe7T6LVVFbfFyw2lhJA=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/EmptyLines.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,15 @@
+ 
+
+
+    
+	
+	 
+	    
+                
+                    
+                        
+                        
+         	
+ 
+
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/FL_Rocks.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,6 @@
+MIDlet-Version: 1.0
+MIDlet-Vendor: Standing Still Limited
+MIDlet-Jar-URL: http://195.114.231.97:7001/dls/delivery/ds/01AAvJ1WX3jmZsurMwoC/1/FL_Rocks.dm
+MIDlet-Install-Notify: http://195.114.231.97:7001/dls/delivery/ds/01AAvJ1WX3jmZsurMwoC/2/FL_Rocks/status
+MIDlet-Name: Rocks
+MIDlet-Jar-Size: 28196
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/NDRM.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,10 @@
+MIDlet-Jar-URL: NDRM.jar
+MIDlet-Install-Notify: http://uljava.gjmptw.de:8080/Index/Index/NDRM.jad?nstalled=NDRM_harmony
+MIDlet-Name: DRMonitor
+MIDlet-Vendor: m-internet.com Limited
+MIDlet-Version: 1.0
+MIDlet-Jar-Size: 24472
+MIDlet-Icon: /icon.png
+MIDlet-1: NDRM, /icon.png, ndrm.NDRMMIDlet
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/PlatformReqHTTP.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,11 @@
+MIDlet-1: PlatformReqHTTP, , com.nokia.midp.test.securitytests.PlatformReqHTTP
+MIDlet-Jar-Size: 2272
+MIDlet-Jar-URL: PlatformReqHTTP.jar
+MIDlet-Name: PlatformReqHTTP
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+URL: http://tcktest3.extra.wirelessfuture.com:8080/axis/servlet/marika.GetServlet
+MIDlet-Certificate-1-1: MIICPDCCAaUCBD+zblMwDQYJKoZIhvcNAQEEBQAwZTELMAkGA1UEBhMCZmkxEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQwwCgYDVQQLEwNKQ0YxFDASBgNVBAMTC01hcmlrYSBGYWJlMB4XDTAzMTExMzExNDMxNVoXDTEzMTExMDExNDMxNVowZTELMAkGA1UEBhMCZmkxEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQwwCgYDVQQLEwNKQ0YxFDASBgNVBAMTC01hcmlrYSBGYWJlMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsUJbYMb9GlP99Ax9n6m2AIAg+b2zC0u6h7OuLP+ls9OpI0sLtE1uBABCePloS0uKwmjtsdFc1zLyA/bpbi644xDw3PMIEhppeuKbLrog5uMk5wD1bFk5kJXYwYEorWVrFpLDmqFwEMig2a+Uhf7eTq1Ze/JgMHoUDXRo0eVsnFwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBACuTqh37N34NnVzziuj66gmiE3rt7fKDTUCiqoHGfv7dpr4M0e8+y6FvtXtUXEajxX/DZbZuy0E9mZqmXsYyP2DDKbCg4cBJ23uOCffuYYVQFSnv4RQFVrQr4jMUHgX7wT5Ox4Ee8xcpsvWWfOgTY4zyEznOBUj6Uw4Xj7F+1yk8
+MIDlet-Jar-RSA-SHA1: UfQMdprNMMmJOk9INrJXe+Y06tnuL+zOJz4gJNEKnLPOzb6UwR2zczNddwfdBxENKbhw2RVp3GBQD2OZjB6UEU4kiw2S956RMlk5OVfqwXB5wvYPCePX6/8qgKSUmsBjNiEpXBGE2UT7MqbRApxmsf/OaDnzzd9Tlr9jUw+YU3w=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/SimpleRMS8.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-Name: SimpleRMS
+Created-By: 1.5.0_12 (Sun Microsystems Inc.)
+MIDlet-Vendor: Unknown
+MIDlet-1: SimpleRMS, SimpleRMS.png, SimpleRMS
+MIDlet-Version: 1.0
+MicroEdition-Profile: MIDP-2.0
+
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/SimpleRMS8.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/SunShines3D_DEMO_nokia_N900_EN_IGP_ATandT_901.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,24 @@
+IGP-BS: MP3D=MP3D_BS;SCDA=SCDA_BS;ASP3=ASP3_BS;PSDK=PSDK_BS;
+IGP-CATEGORIES: WN=WN;BS=BS;PROMO=0;OP=OP;
+IGP-DEMOS: DEMOPG=DEL;
+IGP-PROMOS: MB3D=MB3D;PB07=PB07;BBRK=BBRK;
+IGP-VERSION: 2.5.0
+IGP-WN: RBPF=RBPF_WN;MMN=MMN_WN;BRBO=BRBO_WN;ASCR=ASCR_WN;
+MIDLET-FULLVERSION-URL: http://advers.bestgamfts.com/redir/?from=D725&game=MD3D&op=GONG&game_type=DM&lg=EN
+MIDlet-1: Sun Shines 3D Demo, /icon.png, HightS3D
+MIDlet-Data-Size: 8192
+MIDlet-Description: Sun Shines 3D, Emulated sun shine in full 3D!
+MIDlet-Icon: /icon.png
+MIDlet-Jar-Size: 754864
+MIDlet-Jar-URL: SunShines3D_DEMO_nokia_N900_EN_IGP_ATandT_901.jar
+MIDlet-Name: Sun Shines 3D Demo
+MIDlet-Vendor: Celedons Two
+MIDlet-Version: 1.0.4
+Nokia-MIDlet-Block-Uninstall: true
+Nokia-MIDlet-Category: Applications
+Nokia-MIDlet-UID-1: 0x20012293
+Nokia-Scalable-Icon: /icon.svg
+Nokia-Scalable-Icon-MIDlet-1: /icon.svg
+URL-OPERATOR: http://bestgamfts.hereis.com/redir/?from=D725&op=GONG&game_type=DM&lg=EN&ver=2.5.0
+URL-PT: 0
+URL-TEMPLATE-GAME: http://bestgamfts.hereis.com/redir/?from=D725&op=GONG&game=XXXX&game_type=DM&lg=EN&emb=1&ver=2.5.0
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/SunShines3D_DEMO_nokia_N900_EN_IGP_ATandT_901.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/TestMidlet.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,14 @@
+MIDlet-1: TestMidlet, TestMidlet.png, TestMidlet
+MIDlet-Jar-Size: 3674
+MIDlet-Jar-URL: TestMidlet.jar
+MIDlet-Name: TestMidlet
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+: Empty attribute name
+ : White space only attribute name
+ 	: White space only attribute name 2
+a<>: separators in attribute name
+bo: control characters in attribute name
+c:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/TestMidlet2.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,3 @@
+a<>: separators in attribute name
+bo: control characters in attribute name
+c:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/TestMidlet3.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,9 @@
+MIDlet-1: TestMidlet, TestMidlet.png, TestMidlet
+MIDlet-Jar-Size: 3674
+MIDlet-Jar-URL: TestMidlet.jar
+MIDlet-Name: TestMidlet
+MIDlet-Vendor: Nokia
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+o: attribute name starts with CTL characters
+MIDlet-Version: 1.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/calc2_en_de_es_ES_fr_it_tr_TR_nl_NL_pt_PT.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,32 @@
+MIDlet-1: Calculator, i.png,common.control.CalculatorMIDlet
+MIDlet-Name: Calculator
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.5
+MIDlet-Jar-Size: 123
+Nokia-MIDlet-Category: Application
+Nokia-UI-Enhancement: CanvasHasBackground
+MIDlet-Data-Size: 150
+Vertical-Move-Delta: 10
+Vertical-Move-Period: 2
+Inline-Editing-Supported: true
+Nokia-Platform: Nokia*
+Nokia-MIDlet-Category: Games
+Nokia-MIDlet-Name-en: Calculator
+Nokia-MIDlet-Name-de: Rechner
+Nokia-MIDlet-Name-es-ES: Calculadora
+Nokia-MIDlet-Name-fr: Calculatrice
+Nokia-MIDlet-Name-it: Calcolatrice
+Nokia-MIDlet-Name-tr-TR: Hesaplamalar
+Nokia-MIDlet-Name-nl-NL: Rekenmachine
+Nokia-MIDlet-Name-pt-PT: Calculadora
+Nokia-MIDlet-1-en: Calculator
+Nokia-MIDlet-1-de: Rechner
+Nokia-MIDlet-1-es-ES: Calculadora
+Nokia-MIDlet-1-fr: Calculatrice
+Nokia-MIDlet-1-it: Calcolatrice
+Nokia-MIDlet-1-tr-TR: Hesaplamalar
+Nokia-MIDlet-1-nl-NL: Rekenmachine
+Nokia-MIDlet-1-pt-PT: Calculadora
+MIDlet-Jar-Size: 84713
+MIDlet-Jar-URL: calc2_en_de_es_ES_fr_it_tr_TR_nl_NL_pt_PT.jar
+Nokia-MIDlet-Category: Best-Sellers
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/calc2_en_de_es_ES_fr_it_tr_TR_nl_NL_pt_PT.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/ceac00.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,12 @@
+MIDlet-Name: ASCII
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceac00/bin/CEAC00.jar
+MIDlet-Jar-Size: 1494
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ASCII,,USASCII.CEAC00_01
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=9F732D83F3B6AF98EB6577EA92366D95&tID=ceac00
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/cecn02.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,12 @@
+MIDlet-Name: ùÓùÔùÕ
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cecn02/bin/CECN02.jar
+MIDlet-Jar-Size: 1417
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ùÓùÔùÕ, ,Big5.CECN02_01
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=C9EABB544D0A47788C684D71A5A1C8C9&tID=cecn02
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/cecn06.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,12 @@
+MIDlet-Name: ‚X‚Y‚Z‚[
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cecn06/bin/CECN06.jar
+MIDlet-Jar-Size: 1415
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ‚X‚Y‚Z‚[,,GBK.CECN06_01
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=79CD95B6352F8388513D6DDB699817CF&tID=cecn06
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/ceis00.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,19 @@
+MIDlet-Name: ÷ùø
+
+MIDlet-Vendor: Nokia
+
+MIDlet-Version: 1.0
+
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceis00/bin/CEIS00.jar
+
+MIDlet-Jar-Size: 1450
+
+MIDlet-1: ÷ùø, , ISO8859_1.CEIS00_01
+
+MicroEdition-Configuration: CLDC-1.0
+
+MicroEdition-Profile: MIDP-2.0
+
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=1D11AB7B2A1E2BC200165EB4CF554232&tID=ceis00
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/ceis09.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,11 @@
+MIDlet-Name: ¢£¤
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceis09/bin/CEIS09.jar
+MIDlet-Jar-Size: 1457
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ¢£¤, ,ISO8859_15.CEIS09_01
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=7F914DE931B9D04E5F731F1ADCD163F6&tID=ceis09
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/ceis14.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,12 @@
+MIDlet-Name: ??»
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceis14/bin/CEIS14.jar
+MIDlet-Jar-Size: 1456
+MIDlet-1: ??», ,ISO8859_16.CEIS14_01
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=336AA79A2E085DC20583865B841DBE6B&tID=ceis14
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/cejp04.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,4 @@
+MIDlet"DNa"De:"D"D@!"D"D"D"D"D"D"DMIDlet"DVe"Ddo"D"D"DNoki"D"D"DMIDlet"DVe"D"Dio"D"D"D1."D"D"DMIDlet"DJa"D"DURL:"DCEJP04"Dja"D"D"DMIDlet"DJa"D"DSi"De:"D1439"D"DMIDlet"D1:"D"D@!"D"D"D"D"D"D"D"DJISX0208"DCEJP04_0"D"D"DMicr"DEditio"D"DCo"Dfigu"Datio"D"D"DCLDC"D1."D"D"DMicr"DEditio"D"DPr"Dfile"D"DMIDP"D2."D"D"D
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=CF0B99F53572032690A4D26E0CB83D02&tID=cejp04
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/ceko01.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,11 @@
+MIDlet-Name: ÍÎÏÐ
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceko01/bin/CEKO01.jar
+MIDlet-Jar-Size: 1429
+MIDlet-1: ÍÎÏÐ, ,KOI8_R.CEKO01_01
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=64E5A88BE41622497EDF05039C15F26C&tID=ceko01
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/cems01.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,12 @@
+MIDlet-Name: ýþ€
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cems01/bin/CEMS01.jar
+MIDlet-Jar-Size: 1465
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ýþ€, ,windows_1250.CEMS01_01
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=3F627BEFBC6E8A0FB9510BA4EB42AE6F&tID=cems01
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/cems11.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,12 @@
+MIDlet-Name: ýþÿ
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cems11/bin/CEMS11.jar
+MIDlet-Jar-Size: 1467
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ýþÿ, ,windows_1256.CEMS11_01
+MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=3EBDFC736561D6876CF9ED93D3BF1B36&tID=cems11
+
+
+
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut03.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut04.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut08.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut09.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/einstein_EN_FR_IT_DE_ES_N97_v2942.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/javahelper.mif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/mine_en_fr_de_it_es_ES_pt_PT.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,33 @@
+MIDlet-Name: HecticMine
+MIDlet-1: HecticMine,/images/icon.png,com.nokia.mid.appl.mine.common.MineMIDlet
+Nokia-MIDlet-Category: Game
+MIDlet-Icon: /images/icon.png
+MIDlet-Vendor: Nokia
+MIDlet-Version: 3.0.4
+MIDlet-Description: HecticMine
+Period-Speed-ms: 100
+Vertical-Text-Offset: -2
+Nokia-Platform: Nokia*
+Nokia-MIDlet-Name-en: 
+Nokia-MIDlet-Name-fr: Hectic Mine
+Nokia-MIDlet-Name-de: Hectic Mine
+Nokia-MIDlet-Name-it: Hectic Mine
+Nokia-MIDlet-Name-es-ES: Hectic Mine
+Nokia-MIDlet-Name-pt-PT: Hectic Mine
+MIDlet-Jar-Size: 233616
+MIDlet-Jar-URL: mine_en_fr_de_it_es-ES_pt-PT.jar
+MIDlet-Certificate-1-1: MIIDhDCCAmygAwIBAgIEQhnyeTANBgkqhkiG9w0BAQUFADAzMQ4wDAYDVQQKEwVOb2tpYTEhMB8
+ GA1UEAxMYTm9raWEgQ29udGVudCBTaWduaW5nIENBMB4XDTA1MDIyMTE0Mzg0OVoXDTE2MDEwMjExMDUwNFowKDEOMAwGA1UEC
+ hMFTm9raWExFjAUBgNVBAMTDU5va2lhIENvbnRlbnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAK2PV8KLVSZ9OePe4k
+ 78GeQ0MiujbMd1wU9/xqhUFPst50drxhKzH+fMxvXgQOJ7viReolqWyq+ZmKpikGa+6SdqHysnVBhAqo9SLMNjlMfoOXVJ/lvM
+ gOk9k5oyVhBqFonw/FDDHmINC6w9o83e3gRq1C1m2T368yHbZtKifiVdAgMBAAGjggEtMIIBKTAOBgNVHQ8BAf8EBAMCB4AwEw
+ YDVR0lBAwwCgYIKwYBBQUHAwMwggEABgNVHSAEgfgwgfUwgfIGCysGAQQBXgExAQMBMIHiMIHRBggrBgEFBQcCAjCBxBqBwVJl
+ bGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgc3RhbmRhcm
+ QgdGVybXMgYW5kIGNvbmRpdGlvbnMgYW5kIGxpbWl0YXRpb25zIG9mIHVzZSwgYXMgZGV0YWlsZWQgaW4gdGhlIENlcnRpZmlj
+ YXRlIFByYWN0aWNlIFN0YXRlbWVudCBhdmFpbGFibGUgZnJvbSBOb2tpYS4wDAYIKwYBBQUHAgEWADANBgkqhkiG9w0BAQUFAA
+ OCAQEAvXtgKSffVjD52zHgUEFBBmXFq3QjgWNh8+cQTD23wnPYgfA4GBomMmznLiV3X03SOOI42DUUenQ9baPb78iU8AngF6xd
+ oOpFYlNtVka9YdD9mA0jtkoe4YEmykxPabSKDS50xVYgQG+5Y9H8nO9EyIiviP6drFmpRv635mf8Trlao63XIx4geoCMb9v8vS
+ dfs0louKB9DrjwFki/uHAQvRcVYnFNtAwHdri22UMx+GMppuY4/oPVvQqxgzfP+1AX/w2lgG7pi3lbVVUB4MLhG36kZIk8/J7B
+ lmATAL1/G5t19HR3+9doz5H94y3WQG7ClWN1eoQtjLlvLfZO/iu20g==
+MIDlet-Jar-RSA-SHA1: ncuy0soEPUB4OPGHNyLn1ldXU2FvKvs0bUKGn/aPQefKI15aOlrczlapIWreUukE3ArQImU/xwxWh0
+ Q8LROEULJKXRIYyoGCCblM6o6EPYn+YT+CDd/HV8JlHS6OO+sAV//9vWuo9orIwSwdKN8wGl0g1JmPl8LF8V5/MjSmyh8=
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/utf8bom.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,8 @@
+MIDlet-Name: ışÿ
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MIDlet-Jar-URL: utf8bom.jar
+MIDlet-Jar-Size: 1417
+MicroEdition-Profile: MIDP-2.0
+MicroEdition-Configuration: CLDC-1.0
+MIDlet-1: ışÿ, ,UTF8BOM.UTF8BOM
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -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: 
+#
+-->
+<project name="InstallerTestServer" default="dist" basedir="..">
+    <property name="catalina.home" value="C:/apps/apache-tomcat-6.0.26"/>
+    <property name="build" value="${basedir}/build"/>
+    <property name="java.build" value="${build}/javabuild"/>
+    <property name="classes" value="${java.build}/WEB-INF/classes"/>
+    <property name="src" value="${basedir}/javasrc"/>
+    <property name="web" value="${basedir}/content"/>
+
+    <path id="compile.classpath">
+        <fileset dir="${catalina.home}/bin">
+            <include name="*.jar"/>
+        </fileset>
+        <pathelement location="${catalina.home}/lib"/>
+        <fileset dir="${catalina.home}/lib">
+            <include name="*.jar"/>
+        </fileset>
+    </path>
+
+    <target name="compile">
+        <mkdir dir="${classes}"/>
+        <javac source="1.5" target="1.5" destdir="${classes}" srcdir="${src}">
+            <classpath refid="compile.classpath"/>
+        </javac>
+    </target>
+
+    <target name="dist" depends="compile">
+        <jar jarfile="${build}/installertest.war" basedir="${java.build}"
+            manifest="${web}/META-INF/MANIFEST.MF"/>
+        <jar jarfile="${build}/installertest.war" basedir="${web}"
+            update="true"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="${java.build}"/>
+        <delete file="${build}/installertest.war"/>
+    </target>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/build/readme.txt	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,41 @@
+Building
+--------
+
+Requirements:
+    * Apache Ant.
+    * Apache Tomcat. (Tested with 6.0.26)
+
+Change "catalina.home" property in build.xml file to match your Tomcat
+installation directory. Default is as follows:
+
+    <property name="catalina.home" value="C:/apps/apache-tomcat-6.0.26"/>
+
+To compile the project and to create .war archive just use either of following
+commands:
+
+    ant
+    ant dist
+
+To compile only use:
+
+    ant compile
+
+And to clean all build artifacts use:
+
+    ant clean
+
+Deployment
+----------
+
+After build is complete, "installertest.war" file is created into the "build"
+directory. Deploy it to Tomcat instance as any other .war file. For HTTP
+authentication tests it is assumed that user named "guest" with password
+"guest" and with role "guest" exits.
+
+Running the tests
+-----------------
+
+Before running tests add option "-server=server_ip_address:port" to
+NotificationPosterTest, DownloaderTest and InstallerEngineTest
+test suites in jiut.bat (for S60) or in build.xml (for Linux)
+in "javainstaller\installer\tsrc\build" directory.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,8 @@
+MIDlet-1: HelloWorld, , helloworld.HelloWorld
+MIDlet-Jar-Size: 1511
+MIDlet-Jar-URL: HelloWorld.jar
+MIDlet-Name: HelloWorld
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
\ No newline at end of file
Binary file javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld_8mb.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,10 @@
+MIDlet-1: HelloWorld, , helloworld.HelloWorld
+MIDlet-Jar-Size: 7867927
+MIDlet-Jar-URL: HelloWorld_8mb.jar
+MIDlet-Name: HelloWorld_8mb
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+MIDlet-Install-Notify: http://<SERVER><CONTEXT>/notify?tID=900_success
+MIDlet-Delete-Notify: http://<SERVER><CONTEXT>/notify?tID=912_deletion
Binary file javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld_8mb.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld_ota.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,10 @@
+MIDlet-1: HelloWorld, , helloworld.HelloWorld
+MIDlet-Jar-Size: 1511
+MIDlet-Jar-URL: HelloWorld.jar
+MIDlet-Name: HelloWorld
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+MIDlet-Install-Notify: http://<SERVER><CONTEXT>/notify?tID=900_success
+MIDlet-Delete-Notify: http://<SERVER><CONTEXT>/notify?tID=912_deletion
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld_redirect.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,9 @@
+MIDlet-1: HelloWorld, , helloworld.HelloWorld
+MIDlet-Jar-Size: 1719
+MIDlet-Jar-URL: http://<SERVER><CONTEXT>/redirect?name=HelloWorld_redirect.jar
+MIDlet-Name: HelloWorld_redirect
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
+MIDlet-Install-Notify: http://<SERVER><CONTEXT>/notify?tID=900_success
Binary file javamanager/javainstaller/installer/tsrc/testserver/content/HelloWorld_redirect.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/META-INF/MANIFEST.MF	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/META-INF/context.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# 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: 
+#
+-->
+<Context docBase="installertest" path="/installertest">
+</Context>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/WEB-INF/web.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# 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:
+#
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+  <display-name>installertest</display-name>
+
+  <servlet>
+    <description></description>
+    <display-name>redirect</display-name>
+    <servlet-name>redirect</servlet-name>
+    <servlet-class>com.nokia.mj.impl.installer.testserver.RedirectServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>redirect</servlet-name>
+    <url-pattern>/redirect</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <description></description>
+    <display-name>jad</display-name>
+    <servlet-name>jad</servlet-name>
+    <servlet-class>com.nokia.mj.impl.installer.testserver.JadServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>jad</servlet-name>
+    <url-pattern>*.jad</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <description></description>
+    <display-name>notify</display-name>
+    <servlet-name>notify</servlet-name>
+    <servlet-class>com.nokia.mj.impl.installer.testserver.NotifyServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>notify</servlet-name>
+    <url-pattern>/notify</url-pattern>
+  </servlet-mapping>
+
+  <security-constraint>
+    <web-resource-collection>
+      <web-resource-name></web-resource-name>
+      <url-pattern>/httpauth/*</url-pattern>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>guest</role-name>
+    </auth-constraint>
+  </security-constraint>
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>httpauth</realm-name>
+  </login-config>
+
+  <security-role>
+    <role-name>guest</role-name>
+  </security-role>
+
+</web-app>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/content/httpauth/HelloWorld_http_auth.jad	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,8 @@
+MIDlet-1: HelloWorld, , helloworld.HelloWorld
+MIDlet-Jar-Size: 1721
+MIDlet-Jar-URL: HelloWorld_http_auth.jar
+MIDlet-Name: HelloWorld_http_auth
+MIDlet-Vendor: Nokia
+MIDlet-Version: 1.0
+MicroEdition-Configuration: CLDC-1.0
+MicroEdition-Profile: MIDP-2.0
\ No newline at end of file
Binary file javamanager/javainstaller/installer/tsrc/testserver/content/httpauth/HelloWorld_http_auth.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/javasrc/com/nokia/mj/impl/installer/testserver/JadServlet.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* 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.installer.testserver;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class JadServlet
+ */
+public class JadServlet extends HttpServlet
+{
+    private static final long serialVersionUID = 1L;
+
+    protected void processRequest(HttpServletRequest request,
+                                  HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        ServletContext context = getServletContext();
+        String localPath = context.getRealPath(request.getServletPath());
+
+        response.setContentType("text/vnd.sun.j2me.app-descriptor");
+
+        BufferedReader in = null;
+        ServletOutputStream out = null;
+
+        try
+        {
+            in = new BufferedReader(new FileReader(localPath));
+            out = response.getOutputStream();
+
+            String line = in.readLine();
+            while (line != null)
+            {
+                if (line.startsWith("MIDlet-Jar-URL:")
+                        || line.startsWith("MIDlet-Install-Notify:")
+                        || line.startsWith("MIDlet-Delete-Notify:"))
+                {
+                    line = line.replaceAll("<SERVER>", request.getServerName()
+                                           + ":" + request.getServerPort());
+                    line = line.replaceAll("<CONTEXT>",
+                                           request.getContextPath());
+                }
+                out.println(line);
+                line = in.readLine();
+            }
+        }
+        catch (FileNotFoundException e)
+        {
+            response.sendError(HttpServletResponse.SC_NOT_FOUND,
+                               request.getServletPath());
+        }
+        finally
+        {
+            if (out != null)
+            {
+                out.close();
+            }
+            if (in != null)
+            {
+                in.close();
+            }
+        }
+    }
+
+    protected void doGet(HttpServletRequest request,
+                         HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        processRequest(request, response);
+    }
+
+    protected void doPost(HttpServletRequest request,
+                          HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        processRequest(request, response);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/javasrc/com/nokia/mj/impl/installer/testserver/NotifyServlet.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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.installer.testserver;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class NotifyServlet
+ */
+public class NotifyServlet extends HttpServlet
+{
+    private static final long serialVersionUID = 1L;
+
+    protected void processRequest(HttpServletRequest request,
+                                  HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        response.setStatus(HttpServletResponse.SC_OK);
+    }
+
+    protected void doGet(HttpServletRequest request,
+                         HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        processRequest(request, response);
+    }
+
+    protected void doPost(HttpServletRequest request,
+                          HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        processRequest(request, response);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/tsrc/testserver/javasrc/com/nokia/mj/impl/installer/testserver/RedirectServlet.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* 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.installer.testserver;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class RedirectServlet
+ */
+public class RedirectServlet extends HttpServlet
+{
+    private static final long serialVersionUID = 1L;
+
+    protected void processRequest(HttpServletRequest request,
+                                  HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        int redirectCount = 1;
+        String redirectUrl = "http://" + request.getServerName() + ":"
+                             + request.getServerPort()
+                             + request.getContextPath();
+
+        String countParam = request.getParameter("count");
+        String nameParam = request.getParameter("name");
+
+        if (countParam != null)
+        {
+            try
+            {
+                redirectCount = Integer.parseInt(countParam);
+            }
+            catch (NumberFormatException nfe)
+            {
+            }
+        }
+
+        if (redirectCount > 1)
+        {
+            redirectUrl += request.getServletPath() + "?count="
+                           + (redirectCount - 1) + "&name=";
+        }
+        else
+        {
+            redirectUrl += "/";
+        }
+
+        redirectUrl += nameParam;
+        response.sendRedirect(redirectUrl);
+    }
+
+    protected void doGet(HttpServletRequest request,
+                         HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        processRequest(request, response);
+    }
+
+    protected void doPost(HttpServletRequest request,
+                          HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        processRequest(request, response);
+    }
+
+}
--- a/javamanager/javainstaller/installerui/build/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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/InstallerUi.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/InstallerUi.java	Thu Jul 22 16:31:34 2010 +0100
@@ -385,6 +385,13 @@
     }
 
     /**
+     * Executes given Runnable synchronously in the UI thread. 
+     */
+    public void syncExec(Runnable aRunnable)
+    {
+    }
+
+    /**
      * Writes an info log entry to JavaInstaller log.
      *
      * @param aMsg message to be logged
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/InstallerUiFactory.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/InstallerUiFactory.java	Thu Jul 22 16:31:34 2010 +0100
@@ -50,9 +50,9 @@
             installerUi = (InstallerUi)clazz.newInstance();
             installerUi.init(aMode, aListener);
         }
-        catch (Exception ex)
+        catch (Throwable t)
         {
-            logError("Instantiating " + className + " failed", ex);
+            logError("Instantiating " + className + " failed", t);
         }
         return installerUi;
     }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/CertificateDetailsView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorDetailsView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallConfirmationView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/LaunchAppQueryView.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/LaunchAppQueryView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -18,12 +18,9 @@
 
 package com.nokia.mj.impl.installer.ui.eswt2;
 
-import com.nokia.mj.impl.installer.ui.InstallInfo;
 import com.nokia.mj.impl.installer.ui.LaunchAppInfo;
 
-import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Button;
 
 /**
  * LaunchAppQueryView asks from the user if the installed
@@ -31,9 +28,6 @@
  */
 public class LaunchAppQueryView extends ConfirmationViewBase
 {
-    private LaunchAppInfo iLaunchAppInfo = null;
-    private Button iDefaultButton = null;
-
     /** Constructor */
     protected LaunchAppQueryView()
     {
@@ -58,7 +52,6 @@
             return false;
         }
 
-        iLaunchAppInfo = aLaunchAppInfo;
         // Use confirm() from super class to display the view.
         boolean result = confirm();
         // Return the result to the client.
@@ -81,26 +74,4 @@
     {
         // User selection data is initialized in button listeners.
     }
-
-    /**
-     * Returns SWT style for this view.
-     */
-    protected int getStyle()
-    {
-        return SWT.V_SCROLL;
-    }
-
-    /**
-     * Called after view and commands have been created. Subclasses
-     * can overrride this method to set focus to their own default
-     * commands.
-     */
-    protected void setDefaultCommand()
-    {
-        if (iDefaultButton != null)
-        {
-            iDefaultButton.setFocus();
-            getShell().setDefaultButton(iDefaultButton);
-        }
-    }
 }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/RuntimeConfirmationView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/build/javasifplugin.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -52,9 +52,6 @@
 USERINCLUDE     ../inc
 USERINCLUDE     ../../../../inc
 
-SYSTEMINCLUDE   ../../../../inc
-SYSTEMINCLUDE   /epoc32/include/mw/usif
-
 // Libraries
 LIBRARY         apgrfx.lib
 LIBRARY         apmime.lib
--- a/javamanager/javainstaller/javasifplugin/inc/javasifplugin.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/inc/javasifplugin.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/inc/resultsserver.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/src/proxy.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/src/resultsserver.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/tsrc/build/testsifapi.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javalauncher/src.s60/javalauncher.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javalauncher/src.s60/javalauncher.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -92,7 +92,7 @@
     JavaStorageApplicationList_t  foundEntries;
 
 
-    // Get MIDlet-n from APPLICATION_PACKAGE_ATTRIBUTES_TABLE based on 
+    // Get MIDlet-n from APPLICATION_PACKAGE_ATTRIBUTES_TABLE based on
     // PACKAGE_ID and NAME.
     attribute.setEntry(ID, aPackageId);
     findPattern.insert(attribute);
@@ -107,7 +107,7 @@
         return KErrNotFound;
     }
 
-    // Found the MIDlet-n argument. Now getting the MIDlet name and 
+    // Found the MIDlet-n argument. Now getting the MIDlet name and
     // main class. Name is the first argument and main class is the last
     // in the comma separated list.
     std::wstring value = foundEntries.front().begin()->entryValue();
@@ -549,6 +549,10 @@
         err = getUidFromCommandLine(cmdLineBuf, uid);
         if (KErrNone != err)
         {
+            ELOG1WSTR(EJavaCaptain,
+                "JavaLauncher: process command line was %s",
+                 (wchar_t *)(cmdLineBuf.PtrZ()));
+
             CleanupStack::PopAndDestroy(pBufCmdLine);
             CleanupStack::PopAndDestroy(commandLine);
             return err;
@@ -773,6 +777,8 @@
               "javalauncher: OMJ app launch: Exception %s caught", e.what());
     }
 
+    delete pBufCmdLine;
+
     return err;
 }
 
--- a/javamanager/javamanager.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javamanager.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javarecognizer/build/recjar.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javarecognizer/build/recjar.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -32,7 +32,11 @@
 // Use bytepair compression to enable code paging
 PAGED
 
+APP_LAYER_SYSTEMINCLUDE
+
 USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc 
+
 SOURCEPATH      ../src
 
 SOURCE          recjar.cpp
@@ -40,9 +44,6 @@
 TARGET          recjar.rsc
 END
 
-SYSTEMINCLUDE   ../../../inc 
-APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE   /epoc32/include/ecom
 
 LIBRARY         euser.lib apmime.lib efsrv.lib
 
--- a/javamanager/javaregistry/build/eabi/javaregistryclientu.def	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/build/eabi/javaregistryclientu.def	Thu Jul 22 16:31:34 2010 +0100
@@ -209,4 +209,12 @@
 	_ZNK4Java7Manager8Registry34CWriteableJavaRegistryPackageEntry17UsedUserDiskSpaceEv @ 208 NONAME
 	_ZNK4Java7Manager8Registry34CWriteableJavaRegistryPackageEntry14IsPreinstalledEv @ 209 NONAME
 	_ZNK4Java25CJavaRegistryPackageEntry14IsPreinstalledEv @ 210 NONAME
+	_ZN4Java14CJavaAttributeD0Ev @ 211 NONAME
+	_ZN4Java14CJavaAttributeD1Ev @ 212 NONAME
+	_ZN4Java14CJavaAttributeD2Ev @ 213 NONAME
+	_ZN4Java18CJavaRegistryEntryD0Ev @ 214 NONAME
+	_ZN4Java18CJavaRegistryEntryD1Ev @ 215 NONAME
+	_ZN4Java18CJavaRegistryEntryD2Ev @ 216 NONAME
+	_ZThn4_N4Java14CJavaAttributeD0Ev @ 217 NONAME
+	_ZThn4_N4Java14CJavaAttributeD1Ev @ 218 NONAME
 
--- a/javamanager/javaregistry/client/src/javaattribute.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/client/src/javaattribute.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -92,7 +92,7 @@
 // ---------------------------------------------------------------------------
 // CJavaAttribute::~MJavaAttribute
 // ---------------------------------------------------------------------------
-CJavaAttribute::~CJavaAttribute()
+EXPORT_C CJavaAttribute::~CJavaAttribute()
 {
     delete iName;
     delete iValue;
--- a/javamanager/javaregistry/client/src/javaregistryentry.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/client/src/javaregistryentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -115,7 +115,7 @@
 // CJavaRegistryEntry::~CJavaRegistryEntry
 // ---------------------------------------------------------------------------
 //
-CJavaRegistryEntry::~CJavaRegistryEntry()
+EXPORT_C CJavaRegistryEntry::~CJavaRegistryEntry()
 {
     if (iWritableEntry)
     {
--- a/javamanager/javaregistry/client/src/writeablejavaregistry.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/client/src/writeablejavaregistry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -414,7 +414,7 @@
             }
         }
     }
-    catch (ExceptionBase)
+    catch (ExceptionBase& ee)
     {
         ELOG1WSTR(EJavaStorage, "MediaId conversion failed: '%s'", value);
     }
--- a/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/build/testlegacyregistry.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/src/AllTests.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/src/testinstalledappsregistryentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/src/testlegacyregistry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/src/testmidletentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/legacy/tsrc/src/testsuiteentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/build/alltests.mmp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/src/AllTests.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/src/AllTests.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/src/testregistry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/src/testregistryapplicationentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/src/testregistryentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaregistry/tsrc/src/testregistrypackageentry.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/build/javaapplicationsettingsview.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javasettings/appsettingsview_qt/build/javaapplicationsettingsview.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -15,8 +15,9 @@
 #
 TEMPLATE = lib
 TARGET = javaapplicationsettingsview
-CONFIG += qt hb stl plugin
-LIBS += -ljavastorage -lcmapplsettingsui -ljavaconnectionmanager -lqtbearer -ljavautils
+CONFIG += qt hb stl plugin mobility
+MOBILITY += bearer
+LIBS += -ljavastorage -lcmapplsettingsui -ljavaconnectionmanager -ljavautils
 TRANSLATIONS = javaruntimeapplicationsettings.ts          
 
 INCLUDEPATH += ../inc ../../../../inc
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.h	Thu Jul 22 16:31:34 2010 +0100
@@ -80,7 +80,7 @@
     void writeToStorage(JavaApplicationSettings& settings);
     bool findFromStorage(const std::wstring&, const std::wstring&, const std::wstring&, const std::string&);
     std::wstring readFromStorage(const std::wstring&, const std::wstring&, const std::wstring&, const std::string&);
-    std::vector<IndexedSettingsName> readFromStorage(const std::wstring& aColumnName, const std::string& aTableName);
+    std::vector<IndexedSettingsName> readFromStorage(const std::wstring& aColumnName, const std::string& aPrimaryTableName,const std::string& aSecondaryTableName);
     void filterSecuritySettings(JavaApplicationSettings& settings);
     void findEntry(const java::storage::JavaStorageApplicationList_t&, const std::wstring&, std::wstring& eValue);
     void readSuiteUid(const QString& aAppUid);
--- a/javamanager/javasidchecker/build/bld.inf	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* 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:  Build information file for Java SID Checker component
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-javasidchecker.mmp
--- a/javamanager/javasidchecker/build/javasidchecker.mmp	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* 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 is an ECOM plugin for Symbian AppArc (database that contains
-*                info on all applications installed to the device)
-*                This plugin tells AppArc whether Java application installed
-*                to a removable storage media is present and can be executed.
-*
-*/
-
-
-//  INCLUDES
-#include <../../../inc/project_defines.hrh>
-#include <../../../inc/build_defines.hrh>
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-#include <../../../inc/java_stdcpp_support_for_dll.hrh>
-
-TARGET javasidchecker.dll
-CAPABILITY All -Tcb
-TARGETTYPE plugin
-
-UID 0x10009d8d 0x10281FBE
-
-// Use bytepair compression to enable code paging
-PAGED
-
-// Includes
-USERINCLUDE     .
-USERINCLUDE     ../inc
-USERINCLUDE     ../../../inc
-
-// Sources
-SOURCEPATH    ../src
-SOURCE        javasidchecker.cpp
-
-start RESOURCE ../data/10281FBE.rss
-target javasidchecker.rsc
-end
-
-#ifdef RD_JAVA_OLD_SIDCHECKER_LIBRARY
-LIBRARY apfile.lib
-#else
-LIBRARY aplist.lib
-#endif
-
-LIBRARY ecom.lib
-LIBRARY javaregistryclient.lib
--- a/javamanager/javasidchecker/data/10281FBE.rss	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* 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:  Java Sid Checker is an ECOM plugin for Symbian AppArc
-*                (database that contains info on all applications installed
-*                 to the device)
-*                It tells AppArc whether Java application installed
-*                to a removable storage media is present and can be executed.
-*
-*/
-
-
-// Registry file for the CApparcVerifierInterface JavaRegistry implementation
-
-#include <ecom/registryinfov2.rh>
-#include "javauids.h"
-
-RESOURCE REGISTRY_INFO r_registry
-{
-    resource_format_version = RESOURCE_FORMAT_VERSION_2;
-	dll_uid = KJavaSidCheckerDllUid;    // must match the name of this file
-	interfaces =
-	{
-		INTERFACE_INFO
-		{
-			interface_uid = KSidCheckerEcomIfUid;
-			implementations =
-			{
-				IMPLEMENTATION_INFO
-				{
-					implementation_uid = KSidCheckerEcomImplUid;
-					// Version number is 2 so that this implementation should override the old one in ROM
-                    version_no         =  2;
-					display_name = "JavaVerify";
-					default_data = "[10210e26]";
-					opaque_data  = "";
-					rom_only           =  0;
-				}
-			};
-		}
-	};
-}
--- a/javamanager/javasidchecker/inc/javasidchecker.h	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* 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:  Java Sid Checker is an ECOM plugin for Symbian AppArc
- *                (database that contains info on all applications installed
- *                 to the device)
- *                It tells AppArc whether Java application installed
- *                to a removable storage media is present and can be executed.
- *
-*/
-
-
-#ifndef JAVASIDCHECKER_H
-#define JAVASIDCHECKER_H
-
-#include <apsidchecker.h>
-#include <javaregistryincludes.h>
-
-NONSHARABLE_CLASS(CJavaSidChecker) : public CAppSidChecker
-        /** Java Sid checker.
-
-        This is an implementation of CAppSidChecker for checking native application Sids
-
-        This instance of the CAppSidChecker is used to verify that a native application
-        installed and can be launched.
-        */
-{
-public:
-    static CJavaSidChecker* NewL();
-    ~CJavaSidChecker();
-
-    // From CAppSidChecker
-    TBool AppRegisteredAt(const TUid& aSid, TDriveUnit aDrive);
-
-    void SetRescanCallBackL(const TCallBack &aCallback);
-
-private:
-    CJavaSidChecker();
-    TBool AppRegisteredAtL(const TUid& aSid, TDriveUnit aDrive);
-
-    Java::CJavaRegistry* iJavaRegistry;
-};
-
-#endif // JAVASIDCHECKER_H
--- a/javamanager/javasidchecker/src/javasidchecker.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* 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:  Java Sid Checker is an ECOM plugin for Symbian AppArc
- *                (database that contains info on all applications installed
- *                 to the device)
- *                It tells AppArc whether Java application installed
- *                to a removable storage media is present and can be executed.
- *
-*/
-
-
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-#include <appversion.h>
-
-#include "javauids.h"
-#include "javasidchecker.h"
-#include "logger.h"
-
-
-// DLL Entry point
-TBool E32Dll()
-{
-    return ETrue;
-}
-
-// ECOM Implementation Table
-const TImplementationProxy ImplementationTable[] =
-{
-    IMPLEMENTATION_PROXY_ENTRY(KSidCheckerEcomImplUid, CJavaSidChecker::NewL)
-};
-
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-}
-
-
-CJavaSidChecker* CJavaSidChecker::NewL()
-{
-    // Minimal construction (we don't want this to fail)
-    return new(ELeave) CJavaSidChecker;
-}
-
-CJavaSidChecker::CJavaSidChecker()
-{
-    iJavaRegistry = NULL;
-    LOG(EUtils, EInfo, "CJavaSidChecker: Constructor called");
-}
-
-CJavaSidChecker::~CJavaSidChecker()
-{
-    if (NULL != iJavaRegistry)
-    {
-        delete iJavaRegistry;
-        iJavaRegistry = NULL;
-    }
-    LOG(EUtils, EInfo, "CJavaSidChecker: Destructor called");
-}
-
-TBool CJavaSidChecker::AppRegisteredAt(const TUid& aSid, TDriveUnit aDrive)
-{
-    TBool installed = EFalse;
-
-    LOG1(EUtils, EInfo, "CJavaSidChecker: AppRegisteredAt called, %x", aSid.iUid);
-
-    // No Java application can have Uid 0
-    if (aSid.iUid == 0)
-    {
-        return installed;
-    }
-
-    TRAPD(err, installed = AppRegisteredAtL(aSid, aDrive));
-    if (KErrNone != err)
-    {
-        ELOG1(EUtils, "CJavaSidChecker: AppRegisteredAt error %d", err);
-    }
-
-    return installed;
-}
-
-TBool CJavaSidChecker::AppRegisteredAtL(const TUid& aSid, TDriveUnit /*aDrive*/)
-{
-    // Create the Java Registry if it has not been created already
-    if (NULL == iJavaRegistry)
-    {
-        iJavaRegistry = Java::CJavaRegistry::NewL();
-    }
-
-    // JavaRegistry does not return entries that are not present.
-    return iJavaRegistry->RegistryEntryExistsL(aSid);
-}
-
-void CJavaSidChecker::SetRescanCallBackL(const TCallBack &/*aCallBack*/)
-{
-    // Do nothing
-    return;
-}
--- a/javamanager/javaupgradeapp/src.s60/javaupgradeapp.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/javaupgradeapp/src.s60/javaupgradeapp.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/preinstaller/build/javapreinstaller.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -27,7 +27,9 @@
             -lPlatformEnv \
             -ljavacomms \
             -lcharconv \
-            -ljavastorage
+            -ljavastorage \
+            -lapparc \
+            -lapgrfx
 }
 
 include(../../../build/omj.pri)
--- a/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/preinstaller/src.s60/silentmidletinstall.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javamanager/subsystem.mk	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaruntimes/installer/starterdll/src/main.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javaruntimes.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaruntimes/javaruntimes.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -19,6 +19,6 @@
 SUBDIRS += installer/starterdll/build/javainstallerstarter.pro 
 SUBDIRS += installer/starterexe/build/javainstaller.pro 
 SUBDIRS += jvmargmodifier/file/build/javajvmargsmodifierfile.pro 
-SUBDIRS += starter/build/java.pro 
+SUBDIRS += starter/build/javamidp.pro 
 SUBDIRS += midp 
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- a/javaruntimes/midp/runtime/build/javamidpruntime.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaruntimes/midp/runtime/build/javamidpruntime.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -23,7 +23,7 @@
         
 
 symbian {
-    INCLUDEPATH += /epoc32/include/ecom
+    INCLUDEPATH += /epoc32/include/ecom     # Due to schemehandler.inl in S60 5.0 2009w18 and SPB 10.1
     LIBS += -lecom -lflogger -lDrmRightsInfo -lcaf -lDrmHelper -lapgrfx -lapparc -ljavautils
 }
 
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Main.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Main.java	Thu Jul 22 16:31:34 2010 +0100
@@ -38,12 +38,14 @@
     {
         // Do the start up trace.
         StartUpTrace.doTrace("Midp runtime ready");
-        if (Log.mOn) Log.logI("Starting MIDP runtime");
-
-        System.out.println("java.version: " +
-                           System.getProperty("java.version"));
-        System.out.println("java.fullversion: " +
-                           System.getProperty("java.fullversion"));
+        if (Log.mOn) 
+        {
+            Log.logI("Starting MIDP runtime");
+ 	          Log.logI("java.version: " +
+                     System.getProperty("java.version"));
+            Log.logI("java.fullversion: " +
+                     System.getProperty("java.fullversion"));
+        }
         boolean ok = true;
 
         try
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java	Thu Jul 22 16:31:34 2010 +0100
@@ -27,6 +27,8 @@
 
 import java.security.AccessControlException;
 
+import com.nokia.mj.impl.gcf.PushSecurityUtils;
+
 import com.nokia.mj.impl.rt.utils.ExtensionUtil;
 import com.nokia.mj.impl.rt.utils.CmdLineArgsPermission;
 
@@ -992,16 +994,35 @@
             DrmUtil.consumeRightsStart();
         }
 
-        // If the MIDlet launch is a result of auto invocation we need to
+        // If the MIDlet launch is a result of push auto invocation we need to
         // ensure that user allows the start up.
-        if ((mMainArgs.findArgument("-autoinvocation") != null) ||
-                mAutoinvocationFromUrl)
+        if (mMainArgs.findArgument("-autoinvocation") != null)
         {
-            if (Log.mOn) Log.logI("Ensuring autoinvocation.");
+            if (Log.mOn) Log.logI("Ensuring push autoinvocation.");
             String pushAdditionalInfo =
                 mMainArgs.findArgument("-autoInvocationAdditional");
             if (Log.mOn) Log.logI("  addInfo: '" + pushAdditionalInfo + "'");
 
+            try
+            {
+                PushSecurityUtils.ensurePermission("autoinvocation",
+                                                   pushAdditionalInfo);
+            }catch(SecurityException e)
+            {
+                // The user didn't allow starting. Throw StartupException and
+                // mark it as non fatal.
+                if (Log.mOn) Log.logI("Push autoinvocation NOT allowed.");                
+                throw new StartupException(e.toString(),
+                                           false);
+            }
+        }
+        
+        // If the MIDlet launch is triggered from url we need to
+        // ensure that user allows the start up.
+        if (mAutoinvocationFromUrl)
+        {
+            if (Log.mOn) Log.logI("Ensuring web start invocation.");
+
             // ensure security
             try
             {
@@ -1009,10 +1030,10 @@
                 CmdLineArgsPermission cmdLineArgsPermission = 
                     new CmdLineArgsPermission();
                 appUtils.checkPermission(cmdLineArgsPermission);
-                if (Log.mOn) Log.logI("Autoinvocation allowed.");
+                if (Log.mOn) Log.logI("Web start invocation allowed.");
             }catch(AccessControlException e)
             {
-                if (Log.mOn) Log.logI("Autoinvocation NOT allowed.");                
+                if (Log.mOn) Log.logI("Web start invocation NOT allowed.");                
                 throw new StartupException(e.toString(),
                                            false);
             }
--- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/javaruntimes/starter/build/java.pro	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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: 
-#
-
-TEMPLATE=app
-TARGET=javamidp
-CONFIG += omj no_icon stl
-CONFIG -= qt
-
-include(../../../inc/build_defines.pri)
-
-symbian {
-
-contains(PROJECT_DEFINES,RD_JAVA_UI_QT) {
-    TARGET.EPOCSTACKSIZE = 81920
-}
-
-!contains(PROJECT_DEFINES,RD_JAVA_UI_QT) {
-    TARGET.EPOCSTACKSIZE = 16384
-}
-
-    TARGET.EPOCHEAPSIZE = 0x00001000 0x02000000
-
-    TARGET.UID2 = 0x102033E6
-    TARGET.UID3 = 0x102033E6
-
-    TARGET.SID = 0x102033E6
-    TARGET.VID = 0x101FB657
-
-    TARGET.CAPABILITY = \
-        LocalServices NetworkServices ProtServ WriteDeviceData \
-        ReadDeviceData ReadUserData WriteUserData UserEnvironment  \
-        SwEvent Location MultiMediaDD NetworkControl TrustedUI
-}
-
-include(../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javaruntimes/starter/build/javamidp.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,48 @@
+#
+# 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=app
+TARGET=javamidp
+CONFIG += omj no_icon stl
+CONFIG -= qt
+
+include(../../../inc/build_defines.pri)
+
+symbian {
+
+contains(PROJECT_DEFINES,RD_JAVA_UI_QT) {
+    TARGET.EPOCSTACKSIZE = 81920
+}
+
+!contains(PROJECT_DEFINES,RD_JAVA_UI_QT) {
+    TARGET.EPOCSTACKSIZE = 16384
+}
+
+    TARGET.EPOCHEAPSIZE = 0x00001000 0x02000000
+
+    TARGET.UID2 = 0x102033E6
+    TARGET.UID3 = 0x102033E6
+
+    TARGET.SID = 0x102033E6
+    TARGET.VID = 0x101FB657
+
+    TARGET.CAPABILITY = \
+        LocalServices NetworkServices ProtServ WriteDeviceData \
+        ReadDeviceData ReadUserData WriteUserData UserEnvironment  \
+        SwEvent Location MultiMediaDD NetworkControl TrustedUI
+}
+
+include(../../../build/omj.pri)
--- a/javatools/javacontrolpanel/controlpanel/src/javacaptain.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javatools/javacontrolpanel/controlpanel/src/javacaptain.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #endif
 
+#include <cstring>
 #include <errno.h>
 #include "logger.h"
 
Binary file javatools/javasecuritycustomization/policyeditor/bin/securitypolicyeditor.jar has changed
--- a/javatools/javasecuritycustomization/policyeditor/javasrc/com/nokia/mj/tools/security/midp/PolicyEditor.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javatools/javasecuritycustomization/policyeditor/javasrc/com/nokia/mj/tools/security/midp/PolicyEditor.java	Thu Jul 22 16:31:34 2010 +0100
@@ -18,6 +18,7 @@
 package com.nokia.mj.tools.security.midp;
 
 import java.util.Vector;
+import java.util.Hashtable;
 import java.io.IOException;
 import java.io.FileInputStream;
 import java.util.StringTokenizer;
@@ -46,7 +47,7 @@
  * domain: 'domain' Identifier ';' grant+;
  * grant: 'grant' (grant_user | grant_allowed | grant_assigned);
  * grant_allowed: 'allowed' permissions;
- * grant_assigned: 'assigned' permissions;
+ * grant_assigned: 'assigned' grant_name? (initial_mode other_modes permissions)? permissions;
  * grant_user: 'user' grant_name initial_mode other_modes permissions;
  * grant_name: '"' Identifier '"';
  * permissions: '{' permission+ '}';
@@ -70,6 +71,7 @@
     private SecurityPolicy securityPolicy;
     private static String destPath;
     private static final String POLICY_FILE_EXTENSION = ".txt";
+    private Hashtable allSettings = new Hashtable();
 
     public static void main(String[] args)
     {
@@ -159,14 +161,17 @@
         }
         domain = extractToken(';');
         Vector perms = new Vector();
+        Vector unconfirmedPerms = new Vector();
         find("grant");
         while (offset < policy.length)
         {
             SecurityPolicyPermissionSettings settings = null;
+            SecurityPolicyPermissionSettings unconfirmedSettings = null;
             int type = getType(extractToken());
+            String settingsName = null;
             if (type == PolicyBasedPermission.USER_TYPE)
             {
-                String settingsName = extractToken('"', '"');
+                settingsName = extractToken('"', '"');
                 check(settingsName, "User grant group without name");
                 // trim off the leading and trailing double-quotes
                 if (settingsName.startsWith("\""))
@@ -192,6 +197,44 @@
                                                     interactionModes);
                 settings = new SecurityPolicyPermissionSettings(settingsName,
                         currentInteractionMode, allowedInteractionModes);
+                allSettings.put(settingsName, settings);
+            }
+            else if (type == PolicyBasedPermission.ASSIGNED_TYPE)
+            {
+                settingsName = extractToken('"', '"');
+                if (settingsName != null 
+                    && settingsName.length() > 0 
+                    && settingsName.indexOf("{") == -1)
+                {
+                    type = PolicyBasedPermission.USER_ASSIGNED_TYPE;
+                    settings = (SecurityPolicyPermissionSettings)allSettings.get(
+                        settingsName);
+                    if (settings == null)
+                    {
+                        // parse the rest of the settings and store it as 
+                        // unconfirmed settings: after all the parsing is 
+                        // done go through the unconfirmed settings and 
+                        // replace them with settings from user permissions
+                        // (if found) or use the unconfirmed settings if no
+                        // other user settings were found
+                        String strInteractionModes = extractToken('{');
+                        String[] interactionModes = split(strInteractionModes,",");
+                        if (interactionModes != null && interactionModes.length > 0)
+                        {
+                            int currentInteractionMode = getInteractionMode(
+                                                         interactionModes[0]);
+                            int[] allowedInteractionModes = getInteractionModes(
+                                                            interactionModes);
+                            unconfirmedSettings = new SecurityPolicyPermissionSettings(
+                                settingsName, currentInteractionMode, allowedInteractionModes);
+                        }
+                        else
+                        {
+                            unconfirmedSettings = new SecurityPolicyPermissionSettings(
+                                settingsName);
+                        }
+                    }
+                }
             }
             find("permission");
             while (offset < policy.length && policy[offset] != '}')
@@ -246,28 +289,75 @@
                 // return multiple permissions with simple actions. This step is
                 // to be removed when APIs support composite actions
                 String[] actions = split(pActionList,",");
+                if (unconfirmedSettings != null 
+                    && unconfirmedSettings.getCurrentInteractionMode() 
+                    == UserSecuritySettings.UNDEFINED_INTERACTION_MODE)
+                {
+                    // discard the settings since they are not vald
+                    unconfirmedSettings = null;
+                }
                 if (actions != null)
                 {
                     for (int i=0; i<actions.length; i++)
                     {
-                        perms.add(getPermission(pName,
-                                                pTarget, actions[i], type, settings));
+                        if (unconfirmedSettings == null)
+                        {
+                            perms.add(getSecurityPolicyPermission(
+                                pName, pTarget, actions[i], type, settings));
+                        }
+                        else
+                        {
+                            unconfirmedPerms.add(getSecurityPolicyPermission(
+                                pName, pTarget, actions[i], type, unconfirmedSettings));
+                        }
                     }
                 }
                 else
                 {
-                    perms.add(getPermission(pName,
-                                            pTarget, pActionList, type, settings));
+                    if (unconfirmedSettings == null)
+                    {
+                        perms.add(getSecurityPolicyPermission(
+                            pName, pTarget, pActionList, type, settings));
+                    }
+                    else
+                    {
+                        unconfirmedPerms.add(getSecurityPolicyPermission(
+                            pName, pTarget, pActionList, type, unconfirmedSettings));
+                    }
                 }
                 find("permission");
             }
             find("grant", true);
         }
-        if (perms.size() == 0)
+        if (perms.size() == 0 && unconfirmedPerms.size() == 0)
         {
             throw new IllegalArgumentException(
                 "Invalid security policy - missing/invalid permissions information");
         }
+        // confirm the unconfirmed permissions: look for settings in the perms -> 
+        // if found then use those settings, otherwise use the unconfirmed settings
+        for(int i=0; i<unconfirmedPerms.size(); i++)
+        {
+            SecurityPolicyPermission unconfirmedPerm = 
+                (SecurityPolicyPermission) unconfirmedPerms
+                .elementAt(i);
+            SecurityPolicyPermissionSettings confirmedSettings = 
+                (SecurityPolicyPermissionSettings)allSettings
+                .get(unconfirmedPerm.getUserSecuritySettings().getName());
+            if (confirmedSettings != null)
+            {
+                perms.add(getSecurityPolicyPermission(
+                    unconfirmedPerm.getName(), 
+                    unconfirmedPerm.getTarget(), 
+                    unconfirmedPerm.getActionList(), 
+                    unconfirmedPerm.getType(), 
+                    confirmedSettings));
+            }
+            else
+            {
+                perms.add(unconfirmedPerm); 
+            }
+        }
         SecurityPolicyPermission[] permissions
         = new SecurityPolicyPermission[perms.size()];
         perms.copyInto(permissions);
@@ -463,22 +553,18 @@
         tokens.copyInto(strTokens);
         return strTokens;
     }
-
-    private SecurityPolicyPermission getPermission(String pName,
-            String pTarget,
-            String pAction,
-            int pType,
-            SecurityPolicyPermissionSettings pSettings)
+    
+    private SecurityPolicyPermission getSecurityPolicyPermission(
+        String name,
+        String target,
+        String actionList,
+        int type,
+        SecurityPolicyPermissionSettings settings)
     {
-        if (pSettings == null)
+        if (settings == null && type == PolicyBasedPermission.USER_ASSIGNED_TYPE)
         {
-            return new SecurityPolicyPermission(
-                       pName, pTarget, pAction, pType);
+            return new SecurityPolicyPermission(name, target, actionList, PolicyBasedPermission.ASSIGNED_TYPE);
         }
-        else
-        {
-            return new SecurityPolicyPermission(
-                       pName, pTarget, pAction, pSettings);
-        }
+        return new SecurityPolicyPermission(name, target, actionList, type, settings);
     }
 }
--- a/javatools/tckrunner/runner/src/tckrunnernative.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javatools/tckrunner/runner/src/tckrunnernative.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -58,12 +58,13 @@
 {
     int rc = 0;
 
-    const char* av[MAX_PARAMS + 5];
+    const char* av[MAX_PARAMS + 6];
     int index = 0;
     av[index++] = java::runtime::JAVA_PROCESS;
     av[index++] = java::runtime::JAVA_INSTALLER_STARTER_DLL;
     av[index++] = "poll";
     av[index++] = "-address=tck";
+    av[index++] = "-drive=C";
 
     int args = aEnv->GetArrayLength(aArgs);
     char** installerArgs = new char*[args];
--- a/javauis/amms_qt/build/javaamms.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/build/javaamms.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammspancontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/mmacontrol/inc.mmf/cammspancontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/mmacontrol/inc/cammscustomcommandutility.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsprioritycontrol.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/mmacontrol/src.mmf/cammsprioritycontrol.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/build/eswtqtwebkit/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/build/eswtqtwebkit/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -26,7 +26,7 @@
 
     <target name="init.component.properties">
         <property name="java.src.paths" value="../../org.eclipse.swt/Eclipse_SWT_PI/webkit"/>
-        <property name="javah.classnames" value="org.eclipse.swt.internal.qt.webkit.OS_webkit"/>
+        <property name="javah.classnames" value="org.eclipse.swt.internal.qt.webkit.WebkitOS"/>
         <echo message="java.src.paths = ${java.src.paths}"/>
         <echo message="javah.classnames = ${javah.classnames}"/>
     </target>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/MobileShellExtension.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.swt.internal.extension;
+
+import org.eclipse.ercp.swt.mobile.MobileShell;
+import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Internal_PackageSupport;
+
+public class MobileShellExtension extends MobileShell {
+
+    public MobileShellExtension(Display display, int style) {
+        super(display, style);
+    }
+    
+    public void addSymbianWindowVisibilityListener(SymbianWindowVisibilityListener listener) {
+        Internal_PackageSupport.addSymbianWindowVisibilityListener(this, listener);
+    }
+
+    public void removeSymbianWindowVisibilityListener(SymbianWindowVisibilityListener listener) {
+        Internal_PackageSupport.removeSymbianWindowVisibilityListener(this, listener);
+    }
+}
--- a/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/OS.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/OS.java	Thu Jul 22 16:31:34 2010 +0100
@@ -33,4 +33,6 @@
     //
     public static final native int XQCallInfo_create();
     public static final native boolean XQCallInfo_swt_hasCalls(int handle);
+    
+    public static final native int HbInputSettingProxy_availableHwKeyboard();
 }
--- a/javauis/eswt_qt/eswtuitestutils/javasrc/com/nokia/mj/impl/uitestutils/S60Utils.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/eswtuitestutils/javasrc/com/nokia/mj/impl/uitestutils/S60Utils.java	Thu Jul 22 16:31:34 2010 +0100
@@ -6,7 +6,7 @@
 	static {
 		// Should use vmport, this is CDC/J2SE API
 		//System.loadLibrary("s60uitestutils");
-		org.eclipse.swt.internal.Library.loadLibrary("s60uitestutils");
+		org.eclipse.swt.internal.Library.loadLibrary("eswtuitestutils");
 	}
 
     /**
--- a/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.me/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.me/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -263,7 +263,7 @@
 
     <target name="build.lib.common.webkit" depends="init" description="params: config">
         <javah destdir="${lib.path}/${generated.native.dir.webkit}/" classpath="${plugin.dir}/bin" verbose="yes">
-            <class name="org.eclipse.swt.internal.qt.webkit.OS_webkit"/>
+            <class name="org.eclipse.swt.internal.qt.webkit.WebkitOS"/>
         </javah>
         <antcall target="qmake">
             <param name="qmake.dir" value="${lib.path}/webkit"/>
--- a/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.se/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.se/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -244,7 +244,7 @@
 
     <target name="build.lib.common.webkit" depends="init" description="params: config">
         <javah destdir="${lib.path}/${generated.native.dir.webkit}/" classpath="${plugin.dir}/bin" verbose="yes">
-            <class name="org.eclipse.swt.internal.qt.webkit.OS_webkit"/>
+            <class name="org.eclipse.swt.internal.qt.webkit.WebkitOS"/>
         </javah>
         <antcall target="qmake">
             <param name="qmake.dir" value="${lib.path}/webkit"/>
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT Browser/qt/org/eclipse/swt/browser/QtWebKit.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT Browser/qt/org/eclipse/swt/browser/QtWebKit.java	Thu Jul 22 16:31:34 2010 +0100
@@ -12,7 +12,7 @@
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.internal.qt.OS;
-import org.eclipse.swt.internal.qt.webkit.OS_webkit;
+import org.eclipse.swt.internal.qt.webkit.WebkitOS;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
@@ -39,7 +39,7 @@
     // At this point, browser.handle is the view port of QScrollArea, set by Composite
     int scrollAreaHandle = Internal_PackageSupport.topHandle(browser);
     int viewPortHandle = Internal_PackageSupport.handle(browser);
-    webViewHandle = OS_webkit.QWebView_new();
+    webViewHandle = WebkitOS.QWebView_new();
     OS.QWidget_setParent(webViewHandle, scrollAreaHandle);
     
     int layout = OS.QVBoxLayout_new(0);
@@ -111,10 +111,10 @@
  * @see WebBrowser
  */
 public boolean back() {
-    if (OS_webkit.QWebView_swt_canGoBack(webViewHandle)) {
+    if (WebkitOS.QWebView_swt_canGoBack(webViewHandle)) {
         if (sendLocationEventChanging((int)System.currentTimeMillis(), 
-            OS_webkit.QWebView_swt_backUrl(webViewHandle))) {
-            OS_webkit.QWebView_back(webViewHandle);
+            WebkitOS.QWebView_swt_backUrl(webViewHandle))) {
+            WebkitOS.QWebView_back(webViewHandle);
             return true;
         }
     }
@@ -125,17 +125,17 @@
  * @see WebBrowser
  */
 public boolean execute(String script) {
-    return OS_webkit.QWebView_swt_evaluateJavaScript(webViewHandle, script);
+    return WebkitOS.QWebView_swt_evaluateJavaScript(webViewHandle, script);
 }
 
 /**
  * @see WebBrowser
  */
 public boolean forward() {
-    if (OS_webkit.QWebView_swt_canGoForward(webViewHandle)) {
+    if (WebkitOS.QWebView_swt_canGoForward(webViewHandle)) {
         if (sendLocationEventChanging((int)System.currentTimeMillis(), 
-            OS_webkit.QWebView_swt_forwardUrl(webViewHandle))) {
-            OS_webkit.QWebView_forward(webViewHandle);
+            WebkitOS.QWebView_swt_forwardUrl(webViewHandle))) {
+            WebkitOS.QWebView_forward(webViewHandle);
             return true;
         }
     }
@@ -160,21 +160,21 @@
  * @see WebBrowser
  */
 public String getUrl() {
-    return OS_webkit.QWebView_url(webViewHandle);
+    return WebkitOS.QWebView_url(webViewHandle);
 }
 
 /**
  * @see WebBrowser
  */
 public boolean isBackEnabled() {
-    return OS_webkit.QWebView_swt_canGoBack(webViewHandle);
+    return WebkitOS.QWebView_swt_canGoBack(webViewHandle);
 }
 
 /**
  * @see WebBrowser
  */
 public boolean isForwardEnabled() {
-    return OS_webkit.QWebView_swt_canGoForward(webViewHandle);
+    return WebkitOS.QWebView_swt_canGoForward(webViewHandle);
 }
 
 /**
@@ -182,8 +182,8 @@
  */
 public void refresh() {
     if (sendLocationEventChanging((int)System.currentTimeMillis(), 
-        OS_webkit.QWebView_url(webViewHandle))) {
-        OS_webkit.QWebView_reload(webViewHandle);
+        WebkitOS.QWebView_url(webViewHandle))) {
+        WebkitOS.QWebView_reload(webViewHandle);
     }
 }
 
@@ -192,7 +192,7 @@
  */
 public boolean setText(String html) {
     if (sendLocationEventChanging((int)System.currentTimeMillis(), "about:blank")) {
-        OS_webkit.QWebView_setHtml(webViewHandle, html);
+        WebkitOS.QWebView_setHtml(webViewHandle, html);
         return true;
     }
     else {
@@ -205,7 +205,7 @@
  */
 public boolean setUrl(String url) {
     if (sendLocationEventChanging((int)System.currentTimeMillis(), url)) {
-        OS_webkit.QWebView_setUrl(webViewHandle, url);
+        WebkitOS.QWebView_setUrl(webViewHandle, url);
         return true;
     }
     else {
@@ -217,7 +217,7 @@
  * @see WebBrowser
  */
 public void stop() {
-    OS_webkit.QWebView_stop(webViewHandle);
+    WebkitOS.QWebView_stop(webViewHandle);
 }
 
 final boolean eventProcess( int widgetHandle, int eventType, int time, 
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/MobileDevice.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/MobileDevice.java	Thu Jul 22 16:31:34 2010 +0100
@@ -44,521 +44,524 @@
  */
 public class MobileDevice {
 
-    private static int 		handleMobileDevice;
-    private Vector		mobileDeviceListeners;
-    private Screen[]	screens;
-    private Input[]		inputs;
-    private int			alertLevel;
-    private boolean		isOpen;
-    private static int desktopWidgetHandle;
+    private static int  handleMobileDevice;
+    private Vector      mobileDeviceListeners;
+    private Screen[]    screens;
+    private Input[]     inputs;
+    private int         alertLevel;
+    private boolean     isOpen;
+    private static int  desktopWidgetHandle;
     static MobileDevice currentMobileDevice;
-    private int activeScreenId;
+    private int         activeScreenId;
     
     
 
     
     /** 
      * feature which is permanently attached to the mobile device and always available
-     */	
+     */    
     public static final int LOCAL = 0;
 
-	/**
-	 * local feature which is only available when mobile device is opened
-	 */
-	public static final int INTERNAL = 1;
+    /**
+     * local feature which is only available when mobile device is opened
+     */
+    public static final int INTERNAL = 1;
 
-	/**
-	 * local feature which is only available when mobile device is closed
-	 */
-	public static final int EXTERNAL = 2;
-	
-	/**
-	 * feature which is not part of the mobile device unless connected via wire or wireless signal
-	 */
-	public static final int REMOTE = 3;
-	
-	/**
-	 * alert level indicating simple notification (ex. e-mail arrival)
-	 */
-	public static final int ALERT_LOW_IMPORTANCE = 1;
-	
-	/**
-	 * alert level indicating user attention desired (ex. instant message arrival)
-	 */
-	public static final int ALERT_HIGH_IMPORTANCE = 2;
-	
-	/**
-	 * alert level indicating immediate attention is required (ex. battery level at 1%)
-	 */
-	public static final int ALERT_CRITICAL = 3;
+    /**
+     * local feature which is only available when mobile device is closed
+     */
+    public static final int EXTERNAL = 2;
+    
+    /**
+     * feature which is not part of the mobile device unless connected via wire or wireless signal
+     */
+    public static final int REMOTE = 3;
+    
+    /**
+     * alert level indicating simple notification (ex. e-mail arrival)
+     */
+    public static final int ALERT_LOW_IMPORTANCE = 1;
+    
+    /**
+     * alert level indicating user attention desired (ex. instant message arrival)
+     */
+    public static final int ALERT_HIGH_IMPORTANCE = 2;
+    
+    /**
+     * alert level indicating immediate attention is required (ex. battery level at 1%)
+     */
+    public static final int ALERT_CRITICAL = 3;
    /**
     * virtual keyboard status indicating normal show and hide operation
     */
-	public static final int VK_NORMAL = 1;
+    public static final int VK_NORMAL = 1;
 
-	/**
-	 * virtual keyboard status indicating keyboard is always visible
-	 */
-	public static final int VK_ALWAYS_ON = 2;
+    /**
+     * virtual keyboard status indicating keyboard is always visible
+     */
+    public static final int VK_ALWAYS_ON = 2;
 
-	/**
-	 * virtual keyboard status indicating keyboard is always hidden
-	 */
-	public static final int VK_ALWAYS_OFF = 3;	  
-	
-	/**
-	 * Constructs a new instance of this class. Non-public to prevent
-	 * instantiation outside this package.
-	 * 
-	 */
-	MobileDevice () {
-	   
-	    (getDisplay()).syncExec(new Runnable() {
-			public void run() {
-				handleMobileDevice = Internal_PackageSupport.initializeMobileDevice(
-						Internal_PackageSupport.getDisplayInstance());
-				OS.MobileDevice_createFlipWatch(handleMobileDevice);
-			}
-		}); 
-	    mobileDeviceListeners = new Vector();
-	    isOpen = true;
-	}
-	
-	private static Display getDisplay(){
-		Display display = Internal_PackageSupport.getDisplayInstance();
-		
-		// Following if-statement (getting default display) should be removed
-		// if agreed that MobileDevice shouldn't create the display.
-		if(display==null){
-			display = Display.getDefault();
-		}
-		
-		if(display == null || display.isDisposed()){
-	    	SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-	    }
-		return display;
-	}
-	
-	private void sendMobileDeviceChangedEvent(int eventType) {
-		// MobileDevice changed event for open and closed
-		int count = mobileDeviceListeners.size();
-		for (int i = 0; i <count; ++i) {
-			MobileDeviceEvent event = new MobileDeviceEvent(this);
-			event.type = eventType;
-			MobileDeviceListener listener = (MobileDeviceListener) mobileDeviceListeners.elementAt(i);
-			listener.deviceChanged(event);
-		}
-	}
-	
-	void qt_swt_event_mobiledevice_changed(boolean aStatus) {
-		// update MobileDevice status to opened/closed
-		isOpen = aStatus;
-		
-		if(isOpen){
-			sendMobileDeviceChangedEvent(MobileDeviceEvent.OPENED);
-		}else{
-			sendMobileDeviceChangedEvent(MobileDeviceEvent.CLOSED);
-		}
-	}
-	
-	void qt_swt_event_mobiledevice_screen_activate(boolean aStatus) {
-		
-		if(screens.length > 0 && activeScreenId<screens.length){
-			if(aStatus){
-				// update the active screen
-				activeScreenId = OS.getScreenDeviceNumber();
-				//forward to screen activated event to new active screen
-				screens[activeScreenId].internal_sendScreenEventActivated();
-			}else {
-				//forward to screen deactivated event to old active screen
-				screens[activeScreenId].internal_sendScreenEventDeactivated();
-			}
-		}
-	}
-	
-	void qt_swt_event_mobiledevice_orientationchanged() {
-		activeScreenId = OS.getScreenDeviceNumber();
-		if(activeScreenId<screens.length){
-			// forward to orientation change event to active screen
-			screens[activeScreenId].internal_sendOrientationScreenChanged();
-		}
-	}
-	
-	private void sendMobileDeviceScreenChangedEvent(int eventType, Screen screen) {
-		int count = mobileDeviceListeners.size();
-		for (int i = 0; i <count; ++i) {
-			MobileDeviceEvent event = new MobileDeviceEvent(this);
-			event.type = eventType;
-			event.data = screen;
-			event.feature = screen;
-			MobileDeviceListener listener = (MobileDeviceListener) mobileDeviceListeners.elementAt(i);
-			listener.screenChanged(event);
-		}
-	}
-	
-	void qt_signal_screen_changed(int aCount) {
-		int type = 0;
-		Screen screen = null;
-		Screen []newScreens = new Screen[aCount];
-		
-		// if getScreen is not called and if still want 
-		// screen changed event in the MobileDevice
-		if(screens.length==0){
-			getScreens();
-		}
-		
-		if(screens.length > aCount){
-			// screen removed
-			int screenHandle = 0;
-			for(int j=0; j<screens.length; j++) {
-				// found removed screen
-				boolean found = false;
-				for(int i=0; i<aCount; i++) {     
-					screenHandle = OS.QDesktopWidget_screen(desktopWidgetHandle, i);
-					if(screens[j].screenHandle== screenHandle){
-						newScreens[i] = screens[j];
-						newScreens[i].id = i;
-						found = true;
-						break;
-		        	 }
-				}
-		        if(!found){
-		        	screen = screens[j];
-		        	screens[j].internal_dispose();
-		        } 
-		    }
-			screens = new Screen[aCount];
-			// remove detached screen from 'screens'
-			System.arraycopy(newScreens, 0, screens, 0, aCount);
-			type = MobileDeviceEvent.REMOVED;
-		} else if( screens.length < aCount){
-			// screen attached
-			for(int i=0; i<aCount; i++) {   
-				// found added screen
-				int screenHandle = OS.QDesktopWidget_screen(desktopWidgetHandle, i);
-				boolean found=false;
-				for(int j=0; j<screens.length; j++) {
-					if(screens[j].screenHandle== screenHandle){
-						newScreens[i] = screens[j];
-						newScreens[i].id = i;
-						found = true;
-						break;
-					}
-				}
-				if(!found){
-					screen = screens[i];
-					newScreens[i] = new Screen(i, desktopWidgetHandle);
-				} 
-			}
-			screens = new Screen[aCount];
-			// add attached screen to 'screens'
-			System.arraycopy(newScreens, 0, screens, 0, aCount);
-			type = MobileDeviceEvent.ADDED;
-		}
-		sendMobileDeviceScreenChangedEvent(type, screen);
-		activeScreenId = OS.getScreenDeviceNumber();
-	}
-	
-	private static void hookEvents() {
-	    int screenSignalProxy = OS.SignalHandler_new(desktopWidgetHandle, OS.QSIGNAL_QDESKTOPWIDGET_SCREENCOUNTCHANGED);
-	    OS.QObject_connectOrThrow(desktopWidgetHandle, "screenCountChanged(int)", screenSignalProxy,
-	            "widgetSignal(int)", OS.QT_AUTOCONNECTION);
-	}
+    /**
+     * virtual keyboard status indicating keyboard is always hidden
+     */
+    public static final int VK_ALWAYS_OFF = 3;      
+    
+    /**
+     * Constructs a new instance of this class. Non-public to prevent
+     * instantiation outside this package.
+     * 
+     */
+    MobileDevice () {
+       
+        (getDisplay()).syncExec(new Runnable() {
+            public void run() {
+                handleMobileDevice = Internal_PackageSupport.initializeMobileDevice(
+                        Internal_PackageSupport.getDisplayInstance());
+                if (handleMobileDevice == 0) {
+                    SWT.error(SWT.ERROR_NO_HANDLES);
+                }
+                OS.MobileDevice_createFlipWatch(handleMobileDevice);
+            }
+        }); 
+        mobileDeviceListeners = new Vector();
+        isOpen = true;
+    }
+    
+    private static Display getDisplay(){
+        Display display = Internal_PackageSupport.getDisplayInstance();
+        
+        // Following if-statement (getting default display) should be removed
+        // if agreed that MobileDevice shouldn't create the display.
+        if(display==null){
+            display = Display.getDefault();
+        }
+        
+        if(display == null || display.isDisposed()){
+            SWT.error(SWT.ERROR_DEVICE_DISPOSED);
+        }
+        return display;
+    }
+    
+    private void sendMobileDeviceChangedEvent(int eventType) {
+        // MobileDevice changed event for open and closed
+        int count = mobileDeviceListeners.size();
+        for (int i = 0; i <count; ++i) {
+            MobileDeviceEvent event = new MobileDeviceEvent(this);
+            event.type = eventType;
+            MobileDeviceListener listener = (MobileDeviceListener) mobileDeviceListeners.elementAt(i);
+            listener.deviceChanged(event);
+        }
+    }
+    
+    void qt_swt_event_mobiledevice_changed(boolean aStatus) {
+        // update MobileDevice status to opened/closed
+        isOpen = aStatus;
+        
+        if(isOpen){
+            sendMobileDeviceChangedEvent(MobileDeviceEvent.OPENED);
+        }else{
+            sendMobileDeviceChangedEvent(MobileDeviceEvent.CLOSED);
+        }
+    }
+    
+    void qt_swt_event_mobiledevice_screen_activate(boolean aStatus) {
+        
+        if(screens.length > 0 && activeScreenId<screens.length){
+            if(aStatus){
+                // update the active screen
+                activeScreenId = OS.getScreenDeviceNumber();
+                //forward to screen activated event to new active screen
+                screens[activeScreenId].internal_sendScreenEventActivated();
+            }else {
+                //forward to screen deactivated event to old active screen
+                screens[activeScreenId].internal_sendScreenEventDeactivated();
+            }
+        }
+    }
+    
+    void qt_swt_event_mobiledevice_orientationchanged() {
+        activeScreenId = OS.getScreenDeviceNumber();
+        if(activeScreenId<screens.length){
+            // forward to orientation change event to active screen
+            screens[activeScreenId].internal_sendOrientationScreenChanged();
+        }
+    }
+    
+    private void sendMobileDeviceScreenChangedEvent(int eventType, Screen screen) {
+        int count = mobileDeviceListeners.size();
+        for (int i = 0; i <count; ++i) {
+            MobileDeviceEvent event = new MobileDeviceEvent(this);
+            event.type = eventType;
+            event.data = screen;
+            event.feature = screen;
+            MobileDeviceListener listener = (MobileDeviceListener) mobileDeviceListeners.elementAt(i);
+            listener.screenChanged(event);
+        }
+    }
+    
+    void qt_signal_screen_changed(int aCount) {
+        int type = 0;
+        Screen screen = null;
+        Screen []newScreens = new Screen[aCount];
+        
+        // if getScreen is not called and if still want 
+        // screen changed event in the MobileDevice
+        if(screens.length==0){
+            getScreens();
+        }
+        
+        if(screens.length > aCount){
+            // screen removed
+            int screenHandle = 0;
+            for(int j=0; j<screens.length; j++) {
+                // found removed screen
+                boolean found = false;
+                for(int i=0; i<aCount; i++) {     
+                    screenHandle = OS.QDesktopWidget_screen(desktopWidgetHandle, i);
+                    if(screens[j].screenHandle== screenHandle){
+                        newScreens[i] = screens[j];
+                        newScreens[i].id = i;
+                        found = true;
+                        break;
+                     }
+                }
+                if(!found){
+                    screen = screens[j];
+                    screens[j].internal_dispose();
+                } 
+            }
+            screens = new Screen[aCount];
+            // remove detached screen from 'screens'
+            System.arraycopy(newScreens, 0, screens, 0, aCount);
+            type = MobileDeviceEvent.REMOVED;
+        } else if( screens.length < aCount){
+            // screen attached
+            for(int i=0; i<aCount; i++) {   
+                // found added screen
+                int screenHandle = OS.QDesktopWidget_screen(desktopWidgetHandle, i);
+                boolean found=false;
+                for(int j=0; j<screens.length; j++) {
+                    if(screens[j].screenHandle== screenHandle){
+                        newScreens[i] = screens[j];
+                        newScreens[i].id = i;
+                        found = true;
+                        break;
+                    }
+                }
+                if(!found){
+                    screen = screens[i];
+                    newScreens[i] = new Screen(i, desktopWidgetHandle);
+                } 
+            }
+            screens = new Screen[aCount];
+            // add attached screen to 'screens'
+            System.arraycopy(newScreens, 0, screens, 0, aCount);
+            type = MobileDeviceEvent.ADDED;
+        }
+        sendMobileDeviceScreenChangedEvent(type, screen);
+        activeScreenId = OS.getScreenDeviceNumber();
+    }
+    
+    private static void hookEvents() {
+        int screenSignalProxy = OS.SignalHandler_new(desktopWidgetHandle, OS.QSIGNAL_QDESKTOPWIDGET_SCREENCOUNTCHANGED);
+        OS.QObject_connectOrThrow(desktopWidgetHandle, "screenCountChanged(int)", screenSignalProxy,
+                "widgetSignal(int)", OS.QT_AUTOCONNECTION);
+    }
 
-	/**
-	 * Adds the listener to the collection of listeners who will be notified when a device 
-	 * configuration change occurs, by calling one of the methods defined in the 
-	 * <code>MobileDeviceListener</code> interface. 
-	 * <p>
-	 * <code>screenChanged</code> is called when a monitor configuration changes.<br>
-	 * <code>inputChanged</code> is called when an input configuration changes.<br>
-	 * <code>deviceChanged</code> is called when the device is opened or closed.<br>
-	 *
-	 * @param listener instance called when device events occur
-	 *
-	 * @exception IllegalArgumentException <ul>
-	 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
-	 * </ul>
-	 * @exception SWTError <ul>
-	 *    <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
-	 * </ul>
-	 *
-	 * @see #removeMobileDeviceListener
-	 * @see MobileDeviceListener
-	 */
-	public void addMobileDeviceListener(MobileDeviceListener listener) {
-	    if (listener == null) {
-			SWT.error (SWT.ERROR_NULL_ARGUMENT);
-		}
-		mobileDeviceListeners.addElement(listener);
-	}
-	
-	
-	/**
-	 * Alerts the user using device specific mechanisms such as sounds, flashing, or
-	 * vibration. <code>Level</code> must be one of ALERT_LOW_IMPORTANCE,
-	 * ALERT_HIGH_IMPORTANCE, or ALERT_CRITICAL. The method maps these levels to
-	 * device specific features that may also be dependent upon user configuration
-	 * or current profile.
-	 * 
-	 * @param level
-	 *            constant describing the importance of the alert
-	 * 
-	 * @exception IllegalArgumentException
-	 *                <ul>
-	 *                <li>ERROR_INVALID_ARGUMENT - if level is not one of the
-	 *                allowed class constants</li>
-	 *                </ul>
-	 * 
-	 * @see #ALERT_LOW_IMPORTANCE
-	 * @see #ALERT_HIGH_IMPORTANCE
-	 * @see #ALERT_CRITICAL
-	 */
-	public void alert(int level) {
-	    if (	level != ALERT_LOW_IMPORTANCE &&
-	            level != ALERT_HIGH_IMPORTANCE &&
-	            level != ALERT_CRITICAL) {
-	        SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-	    }
-	    alertLevel = level;
-		(getDisplay()).syncExec(new Runnable() {
-			public void run() {
-				if(alertLevel == ALERT_LOW_IMPORTANCE){
-					OS.QApplication_beep();
-				}else if(alertLevel == ALERT_HIGH_IMPORTANCE){
-					OS.MobileDevice_flashLights(handleMobileDevice, 3000);
-					OS.MobileDevice_vibration(handleMobileDevice, 3000);
-				}else if(alertLevel == ALERT_CRITICAL){
-					OS.QApplication_beep();
-					OS.MobileDevice_flashLights(handleMobileDevice, 3000);
-					OS.MobileDevice_vibration(handleMobileDevice, 3000);
-				}
-			   
-			}
-		}); 
-	}
-	
-	
-	/**
-	 * Returns an array of Input objects describing the input features available to the device. 
-	 * The return value may be <code>null</code> if there are no input features available.
-	 * 
-	 * @exception SWTError <ul>
-	 *    <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because 
-	 * 		of an operating system failure</li>
-	 * </ul> 
-	 *
-	 * @see Input
-	 */
-	public Input[] getInputs() {
-		if(inputs == null) {
-		    try {
-			    (getDisplay()).syncExec(new Runnable() {
-					public void run() {
-						int mask = OS.getHwInputs();
-						int nbInputs = 0;
-						
-						// finding out number of keyboards available
-						if((mask & OS.SYMBIAN_KEYBOARD_FULL)!=0){
-							nbInputs+=2;
-						}
-						
-						if((mask & OS.SYMBIAN_KEYBOARD_KEYPAD)!=0){
-							nbInputs+=2;
-						}
-						// create java counter part of Inputs and
-						// add location and type
-					    inputs = new Input[nbInputs];
-					    int i=0;
-					    int location;
-					    if((mask & OS.SYMBIAN_KEYBOARD_FULL)!=0){
-					    	if((mask & OS.SYMBIAN_KEYBOARD_KEYPAD)!=0){
-								location = MobileDevice.INTERNAL;
-							} else {
-								location = MobileDevice.LOCAL;
-							}
-					    	inputs[i] = new Input(i);
-					    	inputs[i].setLocation(location);
-					    	inputs[i].setType(Input.SOFTKEYS);
-					    	i+=1;
-					    	inputs[i] = new Input(i);
-					    	inputs[i].setLocation(location);
-					    	inputs[i].setType(Input.FULL_KEYBOARD);
-					    	i+=1;
-						}
-					    
-					    if((mask & OS.SYMBIAN_KEYBOARD_KEYPAD)!=0){
-					    	if((mask & OS.SYMBIAN_KEYBOARD_FULL)!=0){
-								location = MobileDevice.EXTERNAL;
-							} else {
-								location = MobileDevice.LOCAL;
-							}
-					    	inputs[i] = new Input(i);
-					    	inputs[i].setLocation(location);
-					    	inputs[i].setType(Input.SOFTKEYS);
-					    	i+=1;
-					    	inputs[i] = new Input(i);
-					    	inputs[i].setLocation(location);
-					    	inputs[i].setType(Input.KEYPAD);
-						}
-					}
-				});
-		    } catch(Throwable e) {
-		        SWT.error(SWT.ERROR_CANNOT_GET_SELECTION);	       
-		    }
-	    }
-	    return inputs;
-	}
-	
-	
-	/**
-	 * Returns an array of Screen objects describing the display features available to the device. 
-	 * The return value may be <code>null</code> if there are no display screens available.
-	 * 
-	 * @exception SWTError <ul>
-	 *    <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because 
-	 * 		of an operating system failure</li>
-	 * </ul> 
-	 *
-	 * @see Screen
-	 */
-	public Screen[] getScreens() {
-		if(screens == null) {
-		    try {
-			    (getDisplay()).syncExec(new Runnable() {
-					public void run() {
-					    int nbScreens = OS.QDesktopWidget_screenCount(desktopWidgetHandle);
-					    activeScreenId = OS.getScreenDeviceNumber();
-					    screens = new Screen[nbScreens];
-					    for(int i=0; i<nbScreens; i++) {
-					        screens[i] = new Screen(i, desktopWidgetHandle);
-					    }
-					}
-				});
-		    } catch(Throwable e) {
-		        SWT.error(SWT.ERROR_CANNOT_GET_SELECTION);	       
-		    }
-	    }
-	    return screens;
-	}
-	
-	
-	/**
-	 * Returns singleton instance of MobileDevice class.
-	 * 
-	 * @return singleton of MobileDevice class. Must not be Null.
-	 * 
-	 * @exception SWTError <ul>
-	 *    <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of 
-	 * 		an operating system failure</li>
-	 * </ul> 
-	 */ 
-	public static MobileDevice getMobileDevice() {
-	    if(currentMobileDevice == null) {
-	        try {
-		        currentMobileDevice = new MobileDevice(); 
-		        Internal_PackageSupport.setMobileDevice(getDisplay(),currentMobileDevice);
-			    desktopWidgetHandle = OS.QApplication_desktop();
-			    hookEvents();
-	        } catch (Throwable e) {
-	            SWT.error(SWT.ERROR_CANNOT_GET_SELECTION);
-	        }
-	    }
-	    return currentMobileDevice;
-	}
-	 
-	 
-	/**
-	 * Returns whether device is opened. For devices that have no internal screens 
-	 * or input features, the method always returns <code>true</code>.
-	 */
-	public boolean isOpen() { 
-	    getDisplay();
+    /**
+     * Adds the listener to the collection of listeners who will be notified when a device 
+     * configuration change occurs, by calling one of the methods defined in the 
+     * <code>MobileDeviceListener</code> interface. 
+     * <p>
+     * <code>screenChanged</code> is called when a monitor configuration changes.<br>
+     * <code>inputChanged</code> is called when an input configuration changes.<br>
+     * <code>deviceChanged</code> is called when the device is opened or closed.<br>
+     *
+     * @param listener instance called when device events occur
+     *
+     * @exception IllegalArgumentException <ul>
+     *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+     * </ul>
+     * @exception SWTError <ul>
+     *    <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+     * </ul>
+     *
+     * @see #removeMobileDeviceListener
+     * @see MobileDeviceListener
+     */
+    public void addMobileDeviceListener(MobileDeviceListener listener) {
+        if (listener == null) {
+            SWT.error (SWT.ERROR_NULL_ARGUMENT);
+        }
+        mobileDeviceListeners.addElement(listener);
+    }
+    
+    
+    /**
+     * Alerts the user using device specific mechanisms such as sounds, flashing, or
+     * vibration. <code>Level</code> must be one of ALERT_LOW_IMPORTANCE,
+     * ALERT_HIGH_IMPORTANCE, or ALERT_CRITICAL. The method maps these levels to
+     * device specific features that may also be dependent upon user configuration
+     * or current profile.
+     * 
+     * @param level
+     *            constant describing the importance of the alert
+     * 
+     * @exception IllegalArgumentException
+     *                <ul>
+     *                <li>ERROR_INVALID_ARGUMENT - if level is not one of the
+     *                allowed class constants</li>
+     *                </ul>
+     * 
+     * @see #ALERT_LOW_IMPORTANCE
+     * @see #ALERT_HIGH_IMPORTANCE
+     * @see #ALERT_CRITICAL
+     */
+    public void alert(int level) {
+        if (    level != ALERT_LOW_IMPORTANCE &&
+                level != ALERT_HIGH_IMPORTANCE &&
+                level != ALERT_CRITICAL) {
+            SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+        }
+        alertLevel = level;
+        (getDisplay()).syncExec(new Runnable() {
+            public void run() {
+                if(alertLevel == ALERT_LOW_IMPORTANCE){
+                    OS.QApplication_beep();
+                }else if(alertLevel == ALERT_HIGH_IMPORTANCE){
+                    OS.MobileDevice_flashLights(handleMobileDevice, 3000);
+                    OS.MobileDevice_vibration(handleMobileDevice, 3000);
+                }else if(alertLevel == ALERT_CRITICAL){
+                    OS.QApplication_beep();
+                    OS.MobileDevice_flashLights(handleMobileDevice, 3000);
+                    OS.MobileDevice_vibration(handleMobileDevice, 3000);
+                }
+               
+            }
+        }); 
+    }
+    
+    
+    /**
+     * Returns an array of Input objects describing the input features available to the device. 
+     * The return value may be <code>null</code> if there are no input features available.
+     * 
+     * @exception SWTError <ul>
+     *    <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because 
+     *         of an operating system failure</li>
+     * </ul> 
+     *
+     * @see Input
+     */
+    public Input[] getInputs() {
+        if(inputs == null) {
+            try {
+                (getDisplay()).syncExec(new Runnable() {
+                    public void run() {
+                        int mask = OS.getHwInputs();
+                        int nbInputs = 0;
+                        
+                        // finding out number of keyboards available
+                        if((mask & OS.SYMBIAN_KEYBOARD_FULL)!=0){
+                            nbInputs+=2;
+                        }
+                        
+                        if((mask & OS.SYMBIAN_KEYBOARD_KEYPAD)!=0){
+                            nbInputs+=2;
+                        }
+                        // create java counter part of Inputs and
+                        // add location and type
+                        inputs = new Input[nbInputs];
+                        int i=0;
+                        int location;
+                        if((mask & OS.SYMBIAN_KEYBOARD_FULL)!=0){
+                            if((mask & OS.SYMBIAN_KEYBOARD_KEYPAD)!=0){
+                                location = MobileDevice.INTERNAL;
+                            } else {
+                                location = MobileDevice.LOCAL;
+                            }
+                            inputs[i] = new Input(i);
+                            inputs[i].setLocation(location);
+                            inputs[i].setType(Input.SOFTKEYS);
+                            i+=1;
+                            inputs[i] = new Input(i);
+                            inputs[i].setLocation(location);
+                            inputs[i].setType(Input.FULL_KEYBOARD);
+                            i+=1;
+                        }
+                        
+                        if((mask & OS.SYMBIAN_KEYBOARD_KEYPAD)!=0){
+                            if((mask & OS.SYMBIAN_KEYBOARD_FULL)!=0){
+                                location = MobileDevice.EXTERNAL;
+                            } else {
+                                location = MobileDevice.LOCAL;
+                            }
+                            inputs[i] = new Input(i);
+                            inputs[i].setLocation(location);
+                            inputs[i].setType(Input.SOFTKEYS);
+                            i+=1;
+                            inputs[i] = new Input(i);
+                            inputs[i].setLocation(location);
+                            inputs[i].setType(Input.KEYPAD);
+                        }
+                    }
+                });
+            } catch(Throwable e) {
+                SWT.error(SWT.ERROR_CANNOT_GET_SELECTION);           
+            }
+        }
+        return inputs;
+    }
+    
+    
+    /**
+     * Returns an array of Screen objects describing the display features available to the device. 
+     * The return value may be <code>null</code> if there are no display screens available.
+     * 
+     * @exception SWTError <ul>
+     *    <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because 
+     *         of an operating system failure</li>
+     * </ul> 
+     *
+     * @see Screen
+     */
+    public Screen[] getScreens() {
+        if(screens == null) {
+            try {
+                (getDisplay()).syncExec(new Runnable() {
+                    public void run() {
+                        int nbScreens = OS.QDesktopWidget_screenCount(desktopWidgetHandle);
+                        activeScreenId = OS.getScreenDeviceNumber();
+                        screens = new Screen[nbScreens];
+                        for(int i=0; i<nbScreens; i++) {
+                            screens[i] = new Screen(i, desktopWidgetHandle);
+                        }
+                    }
+                });
+            } catch(Throwable e) {
+                SWT.error(SWT.ERROR_CANNOT_GET_SELECTION);           
+            }
+        }
+        return screens;
+    }
+    
+    
+    /**
+     * Returns singleton instance of MobileDevice class.
+     * 
+     * @return singleton of MobileDevice class. Must not be Null.
+     * 
+     * @exception SWTError <ul>
+     *    <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of 
+     *         an operating system failure</li>
+     * </ul> 
+     */ 
+    public static MobileDevice getMobileDevice() {
+        if(currentMobileDevice == null) {
+            try {
+                currentMobileDevice = new MobileDevice(); 
+                Internal_PackageSupport.setMobileDevice(getDisplay(),currentMobileDevice);
+                desktopWidgetHandle = OS.QApplication_desktop();
+                hookEvents();
+            } catch (Throwable e) {
+                SWT.error(SWT.ERROR_CANNOT_GET_SELECTION);
+            }
+        }
+        return currentMobileDevice;
+    }
+     
+     
+    /**
+     * Returns whether device is opened. For devices that have no internal screens 
+     * or input features, the method always returns <code>true</code>.
+     */
+    public boolean isOpen() { 
+        getDisplay();
 
-	    return isOpen; 
-	}
+        return isOpen; 
+    }
 
-	
-	/**
-	 * Call to dispose the Screen object.
-	 *
-	 */
-	void internal_dispose() {
-		if (inputs != null) {
-			for (int i = 0; i < inputs.length; i++) {
-				if (inputs[i] != null) {
-					inputs[i].internal_dispose();
-				}
-			}
-		}
+    
+    /**
+     * Call to dispose the Screen object.
+     *
+     */
+    void internal_dispose() {
+        if (inputs != null) {
+            for (int i = 0; i < inputs.length; i++) {
+                if (inputs[i] != null) {
+                    inputs[i].internal_dispose();
+                }
+            }
+        }
 
-		if (screens != null) {
-			for (int i = 0; i < screens.length; i++) {
-				if (screens[i] != null) {
-					screens[i].internal_dispose();
-				}
-			}
-		}
-		// actual native counter part is deleted in display
-		currentMobileDevice = null;
-		handleMobileDevice = 0;
-		inputs = null;
-		screens = null;
-		desktopWidgetHandle = 0;
-	}
-	
-	
-	/**
-	 * Removes the listener from the collection of listeners who will be notified when a device 
-	 * configuration change occurs. 
-	 *
-	 * @param listener instance called when device events occur
-	 *
-	 * @exception IllegalArgumentException <ul>
-	 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
-	 * </ul>
-	 * @exception SWTError <ul>
-	 *    <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because 
-	 * 		of an operating system failure</li>
-	 * </ul>
-	 *
-	 * @see #addMobileDeviceListener
-	 * @see MobileDeviceListener
-	 */
-	public void removeMobileDeviceListener(MobileDeviceListener listener) {
-		if (listener == null) {
-			SWT.error (SWT.ERROR_NULL_ARGUMENT);
-		}
+        if (screens != null) {
+            for (int i = 0; i < screens.length; i++) {
+                if (screens[i] != null) {
+                    screens[i].internal_dispose();
+                }
+            }
+        }
+        // actual native counter part is deleted in display
+        currentMobileDevice = null;
+        handleMobileDevice = 0;
+        inputs = null;
+        screens = null;
+        desktopWidgetHandle = 0;
+    }
+    
+    
+    /**
+     * Removes the listener from the collection of listeners who will be notified when a device 
+     * configuration change occurs. 
+     *
+     * @param listener instance called when device events occur
+     *
+     * @exception IllegalArgumentException <ul>
+     *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+     * </ul>
+     * @exception SWTError <ul>
+     *    <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because 
+     *         of an operating system failure</li>
+     * </ul>
+     *
+     * @see #addMobileDeviceListener
+     * @see MobileDeviceListener
+     */
+    public void removeMobileDeviceListener(MobileDeviceListener listener) {
+        if (listener == null) {
+            SWT.error (SWT.ERROR_NULL_ARGUMENT);
+        }
 
-		//remove listener
-		//Remove method of Vector class never fails,
-		//so ERROR_ITEM_NOT_REMOVED could never be thrown.
-		mobileDeviceListeners.removeElement(listener);
-	}
-	
-	 /**
-	  * Sets the status of the system virtual keyboard (if one is available).
-	  * By default, or when status is set to VK_NORMAL, a system virtual keyboard
-	  * is displayed when a widget capable of text input gains focus and is
-	  * hidden when that widget looses focus. However, there are cases where 
-	  * an application may wish to continuously display the virtual keyboard
-	  * or always keep it hidden. Setting the status to VK_ALWAYS_ON or VK_ALWAYS_OFF
-	  * will accomplish this and the effect is immediate. Changing focus will
-	  * then have no affect on the virtual keyboard. Note: By default, widgets which 
-	  * normally accept input but are set to <i>read only</i> do not cause the 
-	  * the virtual keyboard to display.
-	  *
-	  * @param status virtual keyboard mode. One of VK_NORMAL, VK_ALWAYS_ON, VK_ALWAYS_OFF
-	  * 
-	  * @exception IllegalArgumentException <ul>
-	  *    <li>ERROR_INVALID_ARGUMENT - if the status parameter is not valid</li>
-	  * </ul>
-	  *
-	  * @see #VK_NORMAL
-	  * @see #VK_ALWAYS_ON
-	  * @see #VK_ALWAYS_OFF
-	  */
-	public void setVKStatus(int status){
-		
-	}
+        //remove listener
+        //Remove method of Vector class never fails,
+        //so ERROR_ITEM_NOT_REMOVED could never be thrown.
+        mobileDeviceListeners.removeElement(listener);
+    }
+    
+     /**
+      * Sets the status of the system virtual keyboard (if one is available).
+      * By default, or when status is set to VK_NORMAL, a system virtual keyboard
+      * is displayed when a widget capable of text input gains focus and is
+      * hidden when that widget looses focus. However, there are cases where 
+      * an application may wish to continuously display the virtual keyboard
+      * or always keep it hidden. Setting the status to VK_ALWAYS_ON or VK_ALWAYS_OFF
+      * will accomplish this and the effect is immediate. Changing focus will
+      * then have no affect on the virtual keyboard. Note: By default, widgets which 
+      * normally accept input but are set to <i>read only</i> do not cause the 
+      * the virtual keyboard to display.
+      *
+      * @param status virtual keyboard mode. One of VK_NORMAL, VK_ALWAYS_ON, VK_ALWAYS_OFF
+      * 
+      * @exception IllegalArgumentException <ul>
+      *    <li>ERROR_INVALID_ARGUMENT - if the status parameter is not valid</li>
+      * </ul>
+      *
+      * @see #VK_NORMAL
+      * @see #VK_ALWAYS_ON
+      * @see #VK_ALWAYS_OFF
+      */
+    public void setVKStatus(int status){
+        
+    }
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Composite.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Composite.java	Thu Jul 22 16:31:34 2010 +0100
@@ -510,7 +510,7 @@
     return new Point (width, height);
 }
 
-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) {
     if (isDisposed ()) return;
     if((widgetHandle == handle) && isMirrored()) {
         // In real coordinate system the children need to be moved so that they
@@ -533,7 +533,7 @@
             }
         }
     }
-    super.qt_swt_event_widgetResized_pp(widgetHandle, oldWidth, oldHeight, width, height);
+    super.qt_swt_event_widgetResized_pp(widgetHandle, oldWidth, oldHeight, width, height, sendResizeEvent);
     if (layout != null) {
         markLayout (false, false);
         updateLayout (false);
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Control.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Control.java	Thu Jul 22 16:31:34 2010 +0100
@@ -1977,10 +1977,10 @@
         sendEvent(SWT.Move);
 }
 
-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) {
     // Resize events are sent only for top native widget,
     // as some Controls are made of multiple native widgets.
-    if (widgetHandle == topHandle)
+    if (widgetHandle == topHandle && sendResizeEvent)
         sendEvent(SWT.Resize);
 }
 
@@ -2008,9 +2008,8 @@
             Display.focusEvent = SWT.None;
         }
     }
-    if(display != null && !display.isDisposed()) {
-        Display.commandArranger.focusedControlChanged();
-    }
+    
+    
 }
 void qt_swt_event_focusWasLost() {
     try {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Decorations.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Decorations.java	Thu Jul 22 16:31:34 2010 +0100
@@ -902,6 +902,7 @@
 
 boolean qt_event_windowActivate(int widgetHandle) {
     if(widgetHandle == topHandle) {
+        display.commandArranger.shellActivityChanged();
         sendEvent(SWT.Activate);
     }
     return false;
@@ -909,6 +910,7 @@
 
 boolean qt_event_windowDeactivate(int widgetHandle) {
     if(widgetHandle == topHandle) {
+        display.commandArranger.shellActivityChanged();
         sendEvent(SWT.Deactivate);
         saveFocus();
     }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Shell.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/common_j2me/org/eclipse/swt/internal/ApplicationUidWrapper.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009,2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Nokia Corporation - initial implementation
- *******************************************************************************/
-package org.eclipse.swt.internal;
-
-import com.nokia.mj.impl.rt.support.ApplicationInfo;
-
-
-public final class ApplicationUidWrapper {
-
-	public static int uid() {
-        int midletUid = -1;
-        try{
-            String uidS = ApplicationInfo.getInstance().getUid().getStringValue();
-            // In Symbian the UID is in format '[<uid>]' where <uid> is in hex
-            // format. So wee need to take the brackets away.
-            // Long is needed in conversion because UIDs greater than 0x80000000
-            // would fail if Integer would be used. However typecast from long
-            // to int is safe since UID in Symbian is 32 bit.
-            long uidL = Long.parseLong(uidS.substring(1,uidS.length()-1), 16);
-            return (int)uidL;
-        }
-        catch (Throwable t) {/* Not handled*/ }
-        return midletUid;
-    }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2me/org/eclipse/swt/internal/CommandPresentationStrategyWrapper.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     Nokia Corporation - initial implementation 
- *******************************************************************************/
-package org.eclipse.swt.internal;
-
-public final class CommandPresentationStrategyWrapper {
-	public static org.eclipse.swt.internal.qt.CommandPresentationStrategy createStrategy() {
-    	return new org.eclipse.swt.internal.qt.s60.S60CommandPresentationStrategy();	
-    	}
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2me/org/eclipse/swt/internal/ExitNotificationWrapper.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2me/org/eclipse/swt/internal/ExitNotificationWrapper.java	Thu Jul 22 16:31:34 2010 +0100
@@ -14,10 +14,13 @@
  * Note that this might be called directly from native code. 
  * Be careful renaming or moving it.
  */ 
-public class ExitNotificationWrapper {  
+public final class ExitNotificationWrapper {  
     
     public static void notifyExit() {
         com.nokia.mj.impl.rt.support.ApplicationUtils.getInstance().notifyExitCmd();
     }
     
+    public static void uiDisposed() {
+        com.nokia.mj.impl.rt.support.ApplicationUtils.getInstance().uiDisposed();
+    }
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/ApplicationUidWrapper.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     Nokia Corporation - initial implementation 
- *******************************************************************************/
-package org.eclipse.swt.internal;
-
-public final class ApplicationUidWrapper {
-    public static int uid() {
-        return 0;
-    }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/CommandPresentationStrategyWrapper.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     Nokia Corporation - initial implementation 
- *******************************************************************************/
-package org.eclipse.swt.internal;
-
-public final class CommandPresentationStrategyWrapper {
-	public static org.eclipse.swt.internal.qt.CommandPresentationStrategy createStrategy() {
-    	return new org.eclipse.swt.internal.qt.DesktopCommandPresentationStrategy();
-        }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/ExitNotificationWrapper.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/ExitNotificationWrapper.java	Thu Jul 22 16:31:34 2010 +0100
@@ -12,13 +12,16 @@
 import org.eclipse.swt.widgets.Display;
 
 
-public class ExitNotificationWrapper {	
-	
-	public static void notifyExit() {
-	    Display display = Display.getCurrent();
-	    if(display != null) {
-	        display.dispose();
-		}
- 	}
-	
+public final class ExitNotificationWrapper {	
+    
+    public static void notifyExit() {
+        Display display = Display.getCurrent();
+        if(display != null) {
+            display.dispose();
+        }
+    }
+    
+    public static void uiDisposed() {
+        notifyExit();
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/linux/org/eclipse/swt/internal/ApplicationUidWrapper.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Nokia Corporation - initial implementation 
+ *******************************************************************************/
+package org.eclipse.swt.internal;
+
+public final class ApplicationUidWrapper {
+    public static int uid() {
+        return 0;
+    }
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/linux/org/eclipse/swt/internal/qt/s60/S60CommandPresentationStrategy.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-package org.eclipse.swt.internal.qt.s60;
-
-import org.eclipse.ercp.swt.mobile.Command;
-import org.eclipse.swt.internal.qt.CommandPresentationStrategy;
-import org.eclipse.swt.internal.qt.CommandUtils;
-import org.eclipse.swt.internal.qt.OS;
-import org.eclipse.swt.internal.qt.CommandArranger.CommandCollection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Internal_PackageSupport;
-import org.eclipse.swt.widgets.Widget;
-
-public class S60CommandPresentationStrategy extends CommandPresentationStrategy {
-    private Command[] positiveKeyCommands;
-    private Command negativeKeyCommand;
-    private Command defaultCommand;
-
-    public S60CommandPresentationStrategy() {
-        super();
-    }
-
-    protected void dispose() {
-        positiveKeyCommands = null;
-        negativeKeyCommand = null;
-        defaultCommand =null;
-    }
-
-
-    protected void handleCommandListChange(Command added, Command removed,
-            CommandCollection commands) {
-        cleanNegativeCommand();
-        cleanPositiveCommands();
-        updateCommandPositions(commands.getCommands(null));
-        placeNegativeCommand();
-        placePositiveCommands();
-    }
-
-    protected void handleDefaultCommandChange(Command defaultCommand) {
-        this.defaultCommand = defaultCommand;
-        cleanPositiveCommands();
-        placePositiveCommands();
-    }
-
-
-    protected void handleFocusChange(Control focused,
-            CommandCollection oldCommands, CommandCollection commands) {
-
-        //Clean-up the existing commands
-        cleanPositiveCommands();
-        cleanNegativeCommand();
-        //determine where the commands go
-        if( commands != null && commands.getSize()>0 ){
-            Command[] add = commands.getCommands(null);
-            updateCommandPositions(add);
-        }
-        //Place them to their places
-        placePositiveCommands();
-        placeNegativeCommand();
-
-    }
-
-    private void updateCommandPositions(Command[] commands) {
-        positiveKeyCommands = new Command[commands.length];
-        int  positiveKeyIndex=0;
-        for (int i = 0; i < commands.length; i++) {
-            Command cmd = commands[i];
-            if ( cmd.isDefaultCommand()){
-                defaultCommand = cmd;
-                continue;
-            }
-            if( CommandUtils.isNegativeType(cmd.type) ){
-                if (negativeKeyCommand == null || negativeKeyCommand.isDisposed()){
-                    negativeKeyCommand = cmd;
-                }else
-                if( negativeKeyCommand.getPriority() <= cmd.getPriority() ){
-                    positiveKeyCommands[positiveKeyIndex] = negativeKeyCommand;
-                    positiveKeyIndex++;
-                    negativeKeyCommand = cmd;
-                }else{
-                    positiveKeyCommands[positiveKeyIndex] = cmd;
-                    positiveKeyIndex++;
-                }
-                continue;
-            }
-            positiveKeyCommands[positiveKeyIndex]=cmd;
-            positiveKeyIndex++;
-        }
-        if ((positiveKeyIndex) < positiveKeyCommands.length ){// needs to shrink
-            Command[] rightSized = new Command[positiveKeyIndex];
-            System.arraycopy(positiveKeyCommands, 0, rightSized, 0, rightSized.length);
-            positiveKeyCommands = rightSized;
-        }
-    }
-
-
-    private void cleanPositiveCommands() {
-        boolean useBar = false;
-        if ( (positiveKeyCommands != null && positiveKeyCommands.length >1) ||
-                (defaultCommand != null && positiveKeyCommands != null) ){
-            useBar = true;
-        }
-        if (defaultCommand != null && !defaultCommand.isDisposed()
-                && !defaultCommand.control.isDisposed()) {
-            if (useBar) {
-                OS.QWidget_removeAction(defaultCommand.control.getShell()
-                        .internal_getOwnMenuBar(), topHandle(defaultCommand));
-            }
-            else{
-                 OS.QWidget_removeAction(topHandle(defaultCommand.control), topHandle(defaultCommand));
-            }
-        }
-        if (positiveKeyCommands != null) {
-            for (int i = 0; i < positiveKeyCommands.length; i++) {
-                Command cmd = positiveKeyCommands[i];
-                if (cmd == null || cmd.isDisposed()  || cmd.control.isDisposed()){
-                	continue;
-                }
-                int handle = 0;
-                if (useBar) {
-                    handle = cmd.control.getShell().internal_getOwnMenuBar();
-                } else {
-                    handle = topHandle(positiveKeyCommands[0].control);
-                }
-                OS.QWidget_removeAction(handle, topHandle(cmd));
-
-            }
-        }
-    }
-
-   private void cleanNegativeCommand() {
-        if(negativeKeyCommand != null && !negativeKeyCommand.isDisposed() && !negativeKeyCommand.control.isDisposed() ){
-            OS.QWidget_removeAction(topHandle(negativeKeyCommand.control), topHandle(negativeKeyCommand));
-        }
-    }
-
-    private void placeNegativeCommand() {
-        if(negativeKeyCommand != null ){
-            OS.QWidget_addAction(Internal_PackageSupport.topHandle(negativeKeyCommand.control),
-                    topHandle(negativeKeyCommand));
-        }
-    }
-
-    private void placePositiveCommands() {
-        if (defaultCommand != null ) {
-            int defaultCmdHandle = topHandle(defaultCommand);
-            if (positiveKeyCommands != null) {
-                OS.QMenuBar_addAction(defaultCommand.control.getShell()
-                        .internal_getOwnMenuBar(), defaultCmdHandle);
-            } else {
-                OS.QWidget_addAction(Internal_PackageSupport
-                        .topHandle(defaultCommand.control), defaultCmdHandle);
-            }
-        }
-        if (positiveKeyCommands != null) {
-            if (positiveKeyCommands.length == 1 && defaultCommand == null) {
-                OS.QWidget_addAction(Internal_PackageSupport
-                        .topHandle(positiveKeyCommands[0].control),
-                        topHandle(positiveKeyCommands[0]));
-            } else {
-                CommandUtils.sort(positiveKeyCommands);
-                for (int i = 0; i < positiveKeyCommands.length; i++) {
-                    OS.QMenuBar_addAction(positiveKeyCommands[i].control
-                            .getShell().internal_getOwnMenuBar(),
-                            topHandle(positiveKeyCommands[i]));
-                }
-            }
-        }
-    }
-
-    protected void handleMenuBarChanged(int newMenuBar,
-            CommandCollection commands) {
-        placePositiveCommands();
-    }
-
-
-    private static final int topHandle(Widget w) {
-        return Internal_PackageSupport.topHandle(w);
-    }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eventcallback.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/graphicscontextimpl.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/imageloaderimpl.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/surfaceimpl.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_linux.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/swtapplication.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtapplication.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -123,7 +123,7 @@
     SWT_LOG_FUNC_CALL();
     int handle = 0;
 #ifdef __SYMBIAN32__
-   handle = reinterpret_cast<int>(CSwtMobileDevice::NewL());
+    TRAP_IGNORE(handle = reinterpret_cast<int>(CSwtMobileDevice::NewL()));
 #endif
     return handle;
     }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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/swtmobiledevice.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -146,7 +146,7 @@
     {
     if ((aLevel < 0) || (aLevel > KMIDMaxLightLevel))
         {
-        User::Leave(KErrArgument);
+        return;
         }
 
     if (!iHWRMLight)
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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/library/webkit/os.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/webkit/os.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -15,13 +15,13 @@
 #include <QWebHistory>
 #endif
 
-#include "org_eclipse_swt_internal_qt_webkit_OS_0005fwebkit.h"
+#include "org_eclipse_swt_internal_qt_webkit_WebkitOS.h"
 #include "swt.h"
 #include "swtlog.h"
 #include "swtapplication.h"
 #include "jniutils.h"
 
-#define OS_NATIVE(func) Java_org_eclipse_swt_internal_qt_webkit_OS_1webkit_##func
+#define OS_NATIVE(func) Java_org_eclipse_swt_internal_qt_webkit_WebkitOS_##func
 
 using namespace Java::eSWT;
 
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java	Thu Jul 22 16:31:34 2010 +0100
@@ -11,12 +11,14 @@
 package org.eclipse.swt.internal.qt;
 
 import org.eclipse.ercp.swt.mobile.Command;
-import org.eclipse.swt.internal.CommandPresentationStrategyWrapper;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Decorations;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Internal_PackageSupport;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
 /**
  * Manages the Command presentation cycle. This is a singleton object that gets
  * notified about the events that can have an effect on the way the Commands are
@@ -24,298 +26,420 @@
  * context with the help of {@link CommandCollection}. It also notifies the
  * currently active {@link CommandPresentationStrategy} so that the presentation
  * is updated if necessary.
- *
+ * 
  * @see Command
  * @see CommandCollection
  * @see CommandPresentationStrategy
  */
 public class CommandArranger {
-    Control focusedControl;
 
-    /**
-     * A helper for keeping an ordered list of {@link Command}s in the current focus context.
-     * The Commands are ordered according to their proximity to the currently focused control.
-     * The ordered list starts with Commands from the currently focused Control if any and ends with
-     * the active Shell and includes all the Commands in between. If a Control has more
-     * than one Command they are ordered among themselves according to creation order.
-     */
-    public class CommandCollection{
+/**
+ * A helper for keeping an ordered list of {@link Command}s in the current focus
+ * context. The Commands are ordered according to their proximity to the
+ * currently focused control. The ordered list starts with Commands from the
+ * currently focused Control if any and ends with the active Shell and includes
+ * all the Commands in between. If a Control has more than one Command they are
+ * ordered among themselves according to creation order.
+ */
+public class CommandCollection {
 
-        private Command[] fCommands;
+private Command[] fCommands;
 
-        CommandCollection(){
-            super();
-        }
+CommandCollection() {
+    super();
+}
 
-        /**
-         * Adds the command to the collection.
-         * Warning: This does not make duplicate control.
-         * @param command
-         */
-        void addCommand(Command command) {
-            if (command == null)
-                return;
-            if (fCommands == null) {
-                fCommands = new Command[1];
-                fCommands[0] = command;
-                return;
-            }
-            int size = fCommands.length + 1;
-            Command[] newList = new Command[size];
-            // find the insertion point so that the order is correct
-            int insertPoint = 0;
-            Shell activeShell = display.getActiveShell();
-            Control ctrl = display.getFocusControl();
-            while (ctrl != null && ctrl != activeShell) {
-                if (ctrl == command.control) {
-                    // Adding a command to focused control increment by one.
-                    // adding Command.internal_getCommands(ctrl).length will
-                    // just duplicate the count for Commands already in array.
-                    insertPoint++;
-                    break;
-                }
-                insertPoint += Command.internal_getCommands(ctrl).length;
-                ctrl = ctrl.getParent();
-            }
-            System.arraycopy(fCommands, 0, newList, 0, insertPoint);
-            System.arraycopy(fCommands, insertPoint, newList, insertPoint + 1,
-                    fCommands.length - insertPoint);
-            newList[insertPoint] = command;
-            fCommands = newList;
+/**
+ * Adds the command to the collection. Warning: This does not make duplicate
+ * control.
+ * 
+ * @param command
+ */
+void addCommand(Command command) {
+    if (command == null)
+        return;
+    if (fCommands == null) {
+        fCommands = new Command[1];
+        fCommands[0] = command;
+        return;
+    }
+    int size = fCommands.length + 1;
+    Command[] newList = new Command[size];
+    // find the insertion point so that the order is correct
+    int insertPoint = 0;
+    Shell activeShell = display.getActiveShell();
+    Control ctrl = display.getFocusControl();
+    while (ctrl != null && ctrl != activeShell) {
+        if (ctrl == command.control) {
+            // Adding a command to focused control increment by one.
+            // adding Command.internal_getCommands(ctrl).length will
+            // just duplicate the count for Commands already in array.
+            insertPoint++;
+            break;
         }
+        insertPoint += Command.internal_getCommands(ctrl).length;
+        ctrl = ctrl.getParent();
+    }
+    System.arraycopy(fCommands, 0, newList, 0, insertPoint);
+    System.arraycopy(fCommands, insertPoint, newList, insertPoint + 1, fCommands.length
+        - insertPoint);
+    newList[insertPoint] = command;
+    fCommands = newList;
+}
 
-        /**
-         * Adds the list of Commands to the collection.
-         * @param commands
-         */
-        void addCommand( Command[] commands ){
-            if (commands == null || commands.length == 0 ) return;
-            if (fCommands == null ){
-                fCommands = new Command[ commands.length ];
-                System.arraycopy(commands, 0, fCommands, 0, commands.length );
-                return;
-            }
-            int size = commands.length + fCommands.length;
-            Command[] newList = new Command[ size ];
-            System.arraycopy(fCommands, 0, newList, 0, fCommands.length);
-            System.arraycopy(commands, 0, newList, fCommands.length , commands.length );
-            fCommands = newList;
+/**
+ * Adds the list of Commands to the collection.
+ * 
+ * @param commands
+ */
+void addCommand(Command[] commands) {
+    if (commands == null || commands.length == 0)
+        return;
+    if (fCommands == null) {
+        fCommands = new Command[commands.length];
+        System.arraycopy(commands, 0, fCommands, 0, commands.length);
+        return;
+    }
+    int size = commands.length + fCommands.length;
+    Command[] newList = new Command[size];
+    System.arraycopy(fCommands, 0, newList, 0, fCommands.length);
+    System.arraycopy(commands, 0, newList, fCommands.length, commands.length);
+    fCommands = newList;
+}
+
+/**
+ * Removes the command from the list.
+ * 
+ * @param command
+ */
+void removeCommand(Command command) {
+    if (command == null)
+        return;
+    if (fCommands == null || fCommands.length == 0)
+        return;
+    int removeIndex = -1;
+    for (int i = 0; i < fCommands.length; i++) {
+        if (fCommands[i] == command) {
+            removeIndex = i;
         }
+    }
+    if (removeIndex == -1)
+        return;
+    Command[] newList = new Command[fCommands.length - 1];
+    System.arraycopy(fCommands, 0, newList, 0, removeIndex);
+    System.arraycopy(fCommands, removeIndex + 1, newList, removeIndex, (fCommands.length
+        - removeIndex - 1));
+    fCommands = newList;
+}
 
-        /**
-         * Removes the command from the list.
-         * @param command
-         */
-        void removeCommand( Command command ){
-            if ( command == null ) return;
-            if (fCommands == null || fCommands.length == 0 ) return;
-            int removeIndex = -1;
-            for (int i = 0; i < fCommands.length; i++) {
-                if(fCommands[i] == command ){
-                    removeIndex = i;
-                }
+/**
+ * Returns the number of the Commands
+ * 
+ * @return boolean
+ */
+int getSize() {
+    int size = 0;
+    if (fCommands != null)
+        size = fCommands.length;
+    return size;
+}
+
+/**
+ * Retrieves the Commands of the types indicated by the commandTypes array. The
+ * order of the commandTypes array has no significance. Passing a null parameter
+ * or an empty array retrieves all the available Commands.
+ * 
+ * @param commandTypes
+ * @return Command list
+ */
+Command[] getCommands(int[] commandTypes) {
+    if (commandTypes == null || commandTypes.length == 0) {
+        return fCommands;
+    }
+    int size = getSize();
+    Command[] filteredCommands = new Command[size];
+    int index = 0;
+    for (int i = 0; i < fCommands.length; i++) {
+        for (int j = 0; j < commandTypes.length; j++) {
+            if (fCommands[i].type == commandTypes[j]) {
+                filteredCommands[index] = fCommands[i];
+                index++;
+                break;
             }
-            if ( removeIndex == -1 ) return;
-            Command[] newList = new Command[ fCommands.length -1 ];
-            System.arraycopy( fCommands, 0, newList, 0, removeIndex);
-            System.arraycopy( fCommands, removeIndex + 1, newList, removeIndex, (fCommands.length - removeIndex -1) );
-            fCommands = newList;
         }
+    }
+    if (size > (index)) {// Some commands filtered resize the Array
+        Command[] shrunk = new Command[index];
+        System.arraycopy(filteredCommands, 0, shrunk, 0, index);
+        return shrunk;
+    }
+    return filteredCommands;
+}
 
-        /**
-         * Returns the number of the Commands
-         *
-         * @return boolean
-         */
-        public int getSize(){
-            int size = 0;
-            if (fCommands != null ) size = fCommands.length;
-            return size;
-        }
+}// CommandCollection
 
-        /**
-         * Retrieves the Commands of the types indicated by the commandTypes array.
-         * The order of the commandTypes array has no significance. Passing a null parameter
-         * or an empty array retrieves all the available Commands.
-         *
-         * @param commandTypes
-         * @return Command list
-         */
-        public Command[] getCommands( int[] commandTypes ){
-            if ( commandTypes == null || commandTypes.length == 0 ){
-                return fCommands;
-            }
-            int size = getSize();
-            Command[] filteredCommands = new Command[size];
-            int index = 0;
-            for (int i = 0; i < fCommands.length ; i++) {
-                for(int j = 0; j<commandTypes.length; j++){
-                    if ( fCommands[i].type == commandTypes[j] ){
-                        filteredCommands[index]=fCommands[i];
-                        index++;
-                        break;
-                    }
-                }
-            }
-            if( size > (index) ){// Some commands filtered resize the Array
-                Command[] shrunk = new Command[index];
-                System.arraycopy( filteredCommands, 0, shrunk, 0, index);
-                return shrunk;
-            }
-            return filteredCommands;
-        }
-    }// CommandCollection
+private CommandCollection currentCommands;
+private Command defaultCommand;
+private Display display;
+Control focusedControl;
+Shell lastKnownActiveShell;
+private Command[] positiveKeyCommands;
+private Command negativeKeyCommand;
+
+
+public CommandArranger(Display display) {
+    super();
+    this.display = display;
+    currentCommands = new CommandCollection();
+}
 
-    private CommandCollection currentCommands;
-    private CommandPresentationStrategy strategy;
-    private Command defaultCommand;
-    private Display display;
+/**
+ * Called when the application changes the QMenuBar. This method does not handle
+ * the cases when the QMenuBar may change when the active top-level Shell
+ * changes. Since this does not cause a menu bar change on all platforms.
+ * 
+ * @see org.eclipse.swt.widgets.Decorations#setMenuBar(Menu)
+ * 
+ **/
+public void menuBarChanged(Decorations decorations) {
+    if (currentCommands == null || currentCommands.getSize() < 1)
+        return;
+    // if the changed menu bar is not on the active shell ignore and leave
+    // it to focus change.
+    if (decorations.getShell() != decorations.getDisplay().getActiveShell())
+        return;
+    // Call internal_getOwnMenuBar because the menu bar can be set to null
+    // in Decorations and
+    // we may need to create the internal one.
+    int menuBarHandle = decorations.internal_getOwnMenuBar();
 
-    public CommandArranger(Display display){
-        super();
-        this.display = display;
-        currentCommands = new CommandCollection();
-        strategy = CommandPresentationStrategyWrapper.createStrategy();
+    handleMenuBarChanged(menuBarHandle, currentCommands);
+}
+
+/**
+ * Called when a new Shell becomes active.
+ * 
+ * @see Control#qt_swt_event_focusWasGained() //TODO
+ */
+public void shellActivityChanged() {
+    Shell activeShell = display.getActiveShell();
+    
+    if (activeShell == lastKnownActiveShell) {
+        return;
+    }
+    lastKnownActiveShell = activeShell;
+    
+    cleanPositiveCommands();
+    cleanNegativeCommand();
+    
+    currentCommands = new CommandCollection();
+
+    if (activeShell != null && Command.internal_getCommands(activeShell).length > 0) {
+        currentCommands.addCommand(Command.internal_getCommands(activeShell));
     }
 
+    // Determine where the commands go
+    if (currentCommands.getSize() > 0) {
+        Command[] add = currentCommands.getCommands(null);
+        updateCommandPositions(add);
+        placePositiveCommands();
+        placeNegativeCommand();
+    }
+}
+
+/**
+ * Called when a new Command is created
+ * 
+ * @param command
+ */
+public void commandAdded(Command command) {
+    if (isInFocusContext(command.control)) {
+        currentCommands.addCommand(command);
+        handleCommandListChange(command, null, currentCommands);
+    }
+}
+
+/**
+ * Called when a Command is disposed
+ * 
+ * @param command
+ */
+public void commandRemoved(Command command) {
+    if (command == defaultCommand)
+        defaultCommand = null;
+    if (isInFocusContext(command.control)) {
+        currentCommands.removeCommand(command);
+        handleCommandListChange(null, command, currentCommands);
+    }
+}
+
+/**
+ * Called when the Display is getting disposed.
+ */
+public void dispose() {
+    currentCommands = null;
+    display = null;
+    positiveKeyCommands = null;
+    negativeKeyCommand = null;
+    defaultCommand = null;
+    lastKnownActiveShell = null;
+}
+
+/**
+ * Called when a Command is set default
+ * 
+ * @param command
+ * @see Command#setDefaultCommand();
+ */
+public void setDefaultCommand(Command command) {
+    defaultCommand = command;
+    if (isInFocusContext(command.control)) {
+        handleDefaultCommandChange(command);
+    }
+}
+
+/**
+ * Returns the default command or null if there is none.
+ * 
+ * @return
+ * @see Command#isDefaultCommand()
+ */
+public Command getDefaultCommand() {
+    return defaultCommand;
+}
 
 
-    /**
-     * Called when the application changes the QMenuBar.
-     * This method does not handle the cases when the QMenuBar
-     * may change when the active top-level Shell changes. Since
-     * this does not cause a menu bar change on all platforms.
-     *
-     * @see org.eclipse.swt.widgets.Decorations#setMenuBar(Menu)
-     *
-     **/
-    public void menuBarChanged( Decorations decorations ){
+private boolean isInFocusContext(Control control) {
+    Display display = control.getDisplay();
+    Shell activeShell = display.getActiveShell();
+    return control == activeShell;
+}
+
+private void handleCommandListChange(Command added, Command removed, CommandCollection commands) {
+    cleanNegativeCommand();
+    cleanPositiveCommands();
+    updateCommandPositions(commands.getCommands(null));
+    placeNegativeCommand();
+    placePositiveCommands();
+}
 
-        if ( currentCommands == null || currentCommands.getSize() < 1 ) return;
-        // if the changed menu bar is not on the active shell ignore and leave it to focus change.
-        if (decorations.getShell() != decorations.getDisplay().getActiveShell() )return;
-        // Call internal_getOwnMenuBar because the menu bar can be set to null in Decorations and
-        // we may need to create the internal one.
-        int menuBarHandle = decorations.internal_getOwnMenuBar();
-
-        strategy.handleMenuBarChanged( menuBarHandle, currentCommands );
-    }
+private void handleDefaultCommandChange(Command defaultCommand) {
+    this.defaultCommand = defaultCommand;
+    cleanPositiveCommands();
+    placePositiveCommands();
+}
 
-    /**
-     * Called when a new Control gains focus.
-     *
-     * @see Control#qt_swt_event_focusWasGained()
-     */
-    public void focusedControlChanged(){
-        Control focusControl = display.getFocusControl();
-        if (focusControl == focusedControl) {
-            return;
+private void updateCommandPositions(Command[] commands) {
+    positiveKeyCommands = new Command[commands.length];
+    int positiveKeyIndex = 0;
+    for (int i = 0; i < commands.length; i++) {
+        Command cmd = commands[i];
+        if (cmd.isDefaultCommand()) {
+            defaultCommand = cmd;
+            continue;
         }
-        focusedControl = focusControl;
-
-        Shell activeShell = display.getActiveShell();
-        CommandCollection oldCollection = currentCommands;
-        currentCommands = new CommandCollection();
-
-        Control ctrl = focusControl;
-        while ( ctrl!= null && ctrl != activeShell ){
-            if ( Command.internal_getCommands(ctrl).length > 0 ){
-                currentCommands.addCommand( Command.internal_getCommands(ctrl) );
+        if (CommandUtils.isNegativeType(cmd.type)) {
+            if (negativeKeyCommand == null || negativeKeyCommand.isDisposed()) {
+                negativeKeyCommand = cmd;
+            } else if (negativeKeyCommand.getPriority() <= cmd.getPriority()) {
+                positiveKeyCommands[positiveKeyIndex] = negativeKeyCommand;
+                positiveKeyIndex++;
+                negativeKeyCommand = cmd;
+            } else {
+                positiveKeyCommands[positiveKeyIndex] = cmd;
+                positiveKeyIndex++;
             }
-            ctrl = ctrl.getParent();
+            continue;
         }
-        if (activeShell != null && Command.internal_getCommands(activeShell).length > 0 ){
-            currentCommands.addCommand( Command.internal_getCommands(activeShell) );
-        }
-
-        if (strategy != null) {
-            strategy.handleFocusChange(focusControl, oldCollection, currentCommands);
-        }
+        positiveKeyCommands[positiveKeyIndex] = cmd;
+        positiveKeyIndex++;
     }
+    if ((positiveKeyIndex) < positiveKeyCommands.length) {// needs to shrink
+        Command[] rightSized = new Command[positiveKeyIndex];
+        System.arraycopy(positiveKeyCommands, 0, rightSized, 0, rightSized.length);
+        positiveKeyCommands = rightSized;
+    }
+}
 
-    /**
-     * Called when a new Command is created
-     * @param command
-     */
-    public void commandAdded( Command command ){
-        if( isInFocusContext(command.control)){
-            currentCommands.addCommand(command);
-            strategy.handleCommandListChange(command, null, currentCommands);
+private void cleanPositiveCommands() {
+    boolean useBar = false;
+    if ((positiveKeyCommands != null && positiveKeyCommands.length > 1)
+        || (defaultCommand != null && positiveKeyCommands != null)) {
+        useBar = true;
+    }
+    if (defaultCommand != null && !defaultCommand.isDisposed()
+        && !defaultCommand.control.isDisposed()) {
+        if (useBar) {
+            OS.QWidget_removeAction(defaultCommand.control.getShell().internal_getOwnMenuBar(),
+                topHandle(defaultCommand));
+        } else {
+            OS.QWidget_removeAction(topHandle(defaultCommand.control), topHandle(defaultCommand));
         }
     }
-
-    /**
-     * Called when a Command is disposed
-     * @param command
-     */
-    public void commandRemoved( Command command ){
-        if ( command == defaultCommand ) defaultCommand = null;
-        if (isInFocusContext(command.control)){
-            currentCommands.removeCommand( command );
-            strategy.handleCommandListChange(null, command, currentCommands);
-        }
-    }
+    if (positiveKeyCommands != null) {
+        for (int i = 0; i < positiveKeyCommands.length; i++) {
+            Command cmd = positiveKeyCommands[i];
+            if (cmd == null || cmd.isDisposed() || cmd.control.isDisposed()) {
+                continue;
+            }
+            int handle = 0;
+            if (useBar) {
+                handle = cmd.control.getShell().internal_getOwnMenuBar();
+            } else {
+                handle = topHandle(positiveKeyCommands[0].control);
+            }
+            OS.QWidget_removeAction(handle, topHandle(cmd));
 
-    /**
-     * Called when the Display is getting disposed.
-     */
-    public void dispose(){
-        strategy.dispose();
-        strategy = null;
-        currentCommands = null;
-        display = null;
-    }
-    /**
-     * Called when a Command is set default
-     *
-     * @param command
-     * @see Command#setDefaultCommand();
-     */
-    public void setDefaultCommand(Command command ){
-        defaultCommand = command;
-        if(isInFocusContext(command.control)){
-            strategy.handleDefaultCommandChange(command);
         }
     }
+}
 
-    /**
-     * Returns the default command or null if there is none.
-     *
-     * @return
-     * @see Command#isDefaultCommand()
-     */
-    public Command getDefaultCommand(){
-        return defaultCommand;
+private void cleanNegativeCommand() {
+    if (negativeKeyCommand != null && !negativeKeyCommand.isDisposed()
+        && !negativeKeyCommand.control.isDisposed()) {
+        OS.QWidget_removeAction(topHandle(negativeKeyCommand.control),
+            topHandle(negativeKeyCommand));
     }
+}
 
-    /**
-     * Sets a new {@link CommandPresentationStrategy}. It also disposes to old one.
-     *
-     * @param commandPresentationStrategy
-     */
-    public void setPresentationStrategy( CommandPresentationStrategy commandPresentationStrategy ){
-        CommandPresentationStrategy oldStrategy = strategy;
-        strategy = commandPresentationStrategy;
-        if (oldStrategy != null ){
-            oldStrategy.dispose();
+private void placeNegativeCommand() {
+    if (negativeKeyCommand != null) {
+        OS.QWidget_addAction(Internal_PackageSupport.topHandle(negativeKeyCommand.control),
+            topHandle(negativeKeyCommand));
+    }
+}
+
+private void placePositiveCommands() {
+    if (defaultCommand != null) {
+        int defaultCmdHandle = topHandle(defaultCommand);
+        if (positiveKeyCommands != null) {
+            OS.QMenuBar_addAction(defaultCommand.control.getShell().internal_getOwnMenuBar(),
+                defaultCmdHandle);
+        } else {
+            OS.QWidget_addAction(Internal_PackageSupport.topHandle(defaultCommand.control),
+                defaultCmdHandle);
         }
     }
+    if (positiveKeyCommands != null) {
+        if (positiveKeyCommands.length == 1 && defaultCommand == null) {
+            OS.QWidget_addAction(Internal_PackageSupport.topHandle(positiveKeyCommands[0].control),
+                topHandle(positiveKeyCommands[0]));
+        } else {
+            CommandUtils.sort(positiveKeyCommands);
+            for (int i = 0; i < positiveKeyCommands.length; i++) {
+                OS.QMenuBar_addAction(positiveKeyCommands[i].control.getShell()
+                    .internal_getOwnMenuBar(), topHandle(positiveKeyCommands[i]));
+            }
+        }
+    }
+}
 
-    private boolean isInFocusContext(Control control){
-        Display display = control.getDisplay();
-        Shell activeShell = display.getActiveShell();
-        Control focused = display.getFocusControl();
-        if( focused == null )return false;
-        if(control.getShell() != activeShell) return false;
-        if( control == focused ) return true;
-        return isFocusAncestor(focused, control);
-    }
+private void handleMenuBarChanged(int newMenuBar, CommandCollection commands) {
+    placePositiveCommands();
+}
 
-    private boolean isFocusAncestor(Control node, Control parent){
-        Control nodeParent = node.getParent();
-        if( nodeParent == parent )return true;
-        if (nodeParent == null || nodeParent == node.getShell() )return false;
-        return isFocusAncestor(nodeParent, parent);
-    }
+private static final int topHandle(Widget w) {
+    return Internal_PackageSupport.topHandle(w);
+}
 
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandPresentationStrategy.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Nokia Corporation - initial implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.qt;
-
-import org.eclipse.ercp.swt.mobile.Command;
-import org.eclipse.swt.internal.qt.CommandArranger.CommandCollection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-/**
- * This is the interface that all the {@link Command} presentation is delegated to.
- * The implementations of this abstract class are expected to provide the
- * presentation logic for their respective uses.
- *
- * The implementations of this class can be specific to a platform, toolkit or a
- * combination of factors. Refer to {@link CommandArranger} on the loading mechanism
- * of the {@link CommandPresentationStrategy} implementation.
- *
- * Since the implementations can be specific to a toolkit implementations are expected to
- * handle the following.
- * <ul>
- * 	<li>Ordering of the {@link Command}s</li>
- * 	<li>Positioning {@link Command}s to correct soft keys or menus so that they are accessible</li>
- * </ul>
- *
- */
-public abstract class CommandPresentationStrategy {
-
-
-    /**
-     * CommandArranger delegates to this method when the currently active menu bar has changed.
-     * This does not include the cases where menu bar changes due to active window change which
-     * causes the menu bar to change on some platforms.
-     *
-     * @param newMenuBar
-     * @param commands
-     */
-    protected abstract void handleMenuBarChanged( int newMenuBar, CommandCollection commands );
-
-    /**
-     * CommandArranger delegates to this method when the currently focused control has changed.
-     * On some platforms a focus change can also be accompanied with a menu bar change. Such menu bar
-     * changes due to active window change must be handled here.
-     *
-     * @param focused-currently focused control
-     * @param oldCommands-the commands of the previous focus context
-     * @param commands-of the current focus context
-     *
-     * @see CommandArranger#focusedControlChanged()
-     */
-    protected abstract void handleFocusChange( Control focused, CommandCollection oldCommands, CommandCollection commands );
-
-    /**
-     * CommandArranger delegates to this method, an added or removed Command is in the current
-     * focus context and needs to be presented. In other words, this method does not get notification of
-     * all added or removed Commands but only those that has some impact on the representation.
-     *
-     * @param added Command
-     * @param removed Command
-     * @param commands including the added/removed command
-     *
-     * @see CommandArranger#commandAdded(Command)
-     * @see CommandArranger#commandRemoved(Command)
-     */
-    protected abstract void handleCommandListChange(Command added, Command removed, CommandCollection commands );
-
-    /**
-     * CommandArranger reports the default command changes to this method. However implementations
-     * should take into account default commands on focus changes.
-     *
-     * @param defaultCommand
-     */
-    protected abstract void handleDefaultCommandChange( Command defaultCommand );
-    /**
-     * This method is called when the CommandArranger is disposed as part of
-     * the disposal of the {@link Display} or
-     * if it is replaced by a new one on the CommandArranger.
-     *
-     * On Display dispose, the method is called after all the Shells are disposed but before the Display is cleaned.
-     *
-     * @see CommandArranger#setPresentationStrategy(CommandPresentationStrategy)
-     */
-    protected abstract void dispose();
-
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/DesktopCommandPresentationStrategy.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Nokia Corporation - initial implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.qt;
-
-import org.eclipse.ercp.swt.mobile.Command;
-import org.eclipse.swt.internal.qt.CommandArranger.CommandCollection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Internal_PackageSupport;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-public class DesktopCommandPresentationStrategy extends
-        CommandPresentationStrategy {
-
-    private int commandsMenu;
-    private int commandsMenuAction;
-    private Control previousFocus;
-
-    public DesktopCommandPresentationStrategy(){
-        super();
-        initCommandsMenu();
-    }
-
-    protected void handleCommandListChange(Command added, Command removed,
-            CommandCollection commands) {
-
-        Shell shell = null;
-        if ( added != null ){
-            shell = added.control.getShell();
-            OS.QMenu_addAction(commandsMenu, handle(added) );
-        }
-        else{
-            shell = removed.control.getShell();
-            OS.QWidget_removeAction(commandsMenu, handle(removed) );
-        }
-
-        OS.QMenuBar_addAction(shell.internal_getOwnMenuBar(), commandsMenuAction );
-    }
-
-    protected void handleFocusChange(Control focused,
-            CommandCollection oldCommands, CommandCollection commands) {
-        Shell shell = focused.getShell();
-
-        if( oldCommands != null && oldCommands.getSize() >0 ){
-            Command[] remove = oldCommands.getCommands(null);
-            for(int i=0; i< remove.length; i++){
-                if (previousFocus!= null && remove[i].control == previousFocus){
-                    OS.QWidget_removeAction(handle(previousFocus), handle(remove[i]));
-                }else{
-                    OS.QWidget_removeAction(commandsMenu, handle(remove[i]));
-                }
-            }
-        }
-
-        if ( commands != null && commands.getSize() > 0 ){
-            OS.QMenuBar_addAction(shell.internal_getOwnMenuBar(), commandsMenuAction );
-            Command[] add = commands.getCommands(null);
-            CommandUtils.sort(add);
-            for(int i=0 ; i < add.length; i++){
-                if ( add[i].control != focused ){
-                    OS.QMenu_addAction( commandsMenu, handle(add[i]) );
-                }
-                else{
-                    OS.QWidget_addAction(handle(focused), handle(add[i]));
-                }
-                if (add[i].isDefaultCommand() )OS.QMenu_setDefaultAction( commandsMenu, handle(add[i]) );
-            }
-        }
-        //Store for use next time.
-        previousFocus=focused;
-    }
-
-    protected void handleMenuBarChanged(int newMenuBar,
-            CommandCollection commands) {
-        OS.QMenuBar_addAction(newMenuBar, commandsMenuAction );
-    }
-
-
-    protected void dispose() {
-        if (commandsMenu != 0 ){
-            QObjectDeleteWrapper.deleteSafely( commandsMenu );
-            commandsMenu = 0;
-        }
-        if (commandsMenuAction != 0 ){
-            QObjectDeleteWrapper.deleteSafely( commandsMenuAction );
-            commandsMenuAction = 0;
-        }
-    }
-
-    private void initCommandsMenu (){
-        commandsMenuAction = OS.QAction_new( 0 );
-        OS.QAction_setText( commandsMenuAction, "Commands");
-        commandsMenu = OS.QMenu_new( 0 );
-        OS.QAction_setMenu( commandsMenuAction, commandsMenu );
-    }
-
-    protected void handleDefaultCommandChange(Command defaultCommand) {
-        int handle = 0;
-        if (defaultCommand != null ) handle = handle(defaultCommand);
-        OS.QMenu_setDefaultAction( commandsMenu, handle );
-    }
-
-
-    private final int handle(Widget w) {
-        return Internal_PackageSupport.handle(w);
-    }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/OS.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/OS.java	Thu Jul 22 16:31:34 2010 +0100
@@ -236,6 +236,9 @@
     public static final int QSWTEVENT_MOBILEDEVICECLOSED = QSWTEVENT_ID_RANGE_FIRST + 8;
     public static final int QSWTEVENT_SCREENACTIVATED = QSWTEVENT_ID_RANGE_FIRST + 9;
     public static final int QSWTEVENT_SCREENDEACTIVATED = QSWTEVENT_ID_RANGE_FIRST + 10;
+    public static final int QSWTEVENT_SYMBIAN_WINDOW_FULLY_VISIBLE = QSWTEVENT_ID_RANGE_FIRST + 11;
+    public static final int QSWTEVENT_SYMBIAN_WINDOW_PARTIALLY_VISIBLE = QSWTEVENT_ID_RANGE_FIRST + 12;
+    public static final int QSWTEVENT_SYMBIAN_WINDOW_NOT_VISIBLE = QSWTEVENT_ID_RANGE_FIRST + 13;
 
     // Qt connection types for signal-slot connections
     public static final int QT_AUTOCONNECTION = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/SymbianWindowVisibilityListener.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.swt.internal.qt;
+
+import org.eclipse.swt.widgets.Widget;
+
+public interface SymbianWindowVisibilityListener {
+    /**
+     * Notifies the listeners when the visibility of a window owing widget is changing.
+     * May be sent either before or after the actual visibility is changed.
+     * @param widget - the window owing widget who's visibility is being changed.
+     * @param visible - true when the widget is becoming visible.
+     */
+    public abstract void handleSymbianWindowVisibilityChange(Widget widget, boolean visible);
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/GraphicsContext.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/GraphicsContext.java	Thu Jul 22 16:31:34 2010 +0100
@@ -340,7 +340,7 @@
      */
     public void bindTarget(org.eclipse.swt.widgets.Control target) {
         if(target == null) {
-        	throw new NullPointerException("target is null");
+            throw new NullPointerException("target is null");
         }
         if(target.isDisposed())
             throw new IllegalArgumentException("Target already disposed");
@@ -361,7 +361,7 @@
      */
     public void bindTarget(org.eclipse.swt.widgets.Display target) {
         if(target == null) {
-        	throw new NullPointerException("target is null");
+            throw new NullPointerException("target is null");
         }
         if(target.isDisposed())
             throw new IllegalArgumentException("Target already disposed");
@@ -383,7 +383,7 @@
      */
     public void bindTarget(org.eclipse.swt.internal.qt.graphics.Image target) {
         if(target == null) {
-        	throw new NullPointerException("target is null");
+            throw new NullPointerException("target is null");
         }
         if(target.isDisposed())
             throw new IllegalArgumentException("Target already disposed");
@@ -406,10 +406,10 @@
      */
     public void bindTarget(org.eclipse.swt.internal.qt.graphics.NativeCommandBuffer target, org.eclipse.swt.widgets.Control flushTarget) {
         if(target == null) {
-        	throw new NullPointerException("target is null");
+            throw new NullPointerException("target is null");
         }
         if(flushTarget == null) {
-        	throw new NullPointerException("flushTarget is null");
+            throw new NullPointerException("flushTarget is null");
         }
         if(target.isDisposed())
             throw new IllegalArgumentException("Target already disposed");
@@ -444,7 +444,7 @@
      */
     public void bindTarget(org.eclipse.swt.internal.qt.graphics.NativeCommandBuffer target) {
         if(target == null) {
-        	throw new NullPointerException("Target is null");
+            throw new NullPointerException("Target is null");
         }
         if(target.isDisposed()) {
             throw new IllegalArgumentException("target already disposed");
@@ -464,12 +464,12 @@
      */
     public void bindTarget(org.eclipse.swt.internal.qt.graphics.WindowSurface target) {
         if(target == null) {
-        	throw new NullPointerException("target is null");
+            throw new NullPointerException("target is null");
         }
-    	if(target.isDisposed()) {
+        if(target.isDisposed()) {
             throw new IllegalArgumentException("target already disposed");
         }
-    	bindTarget(target, TARGET_WINDOWSURFACE, target.handle, 0); 
+        bindTarget(target, TARGET_WINDOWSURFACE, target.handle, 0); 
     }
     
     /**
@@ -560,6 +560,10 @@
         }
         // if buffer does not contain data do nothing
         if(buffer.containsData()) {
+            // Notify the image that it will get modified. This affects any existing shallow copies of it. 
+            if(targetData.type == GraphicsContext.TARGET_IMAGE) {
+                ((Image)targetData.target).pixelDataModified();
+            }
             processBuffer(buffer);
         }
     }
@@ -1149,11 +1153,11 @@
      * @throws NullPointerException if surface is null
      */
     public void drawWindowSurface(WindowSurface surface, int x, int y, int width, int height) {
-    	if(surface == null) 
-    	{
-    	    throw new NullPointerException("surface is null");
-    	}
-    	OS.graphicsContext_drawWindowSurface(handle, surface.handle, x, y, width, height);
+        if(surface == null) 
+        {
+            throw new NullPointerException("surface is null");
+        }
+        OS.graphicsContext_drawWindowSurface(handle, surface.handle, x, y, width, height);
     }
     
     
@@ -2094,19 +2098,21 @@
                         }
                         case JavaCommandBuffer.OP_DRAWIMAGE1:
                         {
-                            Image img = (Image)images.elementAt(imageCount++);
+                            Image img = (Image)images.elementAt(imageCount);
+                            images.setElementAt(null, imageCount++);
                             OS.graphicsContext_drawImage(handle, 
                                                          img.handle, 
                                                          intParams[i++], 
                                                          intParams[i++]);
                             // As we made a shallow copy of the image in buffer
                             // its safe to delete that here
-                            img.dispose(); 
+                            img.freeCommandBufferCopy();
                             break;
                         }
                         case JavaCommandBuffer.OP_DRAWIMAGE2:
                         {
-                            Image img = (Image)images.elementAt(imageCount++);  
+                            Image img = (Image)images.elementAt(imageCount);
+                            images.setElementAt(null, imageCount++);
                             OS.graphicsContext_drawImage(handle, 
                                                          img.handle, 
                                                          intParams[i++], 
@@ -2120,7 +2126,7 @@
                                                          intParams[i++]);
                             // As we made a shallow copy of the image in buffer
                             // its safe to delete that here
-                            img.dispose(); 
+                            img.freeCommandBufferCopy();
                             break;
                         }
                         case JavaCommandBuffer.OP_DRAWFOCUS:
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java	Thu Jul 22 16:31:34 2010 +0100
@@ -12,6 +12,8 @@
 
 
 import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Internal_PackageSupport;
 
 public final class Image {
 
@@ -128,6 +130,17 @@
     // GraphicsContext bound to this image
     private GraphicsContext boundingGc = null;
 
+    // Image manages copies of itself for command buffering of drawImage and drawRegion. 
+    private Image commandBufferCopy;
+    private int commandBufferCopyRefs;
+    private boolean commandBufferCopyDirty;
+
+    // A copy-constructed Image remembers what it's a copy of
+    private Image whatAmIACopyOf;
+
+    private Image() {
+    }
+    
     /**
      * Constructs new image with given native image handle.
      *
@@ -135,7 +148,7 @@
      * @throws OutOfMemoryError if imgHandlde is invalid
      */
     Image(int imgHandle) {
-    	Utils.validateUiThread();
+        Utils.validateUiThread();
         // validate handle
         if(imgHandle == 0) {
             throw new OutOfMemoryError();
@@ -218,10 +231,7 @@
         if (sourceImage == null) {
             throw new NullPointerException("img is null");
         }
-        // Construct image in native side and store the handle
-        handle = OS.image_create(sourceImage.handle, x, y, width, height); // may throw outOfMemoryError
-        // set dimensions
-        updateSize();
+        createCopy(sourceImage, x, y, width, height);
     }
 
     /**
@@ -269,7 +279,7 @@
      * releaseTarget() of binding gc is called automatically.
      */
     public void dispose() {
-    	Utils.validateUiThread();
+        Utils.validateUiThread();
         if (handle != 0 || !disposed) {
             // If this instance is being disposed while
             // gc is still bound, release binding before disposing.
@@ -285,6 +295,8 @@
             // it is created for this instance
             SurfaceCache.getInstance().deleteSurface(this);
 
+            whatAmIACopyOf = null;
+
             // dispose native peer
             OS.image_dispose(handle);
             handle = 0;
@@ -308,10 +320,10 @@
      * @return image format
      */
     public int getFormat() {
-    	checkState();
-    	if (pixelFormat == FORMAT_IMG_NONE) {
-    		pixelFormat = OS.image_getFormat(handle);
-    	}
+        checkState();
+        if (pixelFormat == FORMAT_IMG_NONE) {
+            pixelFormat = OS.image_getFormat(handle);
+        }
         return pixelFormat;
     }
     /**
@@ -593,7 +605,7 @@
      */
     public int getHandle()
     {
-    	checkState();
+        checkState();
         return handle;
     }
 
@@ -603,7 +615,7 @@
      */
     synchronized public int getNativePixmapHandle()
     {
-    	checkState();
+        checkState();
         if(pixmapHandle == 0)
         {
             // In the current implementation this will return
@@ -621,7 +633,7 @@
      * @return New object
      */
     public ImageData getImageData() {
-    	checkState();
+        checkState();
         return OS.image_getImageData(handle);
     }
 
@@ -629,7 +641,7 @@
      * Private helper to check the state of the current instance.
      */
     private void checkState() {
-    	Utils.validateUiThread();
+        Utils.validateUiThread();
         if(disposed) {
             throw new IllegalStateException("Image already disposed");
         }
@@ -657,4 +669,97 @@
         int imageHandle = OS.image_create(imageData);
         return new Image(imageHandle);
     }
+
+    /**
+     * Obtains a shallow copy of this Image to be placed in the command buffer.
+     * The returned copy must be marked as free by calling freeCommandBufferCopy
+     * when it's no longer needed.
+     * 
+     * @return The copy
+     */
+    Image getCommandBufferCopy() {
+        if(commandBufferCopyDirty) {
+            return copyInUIThread();
+        }
+        if(commandBufferCopy == null) {
+            commandBufferCopyDirty = false;
+            commandBufferCopy = copyInUIThread();
+            commandBufferCopyRefs = 0;
+        }
+        commandBufferCopyRefs++;
+        return commandBufferCopy;
+    }
+
+    /**
+     * Marks a copy returned from getCommandBufferCopy as free.
+     * 
+     * @param image
+     *            The image returned from getShallowCopy.
+     */
+    void freeCommandBufferCopy() {
+        if(disposed) {
+            throw new RuntimeException("Image referenced by command buffer has been disposed");
+        }
+        if(whatAmIACopyOf == null) {
+            throw new RuntimeException("Image not a copy");
+        }
+        whatAmIACopyOf.freeCommandBufferCopyOfMe(this);
+    }
+    
+    /**
+     * Tells to the Image that it has been modified and any copies returned from
+     * getShallowCopy() have thus become deep copies.
+     */
+    void pixelDataModified() {
+        if(commandBufferCopy != null) {
+            commandBufferCopyDirty = true;
+        }
+    }
+    
+    /*
+     * Copy-construction
+     */
+    private void createCopy(Image sourceImage, int x, int y, int width, int height) {
+        // Construct image in native side and store the handle
+        handle = OS.image_create(sourceImage.handle, x, y, width, height); // may throw outOfMemoryError
+        // set dimensions
+        updateSize();
+        whatAmIACopyOf = sourceImage;
+    }
+
+    /*
+     * Called on the Image when a copy it has returned from getCommandBufferCopy
+     * is being freed by a call to freeCommandBufferCopy. The Image may be
+     * disposed at this point while the copy is not.
+     */
+    private void freeCommandBufferCopyOfMe(Image copy) {
+        if(copy != commandBufferCopy) {
+            throw new RuntimeException("Copy doesn't exist, freed multiple times?");
+        } else {
+            commandBufferCopyRefs--;
+            if(commandBufferCopyRefs <= 0) {
+                commandBufferCopy.dispose();
+                commandBufferCopy = null;
+            }
+        }
+    }
+    
+    /*
+     * Creates a shallow copy of the Image in the UI thread. 
+     */
+    private Image copyInUIThread() {
+        Display d = Internal_PackageSupport.getDisplayInstance();
+        final Image copy = new Image();
+        if(d != null) {
+            d.syncExec(new Runnable() {
+                public void run() {
+                    copy.createCopy(Image.this, 0, 0, 0, 0);
+                }
+            });
+        }
+        if(copy.handle == 0) {
+            return null;
+        }
+        return copy;
+    }
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/JavaCommandBuffer.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/JavaCommandBuffer.java	Thu Jul 22 16:31:34 2010 +0100
@@ -1,653 +1,574 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Nokia Corporation - initial implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.qt.graphics;
-
-import java.util.Vector;
-import java.util.Enumeration;
-
-/**
- * This class implements a command buffer that can be bound by GraphicsContext
- * to collect the drawing operations. Contents of the command buffer can be replayed to
- * GraphicsContext target with GraphicsContext.render() method.
- *
- * When JavaCommandBuffer is set as the target of GraphicsContext some of the methods
- * provided by GraphicsContext are not supported, e.g. getters, since the JavaCommandBuffer
- * does not have a real rendering target from which to query related data. To find out what is
- * supported see the methods of this class. In principal GraphicsContext supports all draw and set operations,
- * when JavaCommandBuffer is set as rendering target.
- */
-public final class JavaCommandBuffer {
-
-	// All collected drawing operations and their parameters
-	private int[] intParams;
-	private int intCount;
-	private StringBuffer strParams;
-
-	// Holder for images
-	private Vector images;
-
-	// holder for rgbData
-	private Vector rgbData;
-
-	// This flag is indicates if this buffer is bound by some GraphicsContext
-	private boolean bound;
-
-    // This flag indicates if this buffer is empty or not
-	private boolean containsData;
-	
-	// This flag indicates if this buffer has any draw commands in it
-	private boolean containsPrimitiveData;
-
-    // Memory management configuration constants
-	private static final int INT_BUF_GRANULARITY     	 = 10;
-	private static final int INT_BUF_INITIAL_SIZE    	 = 250;
-	private static final int IMAGE_BUF_INITIAL_SIZE 	 = 3;
-	private static final int IMAGE_BUF_GRANULARITY  	 = 2;
-	private static final int STRING_BUFFER_INITIAL_SIZE = 10;
-
-	// Prefixes for different categories of op codes, stored in MSB
-	final static int DRAW_PREFIX = 0;
-	final static int FILL_PREFIX = 1;
-	final static int SET_PREFIX = 2;
-	final static int MISC_PREFIX = 3;
-
-	// Unique operation codes for all the gc operations that can be buffered.
-	static final int OP_DRAWARC            = ((DRAW_PREFIX << 24) | 1);
-	static final int OP_DRAWFOCUS          = ((DRAW_PREFIX << 24) | 2);
-	static final int OP_DRAWIMAGE1         = ((DRAW_PREFIX << 24) | 3);
-	static final int OP_DRAWIMAGE2         = ((DRAW_PREFIX << 24) | 4);
-	static final int OP_DRAWLINE           = ((DRAW_PREFIX << 24) | 5);
-	static final int OP_DRAWELLIPSE        = ((DRAW_PREFIX << 24) | 6);
-	static final int OP_DRAWPOINT          = ((DRAW_PREFIX << 24) | 7);
-	static final int OP_DRAWPOLYGON        = ((DRAW_PREFIX << 24) | 8);
-	static final int OP_DRAWPOLYLINE       = ((DRAW_PREFIX << 24) | 9);
-	static final int OP_DRAWRECT           = ((DRAW_PREFIX << 24) | 10);
-	static final int OP_DRAWRGB_INT        = ((DRAW_PREFIX << 24) | 11);
-	static final int OP_DRAWRGB_BYTE       = ((DRAW_PREFIX << 24) | 12);
-	static final int OP_DRAWRGB_SHORT      = ((DRAW_PREFIX << 24) | 13);
-	static final int OP_DRAWROUNDRECT      = ((DRAW_PREFIX << 24) | 14);
-	static final int OP_DRAWSTRING         = ((DRAW_PREFIX << 24) | 15);
-	static final int OP_FILLARC            = ((FILL_PREFIX << 24) | 16);
-	static final int OP_FILLGRADIENTRECT   = ((FILL_PREFIX << 24) | 17);
-	static final int OP_FILLELLIPSE        = ((FILL_PREFIX << 24) | 18);
-	static final int OP_FILLPOLYGON        = ((FILL_PREFIX << 24) | 19);
-	static final int OP_FILLRECT           = ((FILL_PREFIX << 24) | 20);
-	static final int OP_FILLROUNDRECT      = ((FILL_PREFIX << 24) | 21);
-	static final int OP_SETBACKGROUNDALPHA = ((SET_PREFIX << 24) | 22);
-	static final int OP_SETBACKGROUNDCOLOR = ((SET_PREFIX << 24) | 23);
-	static final int OP_SETBLENDINGMODE    = ((SET_PREFIX << 24) | 24);
-	static final int OP_SETCLIP            = ((SET_PREFIX << 24) | 25);
-	static final int OP_CANCELCLIPPING     = ((SET_PREFIX << 24) | 26);
-	static final int OP_SETFONT            = ((SET_PREFIX << 24) | 27);
-	static final int OP_SETFOREGROUNDALPHA = ((SET_PREFIX << 24) | 28);
-	static final int OP_SETFOREGROUNDCOLOR = ((SET_PREFIX << 24) | 29);
-	static final int OP_SETSTROKESTYLE     = ((SET_PREFIX << 24) | 30);
-	static final int OP_SETSTROKEWIDTH     = ((SET_PREFIX << 24) | 31);
-	static final int OP_TRANSLATE          = ((MISC_PREFIX << 24) | 32);
-	static final int OP_SCALE              = ((MISC_PREFIX << 24) | 33);
-	static final int OP_RESETTRANSFORM     = ((MISC_PREFIX << 24) | 34);
-	static final int OP_COPYAREA1          = ((MISC_PREFIX << 24) | 35);
-	static final int OP_COPYAREA2          = ((MISC_PREFIX << 24) | 36);
-
-	/**
-	 * Constructs empty command buffer with defined buffer sizes.
-	 */
-	public JavaCommandBuffer() {
-		intParams = new int[INT_BUF_INITIAL_SIZE];
-		strParams = new StringBuffer(STRING_BUFFER_INITIAL_SIZE);
-		images = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
-		rgbData = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
-	}
-
-	/**
-	 * Resets the buffer, i.e. removes all recorded commands and related data. The integer array containing
-	 * the actual operation codes is not deleted, only the index pointer is rested, thus the memory consumption of that is not freed.
-	 * CommandBuffer can be reseted only if it is not bound by any GraphicsContext
-	 * @throws IllegalStateException if this CommandBuffer is bound while calling reset
-	 */
-	public void reset() {
-		if(bound) {
-			throw new IllegalStateException("CommandBuffer is still bound by gc");
-		}
-		intCount = 0;
-		strParams.setLength(0);
-
-		Enumeration allImages = images.elements();
-		while(allImages.hasMoreElements()) {
-			Image image = (Image)allImages.nextElement();
-			if(!image.isDisposed()) {
-				image.dispose();
-			}
-		}
-		images.removeAllElements();
-		rgbData.removeAllElements();
-		containsData = false;
-		containsPrimitiveData = false;
-	}
-
-	/**
-	 * Checks that does this buffer contain any commands
-	 * @return true if any command has been written to buffer otherwise false
-	 */
-	public boolean containsData() {
-		return containsData;
-	}
-	
-	/**
-	 * Checks that does this buffer contain any draw commands, i.e. any setters etc. 
-	 * that does to cause any pixels to be rendered are ignored 
-	 * @return true if any draw command has been written to buffer otherwise false
-	 */
-	public boolean containsDrawnPrimitives() {
-		return containsPrimitiveData;
-	}
-	
-	/**
-	 * Binds this buffer
-	 */
-	void bind() {
-		bound = true;
-	}
-
-	/**
-	 * Provides the binding status of this buffer
-	 * @return true if this buffer has been already bound otherwise false
-	 */
-	boolean isBound() {
-		return bound;
-	}
-
-	/**
-	 * Releases this buffer, i.e. it can be bound by some other GraphicsContext
-	 */
-	void release() {
-		bound = false;
-	}
-
-	/**
-	 * Writes an integer to given array.
-	 * @param item The item to be added to the array
-	 * @param array The array where to append given item
-	 * @param elementsUsed The size of slots used in given array
-	 * @param granularity The granularity used if the array needs to be enlarged
-	 * @return Array containing the added item
-	 */
-	private int[] writeToArray(int item, int[] array, int elementsUsed, int granularity) {
-		if( array.length < elementsUsed + 1) {
-			int[] src = array;
-			int[] dst = new int[array.length + granularity];
-			System.arraycopy(src, 0, dst, 0, src.length);
-			array = dst;
-		}
-		array[elementsUsed] = item;
-		return array;
-	}
-
-	private void writeInt(int param) {
-		intParams = writeToArray(param, intParams, intCount++, INT_BUF_GRANULARITY);
-		containsData = true;
-	}
-
-	private void writeImage(Image image) {
-		images.addElement(image);
-	}
-
-	private void writeStr(String string) {
-    	strParams.append(string);
-	}
-
-	private void writeRgb(int[] rgb) {
-		rgbData.addElement(rgb);
-	}
-	private void writeRgb(byte[] rgb) {
-		rgbData.addElement(rgb);
-	}
-
-	private void writeRgb(short[] rgb) {
-		rgbData.addElement(rgb);
-	}
-
-	private void reportNotSupported() {
-		throw new RuntimeException("Intenal: Operation not supported with JavaCommandBuffer");
-	}
-
-	private void printBufferInfo() {
-		System.out.println("CommandBuffer Info: " +this);
-		System.out.println("intParamCount: " + intCount);
-		System.out.println("intBuffer Size: " + intParams.length);
-		System.out.println("StringBuffer Size: " + strParams.length());
-	}
-
-	private void raisePrimitiveFlag() {
-		containsPrimitiveData = true;
-	}
-	
-	int[] intParams() {
-		return intParams;
-	}
-
-	int intParamCount() {
-        return intCount;
-	}
-
-	Vector rgbParams() {
-		return rgbData;
-	}
-
-	Vector images() {
-		return images;
-	}
-
-	String strParams() {
-		return strParams.toString();
-	}
-
-	void drawArc (int x, int y, int width, int height, int startAngle, int arcAngle) {
-		writeInt(OP_DRAWARC);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(startAngle);
-		writeInt(arcAngle);
-		raisePrimitiveFlag();
-	}
-
-	void drawFocus (int x, int y, int width, int height) {
-		writeInt(OP_DRAWFOCUS);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		raisePrimitiveFlag();
-	}
-
-	// must be called from UI thread as images cannot be creates outside that
-	void drawImage(Image image, int x, int y) {
-		writeInt(OP_DRAWIMAGE1);
-		writeInt(x);
-		writeInt(y);
-		// creating copy of image here uses implicit data sharing,
-		// thus only a shallow copy is made
-		writeImage(new Image(image));
-		raisePrimitiveFlag();
-	}
-
-	// must be called from UI thread as images cannot be creates outside that
-	void drawImage(Image image, int tx, int ty, int tw, int th,int sx, int sy, int sw, int sh, int manipulation) {
-		writeInt(OP_DRAWIMAGE2);
-		writeInt(tx);
-		writeInt(ty);
-		writeInt(tw);
-		writeInt(th);
-		writeInt(sx);
-		writeInt(sy);
-		writeInt(sw);
-		writeInt(sh);
-		writeInt(manipulation);
-		// creating copy of image here uses implicit data sharing,
-		// thus only a shallow copy is made
-		writeImage(new Image(image));
-		raisePrimitiveFlag();
-	}
-
-	void drawLine (int x1, int y1, int x2, int y2) {
-		writeInt(OP_DRAWLINE);
-		writeInt(x1);
-		writeInt(y1);
-		writeInt(x2);
-		writeInt(y2);
-		raisePrimitiveFlag();
-	}
-
-	void drawEllipse (int x, int y, int width, int height) {
-		writeInt(OP_DRAWELLIPSE);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		raisePrimitiveFlag();
-	}
-
-	void drawPoint (int x, int y) {
-		writeInt(OP_DRAWPOINT);
-		writeInt(x);
-		writeInt(y);
-		raisePrimitiveFlag();
-	}
-
-	void drawPolygon(int[] pointArray) {
-		writeInt(OP_DRAWPOLYGON);
-		writeInt(pointArray.length);
-		for(int i = 0; i < pointArray.length; ++i) {
-			writeInt(pointArray[i]);
-		}
-		raisePrimitiveFlag();
-	}
-
-	void drawPolyline(int[] pointArray) {
-		writeInt(OP_DRAWPOLYLINE);
-		writeInt(pointArray.length);
-		for(int i = 0; i < pointArray.length; ++i) {
-			writeInt(pointArray[i]);
-		}
-		raisePrimitiveFlag();
-	}
-
-	void drawRect (int x, int y, int width, int height) {
-		writeInt(OP_DRAWRECT);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		raisePrimitiveFlag();
-	}
-
-	void drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha, int manipulation) {
-		writeInt(OP_DRAWRGB_INT);
-		writeInt(offset);
-		writeInt(scanlength);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(processAlpha? 1 : 0);
-		writeInt(manipulation);
-		writeRgb(rgbData);
-		raisePrimitiveFlag();
-	}
-
-	void drawRGB(byte[] rgbData, byte[] transparencyMask,int offset, int scanlength, int x, int y, int width, int height, int manipulation, int format) {
-		writeInt(OP_DRAWRGB_BYTE);
-		writeInt(offset);
-		writeInt(scanlength);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(manipulation);
-		writeInt(format);
-		writeRgb(rgbData);
-		writeRgb(transparencyMask);
-		raisePrimitiveFlag();
-	}
-
-	void drawRGB(short[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha, int manipulation, int format) {
-		writeInt(OP_DRAWRGB_SHORT);
-		writeInt(offset);
-		writeInt(scanlength);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(processAlpha? 1 : 0);
-		writeInt(manipulation);
-		writeInt(format);
-		writeRgb(rgbData);
-		raisePrimitiveFlag();
-	}
-
-	void drawRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight) {
-		writeInt(OP_DRAWROUNDRECT);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(arcWidth);
-		writeInt(arcHeight);
-		raisePrimitiveFlag();
-	}
-
-	void drawString(String string, int x, int y, int width, int height, int alignments, int flags, boolean isTransparent) {
-		writeInt(OP_DRAWSTRING);
-		writeStr(string);
-		writeInt(string.length());
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(alignments);
-		writeInt(flags);
-		writeInt(isTransparent? 1 : 0);
-		raisePrimitiveFlag();
-	}
-
-	void fillArc (int x, int y, int width, int height, int startAngle, int arcAngle) {
-		writeInt(OP_FILLARC);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(startAngle);
-		writeInt(arcAngle);
-		raisePrimitiveFlag();
-	}
-
-	void fillGradientRect(int x, int y, int width, int height, boolean vertical, boolean swapColors) {
-		writeInt(OP_FILLGRADIENTRECT);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(vertical ? 1 : 0);
-		writeInt(swapColors ? 1 : 0);
-		raisePrimitiveFlag();
-	}
-
-	void fillEllipse (int x, int y, int width, int height) {
-		writeInt(OP_FILLELLIPSE);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		raisePrimitiveFlag();
-	}
-
-	void fillPolygon (int[] pointArray) {
-		writeInt(OP_FILLPOLYGON);
-		writeInt(pointArray.length);
-		for(int i = 0; i < pointArray.length; ++i) {
-			writeInt(pointArray[i]);
-		}
-		raisePrimitiveFlag();
-	}
-
-	void fillRect (int x, int y, int width, int height) {
-		writeInt(OP_FILLRECT);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		raisePrimitiveFlag();
-	}
-
-	void fillRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
-		writeInt(OP_FILLROUNDRECT);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(arcWidth);
-		writeInt(arcHeight);
-		raisePrimitiveFlag();
-	}
-
-	public void setBackgroundAlpha(int alpha) {
-		writeInt(OP_SETBACKGROUNDALPHA);
-		writeInt(alpha);
-	}
-
-	void setBackgroundColor(int argb, boolean updateAlpha) {
-		writeInt(OP_SETBACKGROUNDCOLOR);
-		writeInt(argb);
-		writeInt(updateAlpha? 1 : 0);
-	}
-
-	void setBlendingMode(int mode) {
-		writeInt(OP_SETBLENDINGMODE);
-		writeInt(mode);
-	}
-
-	void setClip(int x, int y, int width, int height, boolean intersects) {
-		writeInt(OP_SETCLIP);
-		writeInt(x);
-		writeInt(y);
-		writeInt(width);
-		writeInt(height);
-		writeInt(intersects? 1 : 0 );
-	}
-
-	void cancelClipping () {
-		writeInt(OP_CANCELCLIPPING);
-	}
-
-	void setFont(int fontHandle) {
-		writeInt(OP_SETFONT);
-		writeInt(fontHandle);
-	}
-
-	void setForegroundAlpha(int alpha) {
-		writeInt(OP_SETFOREGROUNDALPHA);
-		writeInt(alpha);
-	}
-
-	void setForegroundColor(int argb, boolean updateAlpha) {
-		writeInt(OP_SETFOREGROUNDCOLOR);
-		writeInt(argb);
-		writeInt(updateAlpha? 1 : 0);
-	}
-
-	void setStrokeStyle(int style) {
-		writeInt(OP_SETSTROKESTYLE);
-		writeInt(style);
-	}
-
-	void setStrokeWidth(int width) {
-		writeInt(OP_SETSTROKEWIDTH);
-		writeInt(width);
-	}
-
-	void translate(int x, int y) {
-		writeInt(OP_TRANSLATE);
-		writeInt(x);
-		writeInt(y);
-	}
-
-	void scale(int x, int y) {
-		writeInt(OP_SCALE);
-		writeInt(x);
-		writeInt(y);
-	}
-
-	void resetTransform() {
-		writeInt(OP_RESETTRANSFORM);
-	}
-
-	void copyArea(Image image, int x, int y) {
-		writeInt(OP_COPYAREA1);
-        writeInt(x);
-        writeInt(y);
-        // TODO does this need flushing on the image
-        images.addElement(new Image(image));
-        raisePrimitiveFlag();
-    }
-
-	void copyArea(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
-        writeInt(OP_COPYAREA2);
-        writeInt(srcX);
-        writeInt(srcY);
-        writeInt(width);
-        writeInt(height);
-        writeInt(destX);
-        writeInt(destY);
-        writeInt(paint? 1 : 0);
-        raisePrimitiveFlag();
-    }
-
-	// Unsupported operations
-	int getAdvancedCharacterWidth(char ch, boolean isAdvanced) {
-		reportNotSupported();
-		return 0;
-	}
-
-	void getFontMetricsData(int[] data, int fontHandle) {
-		reportNotSupported();
-	}
-
-	int getBackgroundAlpha() {
-		reportNotSupported();
-		return 0;
-	}
-
-	int getBackgroundColor() {
-		reportNotSupported();
-		return 0;
-	}
-
-	int getBlendingMode() {
-		reportNotSupported();
-		return 0;
-	}
-
-	void getClip(int[] clip) {
-		reportNotSupported();
-	}
-
-	int getForegroundAlpha() {
-		reportNotSupported();
-		return 0;
-	}
-
-	int getForegroundColor() {
-		reportNotSupported();
-		return 0;
-	}
-
-	void getTextBoundingBox(int[] boundingBox, String string, int alignments, int flags, int rectX, int rectY, int rectWidth, int rectHeight) {
-		reportNotSupported();
-	}
-
-	int getStrokeWidth() {
-		reportNotSupported();
-		return 0;
-	}
-
-	int getStrokeStyle() {
-		reportNotSupported();
-		return 0;
-	}
-
-	int getTranslateX() {
-		reportNotSupported();
-		return 0;
-	}
-
-	int getTranslateY() {
-		reportNotSupported();
-		return 0;
-	}
-
-	boolean hasClipping() {
-		reportNotSupported();
-		return false;
-	}
-
-	void saveSettings() {
-		reportNotSupported();
-	}
-
-	void restoreSettings() {
-		reportNotSupported();
-	}
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.swt.internal.qt.graphics;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+/**
+ * This class implements a command buffer that can be bound by GraphicsContext
+ * to collect the drawing operations. Contents of the command buffer can be replayed to
+ * GraphicsContext target with GraphicsContext.render() method.
+ * * When JavaCommandBuffer is set as the target of GraphicsContext some of the methods
+ * provided by GraphicsContext are not supported, e.g. getters, since the JavaCommandBuffer
+ * does not have a real rendering target from which to query related data. To find out what is
+ * supported see the methods of this class. In principal GraphicsContext supports all draw and set operations,
+ * when JavaCommandBuffer is set as rendering target. */
+
+public final class JavaCommandBuffer {
+    // All collected drawing operations and their parameters
+    private int[] intParams;
+    private int intCount;
+    private StringBuffer strParams;
+    // Container for images
+    private Vector images;
+
+    // Container for rgbData
+    private Vector rgbData;
+
+    // This flag is indicates if this buffer is bound by some GraphicsContext
+    private boolean bound;
+
+    // This flag indicates if this buffer is empty or not
+    private boolean containsData;
+
+    // This flag indicates if this buffer has any draw commands in it
+    private boolean containsPrimitiveData;
+
+    // Memory management configuration constants
+    private static final int INT_BUF_GRANULARITY         = 10;
+    private static final int INT_BUF_INITIAL_SIZE        = 250;
+    private static final int IMAGE_BUF_INITIAL_SIZE      = 3;
+    private static final int IMAGE_BUF_GRANULARITY       = 2;
+    private static final int STRING_BUFFER_INITIAL_SIZE  = 10;
+
+    // Prefixes for different categories of op codes, stored in MSB
+    final static int DRAW_PREFIX = 0;
+    final static int FILL_PREFIX = 1;
+    final static int SET_PREFIX = 2;
+    final static int MISC_PREFIX = 3;
+
+    // Unique operation codes for all the gc operations that can be buffered.
+    static final int OP_DRAWARC            = ((DRAW_PREFIX << 24) | 1);
+    static final int OP_DRAWFOCUS          = ((DRAW_PREFIX << 24) | 2);
+    static final int OP_DRAWIMAGE1         = ((DRAW_PREFIX << 24) | 3);
+    static final int OP_DRAWIMAGE2         = ((DRAW_PREFIX << 24) | 4);
+    static final int OP_DRAWLINE           = ((DRAW_PREFIX << 24) | 5);
+    static final int OP_DRAWELLIPSE        = ((DRAW_PREFIX << 24) | 6);
+    static final int OP_DRAWPOINT          = ((DRAW_PREFIX << 24) | 7);
+    static final int OP_DRAWPOLYGON        = ((DRAW_PREFIX << 24) | 8);
+    static final int OP_DRAWPOLYLINE       = ((DRAW_PREFIX << 24) | 9);
+    static final int OP_DRAWRECT           = ((DRAW_PREFIX << 24) | 10);
+    static final int OP_DRAWRGB_INT        = ((DRAW_PREFIX << 24) | 11);
+    static final int OP_DRAWRGB_BYTE       = ((DRAW_PREFIX << 24) | 12);
+    static final int OP_DRAWRGB_SHORT      = ((DRAW_PREFIX << 24) | 13);
+    static final int OP_DRAWROUNDRECT      = ((DRAW_PREFIX << 24) | 14);
+    static final int OP_DRAWSTRING         = ((DRAW_PREFIX << 24) | 15);
+    static final int OP_FILLARC            = ((FILL_PREFIX << 24) | 16);
+    static final int OP_FILLGRADIENTRECT   = ((FILL_PREFIX << 24) | 17);
+    static final int OP_FILLELLIPSE        = ((FILL_PREFIX << 24) | 18);
+    static final int OP_FILLPOLYGON        = ((FILL_PREFIX << 24) | 19);
+    static final int OP_FILLRECT           = ((FILL_PREFIX << 24) | 20);
+    static final int OP_FILLROUNDRECT      = ((FILL_PREFIX << 24) | 21);
+    static final int OP_SETBACKGROUNDALPHA = ((SET_PREFIX << 24) | 22);
+    static final int OP_SETBACKGROUNDCOLOR = ((SET_PREFIX << 24) | 23);
+    static final int OP_SETBLENDINGMODE    = ((SET_PREFIX << 24) | 24);
+    static final int OP_SETCLIP            = ((SET_PREFIX << 24) | 25);
+    static final int OP_CANCELCLIPPING     = ((SET_PREFIX << 24) | 26);
+    static final int OP_SETFONT            = ((SET_PREFIX << 24) | 27);
+    static final int OP_SETFOREGROUNDALPHA = ((SET_PREFIX << 24) | 28);
+    static final int OP_SETFOREGROUNDCOLOR = ((SET_PREFIX << 24) | 29);
+    static final int OP_SETSTROKESTYLE     = ((SET_PREFIX << 24) | 30);
+    static final int OP_SETSTROKEWIDTH     = ((SET_PREFIX << 24) | 31);
+    static final int OP_TRANSLATE          = ((MISC_PREFIX << 24) | 32);
+    static final int OP_SCALE              = ((MISC_PREFIX << 24) | 33);
+    static final int OP_RESETTRANSFORM     = ((MISC_PREFIX << 24) | 34);
+    static final int OP_COPYAREA1          = ((MISC_PREFIX << 24) | 35);
+    static final int OP_COPYAREA2          = ((MISC_PREFIX << 24) | 36);
+    /**    
+ * Constructs empty command buffer with defined buffer sizes.     */
+    public JavaCommandBuffer() {
+        intParams = new int[INT_BUF_INITIAL_SIZE];
+        strParams = new StringBuffer(STRING_BUFFER_INITIAL_SIZE);
+        images = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
+        rgbData = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
+    }
+    /**    
+ * Resets the buffer, i.e. removes all recorded commands and related data. The integer array containing    
+ * the actual operation codes is not deleted, only the index pointer is rested, thus the memory consumption of that is not freed.    
+ * CommandBuffer can be reseted only if it is not bound by any GraphicsContext    
+ * @throws IllegalStateException if this CommandBuffer is bound while calling reset     */
+    public void reset() {
+        if(bound) {
+            throw new IllegalStateException("CommandBuffer is still bound by gc");
+        }
+        intCount = 0;
+        strParams.setLength(0);
+        Enumeration allImages = images.elements();
+        while(allImages.hasMoreElements()) {
+            Image image = (Image)allImages.nextElement();
+            if(image != null) {
+                image.freeCommandBufferCopy();
+            }
+        }
+        images.removeAllElements();
+        rgbData.removeAllElements();
+        containsData = false;
+        containsPrimitiveData = false;
+    }
+    /**    
+ * Checks that does this buffer contain any commands    
+ * @return true if any command has been written to buffer otherwise false     */
+    public boolean containsData() {
+        return containsData;
+    }
+    /**    
+ * Checks that does this buffer contain any draw commands, i.e. any setters etc.    
+ * that does to cause any pixels to be rendered are ignored    
+ * @return true if any draw command has been written to buffer otherwise false     */
+    public boolean containsDrawnPrimitives() {
+        return containsPrimitiveData;
+    }
+    /**    
+ * Binds this buffer     */
+    void bind() {
+        bound = true;
+    }
+    /**    
+ * Provides the binding status of this buffer    
+ * @return true if this buffer has been already bound otherwise false     */
+    boolean isBound() {
+        return bound;
+    }
+    /**    
+ * Releases this buffer, i.e. it can be bound by some other GraphicsContext     */
+    void release() {
+        bound = false;
+    }
+    private void ensureIntArraySpace(final int items) {
+        if( intParams.length < intCount + items) {
+            int[] dst = new int[intParams.length + Math.max(INT_BUF_GRANULARITY, items)];
+            System.arraycopy(intParams, 0, dst, 0, intParams.length);
+            intParams = dst;
+        }
+        containsData = true;
+    }
+    private void reportNotSupported() {
+        throw new RuntimeException("Intenal: Operation not supported with JavaCommandBuffer");
+    }
+//    private void printBufferInfo() {
+//        System.out.println("CommandBuffer Info: " +this);
+//        System.out.println("intParamCount: " + intCount);
+//        System.out.println("intBuffer Size: " + intParams.length);
+//        System.out.println("StringBuffer Size: " + strParams.length());
+//    }
+    private void raisePrimitiveFlag() {
+        containsPrimitiveData = true;
+    }
+    int[] intParams() {
+        return intParams;
+    }
+    int intParamCount() {
+        return intCount;
+    }
+    Vector rgbParams() {
+        return rgbData;
+    }
+    Vector images() {
+        return images;
+    }
+    String strParams() {
+        return strParams.toString();
+    }
+    void drawArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {
+        ensureIntArraySpace(7);
+        intParams[intCount++] = OP_DRAWARC;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = startAngle;
+        intParams[intCount++] = arcAngle;
+        raisePrimitiveFlag();
+    }
+    void drawFocus (final int x, final int y, final int width, final int height) {
+        ensureIntArraySpace(5);
+        intParams[intCount++] = OP_DRAWFOCUS;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        raisePrimitiveFlag();
+    }
+    // Must be called from UI thread as images cannot be creates outside that
+    void drawImage(final Image image, final int x, final int y) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_DRAWIMAGE1;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        // creating copy of image here uses implicit data sharing,
+        // thus only a shallow copy is made
+        images.addElement(image.getCommandBufferCopy());
+        raisePrimitiveFlag();
+    }
+    // must be called from UI thread as images cannot be creates outside that
+    void drawImage(final Image image, final int tx, final int ty, final int tw, final int th, final int sx, final int sy, final int sw, final int sh, final int manipulation) {
+        ensureIntArraySpace(10);
+        intParams[intCount++] = OP_DRAWIMAGE2;
+        intParams[intCount++] = tx;
+        intParams[intCount++] = ty;
+        intParams[intCount++] = tw;
+        intParams[intCount++] = th;
+        intParams[intCount++] = sx;
+        intParams[intCount++] = sy;
+        intParams[intCount++] = sw;
+        intParams[intCount++] = sh;
+        intParams[intCount++] = manipulation;
+        // creating copy of image here uses implicit data sharing,
+        // thus only a shallow copy is made
+        images.addElement(image.getCommandBufferCopy());
+        raisePrimitiveFlag();
+    }
+    void drawLine (final int x1, final int y1, final int x2, final int y2) {
+        ensureIntArraySpace(5);
+        intParams[intCount++] = OP_DRAWLINE;
+        intParams[intCount++] = x1;
+        intParams[intCount++] = y1;
+        intParams[intCount++] = x2;
+        intParams[intCount++] = y2;
+        raisePrimitiveFlag();
+    }
+    void drawEllipse (final int x, final int y, final int width, final int height) {
+        ensureIntArraySpace(5);
+        intParams[intCount++] = OP_DRAWELLIPSE;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        raisePrimitiveFlag();
+    }
+    void drawPoint (final int x, final int y) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_DRAWPOINT;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        raisePrimitiveFlag();
+    }
+    void drawPolygon(final int[] pointArray) {
+        ensureIntArraySpace(2 + pointArray.length);
+        intParams[intCount++] = OP_DRAWPOLYGON;
+        intParams[intCount++] = pointArray.length;
+        for(int i = 0; i < pointArray.length; ++i) {
+            intParams[intCount++] = pointArray[i];
+        }
+        raisePrimitiveFlag();
+    }
+    void drawPolyline(final int[] pointArray) {
+        ensureIntArraySpace(2 + pointArray.length);
+        intParams[intCount++] = OP_DRAWPOLYLINE;
+        intParams[intCount++] = pointArray.length;
+        for(int i = 0; i < pointArray.length; ++i) {
+            intParams[intCount++] = pointArray[i];
+        }
+        raisePrimitiveFlag();
+    }
+    void drawRect (final int x, final int y, final int width, final int height) {
+        ensureIntArraySpace(5);
+        intParams[intCount++] = OP_DRAWRECT;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        raisePrimitiveFlag();
+    }
+    void drawRGB(final int[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation) {
+        ensureIntArraySpace(9);
+        intParams[intCount++] = OP_DRAWRGB_INT;
+        intParams[intCount++] = offset;
+        intParams[intCount++] = scanlength;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = processAlpha? 1 : 0;
+        intParams[intCount++] = manipulation;
+        rgbData.addElement(rgb);
+        raisePrimitiveFlag();
+    }
+    void drawRGB(final byte[] rgb, final byte[] transparencyMask, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final int manipulation, final int format) {
+        ensureIntArraySpace(9);
+        intParams[intCount++] = OP_DRAWRGB_BYTE;
+        intParams[intCount++] = offset;
+        intParams[intCount++] = scanlength;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = manipulation;
+        intParams[intCount++] = format;
+        rgbData.addElement(rgb);
+        rgbData.addElement(transparencyMask);
+        raisePrimitiveFlag();
+    }
+    void drawRGB(final short[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation, final int format) {
+        ensureIntArraySpace(10);
+        intParams[intCount++] = OP_DRAWRGB_SHORT;
+        intParams[intCount++] = offset;
+        intParams[intCount++] = scanlength;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = processAlpha? 1 : 0;
+        intParams[intCount++] = manipulation;
+        intParams[intCount++] = format;
+        rgbData.addElement(rgb);
+        raisePrimitiveFlag();
+    }
+    void drawRoundRect (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {
+        ensureIntArraySpace(7);
+        intParams[intCount++] = OP_DRAWROUNDRECT;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = arcWidth;
+        intParams[intCount++] = arcHeight;
+        raisePrimitiveFlag();
+    }
+    void drawString(final String string, final int x, final int y, final int width, final int height, final int alignments, final int flags, final boolean isTransparent) {
+        ensureIntArraySpace(9);
+        intParams[intCount++] = OP_DRAWSTRING;
+        intParams[intCount++] = string.length();
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = alignments;
+        intParams[intCount++] = flags;
+        intParams[intCount++] = isTransparent? 1 : 0;
+        strParams.append(string);
+        raisePrimitiveFlag();
+    }
+    void fillArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {
+        ensureIntArraySpace(7);
+        intParams[intCount++] = OP_FILLARC;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = startAngle;
+        intParams[intCount++] = arcAngle;
+        raisePrimitiveFlag();
+    }
+    void fillGradientRect(final int x, final int y, final int width, final int height, final boolean vertical, final boolean swapColors) {
+        ensureIntArraySpace(7);
+        intParams[intCount++] = OP_FILLGRADIENTRECT;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = vertical ? 1 : 0;
+        intParams[intCount++] = swapColors ? 1 : 0;
+        raisePrimitiveFlag();
+    }
+    void fillEllipse (final int x, final int y, final int width, final int height) {
+        ensureIntArraySpace(5);
+        intParams[intCount++] = OP_FILLELLIPSE;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        raisePrimitiveFlag();
+    }
+    void fillPolygon (final int[] pointArray) {
+        ensureIntArraySpace(2 + pointArray.length);
+        intParams[intCount++] = OP_FILLPOLYGON;
+        intParams[intCount++] = pointArray.length;
+        for(int i = 0; i < pointArray.length; ++i) {
+            intParams[intCount++] = pointArray[i];
+        }
+        raisePrimitiveFlag();
+    }
+    void fillRect (final int x, final int y, final int width, final int height) {
+        ensureIntArraySpace(5);
+        intParams[intCount++] = OP_FILLRECT;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        raisePrimitiveFlag();
+    }
+    void fillRoundRectangle (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {
+        ensureIntArraySpace(7);
+        intParams[intCount++] = OP_FILLROUNDRECT;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = arcWidth;
+        intParams[intCount++] = arcHeight;
+        raisePrimitiveFlag();
+    }
+    public void setBackgroundAlpha(final int alpha) {
+        ensureIntArraySpace(2);
+        intParams[intCount++] = OP_SETBACKGROUNDALPHA;
+        intParams[intCount++] = alpha;
+    }
+    void setBackgroundColor(final int argb, final boolean updateAlpha) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_SETBACKGROUNDCOLOR;
+        intParams[intCount++] = argb;
+        intParams[intCount++] = updateAlpha? 1 : 0;
+    }
+    void setBlendingMode(final int mode) {
+        ensureIntArraySpace(2);
+        intParams[intCount++] = OP_SETBLENDINGMODE;
+        intParams[intCount++] = mode;
+    }
+    void setClip(final int x, final int y, final int width, final int height, final boolean intersects) {
+        ensureIntArraySpace(6);
+        intParams[intCount++] = OP_SETCLIP;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = intersects? 1 : 0;
+    }
+    void cancelClipping () {
+        ensureIntArraySpace(1);
+        intParams[intCount++] = OP_CANCELCLIPPING;
+    }
+    void setFont(final int fontHandle) {
+        ensureIntArraySpace(2);
+        intParams[intCount++] = OP_SETFONT;
+        intParams[intCount++] = fontHandle;
+    }
+    void setForegroundAlpha(final int alpha) {
+        ensureIntArraySpace(2);
+        intParams[intCount++] = OP_SETFOREGROUNDALPHA;
+        intParams[intCount++] = alpha;
+    }
+    void setForegroundColor(final int argb, final boolean updateAlpha) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_SETFOREGROUNDCOLOR;
+        intParams[intCount++] = argb;
+        intParams[intCount++] = updateAlpha? 1 : 0;
+    }
+    void setStrokeStyle(final int style) {
+        ensureIntArraySpace(2);
+        intParams[intCount++] = OP_SETSTROKESTYLE;
+        intParams[intCount++] = style;
+    }
+    void setStrokeWidth(final int width) {
+        ensureIntArraySpace(2);
+        intParams[intCount++] = OP_SETSTROKEWIDTH;
+        intParams[intCount++] = width;
+    }
+    void translate(final int x, final int y) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_TRANSLATE;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+    }
+    void scale(final int x, final int y) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_SCALE;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+    }
+    void resetTransform() {
+        ensureIntArraySpace(1);
+        intParams[intCount++] = OP_RESETTRANSFORM;
+    }
+    void copyArea(final Image image, final int x, final int y) {
+        ensureIntArraySpace(3);
+        intParams[intCount++] = OP_COPYAREA1;
+        intParams[intCount++] = x;
+        intParams[intCount++] = y;
+        // TODO does this need flushing on the image
+        images.addElement(new Image(image));
+        raisePrimitiveFlag();
+    }
+    void copyArea(final int srcX, final int srcY, final int width, final int height, final int destX, final int destY, final boolean paint) {
+        ensureIntArraySpace(8);
+        intParams[intCount++] = OP_COPYAREA2;
+        intParams[intCount++] = srcX;
+        intParams[intCount++] = srcY;
+        intParams[intCount++] = width;
+        intParams[intCount++] = height;
+        intParams[intCount++] = destX;
+        intParams[intCount++] = destY;
+        intParams[intCount++] = paint? 1 : 0;
+        raisePrimitiveFlag();
+    }
+    // Unsupported operations
+    int getAdvancedCharacterWidth(final char ch, final boolean isAdvanced) {
+        reportNotSupported();
+        return 0;
+    }
+    void getFontMetricsData(final int[] data, final int fontHandle) {
+        reportNotSupported();
+    }
+    int getBackgroundAlpha() {
+        reportNotSupported();
+        return 0;
+    }
+    int getBackgroundColor() {
+        reportNotSupported();
+        return 0;
+    }
+    int getBlendingMode() {
+        reportNotSupported();
+        return 0;
+    }
+    void getClip(final int[] clip) {
+        reportNotSupported();
+    }
+    int getForegroundAlpha() {
+        reportNotSupported();
+        return 0;
+    }
+    int getForegroundColor() {
+        reportNotSupported();
+        return 0;
+    }
+    void getTextBoundingBox(final int[] boundingBox, final String string, final int alignments, final int flags, final int rectX, final int rectY, final int rectWidth, final int rectHeight) {
+        reportNotSupported();
+    }
+    int getStrokeWidth() {
+        reportNotSupported();
+        return 0;
+    }
+    int getStrokeStyle() {
+        reportNotSupported();
+        return 0;
+    }
+    int getTranslateX() {
+        reportNotSupported();
+        return 0;
+    }
+    int getTranslateY() {
+        reportNotSupported();
+        return 0;
+    }
+    boolean hasClipping() {
+        reportNotSupported();
+        return false;
+    }
+    void saveSettings() {
+        reportNotSupported();
+    }
+    void restoreSettings() {
+        reportNotSupported();
+    }
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/OS.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/OS.java	Thu Jul 22 16:31:34 2010 +0100
@@ -125,4 +125,5 @@
     static final native int windowsurface_getType(int handle);
     static final native void windowsurface_dispose(int handle);
     static final native void windowsurface_refresh(int handle);
+    static final native void windowsurface_handleSymbianWindowVisibilityChange(int handle, boolean visible);
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/WindowSurface.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/WindowSurface.java	Thu Jul 22 16:31:34 2010 +0100
@@ -160,6 +160,17 @@
     	OS.windowsurface_refresh(handle);
     }
     
+    /**
+     * Switch to software rendering when the window is going invisible 
+     * and back to hardware accelerated rendering when going visible.
+     * @param goingVisible True if the window is about to become visible (partially or fully).
+     *                     False if the window is about to become invisible (fully).
+     */
+    public void handleSymbianWindowVisibilityChange(boolean goingVisible)
+    {
+        OS.windowsurface_handleSymbianWindowVisibilityChange(handle, goingVisible);
+    }
+    
     private void checkState() {
     	Utils.validateUiThread();
     	if (disposed) {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/s60/org/eclipse/swt/internal/ApplicationUidWrapper.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - initial implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal;
+
+import com.nokia.mj.impl.rt.support.ApplicationInfo;
+
+
+public final class ApplicationUidWrapper {
+
+	public static int uid() {
+        int midletUid = -1;
+        try{
+            String uidS = ApplicationInfo.getInstance().getUid().getStringValue();
+            // In Symbian the UID is in format '[<uid>]' where <uid> is in hex
+            // format. So wee need to take the brackets away.
+            // Long is needed in conversion because UIDs greater than 0x80000000
+            // would fail if Integer would be used. However typecast from long
+            // to int is safe since UID in Symbian is 32 bit.
+            long uidL = Long.parseLong(uidS.substring(1,uidS.length()-1), 16);
+            return (int)uidL;
+        }
+        catch (Throwable t) {/* Not handled*/ }
+        return midletUid;
+    }
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/s60/org/eclipse/swt/internal/qt/s60/S60CommandPresentationStrategy.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-package org.eclipse.swt.internal.qt.s60;
-
-import org.eclipse.ercp.swt.mobile.Command;
-import org.eclipse.swt.internal.qt.CommandPresentationStrategy;
-import org.eclipse.swt.internal.qt.CommandUtils;
-import org.eclipse.swt.internal.qt.OS;
-import org.eclipse.swt.internal.qt.CommandArranger.CommandCollection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Internal_PackageSupport;
-import org.eclipse.swt.widgets.Widget;
-
-public class S60CommandPresentationStrategy extends CommandPresentationStrategy {
-    private Command[] positiveKeyCommands;
-    private Command negativeKeyCommand;
-    private Command defaultCommand;
-
-    public S60CommandPresentationStrategy() {
-        super();
-    }
-
-    protected void dispose() {
-        positiveKeyCommands = null;
-        negativeKeyCommand = null;
-        defaultCommand =null;
-    }
-
-
-    protected void handleCommandListChange(Command added, Command removed,
-            CommandCollection commands) {
-        cleanNegativeCommand();
-        cleanPositiveCommands();
-        updateCommandPositions(commands.getCommands(null));
-        placeNegativeCommand();
-        placePositiveCommands();
-    }
-
-    protected void handleDefaultCommandChange(Command defaultCommand) {
-        this.defaultCommand = defaultCommand;
-        cleanPositiveCommands();
-        placePositiveCommands();
-    }
-
-
-    protected void handleFocusChange(Control focused,
-            CommandCollection oldCommands, CommandCollection commands) {
-
-        //Clean-up the existing commands
-        cleanPositiveCommands();
-        cleanNegativeCommand();
-        //determine where the commands go
-        if( commands != null && commands.getSize()>0 ){
-            Command[] add = commands.getCommands(null);
-            updateCommandPositions(add);
-        }
-        //Place them to their places
-        placePositiveCommands();
-        placeNegativeCommand();
-
-    }
-
-    private void updateCommandPositions(Command[] commands) {
-        positiveKeyCommands = new Command[commands.length];
-        int  positiveKeyIndex=0;
-        for (int i = 0; i < commands.length; i++) {
-            Command cmd = commands[i];
-            if ( cmd.isDefaultCommand()){
-                defaultCommand = cmd;
-                continue;
-            }
-            if( CommandUtils.isNegativeType(cmd.type) ){
-                if (negativeKeyCommand == null || negativeKeyCommand.isDisposed()){
-                    negativeKeyCommand = cmd;
-                }else
-                if( negativeKeyCommand.getPriority() <= cmd.getPriority() ){
-                    positiveKeyCommands[positiveKeyIndex] = negativeKeyCommand;
-                    positiveKeyIndex++;
-                    negativeKeyCommand = cmd;
-                }else{
-                    positiveKeyCommands[positiveKeyIndex] = cmd;
-                    positiveKeyIndex++;
-                }
-                continue;
-            }
-            positiveKeyCommands[positiveKeyIndex]=cmd;
-            positiveKeyIndex++;
-        }
-        if ((positiveKeyIndex) < positiveKeyCommands.length ){// needs to shrink
-            Command[] rightSized = new Command[positiveKeyIndex];
-            System.arraycopy(positiveKeyCommands, 0, rightSized, 0, rightSized.length);
-            positiveKeyCommands = rightSized;
-        }
-    }
-
-
-    private void cleanPositiveCommands() {
-        boolean useBar = false;
-        if ( (positiveKeyCommands != null && positiveKeyCommands.length >1) ||
-                (defaultCommand != null && positiveKeyCommands != null) ){
-            useBar = true;
-        }
-        if (defaultCommand != null && !defaultCommand.isDisposed()
-                && !defaultCommand.control.isDisposed()) {
-            if (useBar) {
-                OS.QWidget_removeAction(defaultCommand.control.getShell()
-                        .internal_getOwnMenuBar(), topHandle(defaultCommand));
-            }
-            else{
-                 OS.QWidget_removeAction(topHandle(defaultCommand.control), topHandle(defaultCommand));
-            }
-        }
-        if (positiveKeyCommands != null) {
-            for (int i = 0; i < positiveKeyCommands.length; i++) {
-                Command cmd = positiveKeyCommands[i];
-                if (cmd == null || cmd.isDisposed()  || cmd.control.isDisposed()){
-                	continue;
-                }
-                int handle = 0;
-                if (useBar) {
-                    handle = cmd.control.getShell().internal_getOwnMenuBar();
-                } else {
-                    handle = topHandle(positiveKeyCommands[0].control);
-                }
-                OS.QWidget_removeAction(handle, topHandle(cmd));
-
-            }
-        }
-    }
-
-   private void cleanNegativeCommand() {
-        if(negativeKeyCommand != null && !negativeKeyCommand.isDisposed() && !negativeKeyCommand.control.isDisposed() ){
-            OS.QWidget_removeAction(topHandle(negativeKeyCommand.control), topHandle(negativeKeyCommand));
-        }
-    }
-
-    private void placeNegativeCommand() {
-        if(negativeKeyCommand != null ){
-            OS.QWidget_addAction(Internal_PackageSupport.topHandle(negativeKeyCommand.control),
-                    topHandle(negativeKeyCommand));
-        }
-    }
-
-    private void placePositiveCommands() {
-        if (defaultCommand != null ) {
-            int defaultCmdHandle = topHandle(defaultCommand);
-            if (positiveKeyCommands != null) {
-                OS.QMenuBar_addAction(defaultCommand.control.getShell()
-                        .internal_getOwnMenuBar(), defaultCmdHandle);
-            } else {
-                OS.QWidget_addAction(Internal_PackageSupport
-                        .topHandle(defaultCommand.control), defaultCmdHandle);
-            }
-        }
-        if (positiveKeyCommands != null) {
-            if (positiveKeyCommands.length == 1 && defaultCommand == null) {
-                OS.QWidget_addAction(Internal_PackageSupport
-                        .topHandle(positiveKeyCommands[0].control),
-                        topHandle(positiveKeyCommands[0]));
-            } else {
-                CommandUtils.sort(positiveKeyCommands);
-                for (int i = 0; i < positiveKeyCommands.length; i++) {
-                    OS.QMenuBar_addAction(positiveKeyCommands[i].control
-                            .getShell().internal_getOwnMenuBar(),
-                            topHandle(positiveKeyCommands[i]));
-                }
-            }
-        }
-    }
-
-    protected void handleMenuBarChanged(int newMenuBar,
-            CommandCollection commands) {
-        placePositiveCommands();
-    }
-
-
-    private static final int topHandle(Widget w) {
-        return Internal_PackageSupport.topHandle(w);
-    }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/webkit/org/eclipse/swt/internal/qt/webkit/OS_webkit.java	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Nokia Corporation - initial implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.qt.webkit;
-
-import org.eclipse.swt.internal.Library;
-
-/**
- * Native methods requiring QtWebkit. They are separated to avoid
- * loading the related libraries until they are needed. 
- */
-public final class OS_webkit {
-    static {
-        Library.loadLibrary("eswtqtwebkit");
-    }
-
-    //
-    // QWebView
-    //
-    public static final native int QWebView_new();
-    public static final native void QWebView_back(int handle);
-    public static final native void QWebView_forward(int handle);
-    public static final native void QWebView_reload(int handle);
-    public static final native void QWebView_setHtml(int handle, String html);
-    public static final native void QWebView_setUrl(int handle, String url);
-    public static final native void QWebView_stop(int handle);
-    public static final native String QWebView_swt_backUrl(int handle);
-    public static final native boolean QWebView_swt_canGoBack(int handle);
-    public static final native boolean QWebView_swt_canGoForward(int handle);
-    public static final native boolean QWebView_swt_evaluateJavaScript(int handle, String script);
-    public static final native String QWebView_swt_forwardUrl(int handle);
-    public static final native String QWebView_url(int handle);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/webkit/org/eclipse/swt/internal/qt/webkit/WebkitOS.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - initial implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.qt.webkit;
+
+import org.eclipse.swt.internal.Library;
+
+/**
+ * Native methods requiring QtWebkit. They are separated to avoid
+ * loading the related libraries until they are needed. 
+ */
+public final class WebkitOS {
+    static {
+        Library.loadLibrary("eswtqtwebkit");
+    }
+
+    //
+    // QWebView
+    //
+    public static final native int QWebView_new();
+    public static final native void QWebView_back(int handle);
+    public static final native void QWebView_forward(int handle);
+    public static final native void QWebView_reload(int handle);
+    public static final native void QWebView_setHtml(int handle, String html);
+    public static final native void QWebView_setUrl(int handle, String url);
+    public static final native void QWebView_stop(int handle);
+    public static final native String QWebView_swt_backUrl(int handle);
+    public static final native boolean QWebView_swt_canGoBack(int handle);
+    public static final native boolean QWebView_swt_canGoForward(int handle);
+    public static final native boolean QWebView_swt_evaluateJavaScript(int handle, String script);
+    public static final native String QWebView_swt_forwardUrl(int handle);
+    public static final native String QWebView_url(int handle);
+}
--- a/javauis/javalegacyutils/build/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/javalegacyutils/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -31,5 +31,11 @@
                    com.nokia.mj.impl.rt.legacy.MemoryUtil,
                    com.nokia.mj.impl.rt.legacy.MIDEventServer,
                    com.nokia.mj.impl.rt.legacy.NativeError"/>
+
+  <target name="create.internal.api.jar">
+    <omj.internal.apis includes="com/nokia/mj/impl/rt/legacy/MIDEventServer.class,
+                                 com/nokia/mj/impl/rt/legacy/Security.class"/>
+  </target>
+
 </project>
 
--- a/javauis/lcdui_qt/build.linux.j2se/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/build.linux.j2se/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -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/Buffer.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Buffer.java	Thu Jul 22 16:31:34 2010 +0100
@@ -56,12 +56,16 @@
     final static int HOST_TYPE_CUSTOMITEM = 3;
 
     // Flags for raising settings validation
-    private final static int NONE            = 0;
-    private final static int COLOR           = 1;
-    private final static int CLIP            = 2;
-    private final static int FONT            = 4;
-    private final static int STROKESTYLE     = 8;
-    private final static int COORS_TRANSLATION = 16;
+    // FORCE_SETTINGS Forces settings to validated also in case
+    // there's only one Graphics instance as client, normally 
+    // settings are not checked in such case
+    final static int NONE            = 0;
+    final static int COLOR           = 1;
+    final static int CLIP            = 2;
+    final static int FONT            = 4;
+    final static int STROKESTYLE     = 8;
+    final static int COORDS_TRANSLATION = 16; 
+    final static int FORCE_SETTINGS    = 32; 
 
     // Graphics settings active in buffer
     // all values are comparable to those
@@ -107,35 +111,35 @@
      */
     static Buffer createInstance(Object host, Control control)
     {
-    	if(host instanceof Canvas) 
-    	{
-    		if(OS.windowServer == OS.WS_SYMBIAN_S60)
-    		{	
-    		    return new CanvasBufferSymbian((Canvas) host, control);
-    		}
-    		else if(OS.windowServer == OS.WS_X11)
-    		{
-    			return new CanvasBufferLinux((Canvas) host, control);
-    		}
-  			return null;
-    	} 
-    	else if(host instanceof CustomItem)
-    	{
-    		if(OS.windowServer == OS.WS_SYMBIAN_S60)
-    		{	
-    		    return new CustomItemBufferSymbian((CustomItem) host, control);
-    		}
-    		else if(OS.windowServer == OS.WS_X11)
-    		{
-    			return new CustomItemBufferLinux((CustomItem) host, control);
-    		}
-  			return null;
-    	} 
-    	else if(host instanceof Image) 
-    	{
-    	    return new ImageBuffer((Image) host);	
-    	}
-    	return null;
+        if(host instanceof Canvas) 
+        {
+            if(OS.windowServer == OS.WS_SYMBIAN_S60)
+            {   
+                return new CanvasBufferSymbian((Canvas) host, control);
+            }
+            else if(OS.windowServer == OS.WS_X11)
+            {
+                return new CanvasBufferLinux((Canvas) host, control);
+            }
+            return null;
+        } 
+        else if(host instanceof CustomItem)
+        {
+            if(OS.windowServer == OS.WS_SYMBIAN_S60)
+            {   
+                return new CustomItemBufferSymbian((CustomItem) host, control);
+            }
+            else if(OS.windowServer == OS.WS_X11)
+            {
+                return new CustomItemBufferLinux((CustomItem) host, control);
+            }
+            return null;
+        } 
+        else if(host instanceof Image) 
+        {
+            return new ImageBuffer((Image) host);   
+        }
+        return null;
     }
     
     /**
@@ -154,8 +158,7 @@
     /**
      * Defines the bounds of the host.
      * Bounds are used for restricting the rendering in
-     * the area of the control that is being updated. With Images
-     * the bounds are not used.
+     * the area of the control that is being updated. 
      *
      * @param crtl The Control of the host
      * @param clienArea The area of the control which can be drawn by Graphics
@@ -177,6 +180,20 @@
     }
 
     /**
+     * Defines the bounds of the host.
+     *
+     * @param crtl The Control of the host
+     * @param clienArea The area of the control which can be drawn by Graphics
+     */
+    void setImageBounds(int width, int height)
+    {
+        hostBounds.x = 0;
+        hostBounds.y = 0;
+        hostBounds.width = width;
+        hostBounds.height = height;
+    }
+
+    /**
      * Prepares surface for a new frame and starts paint session. 
      * Must be called in UI thread (sync calls this automatically)
      * and at the start of new frame. The rectangle provided as 
@@ -189,11 +206,11 @@
      */
     void startFrame(int x, int y, int w, int h)
     {
-    	if(!isSurfaceSessionOpen)
-    	{
-    	    beginPaint(x, y, w, h);
-    	    isSurfaceSessionOpen = true;
-    	}
+        if(!isSurfaceSessionOpen)
+        {
+            beginPaint(x, y, w, h);
+            isSurfaceSessionOpen = true;
+        }
     }
     
     /**
@@ -202,11 +219,11 @@
      */
     void endFrame()
     {
-    	if(isSurfaceSessionOpen)
-    	{
-    		endPaint();
-    	    isSurfaceSessionOpen = false;
-    	}
+        if(isSurfaceSessionOpen)
+        {
+            endPaint();
+            isSurfaceSessionOpen = false;
+        }
     }
     
     /**
@@ -216,8 +233,8 @@
      */
     void blitToDisplay(GraphicsContext gc, Widget widget)
     {
-  	    endFrame();
-    	blit(gc, widget);
+        endFrame();
+        blit(gc, widget);
     }
     
     /** 
@@ -286,7 +303,7 @@
         // write the default values to the buffer
         if(clientCount == 1) 
         {
-            writeDefaultValuesToBuffer();	
+            writeDefaultValuesToBuffer();   
         }
         return new Graphics(this, hostBounds );
     }
@@ -299,7 +316,7 @@
      */
     void sync() 
     {
-    	sync(true);
+        sync(true);
     }
     
     /**
@@ -325,7 +342,7 @@
         }
         
         // Start surface session if not started yet
-       	startFrame(hostBounds.x, hostBounds.y , hostBounds.width , hostBounds.height);
+        startFrame(hostBounds.x, hostBounds.y , hostBounds.width , hostBounds.height);
         
         doRelease();
         bindToHost(gc);
@@ -365,12 +382,12 @@
      */
     void dispose()
     {
-    	if(gc != null) 
-    	{
+        if(gc != null) 
+        {
             doRelease();
             gc.dispose();
             gc = null;
-    	}
+        }
         commandBuffer = null;
     }
 
@@ -381,31 +398,31 @@
 
     void fillRect(int x, int y, int w, int h, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION), client);
         gc.fillRect(x, y, w, h);
     }
 
     void fillRoundRect(int x, int y, int w, int h, int arcW, int arcH, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION), client);
         gc.fillRoundRect(x, y, w, h, arcW, arcH);
     }
 
     void fillArc(int x, int y, int w, int h, int startAngle, int arcAngle, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION), client);
         gc.fillArc(x, y, w, h, startAngle, arcAngle);
     }
 
     void fillTriangle(int[] points, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION), client);
         gc.fillPolygon(points);
     }
 
     void setClip(int x, int y, int w, int h, Graphics client)
     {
-        validateAndApplySettings(COORS_TRANSLATION, client);
+        validateAndApplySettings(COORDS_TRANSLATION, client);
         // check if given clip is already active in buffer
         if((bufferClip.x == x) && (bufferClip.y == y) &&
                 (bufferClip.width == w) && (bufferClip.height== h))
@@ -420,7 +437,7 @@
         }
 
         // translate clip to display coordinates and apply
-        Rectangle rect = clipToDisplayCoords(x, y, w, h);
+        Rectangle rect = clipToWindowCoords(x, y, w, h);
         if(rect.isEmpty())
         {
             // check is buffer clip is already up to date
@@ -452,6 +469,11 @@
         gc.setClip(rect.x, rect.y, rect.width, rect.height, false);
     }
 
+    void setGraphicsDefaults(Graphics client)
+    {
+    	validateAndApplySettings((FONT|COLOR|STROKESTYLE|COORDS_TRANSLATION|FORCE_SETTINGS), client);
+    }
+    
     void setColor(int r, int g, int b, Graphics client)
     {
         // check if given color is already active in buffer
@@ -503,37 +525,37 @@
 
     void drawLine(int xStart, int yStart, int xEnd, int yEnd, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION|STROKESTYLE), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION|STROKESTYLE), client);
         gc.drawLine(xStart, yStart, xEnd, yEnd);
     }
 
     void drawRect(int x, int y, int w, int h, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION|STROKESTYLE), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION|STROKESTYLE), client);
         gc.drawRect(x, y, w, h);
     }
 
     void drawRoundRect(int x, int y, int w, int h, int arcW, int arcH, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION|STROKESTYLE), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION|STROKESTYLE), client);
         gc.drawRoundRect(x, y, w, h, arcW, arcH);
     }
 
     void drawArc(int x, int y, int w, int h, int startAngle, int arcAngle, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION|STROKESTYLE), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION|STROKESTYLE), client);
         gc.drawArc(x, y, w, h, startAngle, arcAngle);
     }
 
     void drawString(String string, int x, int y, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION|FONT), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION|FONT), client);
         gc.drawString(string, x, y, true);
     }
 
     void drawImage(org.eclipse.swt.internal.qt.graphics.Image image, int x,int y, Graphics client)
     {
-        validateAndApplySettings((CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((CLIP|COORDS_TRANSLATION), client);
         gc.drawImage(image, x, y);
     }
 
@@ -541,7 +563,7 @@
                    int wDst, int hDst, int xSrc, int ySrc, int wSrc, int hSrc,
                    int transform, Graphics client)
     {
-        validateAndApplySettings((CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((CLIP|COORDS_TRANSLATION), client);
         gc.drawImage(image, xDst, yDst, wDst, hDst, xSrc, ySrc, wSrc, hSrc, transform);
     }
 
@@ -555,7 +577,7 @@
                  boolean alpha,
                  Graphics client)
     {
-        validateAndApplySettings((CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((CLIP|COORDS_TRANSLATION), client);
         gc.drawRGB(rgb, offset, scanlength, x, y, w, h, alpha);
     }
 
@@ -570,7 +592,7 @@
                  int manipulation,
                  Graphics client)
     {
-        validateAndApplySettings((CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((CLIP|COORDS_TRANSLATION), client);
         gc.drawRGB(rgb, offset, scanlength, x, y, w, h, alpha, manipulation);
     }
 
@@ -586,7 +608,7 @@
                  int format,
                  Graphics client)
     {
-        validateAndApplySettings((CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((CLIP|COORDS_TRANSLATION), client);
         gc.drawRGB(rgb, transparencyMask, offset, scanlength, x, y, w, h, manipulation, format);
     }
 
@@ -602,19 +624,19 @@
                  int format,
                  Graphics client)
     {
-        validateAndApplySettings((CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((CLIP|COORDS_TRANSLATION), client);
         gc.drawRGB(rgb, offset, scanlength, x, y, w, h, alpha, manipulation, format);
     }
 
     void drawPolygon(int[] points, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION|STROKESTYLE), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION|STROKESTYLE), client);
         gc.drawPolygon(points);
     }
 
     void fillPolygon(int[] points, Graphics client)
     {
-        validateAndApplySettings((COLOR|CLIP|COORS_TRANSLATION), client);
+        validateAndApplySettings((COLOR|CLIP|COORDS_TRANSLATION), client);
         gc.fillPolygon(points);
     }
 
@@ -658,8 +680,16 @@
         return null;
     }
     
+    boolean containsDrawnPrimitives() {
+        boolean result = false;
+        if(commandBuffer != null) {
+            result = commandBuffer.containsDrawnPrimitives();
+        }
+        return result;
+    }
+    
     /**
-     * Translates given rectangle to display/window surface coordinates
+     * Translates given rectangle to window surface coordinates
      * and outlines the clip inside the control bounds.
      *
      * @param x The x-coordinate of the rectangle
@@ -668,7 +698,7 @@
      * @param h The height of the rectangle
      *
      */
-    private Rectangle clipToDisplayCoords(int x, int y, int w, int h)
+    private Rectangle clipToWindowCoords(int x, int y, int w, int h)
     {
         // Bottom-right corner of control bounds in window coordinates
         final int hostX2 = hostBounds.x + hostBounds.width;
@@ -701,7 +731,7 @@
         clipY2 = clipY2Dpy < hostBounds.y ? (clipY2 + (hostBounds.y - clipY1Dpy)) : clipY2;
         clipY2 = clipY2Dpy > hostY2 ? (clipY2 - (clipY1Dpy - hostY2)) : clipY2;
 
-        return new Rectangle(clipX1, clipY1, (clipX2 - clipX1) , (clipY1 - clipY2));
+        return new Rectangle(clipX1, clipY1, (clipX2 - clipX1) , (clipY2 - clipY1));
     }
 
     /**
@@ -715,7 +745,7 @@
      */
     private void validateAndApplySettings(int flags, Graphics client)
     {
-        if(!clientChanged(client))
+        if(!clientChanged(client) && (FORCE_SETTINGS & flags) == 0)
         {
             return;
         }
@@ -736,7 +766,7 @@
                     client.currentClip[3] != bufferClip.height)
             {
 
-                Rectangle rect = clipToDisplayCoords(client.currentClip[0], client.currentClip[1],
+                Rectangle rect = clipToWindowCoords(client.currentClip[0], client.currentClip[1],
                                                      client.currentClip[2], client.currentClip[3]);
                 gc.setClip(rect.x, rect.y, rect.width, rect.height, false);
                 bufferClip.x = client.currentClip[0];
@@ -745,7 +775,7 @@
                 bufferClip.height = client.currentClip[3];
             }
         }
-        if((COORS_TRANSLATION & flags) != 0)
+        if((COORDS_TRANSLATION & flags) != 0)
         {
             if((bufferTranslateX != client.translateX) && (bufferTranslateY != client.translateY))
             {
@@ -815,6 +845,9 @@
 
    /**
     * Writes Graphics default values to buffer
+    * @param force If true defaults are written unconditionally to buffer, 
+    *              otherwise only values that different than the ones in buffer
+    *              are written
     */
     private void writeDefaultValuesToBuffer()
     {
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/CanvasBufferLinux.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasBufferLinux.java	Thu Jul 22 16:31:34 2010 +0100
@@ -40,19 +40,22 @@
         host = canvas;
 	}
     
-	protected void init() 
-    {
-    	super.init();
-    	surface = Internal_PackageSupport.getWindowsurface(host.getShell());
-    }
-	
 	void bindToHost(GraphicsContext gc) 
 	{
 		gc.bindTarget(surface);
 	}
 
+    void ensureWindowSurface() 
+    {
+    	if(surface == null)
+    	{
+    		surface = Internal_PackageSupport.getWindowsurface(host.getShell());
+    	}
+    }
+	
 	void beginPaint(int x, int y, int w, int h) 
 	{
+		ensureWindowSurface();
 		paintX = x; 
 		paintY = y;
 		paintW = w;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java	Thu Jul 22 16:31:34 2010 +0100
@@ -189,10 +189,9 @@
              * Constructs a canvas kepad based on the JAD attribute
              *
              * @param canvas - canvas for which the keypad is required.
-             * @param canvasComp - Composite corresponding to the canvas.
              * @param mode- the jad attribute as a string.
              */
-    CanvasKeypad(Canvas canvas, Composite canvasComp, String mode)
+    CanvasKeypad(Canvas canvas, String mode)
     {
 
         this.canvas = canvas;
@@ -244,7 +243,7 @@
         canvasData.left = new FormAttachment(0);
         canvasData.top = new FormAttachment(0);
         canvasData.bottom = new FormAttachment(keypadComposite);
-        canvasComp.setLayoutData(canvasData);
+        canvas.getContentComp().setLayoutData(canvasData);
 
         FormData navKeyData = new FormData();
         navKeyData.right = new FormAttachment(100);
@@ -438,6 +437,7 @@
         gameKeysComposite.layout();
     }
 
+
     /**
              * Handles orientation changes.
              */
@@ -448,6 +448,16 @@
 
 
     /**
+             * Sets the currect Canvas for Key events.
+             * @param canvas - Current Canvas to which the key events needs to be delivered.
+             */
+    void setCurrentCanvas(Canvas canvas)
+    {
+        this.canvas = canvas;
+    }
+
+
+    /**
              * Adds LSk and RSK keys to navigation keypad if the canvas is set to full screen mode.
              * @param mode- Indicates if the canvas is in fullscreen mode or not. True if fullscreen, False otherwise.
              */
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java	Thu Jul 22 16:31:34 2010 +0100
@@ -68,7 +68,7 @@
 
     // Graphics command buffer for this instance
     Buffer graphicsBuffer;
-    Graphics CustomItemGraphics;
+    Graphics customItemGraphics;
 
     CustomItemLayouter layouter;
 
@@ -550,11 +550,11 @@
                     widgetDisposed = true;
                     return;
                 }
-                if(CustomItemGraphics == null)
+                if(customItemGraphics == null)
                 {
                     graphicsBuffer = Buffer.createInstance(self, (Control)event.widget);
-                    CustomItemGraphics = graphicsBuffer.getGraphics();
-                    CustomItemGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
+                    customItemGraphics = graphicsBuffer.getGraphics();
+                    customItemGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
                 }
                 else
                 {
@@ -583,17 +583,18 @@
                     contentHeight = this.contentHeight;
                 }
 
-                CustomItemGraphics.setClip(0, 0, contentWidth, contentHeight);
-                CustomItemGraphics.cleanBackground(new Rectangle(0, 0, contentWidth, contentHeight));
+                customItemGraphics.setClip(0, 0, contentWidth, contentHeight);
+                customItemGraphics.cleanBackground(new Rectangle(0, 0, contentWidth, contentHeight));
                 cleanupNeeded = false;
             }
         }
 
         // Clip must define the invalid area
-        CustomItemGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
+        customItemGraphics.reset();
+        customItemGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
 
         // The callback
-        paint(CustomItemGraphics, contentWidth, contentHeight);
+        paint(customItemGraphics, contentWidth, contentHeight);
 
         // Wait until the UI thread is available. Then in the UI thread
         // synchronously send a paint event.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/Graphics.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java	Thu Jul 22 16:31:34 2010 +0100
@@ -95,15 +95,19 @@
     
     private DirectGraphics directGraphics;
     private Buffer graphicsBuffer;
-
-    // Current font for rendering texts.
+    
+    // Cache for settings
+    // these members have package visibility,
+    // however they meant to be accessed only by 
+    // this (Graphics) instance or related (Buffer) 
+    // greaphicsBuffer instance
     Font currentFont;
     int currentColor;
     int translateX;
     int translateY;
     int[] currentClip = new int[4];
     int currentStrokeStyle;
-
+    
     private com.nokia.mj.impl.rt.support.Finalizer finalizer;
 
     //Constructor
@@ -135,8 +139,8 @@
         currentClip[1] = clipRect.y;
         currentClip[2] = clipRect.width;
         currentClip[3] = clipRect.height;
+        setDefaultSettings();
         graphicsBuffer = buffer;
-        reset();
     }
 
 
@@ -154,16 +158,29 @@
 
     /**
      * Resets Graphics state to initial.
+     * Reset does not set the clip.
      */
     void reset()
     {
+    	synchronized(graphicsBuffer) {
+    		// setDefaultSettings() must be called 
+    		// before the setGraphicsDefaults() since
+    		// graphicsBuffer (Buffer implementation) uses 
+    		// the member values of this instance when setting the defaults
+    		setDefaultSettings();
+    		graphicsBuffer.setGraphicsDefaults(this);
+    	}
+    }
+
+    void setDefaultSettings() 
+    {
         currentFont = Buffer.defaultFont;
         currentColor = Buffer.defaultColor;
         currentStrokeStyle = Buffer.defaultStrokeStyle;
         translateX = Buffer.defaultTranslateX;
         translateY = Buffer.defaultTranslateY;
     }
-
+    
     /**
      * Cleans the Canvas background.
      */
@@ -193,11 +210,11 @@
      */
     void setSyncStrategy(int strategy)
     {
-    	if((strategy != SYNC_LEAVE_SURFACE_SESSION_CLOSED) && (strategy != SYNC_LEAVE_SURFACE_SESSION_OPEN)) 
-    	{
-    		throw new IllegalArgumentException("Internal: Invalid strategy value");
-    	}
-    	syncStrategy = strategy;
+        if((strategy != SYNC_LEAVE_SURFACE_SESSION_CLOSED) && (strategy != SYNC_LEAVE_SURFACE_SESSION_OPEN)) 
+        {
+            throw new IllegalArgumentException("Internal: Invalid strategy value");
+        }
+        syncStrategy = strategy;
     }
 
     /**
@@ -264,7 +281,7 @@
     {
         synchronized(graphicsBuffer)
         {
-            return currentColor >> 16;
+            return (currentColor >> 16) & COMPONENT_MASK;
         }
     }
 
@@ -875,20 +892,15 @@
             {
                 final Image localLcduiImage = image;
                 final org.eclipse.swt.internal.qt.graphics.Image localCgfxImage = 
-                	Internal_GfxPackageSupport.getImage(Image.getESWTImage(image));
+                    Internal_GfxPackageSupport.getImage(Image.getESWTImage(image));
                 final int localX = x;
                 final int localY = y;
                 final Graphics self = this;
                 
-                ESWTUIThreadRunner.safeSyncExec(new Runnable() 
-    			{
-    				public void run()
-    				{
-    					localLcduiImage.sync(false);
-    					graphicsBuffer.drawImage(localCgfxImage, localX, localY, self);
-    				}
-    			});
-                
+                if(image.graphicsBuffer.containsDrawnPrimitives()) {
+                    localLcduiImage.sync(true);
+                }
+                graphicsBuffer.drawImage(localCgfxImage, localX, localY, self);
             }
         }
     }
@@ -1182,26 +1194,22 @@
             final int gcTransform = Image.getCgTransformValue(transform);
             synchronized(srcImage.graphicsBuffer)
             {
-            	final Image localLcduiSrcImage = srcImage;
-            	final org.eclipse.swt.internal.qt.graphics.Image localCgfxImage = 
-                	Internal_GfxPackageSupport.getImage(Image.getESWTImage(srcImage));
-            	final int localX = x;
-            	final int localY = y;
-            	final int localW = width;
-            	final int localH = height;
-            	final int localXSrc = xSrc;
-            	final int localYSrc = ySrc;
-            	final int localGcTransform = gcTransform;
-            	final Graphics self = this;
-            	ESWTUIThreadRunner.safeSyncExec(new Runnable()
-                {
-                    public void run()
-                    {
-                    	localLcduiSrcImage.sync(false);
-                        graphicsBuffer.drawImage(localCgfxImage,
-                        		localX, localY, localW, localH, localXSrc, localYSrc, localW, localH, localGcTransform, self);
-                    }
-                });
+                final Image localLcduiSrcImage = srcImage;
+                final org.eclipse.swt.internal.qt.graphics.Image localCgfxImage = 
+                    Internal_GfxPackageSupport.getImage(Image.getESWTImage(srcImage));
+                final int localX = x;
+                final int localY = y;
+                final int localW = width;
+                final int localH = height;
+                final int localXSrc = xSrc;
+                final int localYSrc = ySrc;
+                final int localGcTransform = gcTransform;
+                final Graphics self = this;
+                if(srcImage.graphicsBuffer.containsDrawnPrimitives()) {
+                    localLcduiSrcImage.sync(true);
+                }
+                graphicsBuffer.drawImage(localCgfxImage,
+                    localX, localY, localW, localH, localXSrc, localYSrc, localW, localH, localGcTransform, self);
             }
         }
     }
@@ -1212,21 +1220,21 @@
      */
     void sync()
     {
-    	synchronized(graphicsBuffer) 
-    	{
-    		if(syncStrategy == SYNC_LEAVE_SURFACE_SESSION_OPEN)
-    		{
-    			// This instance is used only with paint callbacks, thus  
-    			// sync is called with the indication that surface paint  
-    			// session can be left open as it will be closed when the 
-    			// callback returns.
-    		    graphicsBuffer.sync(false);
-    		}
-    		else 
-    		{
-    			graphicsBuffer.sync(true);
-    		} 
-    	}
+        synchronized(graphicsBuffer) 
+        {
+            if(syncStrategy == SYNC_LEAVE_SURFACE_SESSION_OPEN)
+            {
+                // This instance is used only with paint callbacks, thus  
+                // sync is called with the indication that surface paint  
+                // session can be left open as it will be closed when the 
+                // callback returns.
+                graphicsBuffer.sync(false);
+            }
+            else 
+            {
+                graphicsBuffer.sync(true);
+            } 
+        }
     }
     
     
@@ -1243,14 +1251,14 @@
     }
 
     /**
-	 * Getter for graphics buffer.
-	 * @return The Buffer.
-	 */
+     * Getter for graphics buffer.
+     * @return The Buffer.
+     */
     Buffer getGraphicsBuffer()
     {
         return graphicsBuffer;
     }
-	
+    
     /**
      * Maps stroke style constant from values used by
      * Graphics to values defined in GraphicsContext
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageBuffer.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageBuffer.java	Thu Jul 22 16:31:34 2010 +0100
@@ -29,6 +29,7 @@
     ImageBuffer(Image image)
     {
         host = image;
+        setImageBounds(image.getWidth(), image.getHeight());
     }
 
     int getHostType()
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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/m3g_qt/src/jni/graphics3d.inl	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/m3g_qt/src/jni/graphics3d.inl	Thu Jul 22 16:31:34 2010 +0100
@@ -22,7 +22,7 @@
 JNIEXPORT jboolean JNICALL Java_javax_microedition_m3g_Graphics3D__1isProperRenderer
 (JNIEnv* /*aEnv*/, jclass)
 {
-    EGLContext ctx;
+/*    EGLContext ctx;
     EGLConfig config;
     EGLSurface surf;
     EGLint attrib[5];
@@ -78,7 +78,8 @@
     eglDestroySurface(eglGetDisplay(0), surf);
     eglDestroyContext(eglGetDisplay(0), ctx);
 
-    return isProperRenderer;
+    return isProperRenderer;*/
+    return false;
 }
 
 /*
--- a/javauis/m3g_qt/src/jni/interface.inl	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/m3g_qt/src/jni/interface.inl	Thu Jul 22 16:31:34 2010 +0100
@@ -39,6 +39,14 @@
  */
 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Interface__1ctor(JNIEnv* aEnv, jclass)
 {
+    EGLDisplay oldDisplay = eglGetCurrentDisplay();
+    EGLSurface oldDrawSurface = eglGetCurrentSurface(EGL_DRAW);
+    EGLSurface oldReadSurface = eglGetCurrentSurface(EGL_READ);
+    EGLContext oldContext = eglGetCurrentContext();
+    EGLenum oldAPI = eglQueryAPI();
+    eglMakeCurrent( EGL_DEFAULT_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+    eglBindAPI( EGL_OPENGL_ES_API );
+    
     M3Gparams cs;
     memset(&cs, 0, sizeof(cs));
     cs.mallocFunc = malloc;
@@ -51,6 +59,10 @@
     //jint handle = eventSource->Execute(&createInterface, &cs);
     jint handle = (unsigned)m3gCreateInterface(&cs);
     M3G_DO_UNLOCK(aEnv);
+    
+    eglMakeCurrent( EGL_DEFAULT_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+    eglBindAPI( oldAPI );
+    eglMakeCurrent( oldDisplay, oldDrawSurface, oldReadSurface, oldContext );
     return handle;
 }
 
--- a/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreammetadatacontrol.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreammetadatacontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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/audiostreaming/src.mmf/cmmaaudiostreamplayer.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayer.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -21,10 +21,10 @@
 #include <audiopreference.h>
 #include <logger.h>
 
-#include "CMMAAudioStreamPlayer.h"
-#include "CMMADataSourceStream.h"
-#include "MMAFunctionServer.h"
-#include "CMMAStreamHandler.h"
+#include "cmmaaudiostreamplayer.h"
+#include "cmmadatasourcestream.h"
+#include "mmafunctionserver.h"
+#include "cmmastreamhandler.h"
 
 const TInt KPlayerPriority = KAudioPriorityRecording;
 _LIT(KMMAStreamErrorMessage, "Internal error: %d");
--- a/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayerfactory.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayerfactory.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -19,7 +19,7 @@
 //  INCLUDE FILES
 #include <logger.h>
 #include "CMMAAudioStreamPlayerFactory.h"
-#include "CMMAAudioStreamPlayer.h"
+#include "cmmaaudiostreamplayer.h"
 #include "CMMAAudioVolumeControl.h"
 #include "CMMAStopTimeControl.h"
 #include "CMMAMMFResolver.h"
--- a/javauis/mmapi_qt/audiostreaming/src.mmf/cmmastreamhandler.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmastreamhandler.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -21,9 +21,9 @@
 #include <audiopreference.h>
 #include <logger.h>
 
-#include "CMMAStreamHandler.h"
-#include "CMMADataSourceStream.h"
-#include "MMAFunctionServer.h"
+#include "cmmastreamhandler.h"
+#include "cmmadatasourcestream.h"
+#include "mmafunctionserver.h"
 
 CMMAStreamHandler* CMMAStreamHandler::NewL(
     MMMAStreamHandlerListener& aListener,
--- a/javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudioplayer.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudioplayer.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiometadatacontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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/cmmadisplay.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/cmmadisplay.h	Thu Jul 22 16:31:34 2010 +0100
@@ -50,7 +50,7 @@
     // Default constructor, protected to allow derivation
     CMMADisplay();
 
-    void Construct(MMAFunctionServer* eventSource ,jobject javadisplayref);
+    void Construct(MMAFunctionServer* eventSource ,JNIEnv* aJni, jobject javadisplayref);
 
 public: // Methods derived from MMMADisplay
     void DrawFrameL(const CFbsBitmap* aBitmap);
@@ -66,7 +66,8 @@
     void SetUIPlayer(MMMAGuiPlayer* player);
     TSize SourceSize();
     virtual void SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight,TInt x,TInt y, TRect aBoundsRect) = 0;
-
+    TBool iseSWT();
+    void SetFullscreenSize(TSize& aSize);
     /**
      * Gets notification that there is container to draw assigned
      *
@@ -267,9 +268,19 @@
     MMAFunctionServer* iEventSource;
     JNIEnv* iJni;
     jobject iJavaDisplayObject;
-		jclass iJavaDisplayClass;
-		TSize iFullScreenSize;
-		MMMAGuiPlayer* iUiPlayer;
+	jclass iJavaDisplayClass;
+	TSize iFullScreenSize;
+	MMMAGuiPlayer* iUiPlayer;
+	TBool iIseSWT;
+	jmethodID setRectID;
+	jfieldID iRectDimensionField;
+	jfieldID iDisplayboundarrField;
+	jmethodID setContentBoundID;
+	jmethodID removeContentBoundID;
+	jmethodID redrawControlID;
+	jmethodID getCallBackMethodID;
+	jobject iJavadisplayref;
+	jmethodID getBoundRectID;
 };
 
 #endif // CMMADISPLAY_H
--- a/javauis/mmapi_qt/baseline/inc/cmmaframepositioningcontrol.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/cmmaframepositioningcontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidimetadatacontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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/cmmaplayer.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/cmmaplayer.h	Thu Jul 22 16:31:34 2010 +0100
@@ -134,7 +134,7 @@
      * @param aPlayer Player to use.
      * @param aIndex Control's index.
      */
-    IMPORT_C static CMMAControl* StaticControl(CMMAPlayer* aPlayer,
+    static CMMAControl* StaticControl(CMMAPlayer* aPlayer,
             TInt aIndex);
 
 public: // New methods
@@ -335,9 +335,9 @@
      */
     IMPORT_C void PostActionCompleted(TInt aError);
     
-    IMPORT_C void PostActionCompletedFile();   //LC work for S60 3.2
+    void PostActionCompletedFile();   //LC work for S60 3.2
     
-    IMPORT_C void PostActionCompletedStart();
+    void PostActionCompletedStart();
 protected: // new methods
     /**
      * @see StaticAddSourceStreamL
--- a/javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -102,6 +102,7 @@
      * @param aDeleteRefEvent Event posted in the destructor.
      */
     static void StaticInitDynamicModeL(CMMAVideoControl* aVideoControl,
+                                       JNIEnv* aJni,
                                        TInt* aContentHandle,
                                        MMAFunctionServer* aEventSource,
                                        jobject aGUIObject,
@@ -171,7 +172,16 @@
 private:
 
     void SetForeground(TBool aForeground, TBool aUseEventServer);
-
+    
+public:
+    
+    enum TDisplaytype
+    {
+        EDISPLAY_CANVAS=0,
+        EDISPLAY_VIDEOITEM=1,
+        EDISPLAY_ESWT=2
+    };
+    
 protected:
     /**
      * Not owned.
--- a/javauis/mmapi_qt/baseline/inc/mmmadisplay.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/mmmadisplay.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/inc/tmmaparametervalidator.h	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/FramePositioningControl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/StopTimeControl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoItem.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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/com/nokia/microedition/media/control/BaseDisplay.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java	Thu Jul 22 16:31:34 2010 +0100
@@ -28,9 +28,11 @@
 {
     // represents native side of display and initialized by derived class
     protected int nativeDisplayHandle;
-    protected org.eclipse.swt.widgets.Control eswtCanvasControl;
+    protected org.eclipse.swt.widgets.Control iControl;
     private Rectangle rect;
     private int[] rectDimension = new int[ 4 ];
+    protected boolean iseSWT;
+
     public BaseDisplay()
     {
         rect = new Rectangle(0,0,0,0);
@@ -42,12 +44,20 @@
         */
     public void GetCallbackInUiThread(int aPlaceHolder)
     {
-        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"_+inside BaseDisplay : GetCallbackInUiThread");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"_+inside BaseDisplay : GetCallbackInUiThread ++");
         final int val = aPlaceHolder;
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"_+inside BaseDisplay : GetCallbackInUiThread - aPlaceHolder = "+aPlaceHolder+"nativeDisplayHandle = "+nativeDisplayHandle);
         try
         {
-            final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            org.eclipse.swt.widgets.Display disp = null;
+            if (iseSWT)
+            {
+                disp = org.eclipse.swt.widgets.Display.getDefault();
+            }
+            else
+            {
+                disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            }
             Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"_+inside BaseDisplay : GetCallbackInUiThread - got eswtdisplay");
             disp.syncExec(new Runnable()
             {
@@ -62,82 +72,112 @@
         {
             Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : GetCallbackInUiThread....exception is " + e.toString());
         }
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"_+inside BaseDisplay : GetCallbackInUiThread --");
 
     }
 
     public void setContentBound()
     {
-        System.out.println("inside BaseDisplay : setContentBound +");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : setContentBound +");
         try
         {
 
-            final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            org.eclipse.swt.widgets.Display disp = null;
+            if (iseSWT)
+            {
+                disp = org.eclipse.swt.widgets.Display.getDefault();
+            }
+            else
+            {
+                disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            }
             disp.syncExec(new Runnable()
             {
                 public void run()
                 {
-                    eswtCanvasControl.setBounds(rect);
+                    Rectangle arect = iControl.getBounds();
+                    rect.x = rect.x + arect.x;
+                    rect.y = rect.y + arect.y;
+                    iControl.setBounds(rect);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside BaseDisplay : setContentBound....exception is  " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : setContentBound....exception is  " + e.toString());
         }
-        System.out.println("inside BaseDisplay : setContentBound -");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : setContentBound -");
     }
 
 
     public void removeContentBound()
     {
-        System.out.println("inside BaseDisplay : removeContentBound +");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : removeContentBound +");
         try
         {
 
-            final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            org.eclipse.swt.widgets.Display disp = null;
+            if (iseSWT)
+            {
+                disp = org.eclipse.swt.widgets.Display.getDefault();
+            }
+            else
+            {
+                disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            }
             disp.syncExec(new Runnable()
             {
                 public void run()
                 {
                     Rectangle emptyRect = new Rectangle(0,0,0,0);
-                    eswtCanvasControl.setBounds(emptyRect);
+                    iControl.setBounds(emptyRect);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside BaseDisplay : removeContentBound....exception is  " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : removeContentBound....exception is  " + e.toString());
         }
-        System.out.println("inside BaseDisplay : removeContentBound -");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : removeContentBound -");
     }
 
     public void redrawControl()
     {
-        System.out.println("inside BaseDisplay : redrawControl +");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : redrawControl +");
         try
         {
 
-            final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            org.eclipse.swt.widgets.Display disp = null;
+            if (iseSWT)
+            {
+                disp = org.eclipse.swt.widgets.Display.getDefault();
+            }
+            else
+            {
+                disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            }
             disp.syncExec(new Runnable()
             {
                 public void run()
                 {
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : redrawControl before redraw");
                     // redraw entire bounds of receiver
-                    eswtCanvasControl.redraw();
+                    iControl.redraw();
                 }
             });
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : redrawControl after redraw");
         }
         catch (Exception e)
         {
-            System.out.println("inside BaseDisplay : redrawControl....exception is  " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : redrawControl....exception is  " + e.toString());
         }
-        System.out.println("inside BaseDisplay : redrawControl -");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : redrawControl -");
     }
     /* called from native to reset the java side rect
-       Before the call of this function array is updated from native side
-       which can be used to refresh the UI screen rect and/or
-       set/remove bound rect
-      */
+    Before the call of this function array is updated from native side
+    which can be used to refresh the UI screen rect and/or
+    set/remove bound rect
+    */
     public void setRect()
     {
 
@@ -146,10 +186,39 @@
         rect.width = rectDimension[2];
         rect.height = rectDimension[3];
 
-        System.out.println("BaseDisplay : setRect rect is reset with values: x =" + rect.x +"y ="+ rect.y +"width ="+rect.width+"height = "+ rect.height);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"BaseDisplay : setRect rect is reset with values: x =" + rect.x +"y ="+ rect.y +"width ="+rect.width+"height = "+ rect.height);
 
     }
 
+    public Rectangle getBounds()
+    {
+        try
+        {
+
+            org.eclipse.swt.widgets.Display disp = null;
+            if (iseSWT)
+            {
+                disp = org.eclipse.swt.widgets.Display.getDefault();
+            }
+            else
+            {
+                disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+            }
+            disp.syncExec(new Runnable()
+            {
+                public void run()
+                {
+
+                    rect = iControl.getBounds();
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"  " + e.toString());
+        }
+        return rect;
+    }
     // abstract functions implemented by concrete class
     protected abstract void setDisplaySize(int aWidth, int aHeight);
     protected abstract void setDisplayFullScreen(final boolean aFullScreenMode);
@@ -162,7 +231,7 @@
     protected abstract int getSourceWidth();
     protected abstract int getSourceHeight();
     protected abstract void getBoundRect();
-    protected abstract void setWindowResources(VideoItem aVideoItem);
+    public abstract void setWindowResources(VideoItem aVideoItem);
     protected abstract void setNativeHandle(int handle);
     public abstract void setContainerVisibilityToNative(final boolean active);
     // Native methods
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java	Thu Jul 22 16:31:34 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002 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"
@@ -36,12 +36,13 @@
 {
 
     private int iEventSourceHandle;
-    private org.eclipse.swt.widgets.Control iEswtItemControl;
+
     private MMAPIeSWTObserver iEswtObserver;
     private int x;
     private int y;
     private int qwidgetHandle;
     Rectangle iFormRect;
+    private boolean iQWidgetHandleSet = false;
 
     // index 0 : x-coordinate of topleft corner of display
     // index 1 : y-coordinate of topleft corner of display
@@ -65,7 +66,7 @@
 
 
         iEswtObserver = new MMAPIeSWTObserver();
-        //iEswtItemControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtControl(item);
+        //iControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtControl(item);
         com.nokia.mj.impl.nokialcdui.LCDUIInvoker.setItemControlStateChangeListener((ItemControlStateChangeListener)this,(javax.microedition.lcdui.Item) aVideoItem);
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java - ");
 
@@ -74,9 +75,9 @@
 
     private void addListeners()
     {
-        iEswtObserver.addControlListenerToControl(iEswtItemControl);
-        iEswtObserver.addShellListenerToControl(iEswtItemControl);
-        iEswtObserver.addDisposeListenerToControl(iEswtItemControl);
+        iEswtObserver.addControlListenerToControl(iControl);
+        iEswtObserver.addShellListenerToControl(iControl);
+        iEswtObserver.addDisposeListenerToControl(iControl);
     }
 
     public void setNativeHandle(int handle)
@@ -107,13 +108,13 @@
                 public void run()
                 {
                     org.eclipse.swt.graphics.Point size = new org.eclipse.swt.graphics.Point(width,height);
-                    iEswtItemControl.setSize(size);
+                    iControl.setSize(size);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setDisplaySize - ");
@@ -130,7 +131,7 @@
             {
                 public void run()
                 {
-                    iEswtItemControl.setBounds(disp.getClientArea());
+                    iControl.setBounds(disp.getClientArea());
                     new MobileShell(disp).setFullScreenMode(aFullScreenMode);
                     // instruct native to switch to full screen mode
                     _setFullScreenMode(nativeDisplayHandle,aFullScreenMode);
@@ -160,13 +161,13 @@
             {
                 public void run()
                 {
-                    iEswtItemControl.setLocation(x , y);
+                    iControl.setLocation(x , y);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setDisplayLocation - ");
@@ -177,6 +178,9 @@
     public void setVisible(boolean aVisible)
     {
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setVisible + ");
+        // call native side to set the visibiity
+        _setVisible(nativeDisplayHandle,aVisible);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setVisible after _setVisible ");
         try
         {
             final boolean visible = aVisible;
@@ -185,15 +189,16 @@
             {
                 public void run()
                 {
-                    // iEswtItemControl.setVisible(visible);
-                    // call native side to set the visibiity
-                    _setVisible(nativeDisplayHandle,visible);
+
+
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"before calling iControl.setVisible");
+                    iControl.setVisible(visible);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setVisible - ");
@@ -211,13 +216,13 @@
 
                 public void run()
                 {
-                    y = iEswtItemControl.getSize().y;
+                    y = iControl.getSize().y;
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: getDisplayHeight - ");
@@ -235,14 +240,14 @@
             {
                 public void run()
                 {
-                    x = iEswtItemControl.getSize().x;
+                    x = iControl.getSize().x;
 
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: getDisplayWidth - ");
@@ -259,14 +264,14 @@
             {
                 public void run()
                 {
-                    x = iEswtItemControl.getLocation().x;
+                    x = iControl.getLocation().x;
 
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: getDisplayX - ");
@@ -286,14 +291,14 @@
             {
                 public void run()
                 {
-                    y = iEswtItemControl.getLocation().y;
+                    y = iControl.getLocation().y;
 
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: getDisplayY - ");
@@ -326,13 +331,13 @@
             {
                 public void run()
                 {
-                    Rectangle boundrect  = iEswtItemControl.getBounds();
+                    Rectangle boundrect  = iControl.getBounds();
                     displayboundarr[0] = boundrect.x ;
                     displayboundarr[1] = boundrect.y ;
                     displayboundarr[2] = boundrect.width ;
                     displayboundarr[3] = boundrect.height ;
 
-                    Shell shell = iEswtItemControl.getShell();
+                    Shell shell = iControl.getShell();
                     iFormRect = shell.getBounds();
 
 
@@ -348,7 +353,7 @@
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java :getBoundRect() x =" + displayboundarr[0] + "y ="+ displayboundarr[1] +"width ="+ displayboundarr[2] +"height =" + displayboundarr[3]);
@@ -373,6 +378,8 @@
     public void setWindowResources(VideoItem aVideoItem)
     {
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setWindowResources windowHandle ");
+
+        iQWidgetHandleSet = true;
         if (aVideoItem == null)
             Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setWindowResources aVideoItem is null");
         // set the item size to be that of the video size if the video size is known.
@@ -382,9 +389,9 @@
 
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: after setting the size of item to source size ");
 
-        if (iEswtItemControl == null)
+        if (iControl == null)
         {
-            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"+ItemDisplay() -  iEswtItemControl is null");
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"+ItemDisplay() -  iControl is null");
         }
         try
         {
@@ -394,10 +401,10 @@
             {
                 public void run()
                 {
-                    Shell shell = iEswtItemControl.getShell();
+                    Shell shell = iControl.getShell();
                     qwidgetHandle = Internal_PackageSupport.topHandle(shell);
-                    x = iEswtItemControl.getSize().x;
-                    y = iEswtItemControl.getSize().y;
+                    x = iControl.getSize().x;
+                    y = iControl.getSize().y;
                     _setWindowToNative(nativeDisplayHandle,qwidgetHandle);
                     Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setWindowResources qwidgetHandle is " + qwidgetHandle);
                 }
@@ -405,7 +412,7 @@
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
             e.printStackTrace();
         }
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java: setWindowResources qwidgetHandle(x,y) " +x+"," +y);
@@ -440,12 +447,15 @@
     public void notifyControlAvailable(org.eclipse.swt.widgets.Control ctrl,Item item)
     {
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : notifyControlAvailable + ");
-        iEswtItemControl = ctrl;
+        iControl = ctrl;
         /* now use the control and addobserver to the control
         and setwindowresources
         */
-        NativeResources nativeres = new NativeResources(this,iVideoItem);
-        nativeres.start();
+        if (iQWidgetHandleSet == false)
+        {
+            NativeResources nativeres = new NativeResources(this,iVideoItem);
+            nativeres.start();
+        }
 
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : notifyControlAvailable - ");
     }
@@ -472,8 +482,8 @@
                 final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
                  disp.syncExec(new Runnable() {
                                  public void run() {
-                                      x = iEswtItemControl.getSize().x;
-                                      y = iEswtItemControl.getSize().y;
+                                      x = iControl.getSize().x;
+                                      y = iControl.getSize().y;
 
                                  }
                     });
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMACanvasDisplay.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMACanvasDisplay.java	Thu Jul 22 16:31:34 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002 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"
@@ -24,7 +24,7 @@
 import org.eclipse.ercp.swt.mobile.MobileShell;
 import org.eclipse.swt.graphics.Rectangle;
 import com.nokia.microedition.media.control.VideoItem;
-
+import com.nokia.mj.impl.utils.Logger;
 
 
 public class MMACanvasDisplay extends BaseDisplay
@@ -51,20 +51,20 @@
     {
         iEventSourceHandle = aEventSourceHandle;
         eswtObserver = new MMAPIeSWTObserver();
-        eswtCanvasControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtControl(canvas);
+        iControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtControl(canvas);
         //super.setESWTControl(eswtCanvasControl);
     }
 
     private void addListeners()
     {
-        eswtObserver.addControlListenerToControl(eswtCanvasControl);
-        eswtObserver.addShellListenerToControl(eswtCanvasControl);
-        eswtObserver.addDisposeListenerToControl(eswtCanvasControl);
+        eswtObserver.addControlListenerToControl(iControl);
+        eswtObserver.addShellListenerToControl(iControl);
+        eswtObserver.addDisposeListenerToControl(iControl);
     }
 
     public void setNativeHandle(int handle)
     {
-        System.out.println("MMACanvasDisplay.java : setNativeHandle :" + handle);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : setNativeHandle :" + handle);
         nativeDisplayHandle = handle;
         eswtObserver.setDisplayToObserver(this);
         addListeners();
@@ -82,24 +82,24 @@
                 public void run()
                 {
                     org.eclipse.swt.graphics.Point size = new org.eclipse.swt.graphics.Point(width,height);
-                    eswtCanvasControl.redraw();
+                    iControl.redraw();
 
-                    System.out.println("inside videoControl's setDisplaySize redraw called");
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize redraw called");
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
 
 
-        System.out.println("inside videoControl's setDisplaySize +");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize +");
         _setDisplaySize(nativeDisplayHandle,
                         iEventSourceHandle,
                         aWidth,
                         aHeight);
-        System.out.println("inside videoControl's setDisplaySize -");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize -");
     }
 
     public void setDisplayFullScreen(final boolean aFullScreenMode)
@@ -112,16 +112,16 @@
             {
                 public void run()
                 {
-                    eswtCanvasControl.setBounds(disp.getClientArea());
-                    new MobileShell(disp).setFullScreenMode(aFullScreenMode);
+                    iControl.setBounds(disp.getClientArea());
+                    //new MobileShell(disp).setFullScreenMode(aFullScreenMode);
                     // instruct native to switch to full screen mode
-                    _setFullScreenMode(nativeDisplayHandle,aFullScreenMode);
+                    //_setFullScreenMode(nativeDisplayHandle,aFullScreenMode);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
 
     }
@@ -139,7 +139,7 @@
             {
                 public void run()
                 {
-                    org.eclipse.swt.graphics.Point topleftposition = eswtCanvasControl.getLocation();
+                    org.eclipse.swt.graphics.Point topleftposition = iControl.getLocation();
                     eSWTcontrolLocationX = topleftposition.x;
                     eSWTcontrolLocationY = topleftposition.y;
 
@@ -148,17 +148,17 @@
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
         // To Avoid UI thread block
-        System.out.println("inside videoControl's setDisplaySize before calling _setPosition ");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize before calling _setPosition ");
         _setPosition(nativeDisplayHandle,
                      iEventSourceHandle,
                      eSWTcontrolLocationX,
                      eSWTcontrolLocationY,
                      videoControlLocationX,
                      videoControlLocationY);
-        System.out.println("inside videoControl's setDisplaySize after calling _setPosition ");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize after calling _setPosition ");
 
         try
         {
@@ -167,19 +167,19 @@
             {
                 public void run()
                 {
-                    System.out.println("inside videoControl's setDisplaySize before redraw() ");
-                    eswtCanvasControl.redraw();
-                    System.out.println("inside videoControl's setDisplaySize after redraw() ");
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize before redraw() ");
+                    iControl.redraw();
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize after redraw() ");
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplayLocation in redraw()....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplayLocation in redraw()....exception is " + e.toString());
         }
 
 
-        System.out.println("inside videoControl's setDisplayLocation coming out of setDisplayLocation()");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplayLocation coming out of setDisplayLocation()");
     }
 
 
@@ -201,7 +201,7 @@
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
         //System.out.println("inside videoControl's setVisible before native call");
         // _setVisible(nativeDisplayHandle,aVisible);
@@ -220,13 +220,13 @@
 
                 public void run()
                 {
-                    y = eswtCanvasControl.getSize().y;
+                    y = iControl.getSize().y;
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
         return y;
 
@@ -241,14 +241,14 @@
             {
                 public void run()
                 {
-                    x = eswtCanvasControl.getSize().x;
+                    x = iControl.getSize().x;
 
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
 
         return x;
@@ -263,14 +263,14 @@
             {
                 public void run()
                 {
-                    x = eswtCanvasControl.getLocation().x;
+                    x = iControl.getLocation().x;
 
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
         return x;
 
@@ -288,14 +288,14 @@
             {
                 public void run()
                 {
-                    y = eswtCanvasControl.getLocation().y;
+                    y = iControl.getLocation().y;
 
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
         return y;
     }
@@ -317,7 +317,7 @@
 
     public void getBoundRect()
     {
-        System.out.println("MMACanvasDisplay.java :getBoundRect()");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java :getBoundRect()");
 
         try
         {
@@ -326,7 +326,7 @@
             {
                 public void run()
                 {
-                    Rectangle boundrect  = eswtCanvasControl.getBounds();
+                    Rectangle boundrect  = iControl.getBounds();
                     displayboundarr[0] = boundrect.x ;
                     displayboundarr[1] = boundrect.y ;
                     displayboundarr[2] = boundrect.width ;
@@ -337,9 +337,9 @@
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
-        System.out.println("MMACanvasDisplay.java :getBoundRect() x =" + displayboundarr[0] + "y ="+ displayboundarr[1] +"width ="+ displayboundarr[2] +"height =" + displayboundarr[3]);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java :getBoundRect() x =" + displayboundarr[0] + "y ="+ displayboundarr[1] +"width ="+ displayboundarr[2] +"height =" + displayboundarr[3]);
     }
 
 
@@ -353,22 +353,22 @@
 
     public void setContainerVisibilityToNative(final boolean active)
     {
-        System.out.println("MMACanvasDisplay.java : SetContainerVisibilityToNative + ");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative + ");
         new Thread()
         {
             public void run()
             {
-                System.out.println("MMACanvasDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
+                Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
                 _setContainerVisible(iEventSourceHandle,nativeDisplayHandle,active);
             }
         } .start();
 
-        System.out.println("MMACanvasDisplay.java : SetContainerVisibilityToNative - ");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative - ");
     }
 
     public void setWindowResources(VideoItem aVideoItem)
     {
-        System.out.println("MMACanvasDisplay.java: setWindowResources windowHandle ");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java: setWindowResources windowHandle ");
         try
         {
             final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
@@ -377,18 +377,18 @@
             {
                 public void run()
                 {
-                    Shell shell = eswtCanvasControl.getShell();
+                    Shell shell = iControl.getShell();
                     qwidgetHandle = Internal_PackageSupport.topHandle(shell);
-                    x = eswtCanvasControl.getSize().x;
-                    y = eswtCanvasControl.getSize().y;
+                    x = iControl.getSize().x;
+                    y = iControl.getSize().y;
                     _setWindowToNative(nativeDisplayHandle,qwidgetHandle);
-                    System.out.println("MMACanvasDisplay.java: setWindowResources qwidgetHandle is " + qwidgetHandle);
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java: setWindowResources qwidgetHandle is " + qwidgetHandle);
                 }
             });
         }
         catch (Exception e)
         {
-            System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
         }
         _setNativeWindowSize(nativeDisplayHandle,iEventSourceHandle,x,y);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAeSWTDisplay.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,455 @@
+/*
+* 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.microedition.media.control;
+
+import org.eclipse.ercp.swt.mobile.MobileShell;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Internal_PackageSupport;
+import org.eclipse.swt.widgets.Shell;
+import com.nokia.mj.impl.utils.Logger;
+
+public class MMAeSWTDisplay extends BaseDisplay
+{
+    private int iEventSourceHandle;
+    private int qwidgetHandle;
+    private int x;
+    private int y;
+    private int eSWTcontrolLocationX;
+    private int eSWTcontrolLocationY;
+
+    // index 0 : x-coordinate of topleft corner of display
+    // index 1 : y-coordinate of topleft corner of display
+    // index 3 : width of display
+    // index 4 : height of display
+
+    private int[] displayboundarr = new int[ 4 ];
+
+    //private org.eclipse.swt.widgets.Control iControl;
+    private MMAPIeSWTObserver eswtObserver;
+
+    public MMAeSWTDisplay(int aEventServerHandle, org.eclipse.swt.widgets.Control aControl)
+    {
+        iEventSourceHandle = aEventServerHandle;
+        iControl = aControl;
+        eswtObserver = new MMAPIeSWTObserver();
+        iseSWT = true;
+    }
+
+    private void addListeners()
+    {
+        eswtObserver.addControlListenerToControl(iControl);
+        eswtObserver.addShellListenerToControl(iControl);
+        eswtObserver.addDisposeListenerToControl(iControl);
+    }
+
+    /**
+     * Inherited from BaseDisplay.
+     */
+    /*public void GetCallbackInUiThread(int placeholder)
+    {
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : GetCallbackInUiThread +");
+        final int val = placeholder;
+        try{
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: BaseDisplay.java: GetCallbackInUiThread(): before Display.getDefault()");
+            final org.eclipse.swt.widgets.Display disp = org.eclipse.swt.widgets.Display.getDefault();
+            if(disp == null)
+            {
+                Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: BaseDisplay.java: GetCallbackInUiThread(): disp is null");
+            }
+            disp.syncExec(new Runnable() {
+             public void run() {
+                 Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: BaseDisplay.java: GetCallbackInUiThread(): Before native call");
+                          _nativeMethodCallInUiThread(nativeDisplayHandle , val);
+                        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: BaseDisplay.java: GetCallbackInUiThread(): After native call");
+                             }
+                         });
+           }
+         catch(Exception e)
+         {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : GetCallbackInUiThread....exception is " + e.toString());
+         }
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside BaseDisplay : GetCallbackInUiThread -");
+    }*/
+
+    public void setNativeHandle(int handle)
+    {
+        nativeDisplayHandle = handle;
+        //eswtObserver.setDisplayToObserver(this);
+        //addListeners();
+    }
+
+    public void getBoundRect()
+    {
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java :getBoundRect()");
+
+        try
+        {
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+            display.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    Rectangle boundrect  = iControl.getBounds();
+                    displayboundarr[0] = boundrect.x ;
+                    displayboundarr[1] = boundrect.y ;
+                    displayboundarr[2] = boundrect.width ;
+                    displayboundarr[3] = boundrect.height ;
+
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside videoControl's setDisplaySize....exception is " + e.toString());
+        }
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java :getBoundRect() x =" + displayboundarr[0] + "y ="+ displayboundarr[1] +"width ="+ displayboundarr[2] +"height =" + displayboundarr[3]);
+    }
+
+    public int getDisplayHeight()
+    {
+        try
+        {
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+
+            display.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    y = iControl.getSize().y;
+
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getDisplayHeight() ....exception is "
+                       + e.toString());
+        }
+
+        return y;
+    }
+
+    public int getDisplayWidth()
+    {
+        try
+        {
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+
+            display.syncExec(new Runnable()
+            {
+
+                public void run()
+                {
+                    x = iControl.getSize().x;
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getDisplayWidth() ....exception is "
+                       + e.toString());
+        }
+        return x;
+    }
+
+    public int getDisplayX()
+    {
+
+        try
+        {
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+            display.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    x = iControl.getLocation().x;
+
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside MMAeSWTDisplay.java's getDisplayX....exception is " + e.toString());
+        }
+        return x;
+    }
+
+    protected int getDisplayY()
+    {
+        try
+        {
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+            display.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    y = iControl.getLocation().y;
+
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside MMAeSWTDisplay.java's getDisplayY....exception is " + e.toString());
+        }
+        return y;
+    }
+
+    public int getSourceHeight()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public int getSourceWidth()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public void setDisplayFullScreen(final boolean aFullScreenMode)
+    {
+        try
+        {
+
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+
+            //display.syncExec(new Runnable() {
+            //public void run() {
+            iControl.setBounds(display.getClientArea());
+            System.out.println("enetr in to the full screen mode setDisplayFullScreen %d"+iControl.getBounds());
+//                  new MobileShell(display).setFullScreenMode(aFullScreenMode);
+            //((MobileShell)iControl.getShell()).setFullScreenMode(aFullScreenMode);
+            //  new Shell(display).setFullScreenMode(aFullScreenMode);
+            //((Shell)iControl.getShell()).setFullScreenMode(aFullScreenMode);
+            //TODO
+            // instruct native to switch to full screen mode
+            //_setFullScreenMode(nativeDisplayHandle, aFullScreenMode);
+            //}
+            //});
+        }
+        catch (Exception e)
+        {
+            System.out
+            .println("inside MMAeSWTDisplay.java: setDisplayFullScreen....exception is "
+                     + e.toString());
+            e.printStackTrace();
+        }
+
+
+    }
+
+    public void setDisplayLocation(int aX, int aY)
+    {
+
+        //Not required for eSWT since this function does not work for USE_GUI_PRIMITIVE
+
+        //Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setDisplayLocation() +");
+        //final int videoControlLocationX = aX;
+        //final int videoControlLocationY = aY;
+
+        //try {
+        //  final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+        //  display.syncExec(new Runnable() {
+        //      public void run() {
+        ///         org.eclipse.swt.graphics.Point topleftposition = iControl
+        //                  .getLocation();
+        //          eSWTcontrolLocationX = topleftposition.x;
+        //          eSWTcontrolLocationY = topleftposition.y;
+        //          Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setDisplayLocation(): eSWTcontrolLocationX="+eSWTcontrolLocationX +
+        //                  " eSWTcontrolLocationY=" + eSWTcontrolLocationY);
+        //  }
+        //});
+        //} catch (Exception e) {
+        //  System..println("inside MMAeSWTDisplay's setDisplayLocation....exception is "
+        //+ e.toString());
+        //}
+        // To Avoid UI thread block
+        //System.out
+        //      .println("inside MMAeSWTDisplay's setDisplayLocation before calling _setPosition ");
+        //_setPosition(nativeDisplayHandle, iEventSourceHandle,
+        //      eSWTcontrolLocationX, eSWTcontrolLocationY,
+        //      videoControlLocationX, videoControlLocationY);
+        //System.out
+        //.println("inside MMAeSWTDisplay's setDisplayLocation after calling _setPosition ");
+
+        //try {
+        //  final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+        //  display.syncExec(new Runnable() {
+        //      public void run() {
+        //          //System.out
+        //.println("inside MMAeSWTDisplay's setDisplayLocation before redraw() ");
+        //iControl.redraw();
+        //  System.out
+        //.println("inside MMAeSWTDisplay's setDisplayLocation after redraw() ");
+        //  }
+        //  });
+        //} catch (Exception e) {
+        //System.out
+        //.println("inside MMAeSWTDisplay's setDisplayLocation in redraw()....exception is "
+        //+ e.toString());
+        //  }
+
+        //Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setDisplayLocation() -");
+
+
+
+    }
+
+    public void setDisplaySize(int aWidth, int aHeight)
+    {
+        final int width = aWidth;
+        final int height = aHeight;
+        try
+        {
+            final org.eclipse.swt.widgets.Display disp = org.eclipse.swt.widgets.Display.getDefault();
+
+            //disp.syncExec(new Runnable() {
+            //  public void run() {
+            org.eclipse.swt.graphics.Point size = new org.eclipse.swt.graphics.Point(
+                width, height);
+            //eswtCanvasControl.setSize(size);
+            iControl.setSize(size);
+            iControl.redraw();
+
+            System.out
+            .println("inside MMAeSWTDisplay.java's setDisplaySize redraw called");
+            //}
+            //});
+        }
+        catch (Exception e)
+        {
+            System.out
+            .println("inside MMAeSWTDisplay.java's setDisplaySize....exception is "
+                     + e.toString());
+        }
+
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside MMAeSWTDisplay.java's setDisplaySize");
+        //_setDisplaySize(nativeDisplayHandle, iEventSourceHandle, aWidth,
+        //      aHeight);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside MMAeSWTDisplay.java's setDisplaySize -");
+
+    }
+
+
+
+    public void setVisible(boolean aVisible)
+    {
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setVisible() + " + aVisible);
+        try
+        {
+            final boolean visible = aVisible;
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+            display.asyncExec(new Runnable()
+            {
+                public void run()
+                {
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setVisible() inside asyncExec run()");
+                    //eswtCanvasControl.setVisible(visible);
+                    // call native side to set the visibiity
+                    _setVisible(nativeDisplayHandle, visible);
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: _setVisible() native call completed");
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            System.out
+            .println("MMAPI: MMAeSWTDisplay.java: setVisible() ....exception is "
+                     + e.toString());
+        }
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setVisible() -");
+    }
+
+    public void setWindowResources(VideoItem aVideoItem)
+    {
+
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAeSWTDisplay.java: setWindowResources windowHandle + " + Thread.currentThread().getName());
+        try
+        {
+            final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+            display.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAeSWTDisplay.java: setWindowResources() run() runnable = " + this.hashCode());
+                    Shell shell = iControl.getShell();
+                    qwidgetHandle = Internal_PackageSupport.topHandle(shell);
+                    x = iControl.getSize().x;
+                    y = iControl.getSize().y;
+                    _setWindowToNative(nativeDisplayHandle, qwidgetHandle);
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setWindowResources(): calling _setNativeWindowSize() + " + Thread.currentThread().getName());
+                    _setNativeWindowSize(nativeDisplayHandle, iEventSourceHandle, x, y);
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAeSWTDisplay.java: setWindowResources last statement of syncExec");
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside MMAeSWTDisplay.java's setWindowResources() ....exception is "
+                       + e.toString());
+        }
+        //Removed from here and added to syncexec above, since setWindowResources is called from new Thread this
+        //function is no longer in UI THREAD.
+
+        //Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setWindowResources(): calling _setNativeWindowSize() + " + Thread.currentThread().getName() );
+        //_setNativeWindowSize(nativeDisplayHandle, iEventSourceHandle, x, y);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setWindowResources() - ");
+    }
+
+    public void getCallbackSourceSizeChanged(int width, int height)
+    {
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getCallbackSourceSizeChanged() +");
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getCallbackSourceSizeChanged() width = " + width + " height = " + height);
+        iControl.setSize(width, height);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getCallbackSourceSizeChanged() +");
+    }
+
+    public void setContainerVisibilityToNative(boolean active)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    private native void _setVisible(int nativeDisplayHandle, boolean value);
+
+    private native void _setContainerVisible(int nativeDisplayHandle,
+            boolean value);
+
+    private native void _setFullScreenMode(int nativeDisplayHandle,
+                                           boolean value);
+
+    private native void _setWindowToNative(int nativeDisplayHandle,
+                                           int qwidgetHandle);
+
+    private native void _setNativeWindowSize(int nativeDisplayHandle,
+            int iEventSourceHandle, int width, int height);
+
+    private native void _setPosition(int nativeDisplayHandle,
+                                     int iEventSourceHandle, int uiControlLocationX,
+                                     int uiControlLocationY, int videoControlLocationX,
+                                     int videoControlLocationY);
+
+    private native void _setDisplaySize(int nativeDisplayHandle,
+                                        int iEventSourceHandle, int eSWTcontrolLocationX,
+                                        int eSWTcontrolLocationY);
+
+
+
+}
\ No newline at end of file
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -24,6 +24,7 @@
 import javax.microedition.midlet.MIDlet;
 import javax.microedition.lcdui.Item;
 import com.nokia.microedition.media.NativeError;
+import com.nokia.mj.impl.utils.Logger;
 
 //import com.symbian.midp.runtime.MIDletExecutor;
 import com.nokia.mj.impl.media.PlayerPermission;
@@ -102,6 +103,11 @@
     // class name used to check if eswt is included
     private static String ESWT_CONTROL = ".control";
 
+    //Contants for display type
+    private static final int DISPLAY_CANVAS = 0;
+    private static final int DISPLAY_VIDEOITEM = 1;
+    private static final int DISPLAY_ESWT = 2;
+
     protected int iStatus = NOT_INITIALIZED;
 
     // Needed for getting native handle from lcdui components
@@ -110,6 +116,7 @@
     private VideoItem iVideoItem;
     private Canvas iVideoCanvas;
     private Item iItem ;
+    private int iGuiType;
 
     BaseDisplay iDisplay;
 //    private MIDletInstance iMIDletInstance;
@@ -125,6 +132,11 @@
     // for midlet foreground statelistening
     //ToolkitInvoker iTlkitInvoker;
 
+    //ESWT
+    private org.eclipse.swt.widgets.Display eswtDisplay;
+    private Control iControl;
+    private ESWTProxyControl control;
+
     private Finalizer mFinalizer = new Finalizer()
     {
         public void finalizeImpl()
@@ -191,24 +203,26 @@
 
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setDisplaySize()");
 
+        //canvasdisplay.setDisplaySize( aWidth, aHeight);
+        //iDisplay.setDisplaySize(aWidth, aHeight);
 
-        //canvasdisplay.setDisplaySize( aWidth, aHeight);
-        iDisplay.setDisplaySize(aWidth, aHeight);
-
-        /*
+        if (iGuiType == DISPLAY_ESWT)
+        {
+            iDisplay.setDisplaySize(aWidth, aHeight);
+        }
         int ret = setDisplayProperty(aWidth, aHeight, SET_DISPLAY_SIZE);
         if (ret < 0)
         {
             throw new MediaException("setDisplaySize() failed, SymbianOS error: "
-                                                    + ret);
+                                     + ret);
         }
         if (iStatus == USE_GUI_PRIMITIVE &&
                 iVideoItem != null)  // with dynamic display mode item can be null
         {
-            iVideoItem.privateInvalidate();
+            //iVideoItem.privateInvalidate();
         }
 
-        */
+
     }
 
     /**
@@ -217,17 +231,19 @@
      */
     public void setDisplayFullScreen(boolean aFullScreenMode) throws MediaException
     {
-        // checkState();
+        checkState();
+
         if (iStatus == NOT_INITIALIZED)
         {
             throw new IllegalStateException(
                 "VideoControl.initDisplayMode() not called yet");
         }
-        /*
+
         int ret;
         if (aFullScreenMode)
         {
-            ret = setDisplayProperty(SET_DISPLAY_FULLSCREEN_TRUE);
+            iDisplay.setDisplayFullScreen(aFullScreenMode);
+            ret = setDisplayProperty(360,487,SET_DISPLAY_FULLSCREEN_TRUE);
         }
         else
         {
@@ -239,10 +255,10 @@
             throw new MediaException();
         }
 
-        */
+
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setDisplayFullScreen()");
         //canvasdisplay.setDisplayFullScreen( aFullScreenMode);
-        iDisplay.setDisplayFullScreen(aFullScreenMode);
+//       iDisplay.setDisplayFullScreen(aFullScreenMode);
 
 
     }
@@ -253,7 +269,7 @@
      */
     public void setDisplayLocation(int aX, int aY)
     {
-        // checkState();
+        checkState();
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"VideoControl.java :: setDisplayLocation x, y = " + aX + ","+ aY);
         if (iStatus == USE_GUI_PRIMITIVE)
         {
@@ -265,14 +281,14 @@
             // This method only works when the USE_DIRECT_VIDEO mode is set.
             throw new IllegalStateException();
         }
-        /*
-            // cannot fail -> ignore return value
-            setDisplayProperty(aX, aY, SET_DISPLAY_LOCATION);
-        */
+
+        // cannot fail -> ignore return value
+        setDisplayProperty(aX, aY, SET_DISPLAY_LOCATION);
+
 
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setDisplayLocation()");
         //canvasdisplay.setDisplayLocation( aX , aY);
-        iDisplay.setDisplayLocation(aX , aY);
+        //iDisplay.setDisplayLocation(aX , aY);
 
     }
 
@@ -288,11 +304,11 @@
             throw new IllegalStateException(
                 "VideoControl.initDisplayMode() not called yet");
         }
-        /*if (aVisible)
+        if (aVisible)
         {
             // Update the foreground or background state of the midlet before
             // setting the visibility of the control
-            updateForeground();
+            //updateForeground();
             // cannot fail -> ignore return value
             setDisplayProperty(SET_DISPLAY_VISIBLE_TRUE);
         }
@@ -301,12 +317,12 @@
             // cannot fail -> ignore return value
             setDisplayProperty(SET_DISPLAY_VISIBLE_FALSE);
         }
-        */
+
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
                    " before iDisplay.setVisible()");
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setVisible()");
-        // canvasdisplay.setVisible( aVisible );
-        iDisplay.setVisible(aVisible);
+
+        //iDisplay.setVisible(aVisible);
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
                    "after iDisplay.setVisible()");
 
@@ -320,18 +336,14 @@
      */
     public int getDisplayWidth()
     {
-        /*
-           checkState();
-           if (iStatus == NOT_INITIALIZED)
-           {
-               throw new IllegalStateException(
-               "VideoControl.initDisplayMode() not called yet");
-           }
-           int width = getControlProperty(PROPERTY_DISPLAY_WIDTH);
-           return width;
-           */
-        //return  canvasdisplay.getDisplayWidth( );
-        return iDisplay.getDisplayWidth();
+        checkState();
+        if (iStatus == NOT_INITIALIZED)
+        {
+            throw new IllegalStateException(
+                "VideoControl.initDisplayMode() not called yet");
+        }
+        int width = getControlProperty(PROPERTY_DISPLAY_WIDTH);
+        return width;
     }
 
     /**
@@ -340,17 +352,17 @@
      */
     public int getDisplayHeight()
     {
-        /* checkState();
-         if (iStatus == NOT_INITIALIZED)
-         {
-             throw new IllegalStateException(
-             "VideoControl.initDisplayMode() not called yet");
-         }
-         int height = getControlProperty(PROPERTY_DISPLAY_HEIGHT);
-         return height;
+        checkState();
+        if (iStatus == NOT_INITIALIZED)
+        {
+            throw new IllegalStateException(
+                "VideoControl.initDisplayMode() not called yet");
+        }
+        int height = getControlProperty(PROPERTY_DISPLAY_HEIGHT);
+        return height;
 
-         */
-        return  iDisplay.getDisplayHeight();
+
+        //return  iDisplay.getDisplayHeight();
     }
 
     /**
@@ -359,15 +371,15 @@
      */
     public int getDisplayX()
     {
-        /* checkState();
-         if (iStatus == NOT_INITIALIZED)
-         {
-             return UNDEFINED_RETURN_VALUE;
-         }
-         int x = getControlProperty(PROPERTY_DISPLAY_X);
-         return x;
-         */
-        return  iDisplay.getDisplayX();
+        checkState();
+        if (iStatus == NOT_INITIALIZED)
+        {
+            return UNDEFINED_RETURN_VALUE;
+        }
+        int x = getControlProperty(PROPERTY_DISPLAY_X);
+        return x;
+
+        //return  iDisplay.getDisplayX();
     }
 
     /**
@@ -376,7 +388,7 @@
      */
     public int getDisplayY()
     {
-        /*
+
         checkState();
         if (iStatus == NOT_INITIALIZED)
         {
@@ -385,8 +397,8 @@
         int y = getControlProperty(PROPERTY_DISPLAY_Y);
         return y;
 
-        */
-        return  iDisplay.getDisplayY();
+
+        // return  iDisplay.getDisplayY();
     }
 
     /**
@@ -395,16 +407,16 @@
      */
     public int getSourceWidth()
     {
-        /* checkState();
-         int width = getControlProperty(PROPERTY_SOURCE_WIDTH);
-         if (width <= 0)
-         {
-             width = 1;
-         }
-         return width;
+        checkState();
+        int width = getControlProperty(PROPERTY_SOURCE_WIDTH);
+        if (width <= 0)
+        {
+            width = 1;
+        }
+        return width;
 
-         */
-        return  iDisplay.getSourceWidth();
+
+        //return  0;//iDisplay.getSourceWidth();
     }
 
     /**
@@ -413,15 +425,15 @@
      */
     public int getSourceHeight()
     {
-        /*checkState();
+        checkState();
         int height = getControlProperty(PROPERTY_SOURCE_HEIGHT);
         if (height <= 0)
         {
             height = 1;
         }
         return height;
-        */
-        return  iDisplay.getSourceHeight();
+
+        //return  0;//iDisplay.getSourceHeight();
 
     }
 
@@ -492,6 +504,14 @@
                 "initDisplayMode() already called successfully");
         }
 
+        if (aArg != null && aArg.equals(Control.class.getName()))
+        {
+            eswtDisplay = org.eclipse.swt.widgets.Display.getDefault();
+        }
+        else
+        {
+            eswtDisplay = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+        }
         if (aMode == USE_GUI_PRIMITIVE)
         {
             Object guiObject = null;
@@ -508,6 +528,20 @@
                 else // try load dynamic display mode
                 {
                     guiObject = initDynamicDisplayMode(aArg);
+
+                    iControl = (Control)guiObject;
+
+                    iDisplay = new MMAeSWTDisplay(iEventSource, iControl);
+                    int handle = initNativeDisplay(iControl, iDisplay, iGuiType);
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: initDisplayMode(): nativeDisplayHandle = " + handle);
+                    iDisplay.setNativeHandle(handle);
+                    ESWTProxyControl proxyControl = (ESWTProxyControl)iControl;
+                    proxyControl.seteSWTDisplay(iDisplay);
+                    proxyControl.setNativeDisplayHandle(handle);
+                    //display.setWindowResources();
+
+                    iStatus = USE_GUI_PRIMITIVE;
+                    return iControl;
                 }
             }
 
@@ -521,7 +555,7 @@
             Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
                        "VideoControl : creation of ItemDisplay");
 
-            int handle = initNativeDisplay(iVideoItem, iDisplay, true);
+            int handle = initNativeDisplay(iVideoItem, iDisplay, DISPLAY_VIDEOITEM);
             // here actual listener is added to iDisplay
             iDisplay.setNativeHandle(handle);
             iVideoItem.setNativeHandle(handle);
@@ -548,13 +582,14 @@
                     "For USE_DIRECT_VIDEO mode argument should not be null");
             }
             iVideoCanvas = (Canvas)aArg;
+            iGuiType = DISPLAY_CANVAS;
             // MMAPI UI 3.x req.
 
             iDisplay = new MMACanvasDisplay(iEventSource , iVideoCanvas);
 
             Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"VideoControl.java: after eswt control got from canvas has added observer");
 
-            int handle = initNativeDisplay(iVideoCanvas, iDisplay, false);
+            int handle = initNativeDisplay(iVideoCanvas, iDisplay, DISPLAY_CANVAS);
             // here actual listener is added to iDisplay
             iDisplay.setNativeHandle(handle);
             // Window resource initialization is done to the native video player
@@ -593,7 +628,7 @@
      * Initializes native display.
      *
      */
-    private int initNativeDisplay(Object aGuiObject, Object mmadisplay, boolean aGuiType)
+    private int initNativeDisplay(Object aGuiObject, Object mmadisplay, int aGuiType)
     {
         int handle = _initDisplayMode(iControlHandle,
                                       iEventSource,
@@ -613,7 +648,8 @@
     {
         return _getControlProperty(iControlHandle,
                                    iEventSource,
-                                   aPropertyType);
+                                   aPropertyType,
+                                   iGuiType);
     }
 
     /**
@@ -629,7 +665,8 @@
                                    iEventSource,
                                    aParamA,
                                    aParamB,
-                                   aPropertyType);
+                                   aPropertyType,
+                                   iGuiType);
     }
 
     /**
@@ -643,7 +680,8 @@
                                    iEventSource,
                                    0,
                                    0,
-                                   aPropertyType);
+                                   aPropertyType,
+                                   iGuiType);
     }
 
     /**
@@ -669,13 +707,23 @@
      */
     private Object initDynamicDisplayMode(Object aMode)
     {
-        MMAGUIFactory guiFactory = null;
+        //MMAGUIFactory guiFactory = null;
         try
         {
-            String className = ((String)aMode).toLowerCase() +
-                               GUI_FACTORY_CLASS_NAME;
-            Class guiClass = Class.forName(className);
-            guiFactory = (MMAGUIFactory)guiClass.newInstance();
+            // String className = ((String)aMode).toLowerCase();
+            //GUI_FACTORY_CLASS_NAME;*/
+            Class guiClass = Class.forName((String)aMode);
+            //guiFactory = (MMAGUIFactory)guiClass.newInstance();
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: After loading class");
+            eswtDisplay.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: Before creating ESWTProxyControl.");
+                    control = new ESWTProxyControl();
+                    Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: ESWTProxyControl created.");
+                }
+            });
         }
         catch (ClassNotFoundException cnfe)
         {
@@ -684,19 +732,19 @@
                 "Mode not supported or invalid, " +
                 "valid modes are USE_DIRECT_VIDEO and USE_GUI_PRIMITIVE");
         }
-        catch (IllegalAccessException iae)
-        {
-            // if the class or initializer is not accessible
-            throw new IllegalArgumentException("Mode: " + aMode +
-                                               " caused " + iae);
-        }
-        catch (InstantiationException ie)
-        {
-            // if an application tries to instantiate an abstract class or an
-            // interface, or if the instantiation fails for some other reason
-            throw new IllegalArgumentException("Mode: " + aMode +
-                                               " caused " + ie);
-        }
+        /*       catch (IllegalAccessException iae)
+               {
+                   // if the class or initializer is not accessible
+                   throw new IllegalArgumentException("Mode: " + aMode +
+                                                      " caused " + iae);
+               }
+               catch (InstantiationException ie)
+               {
+                   // if an application tries to instantiate an abstract class or an
+                   // interface, or if the instantiation fails for some other reason
+                   throw new IllegalArgumentException("Mode: " + aMode +
+                                                      " caused " + ie);
+               }*/
         catch (ClassCastException cce)
         {
             // Thrown to indicate that the code has attempted to cast an
@@ -705,12 +753,13 @@
                                                " caused " + cce);
         }
 
-        Object guiObject = guiFactory.initDisplayMode();
+        //Object guiObject = guiFactory.initDisplayMode();
         // initNativeDisplay return handle MMMADirectContainer, 0 parameter
         // indicates that dynamic display will be used
         // MMAPI UI 3.x req.
         //  guiFactory.setContentHandle(initNativeDisplay(guiObject, 0));
-        return guiObject;
+        iGuiType = DISPLAY_ESWT;
+        return control;
     }
 
     /**
@@ -871,13 +920,15 @@
 
     private native int _getControlProperty(int aControlHandle,
                                            int aEventSourceHandle,
-                                           int aPropertyType);
+                                           int aPropertyType,
+                                           int aGuiType);
 
     private native int _setDisplayProperty(int aControlHandle,
                                            int aEventSourceHandle,
                                            int aParamA,
                                            int aParamB,
-                                           int aPropertyType);
+                                           int aPropertyType,
+                                           int aGuiType);
 
     private native int _getSnapshot(int aControlHandle,
                                     int aEventSourceHandle,
@@ -887,7 +938,7 @@
                                         int aEventSourceHandle,
                                         Object aJavaDisplay,
                                         Object aJavaDisplayObject,
-                                        boolean aGuiTYpe);
+                                        int aGuiTYpe);
     private native int _setForeground(int aControlHandle,
                                       int aEventSourceHandle,
                                       int aIsForeground);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoItem.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoItem.java	Thu Jul 22 16:31:34 2010 +0100
@@ -23,6 +23,7 @@
 import javax.microedition.media.PlayerListener;
 import javax.microedition.media.Player;
 import javax.microedition.lcdui.*;
+import com.nokia.mj.impl.utils.Logger;
 
 /**
  * Item for VideoControl.
@@ -51,9 +52,10 @@
     // from PlayerListener
     public void playerUpdate(Player aPlayer, String aEvent, Object aEventData)
     {
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"VideoItem.Playerupdate +");
         if (aEvent == SIZE_CHANGED)
         {
-            invalidate();
+            //invalidate();
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/org/eclipse/swt/widgets/ESWTProxyControl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,436 @@
+/*
+* 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 org.eclipse.swt.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import com.nokia.mj.impl.utils.Logger;
+
+import com.nokia.microedition.media.control.BaseDisplay;
+
+
+public class ESWTProxyControl extends Control
+{
+    /**
+     *  this will be actual Shell, for which this class is acting like proxy
+     */
+    Control iControl;
+    BaseDisplay mmaDisplay;
+    private int iNativeDisplayHandle;
+
+    public ESWTProxyControl()
+    {
+        //super(Display.getDefault().getActiveShell(), SWT.BORDER);
+    }
+
+    public void setNativeDisplayHandle(int aNativeDisplayHandle)
+    {
+        this.iNativeDisplayHandle = aNativeDisplayHandle;
+    }
+    public void seteSWTDisplay(BaseDisplay aDisplay)
+    {
+        this.mmaDisplay = aDisplay;
+    }
+
+    /**
+     * Actual Control will be created here
+     */
+    public boolean setParent(Composite parent)
+    {
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: ESWTProxyControl.java: setParent()+");
+        int sourceWidth=0;
+        int sourceHeight=0;
+        //TODO Throw exception if null
+        if (parent == null)
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: ESWTProxyControl.java: setParent(): parent is null");
+        iControl= new Shell((Shell)parent);
+        int sourceSize[] = _getSourceSize(iNativeDisplayHandle);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: ESWTProxyControl.java: setParent(): int[] length: " + sourceSize.length);
+
+        sourceWidth = sourceSize[0];
+        sourceHeight = sourceSize[1];
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: ESWTProxyControl.java: setParent(): sourceWidth= " + sourceWidth + " sourceHeight= " + sourceHeight);
+
+        ((Shell)iControl).open();
+        ((Shell)iControl).setSize(sourceWidth, sourceHeight);
+
+        new Thread(new Runnable()
+        {
+            public void run()
+            {
+                mmaDisplay.setWindowResources(null);
+            }
+        }).start();
+
+        return true;
+    }
+
+    /**
+     *
+     */
+    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);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ProxyControl::computeSize()"+point);
+        return point;
+    }
+
+    public Point computeSize(int wHint,
+                             int hHint,
+                             boolean changed)
+    {
+        Point point=null;
+        if (iControl!=null)point=iControl.computeSize(wHint, hHint,changed);
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ProxyControl::computeSize()"+point+"Bolean changed "+changed);
+        return point;
+    }
+
+    public Color getBackground()
+    {
+        Color color=null;
+        if (iControl!=null)color=iControl.getBackground();
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ProxyControl::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)
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: ESWTProxyControl.java: getShell(): iControl is not null");
+            return (Shell)iControl;//.getShell();
+        }
+        else
+        {
+            Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: ESWTProxyControl.java: getShell(): iControl is null");
+            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
+
+    }
+
+    private native int[] _getSourceSize(int aNativeDisplayHandle);
+}
--- a/javauis/mmapi_qt/baseline/javasrc/org/eclipse/swt/widgets/ProxyControl.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/javasrc/org/eclipse/swt/widgets/ProxyControl.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/cmmadisplay.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmadisplay.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -50,16 +50,59 @@
         iFullScreen(EFalse),
         iContainerVisible(ETrue),
         iIsForeground(ETrue),
-        iResetDrawRect(EFalse)
+        iResetDrawRect(EFalse),
+        iIseSWT(EFalse)
 {
 }
 
-void CMMADisplay::Construct(MMAFunctionServer* eventSource , jobject javadisplayref)
+void CMMADisplay::Construct(MMAFunctionServer* eventSource ,JNIEnv* aJni, jobject javadisplayref)
 {
     iEventSource = eventSource;
-    iJni = iEventSource->getValidJniEnv();
+    iJavadisplayref = javadisplayref;
+    LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct=%d",iIseSWT);
+    if (iIseSWT)
+    {
+        iJni = aJni;
+    }
+    else
+    {
+        iJni = iEventSource->getValidJniEnv();
+    }
     iJavaDisplayObject = iJni->NewGlobalRef(javadisplayref);
     iJavaDisplayClass = iJni->GetObjectClass(iJavaDisplayObject);
+
+    setRectID = iJni->GetMethodID(iJavaDisplayClass,
+                                  "setRect",
+                                  "()V");
+    iRectDimensionField = iJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
+
+    redrawControlID = iJni->GetMethodID(
+                          iJavaDisplayClass,
+                          "redrawControl",
+                          "()V");
+
+    removeContentBoundID = iJni->GetMethodID(
+                               iJavaDisplayClass,
+                               "removeContentBound",
+                               "()V");
+
+    setContentBoundID = iJni->GetMethodID(
+                            iJavaDisplayClass,
+                            "setContentBound",
+                            "()V");
+
+    getCallBackMethodID = iJni->GetMethodID(
+                              iJavaDisplayClass,
+                              "GetCallbackInUiThread",
+                              "(I)V");
+
+    getBoundRectID = iJni->GetMethodID(
+                         iJavaDisplayClass,
+                         "getBoundRect",
+                         "()V");
+
+    iDisplayboundarrField = iJni->GetFieldID(iJavaDisplayClass, "displayboundarr", "[I");
+
     // Components must have direct content.
     /* __ASSERT_LOG(EJavaMMAPI,EInfo,"aDirectContainer, User::Invariant());
 
@@ -123,6 +166,7 @@
     }
 
     drawRect.Move(position);
+    LOG2(EJavaMMAPI, EInfo, "CMMADisplay::ScaleToFullScreen::drawRect.Width=%d, drawRect.Height=%d",drawRect.Width(), drawRect.Height());
     LOG(EJavaMMAPI,EInfo,"CMMADisplay::ScaleToFullScreen() -");
     return drawRect;
 }
@@ -243,12 +287,15 @@
 // from MMMADisplay
 TSize CMMADisplay::DisplaySize()
 {
+    LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::DisplaySize +");
     if (iWindow && iFullScreen)
     {
+        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::DisplaySize if loop ");
         return iWindow->DrawRect().Size();
     }
     else
     {
+        LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::DisplaySize else loop %d",iUserRect.Size().iHeight);
         return iUserRect.Size();
     }
 }
@@ -295,7 +342,15 @@
     {
         // iWindow->SetVisible(aValue, EFalse);
         //MMAPI UI 3.x req. (had to comment above line and add below line which excutes in FS thread)
-        iWindow->SetVisible(aValue, ETrue);
+        if (iIseSWT == true)
+        {
+            iWindow->SetVisible(aValue, ETrue);
+        }
+        else
+        {
+            iWindow->SetVisible(aValue, EFalse);
+        }
+        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible after iWindow->SetVisible()");
         SetClippingRegion();
         LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible -");
     }
@@ -468,21 +523,31 @@
 
 void CMMADisplay::GetCallbackInUiThread(TInt placeholder)
 {
+    JNIEnv* validJni = iEventSource->getValidJniEnv();
+    jobject javaDisplayObject;
+    jclass javaDisplayClass;
     LOG(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread +");
-
-
-
-
-
-
-
-
-    jmethodID getCallBackMethodID = iJni->GetMethodID(
-                                        iJavaDisplayClass,
-                                        "GetCallbackInUiThread",
-                                        "(I)V");
-    // LOG1(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID);
-    iJni->CallVoidMethod(iJavaDisplayObject,getCallBackMethodID,placeholder);
+    /**
+     * In case of eSWT iJavaDisplayClass and iJavaDisplayObject were initialized with JNI
+     * in UI Thread. Since this function is called from FunctionServer Thread so we need to get
+     * valid JNI for FunctionServer Thread and need to initialize iJavaDisplayClass and iJavaDisplayObject
+     * again for FunctionServer Thread rather than using the one that was created in Constructor(UI Thread).
+     */
+    if (iIseSWT)
+    {
+        javaDisplayObject = validJni->NewGlobalRef(iJavadisplayref);
+        javaDisplayClass =  validJni->GetObjectClass(iJavaDisplayObject);
+    }
+    else
+    {
+        javaDisplayObject = iJavaDisplayObject;
+        javaDisplayClass = iJavaDisplayClass;
+    }
+    getCallBackMethodID = validJni->GetMethodID(javaDisplayClass,
+                          "GetCallbackInUiThread",
+                          "(I)V");
+    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID);
+    validJni->CallVoidMethod(javaDisplayObject,getCallBackMethodID,placeholder);
     LOG(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread -");
 }
 
@@ -514,6 +579,7 @@
         return;
     }
     iWindow->ProcureWindowResourcesFromQWidget(iWs,iScreenDevice,window);
+    iWindow->SetVisible(ETrue,ETrue);
     LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetWindowResources -");
 }
 
@@ -629,27 +695,28 @@
 void CMMADisplay::ResetJavaRectObject(const TRect& aRect)
 {
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject +");
-    JNIEnv* validJni = iEventSource->getValidJniEnv();
-    jmethodID setRectID = validJni->GetMethodID(
-                              iJavaDisplayClass,
-                              "setRect",
-                              "()V");
-
+    //TRect rect = aRect;
+    JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
+    /*jmethodID setRectID = validJni->GetMethodID(
+                                                 iJavaDisplayClass,
+                                                 "setRect",
+                                             "()V");
+    */
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --1");
     // set the value to java,so that we can access those from array
-    jfieldID field = validJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
-    if (field == NULL)
+
+    //jfieldID iRectDimensionField = validJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
+    if (iRectDimensionField == NULL)
     {
         // handle error
     }
     /* Write to the instance fields */
-    jintArray javaDimensionarr = (jintArray)validJni->GetObjectField(iJavaDisplayObject, field);
+    jintArray javaDimensionarr = (jintArray)validJni->GetObjectField(iJavaDisplayObject, iRectDimensionField);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --2");
     jint* nativeRectDimensionArr = validJni->GetIntArrayElements(javaDimensionarr, NULL);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --3");
     if (!nativeRectDimensionArr)
-    {
-        // inputBuffer was already allocated
+    {    // inputBuffer was already allocated
         validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_ABORT);
         LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject Error in resetting rect dimension to java");
         return;
@@ -659,9 +726,10 @@
     nativeRectDimensionArr[2] = aRect.Width();
     nativeRectDimensionArr[3] = aRect.Height();
     // Now the dimension array in java is updated hence reset the java rect
+
+    validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_COMMIT);
     validJni->CallVoidMethod(iJavaDisplayObject,setRectID);
 
-    validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_COMMIT);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject -");
 }
 
@@ -669,13 +737,14 @@
 void CMMADisplay::SetContentBoundToJavaControl(const TRect& aRect)
 {
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::SetContentBoundToJavaControl +");
-    JNIEnv* validJni = iEventSource->getValidJniEnv();
+    JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
     // Reset the java rect
     ResetJavaRectObject(aRect);
-    jmethodID setContentBoundID = validJni->GetMethodID(
-                                      iJavaDisplayClass,
-                                      "setContentBound",
-                                      "()V");
+    /*jmethodID setContentBoundID = validJni->GetMethodID(
+                                         iJavaDisplayClass,
+                                         "setContentBound",
+                                     "()V");
+    */
     // call java function
     validJni->CallVoidMethod(iJavaDisplayObject,setContentBoundID);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::SetContentBoundToJavaControl -");
@@ -684,13 +753,14 @@
 void CMMADisplay::RemoveContentBoundFromJavaControl(const TRect& aRect)
 {
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RemoveContentBoundFromJavaControl +");
-    JNIEnv* validJni = iEventSource->getValidJniEnv();
+    JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();
     // Reset the java rect
     ResetJavaRectObject(aRect);
-    jmethodID removeContentBoundID = validJni->GetMethodID(
+    /*jmethodID removeContentBoundID = validJni->GetMethodID(
                                          iJavaDisplayClass,
                                          "removeContentBound",
-                                         "()V");
+                                     "()V");
+    */
     // call java function
     validJni->CallVoidMethod(iJavaDisplayObject,removeContentBoundID);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RemoveContentBoundFromJavaControl -");
@@ -699,16 +769,26 @@
 void CMMADisplay::RefreshJavaControl()
 {
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RefreshJavaControl +");
-    JNIEnv* validJni = iEventSource->getValidJniEnv();
+    JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
     // Reset the java rect
     //ResetJavaRectObject(aRect);
-    jmethodID redrawControlID = validJni->GetMethodID(
-                                    iJavaDisplayClass,
-                                    "redrawControl",
-                                    "()V");
+    /*jmethodID redrawControlID = validJni->GetMethodID(
+                                         iJavaDisplayClass,
+                                         "redrawControl",
+                                     "()V");
+    */
     // call java function
     validJni->CallVoidMethod(iJavaDisplayObject,redrawControlID);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RefreshJavaControl -");
 }
 
+TBool CMMADisplay::iseSWT()
+{
+    return iIseSWT;
+}
+
+void CMMADisplay::SetFullscreenSize(TSize &aFullscreenSize)
+{
+    iFullScreenSize = aFullscreenSize;
+}
 //  END OF FILE
--- a/javauis/mmapi_qt/baseline/src/cmmaevent.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmaevent.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -45,6 +45,7 @@
 void CMMAEvent::Dispatch(JNIEnv& aJni)
 {
     LOG1(EJavaMMAPI, EInfo, "MMA::CMMAEvent::Dispatch iEventData=%d", iEventData);
+    LOG1(EJavaMMAPI, EInfo, "MMA::CMMAEvent::Dispatch iListenerObject=%d", iEventData);
 
     aJni.CallVoidMethod(iListenerObject,
                         iHandleEventMethod,
--- a/javauis/mmapi_qt/baseline/src/cmmaitemdisplay.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmaitemdisplay.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -29,7 +29,7 @@
 {
     CMMAItemDisplay* self = new(ELeave) CMMAItemDisplay();
     CleanupStack::PushL(self);
-    self->Construct(aEventSource, aItemDispObj);
+    self->Construct(aEventSource, NULL, aItemDispObj);
     return self;
 }
 
@@ -111,45 +111,7 @@
     return TPoint(0, 0);
 }
 
-/*
-void CMMAItemDisplay::SourceSizeChanged(const TSize& aSourceSize)
-{
-    LOG1(EJavaMMAPI,EInfo,"MMA::CMMAItemDisplay::SourceSizeChanged %d",
-              aSourceSize.iWidth);
-    LOG1(EJavaMMAPI,EInfo,"MMA::CMMAItemDisplay::SourceSizeChanged %d",
-              aSourceSize.iHeight);
 
-    #ifdef RD_JAVA_NGA_ENABLED
-    if ( iWindow )
-    {
-    iWindow->SetVideoCropRegion( TRect( iUserRect.iTl, aSourceSize ) );
-    }
-    #endif
-
-    iSourceSize = aSourceSize;
-
-    if (iWindow)
-    {
-        TRect clientRect(iUserRect.iTl, aSourceSize);
-
-        iWindow->SetDrawRect(clientRect);
-        // Setting initial window size if not already set, actual size will
-        // be set in MdcItemContentRectChanged()
-        if (iWindow->WindowSize() == TSize())
-        {
-            iWindow->SetWindowRect(clientRect, MMMADisplay::EMmaThread);
-        }
-    }
-
-    SetClippingRegion();
-
-    if (iUserRect.IsEmpty())
-    {
-        // Java side hasn't set size.
-        iUserRect.SetSize(iSourceSize);
-    }
-}
-*/
 
 
 void CMMAItemDisplay:: SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight,TInt x, TInt y,TRect aBoundsRect)
@@ -282,6 +244,7 @@
 
     SetClippingRegion();
 
+    /*
     if (iUserRect.IsEmpty())
     {
         // Java side hasn't set size.
@@ -292,6 +255,13 @@
         // Addjusting rect to top left corner.
         iUserRect = TRect(iUserRect.Size());
         //}
+    }*/
+    if (iUserRect.IsEmpty())
+    {
+        // Java side hasn't set size.
+        LOG1(EJavaMMAPI,EInfo,"CMMAItemDisplay::SourceSizeChanged()iUserRect is set to source size iSourceSize - %d",iSourceSize.iHeight);
+        iUserRect.SetSize(iSourceSize);
+        LOG1(EJavaMMAPI,EInfo,"CMMAItemDisplay::SourceSizeChanged()iUserRect is set to source size iUserRect - %d",iUserRect.Size().iHeight);
     }
     LOG(EJavaMMAPI,EInfo,"CMMAItemDisplay::SourceSizeChanged(aJavaControlWidth,aJavaControlHeight)-");
 }
--- a/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmasnapshot.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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.
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/eswtdisplay.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* 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 "com_nokia_microedition_media_control_MMAeSWTDisplay.h"
+#include "logger.h"
+#include "qwidget.h"
+#include "cmmadcdisplay.h"
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setVisible
+(JNIEnv *, jobject, jint nativeDisplayHandle, jboolean isVisible)
+{
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setVisible +");
+    CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+    TBool visible = (TBool)isVisible;
+    display ->SetVisible(visible);
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setVisible -");
+}
+
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setContainerVisible
+(JNIEnv *, jobject, jint /*nativeDisplayHandle*/, jboolean /*isActive*/)
+{
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setContainerVisible +");
+    /*        CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+            TBool visible = (TBool)isActive;
+            display ->SetContainerVisibility(visible);*/
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setContainerVisible -");
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setFullScreenMode
+(JNIEnv *, jobject, jint nativeDisplayHandle, jboolean isFullScreen)
+{
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setFullScreenMode  +");
+    CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+    TBool mode = (TBool)isFullScreen;
+    TRAP_IGNORE(display ->SetFullScreenL(mode));
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setFullScreenMode  -");
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setWindowToNative
+(JNIEnv *, jobject,jint nativeDisplayHandle, jint qtWidgetHandle)
+{
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setWindowToNative + ");
+    QWidget *widget = reinterpret_cast<QWidget*>(qtWidgetHandle);
+    CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+    display->SetWindowResources(widget);
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setWindowToNative - ");
+}
+
+LOCAL_C void LocalSourceSizeChanged(CMMADisplay* display,TInt width,TInt height)
+{
+    TRect temp(0,0,0,0);
+    LOG2(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setWindowToNative + %d %d",width,height);
+    display->SourceSizeChanged(width,height,0,0,temp);
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setNativeWindowSize
+(JNIEnv *, jobject,jint nativeDisplayHandle, jint /*aEventSourceHandle*/, jint eswtControlwidth,jint eswtControlheight)
+{
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setNativeWindowSize + ");
+    CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+    TInt width = eswtControlwidth;
+    TInt height = eswtControlheight;
+    // TSize srcsize = TSize(360,487);
+    // TO-DO remove JavaUnhand in final code
+    //MMAFunctionServer* eventSource =  reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+    // need to call in Function server thread context because CMMADisplay's JNI pointer
+    // is valid in that thread context only.
+    /*TInt error = eventSource->ExecuteTrap(&LocalSourceSizeChanged,
+                                                          display,
+                                                          width,
+                                                          height);*/
+    LocalSourceSizeChanged(display, width, height);
+
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : setNativeWindowSize - ");
+}
+
+/*
+LOCAL_C void LocalSetDisplayPosition(CMMADisplay* display,TInt uiX,TInt uiY,TInt vcX,TInt vcY)
+{
+    display->SetDisplayPosition(uiX,uiY,vcX,vcY);
+}
+*/
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setPosition
+(JNIEnv *, jobject,jint /*nativeDisplayHandle*/,jint /*aEventSourceHandle*/,jint /*uiX*/,jint /*uiY*/,jint /*vcX*/,jint /*vcY*/)
+{
+    /*  LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setPosition + ");
+      CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+      TInt uiControlLocationX = uiX;
+      TInt uiControlLocationY = uiY;
+      TInt videoControlLocationX = vcX;
+      TInt videoControlLocationY = vcY;
+      MMAFunctionServer* eventSource =  reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+      // need to call in Function server thread context because CMMADisplay's JNI pointer
+      // is valid in that thread context only.
+      TInt error = eventSource->ExecuteTrap(&LocalSetDisplayPosition,
+                                                               display,
+                                                                     uiControlLocationX,
+                                                                             uiControlLocationY,
+                                                                                     videoControlLocationX,
+                                                                                             videoControlLocationY);
+
+      LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setPosition - ");*/
+}
+
+
+
+
+LOCAL_C void LocalSetDisplaySize(CMMADisplay* display,TInt vcX,TInt vcY)
+{
+    LOG2(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : LocalSetDisplaySize vcX = %d,vcY=%d ",vcX,vcY);
+    TSize size(vcX,vcY);
+    TRAP_IGNORE(display->SetDisplaySizeL(size));
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMAeSWTDisplay__1setDisplaySize
+(JNIEnv *, jobject,jint nativeDisplayHandle,jint /*aEventSourceHandle*/,jint width,jint height)
+{
+    LOG2(EJavaMMAPI,EInfo,"JNI_eswtDisplay.cpp : _setDisplaySize +  width = %d,height = %d",width,height);
+    CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+    TInt vc_width = width;
+    TInt vc_height = height;
+    //MMAFunctionServer* eventSource =  reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+    // need to call in Function server thread context because CMMADisplay's JNI pointer
+    // is valid in that thread context only.
+    LOG2(EJavaMMAPI,EInfo,"JNI_eswtdisplay.cpp : _setDisplaySize +  vc_width = %d,vc_height = %d",vc_width,vc_height);
+    /*TInt error = eventSource->ExecuteTrap(&LocalSetDisplaySize,
+                                                             display,
+                                                                   vc_width,
+                                                                           vc_height);
+    */
+    LocalSetDisplaySize(display, vc_width, vc_height);
+    LOG(EJavaMMAPI,EInfo,"JNI_ESWTDisplay.cpp : _setDisplaySize - ");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/eswtproxycontrol.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* 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:  JNI  in UI thread context
+*
+*/
+
+#include "org_eclipse_swt_widgets_ESWTProxyControl.h"
+#include "logger.h"
+//#include "cmmadcdisplay.h"
+#include "cmmadisplay.h"
+
+JNIEXPORT jintArray JNICALL Java_org_eclipse_swt_widgets_ESWTProxyControl__1getSourceSize
+(JNIEnv *aJni, jobject, jint nativeDisplayHandle)
+{
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtproxycontrol.cpp : getSourceSize +");
+    LOG1(EJavaMMAPI,EInfo,"JNI_eswtproxycontrol.cpp : getSourceSize nativeDisplayHandle = %d", nativeDisplayHandle);
+    CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+    TSize sourceRect = display->SourceSize();
+    jint sourceWidth = sourceRect.iWidth;
+    jint sourceHeight = sourceRect.iHeight;
+
+    jintArray sourceSize = aJni->NewIntArray(2);
+    aJni->SetIntArrayRegion(sourceSize,0,1,&sourceWidth);
+    aJni->SetIntArrayRegion(sourceSize,1,1,&sourceHeight);
+    LOG(EJavaMMAPI,EInfo,"JNI_eswtproxycontrol.cpp : getSourceSize -");
+    return sourceSize;
+}
--- a/javauis/mmapi_qt/baseline/src/managerimpl.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/managerimpl.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -108,7 +108,10 @@
 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ManagerImpl__1createEventSource
 (JNIEnv* aJni, jobject aPeer)
 {
-    TInt eventSourceHandle = MMAFunctionServer::NewL(*aJni, aPeer);
+    TInt eventSourceHandle = -1;
+    TRAPD(err,eventSourceHandle = MMAFunctionServer::NewL(*aJni, aPeer));
+    if (err != KErrNone)
+        eventSourceHandle = err;
     if (eventSourceHandle > KErrNone)
     {
         MMAFunctionServer* eventSource =
--- a/javauis/mmapi_qt/baseline/src/tmmaparametervalidator.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/tmmaparametervalidator.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/baseline/src/videocontrol.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/build/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -65,6 +65,8 @@
                    com.nokia.microedition.media.control.MMACanvasDisplay,
                    com.nokia.microedition.media.control.ItemDisplay,
                    com.nokia.microedition.media.control.BaseDisplay,
+		   com.nokia.microedition.media.control.MMAeSWTDisplay,
+		   org.eclipse.swt.widgets.ESWTProxyControl,
                    com.nokia.microedition.media.control.MMAGUIFactory,
                    com.nokia.microedition.media.control.PitchControl,
                    com.nokia.microedition.media.control.RateControl,
@@ -197,6 +199,10 @@
     </properties>
 
   </target>
+  
+  <target name="create.public.api.jar">
+    <omj.public.apis includes="javax/microedition/media/**/*.class"/>
+  </target>
 
   <target name="create.internal.api.jar">
     <omj.internal.apis includes="com/nokia/microedition/media/control/ControlImpl.class,
--- a/javauis/mmapi_qt/build/bwins/javamobilemediau.def	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/build/bwins/javamobilemediau.def	Thu Jul 22 16:31:34 2010 +0100
@@ -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 *)
 	?SetLoopCount@CMMAPlayer@@UAEXH@Z @ 2 NONAME ; void CMMAPlayer::SetLoopCount(int)
 	?PostObjectEvent@CMMAPlayer@@QAEXW4TEventType@CMMAPlayerEvent@@PAV_jobject@@@Z @ 3 NONAME ; void CMMAPlayer::PostObjectEvent(enum CMMAPlayerEvent::TEventType, class _jobject *)	
 	?PrefetchFileL@CMMAEMCAudioPlayer@@MAEXXZ @ 4 NONAME ; void CMMAEMCAudioPlayer::PrefetchFileL(void)
@@ -8,72 +8,69 @@
 	?PostStringEvent@CMMAPlayer@@QAEXW4TEventType@CMMAPlayerEvent@@ABVTDesC16@@@Z @ 7 NONAME ; void CMMAPlayer::PostStringEvent(enum CMMAPlayerEvent::TEventType, class TDesC16 const &)
 	?SnapshotEncoded@CMMAVideoPlayer@@UAEPAVHBufC8@@XZ @ 8 NONAME ; class HBufC8 * CMMAVideoPlayer::SnapshotEncoded(void)
 	?DoOpen@CMMAMMFPlayerBase@@MAEHVTUid@@ABVTDesC8@@01VTMMFPrioritySettings@@@Z @ 9 NONAME ; int CMMAMMFPlayerBase::DoOpen(class TUid, class TDesC8 const &, class TUid, class TDesC8 const &, class TMMFPrioritySettings)
-	?StaticControl@CMMAPlayer@@SAPAVCMMAControl@@PAV1@H@Z @ 10 NONAME ; class CMMAControl * CMMAPlayer::StaticControl(class CMMAPlayer *, int)
-	?Type@CMMAVideoPlayer@@MAEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CMMAVideoPlayer::Type(void)
-	??0CMMAEMCAudioVolumeControl@@IAE@AAVCMMAEMCAudioPlayer@@@Z @ 12 NONAME ; CMMAEMCAudioVolumeControl::CMMAEMCAudioVolumeControl(class CMMAEMCAudioPlayer &)
-	?PublicClassName@CMMAControl@@UBEABVTDesC16@@XZ @ 13 NONAME ; class TDesC16 const & CMMAControl::PublicClassName(void) const
-	?PostActionCompletedStart@CMMAPlayer@@QAEXXZ @ 14 NONAME ; void CMMAPlayer::PostActionCompletedStart(void)
-	?Controller@CMMAMMFPlayerBase@@QAEAAVRMMFController@@XZ @ 15 NONAME ; class RMMFController & CMMAMMFPlayerBase::Controller(void)
-	?PrefetchDataL@CMMAAudioPlayer@@MAEXABVTDesC8@@@Z @ 16 NONAME ; void CMMAAudioPlayer::PrefetchDataL(class TDesC8 const &)
-	??0CMMAVideoUrlPlayer@@IAE@PAVCMMAMMFResolver@@@Z @ 17 NONAME ; CMMAVideoUrlPlayer::CMMAVideoUrlPlayer(class CMMAMMFResolver *)
-	?CloseL@CMMAVideoUrlPlayer@@UAEXXZ @ 18 NONAME ; void CMMAVideoUrlPlayer::CloseL(void)
-	?SnapshotBitmap@CMMAVideoPlayer@@UAEPAVCFbsBitmap@@XZ @ 19 NONAME ; class CFbsBitmap * CMMAVideoPlayer::SnapshotBitmap(void)
-	?NewL@CTimeOutTimer@@SAPAV1@HAAVMTimeOutNotify@@@Z @ 20 NONAME ; class CTimeOutTimer * CTimeOutTimer::NewL(int, class MTimeOutNotify &)
-	?StartL@CMMAVideoUrlPlayer@@UAEXXZ @ 21 NONAME ; void CMMAVideoUrlPlayer::StartL(void)
-	?ReadCompletedL@CMMAEMCAudioPlayer@@UAEXHABVTDesC8@@@Z @ 22 NONAME ; void CMMAEMCAudioPlayer::ReadCompletedL(int, class TDesC8 const &)
-	?NewL@CMMAEMCAudioVolumeControl@@SAPAV1@AAVCMMAEMCAudioPlayer@@@Z @ 23 NONAME ; class CMMAEMCAudioVolumeControl * CMMAEMCAudioVolumeControl::NewL(class CMMAEMCAudioPlayer &)
-	?HandleEvent@CMMAVideoUrlPlayer@@MAEXABVTMMFEvent@@@Z @ 24 NONAME ; void CMMAVideoUrlPlayer::HandleEvent(class TMMFEvent const &)
-	?ConstructL@CMMAVideoUrlPlayer@@IAEXABVTDesC16@@@Z @ 25 NONAME ; void CMMAVideoUrlPlayer::ConstructL(class TDesC16 const &)
-	?SetDisplayL@CMMAVideoPlayer@@UAEXPAVMMMADisplay@@@Z @ 26 NONAME ; void CMMAVideoPlayer::SetDisplayL(class MMMADisplay *)
-	?TakeSnapshotL@CMMAVideoPlayer@@UAE?AW4TEncoding@MMMASnapshot@@PAVTRequestStatus@@ABVTSize@@ABVCMMAImageSettings@@@Z @ 27 NONAME ; enum MMMASnapshot::TEncoding CMMAVideoPlayer::TakeSnapshotL(class TRequestStatus *, class TSize const &, class CMMAImageSettings const &)
-	?StaticAddObjectFromHandleL@MMAFunctionServer@@SAXPAV1@H@Z @ 28 NONAME ; void MMAFunctionServer::StaticAddObjectFromHandleL(class MMAFunctionServer *, int)
-	?SnapshotReady@CMMAVideoControl@@UAEXXZ @ 29 NONAME ; void CMMAVideoControl::SnapshotReady(void)
-	?CreatePlayerL@CMMAMMFPlayerFactory@@MAEPAVCMMAPlayer@@PAVCMMFFormatSelectionParameters@@PBVTDesC16@@@Z @ 30 NONAME ; class CMMAPlayer * CMMAMMFPlayerFactory::CreatePlayerL(class CMMFFormatSelectionParameters *, class TDesC16 const *)
-	?PlayCompleteL@CMMAEMCAudioPlayer@@MAEXH@Z @ 31 NONAME ; void CMMAEMCAudioPlayer::PlayCompleteL(int)
-	?NewL@CMMAAudioVolumeControl@@SAPAV1@PAVCMMAAudioPlayer@@@Z @ 32 NONAME ; class CMMAAudioVolumeControl * CMMAAudioVolumeControl::NewL(class CMMAAudioPlayer *)
-	?PrefetchDataL@CMMAEMCAudioPlayer@@MAEXABVTDesC8@@@Z @ 33 NONAME ; void CMMAEMCAudioPlayer::PrefetchDataL(class TDesC8 const &)
-	?HandlePlaybackCompleteL@CMMAAudioPlayer@@UAEXXZ @ 34 NONAME ; void CMMAAudioPlayer::HandlePlaybackCompleteL(void)
-	?RemoveStateListener@CMMAPlayer@@QAEXPAVMMMAPlayerStateListener@@@Z @ 35 NONAME ; void CMMAPlayer::RemoveStateListener(class MMMAPlayerStateListener *)
-	??0CMMAEMCAudioPlayer@@IAE@PAVCMMAEMCResolver@@@Z @ 36 NONAME ; CMMAEMCAudioPlayer::CMMAEMCAudioPlayer(class CMMAEMCResolver *)
-	?MidiClient@CMMAMIDIPlayer@@QBEPAVCMidiClientUtility@@XZ @ 37 NONAME ; class CMidiClientUtility * CMMAMIDIPlayer::MidiClient(void) const
-	??1CMMAVideoUrlPlayer@@UAE@XZ @ 38 NONAME ; CMMAVideoUrlPlayer::~CMMAVideoUrlPlayer(void)
-	?ErrorPlaybackComplete@CMMAAudioPlayer@@UAEXH@Z @ 39 NONAME ; void CMMAAudioPlayer::ErrorPlaybackComplete(int)
-	??1CMMAEMCAudioPlayer@@UAE@XZ @ 40 NONAME ; CMMAEMCAudioPlayer::~CMMAEMCAudioPlayer(void)
-	?MMFactory@CMMAEMCPlayerBase@@QAEPAVCMultimediaFactory@multimedia@@XZ @ 41 NONAME ; class multimedia::CMultimediaFactory * CMMAEMCPlayerBase::MMFactory(void)
-	?Players@MMAFunctionServer@@QAEAAV?$RPointerArray@VCMMAPlayer@@@@XZ @ 42 NONAME ; class RPointerArray<class CMMAPlayer> & MMAFunctionServer::Players(void)
-	?PreparePluginSelectionParametersL@CMMAMMFPlayerFactory@@MAEXPAVCMMAMMFResolver@@PAVCMMFFormatSelectionParameters@@@Z @ 43 NONAME ; void CMMAMMFPlayerFactory::PreparePluginSelectionParametersL(class CMMAMMFResolver *, class CMMFFormatSelectionParameters *)
-	?PostActionCompleted@CMMAPlayer@@QAEXH@Z @ 44 NONAME ; void CMMAPlayer::PostActionCompleted(int)
-	?RealizeL@CMMAVideoUrlPlayer@@UAEXXZ @ 45 NONAME ; void CMMAVideoUrlPlayer::RealizeL(void)
-	?SetPlayerInstanceObserver@MMAFunctionServer@@QAEXPAVMMMAPlayerInstanceObserver@@@Z @ 46 NONAME ; void MMAFunctionServer::SetPlayerInstanceObserver(class MMMAPlayerInstanceObserver *)
-	?SetPlayerListenerObjectL@CMMAVideoPlayer@@UAEXPAV_jobject@@PAUJNIEnv_@@PAVMMMAEventPoster@@@Z @ 47 NONAME ; void CMMAVideoPlayer::SetPlayerListenerObjectL(class _jobject *, struct JNIEnv_ *, class MMMAEventPoster *)
-	?RealizeL@CMMAEMCAudioPlayer@@UAEXXZ @ 48 NONAME ; void CMMAEMCAudioPlayer::RealizeL(void)
-	?ControlCount@CMMAPlayer@@QAEHXZ @ 49 NONAME ; int CMMAPlayer::ControlCount(void)
-	?DoSetLevelL@CMMAEMCAudioVolumeControl@@UAEXH@Z @ 50 NONAME ; void CMMAEMCAudioVolumeControl::DoSetLevelL(int)
-	?PlayCompleteL@CMMAAudioPlayer@@MAEXH@Z @ 51 NONAME ; void CMMAAudioPlayer::PlayCompleteL(int)
-	?SourceSize@CMMAVideoPlayer@@UAE?AVTSize@@XZ @ 52 NONAME ; class TSize CMMAVideoPlayer::SourceSize(void)
-	?SnapshoterL@CMMAVideoPlayer@@UAEPAVMMMASnapshot@@XZ @ 53 NONAME ; class MMMASnapshot * CMMAVideoPlayer::SnapshoterL(void)
-	?GetDuration@CMMAMMFPlayerBase@@UAEXPA_J@Z @ 54 NONAME ; void CMMAMMFPlayerBase::GetDuration(long long *)
-	?AddPlayerFactoryL@CMMAManager@@QAEXPAVMMMAPlayerFactory@@@Z @ 55 NONAME ; void CMMAManager::AddPlayerFactoryL(class MMMAPlayerFactory *)
-	??0CMMAVideoControl@@QAE@PAVMMMAGuiPlayer@@@Z @ 56 NONAME ; CMMAVideoControl::CMMAVideoControl(class MMMAGuiPlayer *)
-	?ClassName@CMMAVideoControl@@UBEABVTDesC16@@XZ @ 57 NONAME ; class TDesC16 const & CMMAVideoControl::ClassName(void) const
-	??1CMMAMMFPlayerFactory@@UAE@XZ @ 58 NONAME ; CMMAMMFPlayerFactory::~CMMAMMFPlayerFactory(void)
-	?SetVolumeLevelL@CMMAVolumeControl@@QAEXHH@Z @ 59 NONAME ; void CMMAVolumeControl::SetVolumeLevelL(int, int)
-	?PostActionCompletedFile@CMMAPlayer@@QAEXXZ @ 60 NONAME ; void CMMAPlayer::PostActionCompletedFile(void)
-	?DoGetLevelL@CMMAEMCAudioVolumeControl@@UAEHXZ @ 61 NONAME ; int CMMAEMCAudioVolumeControl::DoGetLevelL(void)
-	?ReadCompletedL@CMMAVideoPlayer@@MAEXHABVTDesC8@@@Z @ 62 NONAME ; void CMMAVideoPlayer::ReadCompletedL(int, class TDesC8 const &)
-	?Type@CMMAEMCAudioPlayer@@UAEABVTDesC16@@XZ @ 63 NONAME ; class TDesC16 const & CMMAEMCAudioPlayer::Type(void)
-	?GetMediaTime@CMMAVideoUrlPlayer@@UAEXPA_J@Z @ 64 NONAME ; void CMMAVideoUrlPlayer::GetMediaTime(long long *)
-	?DeallocateL@CMMAVideoUrlPlayer@@UAEXXZ @ 65 NONAME ; void CMMAVideoUrlPlayer::DeallocateL(void)
-	??0CMMAMMFPlayerFactory@@QAE@XZ @ 66 NONAME ; CMMAMMFPlayerFactory::CMMAMMFPlayerFactory(void)
-	?AddStateListenerL@CMMAPlayer@@QAEXPAVMMMAPlayerStateListener@@@Z @ 67 NONAME ; void CMMAPlayer::AddStateListenerL(class MMMAPlayerStateListener *)
-	?StreamControl@CMMAEMCPlayerBase@@QAEPAVMStreamControl@multimedia@@XZ @ 68 NONAME ; class multimedia::MStreamControl * CMMAEMCPlayerBase::StreamControl(void)
-	?PrefetchFileL@CMMAAudioPlayer@@MAEXXZ @ 69 NONAME ; void CMMAAudioPlayer::PrefetchFileL(void)
-	?PrefetchL@CMMAVideoUrlPlayer@@UAEXXZ @ 70 NONAME ; void CMMAVideoUrlPlayer::PrefetchL(void)
-	?AddLevelL@CMMAVolumeControl@@QAEHXZ @ 71 NONAME ; int CMMAVolumeControl::AddLevelL(void)
-	?ConstructL@CMMAEMCAudioPlayer@@IAEXXZ @ 72 NONAME ; void CMMAEMCAudioPlayer::ConstructL(void)
-	?Control@CMMAPlayer@@QAEPAVCMMAControl@@H@Z @ 73 NONAME ; class CMMAControl * CMMAPlayer::Control(int)
-	?PrefetchL@CMMAEMCAudioPlayer@@UAEXXZ @ 74 NONAME ; void CMMAEMCAudioPlayer::PrefetchL(void)
-	?StopL@CMMAVideoUrlPlayer@@UAEXH@Z @ 75 NONAME ; void CMMAVideoUrlPlayer::StopL(int)
-	??1CMMAVideoControl@@UAE@XZ @ 76 NONAME ; CMMAVideoControl::~CMMAVideoControl(void)
-	?AddSourceStreamL@CMMAPlayer@@MAEPAVCMMASourceStream@@PAUJNIEnv_@@PAVMMAFunctionServer@@PAV_jobject@@@Z @ 77 NONAME ; class CMMASourceStream * CMMAPlayer::AddSourceStreamL(struct JNIEnv_ *, class MMAFunctionServer *, class _jobject *)
+	?Type@CMMAVideoPlayer@@MAEABVTDesC16@@XZ @ 10 NONAME ; class TDesC16 const & CMMAVideoPlayer::Type(void)
+	??0CMMAEMCAudioVolumeControl@@IAE@AAVCMMAEMCAudioPlayer@@@Z @ 11 NONAME ; CMMAEMCAudioVolumeControl::CMMAEMCAudioVolumeControl(class CMMAEMCAudioPlayer &)
+	?PublicClassName@CMMAControl@@UBEABVTDesC16@@XZ @ 12 NONAME ; class TDesC16 const & CMMAControl::PublicClassName(void) const
+	?Controller@CMMAMMFPlayerBase@@QAEAAVRMMFController@@XZ @ 13 NONAME ; class RMMFController & CMMAMMFPlayerBase::Controller(void)
+	?PrefetchDataL@CMMAAudioPlayer@@MAEXABVTDesC8@@@Z @ 14 NONAME ; void CMMAAudioPlayer::PrefetchDataL(class TDesC8 const &)
+	??0CMMAVideoUrlPlayer@@IAE@PAVCMMAMMFResolver@@@Z @ 15 NONAME ; CMMAVideoUrlPlayer::CMMAVideoUrlPlayer(class CMMAMMFResolver *)
+	?CloseL@CMMAVideoUrlPlayer@@UAEXXZ @ 16 NONAME ; void CMMAVideoUrlPlayer::CloseL(void)
+	?SnapshotBitmap@CMMAVideoPlayer@@UAEPAVCFbsBitmap@@XZ @ 17 NONAME ; class CFbsBitmap * CMMAVideoPlayer::SnapshotBitmap(void)
+	?NewL@CTimeOutTimer@@SAPAV1@HAAVMTimeOutNotify@@@Z @ 18 NONAME ; class CTimeOutTimer * CTimeOutTimer::NewL(int, class MTimeOutNotify &)
+	?StartL@CMMAVideoUrlPlayer@@UAEXXZ @ 19 NONAME ; void CMMAVideoUrlPlayer::StartL(void)
+	?ReadCompletedL@CMMAEMCAudioPlayer@@UAEXHABVTDesC8@@@Z @ 20 NONAME ; void CMMAEMCAudioPlayer::ReadCompletedL(int, class TDesC8 const &)
+	?NewL@CMMAEMCAudioVolumeControl@@SAPAV1@AAVCMMAEMCAudioPlayer@@@Z @ 21 NONAME ; class CMMAEMCAudioVolumeControl * CMMAEMCAudioVolumeControl::NewL(class CMMAEMCAudioPlayer &)
+	?HandleEvent@CMMAVideoUrlPlayer@@MAEXABVTMMFEvent@@@Z @ 22 NONAME ; void CMMAVideoUrlPlayer::HandleEvent(class TMMFEvent const &)
+	?ConstructL@CMMAVideoUrlPlayer@@IAEXABVTDesC16@@@Z @ 23 NONAME ; void CMMAVideoUrlPlayer::ConstructL(class TDesC16 const &)
+	?SetDisplayL@CMMAVideoPlayer@@UAEXPAVMMMADisplay@@@Z @ 24 NONAME ; void CMMAVideoPlayer::SetDisplayL(class MMMADisplay *)
+	?TakeSnapshotL@CMMAVideoPlayer@@UAE?AW4TEncoding@MMMASnapshot@@PAVTRequestStatus@@ABVTSize@@ABVCMMAImageSettings@@@Z @ 25 NONAME ; enum MMMASnapshot::TEncoding CMMAVideoPlayer::TakeSnapshotL(class TRequestStatus *, class TSize const &, class CMMAImageSettings const &)
+	?StaticAddObjectFromHandleL@MMAFunctionServer@@SAXPAV1@H@Z @ 26 NONAME ; void MMAFunctionServer::StaticAddObjectFromHandleL(class MMAFunctionServer *, int)
+	?SnapshotReady@CMMAVideoControl@@UAEXXZ @ 27 NONAME ; void CMMAVideoControl::SnapshotReady(void)
+	?CreatePlayerL@CMMAMMFPlayerFactory@@MAEPAVCMMAPlayer@@PAVCMMFFormatSelectionParameters@@PBVTDesC16@@@Z @ 28 NONAME ; class CMMAPlayer * CMMAMMFPlayerFactory::CreatePlayerL(class CMMFFormatSelectionParameters *, class TDesC16 const *)
+	?PlayCompleteL@CMMAEMCAudioPlayer@@MAEXH@Z @ 29 NONAME ; void CMMAEMCAudioPlayer::PlayCompleteL(int)
+	?NewL@CMMAAudioVolumeControl@@SAPAV1@PAVCMMAAudioPlayer@@@Z @ 30 NONAME ; class CMMAAudioVolumeControl * CMMAAudioVolumeControl::NewL(class CMMAAudioPlayer *)
+	?PrefetchDataL@CMMAEMCAudioPlayer@@MAEXABVTDesC8@@@Z @ 31 NONAME ; void CMMAEMCAudioPlayer::PrefetchDataL(class TDesC8 const &)
+	?HandlePlaybackCompleteL@CMMAAudioPlayer@@UAEXXZ @ 32 NONAME ; void CMMAAudioPlayer::HandlePlaybackCompleteL(void)
+	?RemoveStateListener@CMMAPlayer@@QAEXPAVMMMAPlayerStateListener@@@Z @ 33 NONAME ; void CMMAPlayer::RemoveStateListener(class MMMAPlayerStateListener *)
+	??0CMMAEMCAudioPlayer@@IAE@PAVCMMAEMCResolver@@@Z @ 34 NONAME ; CMMAEMCAudioPlayer::CMMAEMCAudioPlayer(class CMMAEMCResolver *)
+	?MidiClient@CMMAMIDIPlayer@@QBEPAVCMidiClientUtility@@XZ @ 35 NONAME ; class CMidiClientUtility * CMMAMIDIPlayer::MidiClient(void) const
+	??1CMMAVideoUrlPlayer@@UAE@XZ @ 36 NONAME ; CMMAVideoUrlPlayer::~CMMAVideoUrlPlayer(void)
+	?ErrorPlaybackComplete@CMMAAudioPlayer@@UAEXH@Z @ 37 NONAME ; void CMMAAudioPlayer::ErrorPlaybackComplete(int)
+	??1CMMAEMCAudioPlayer@@UAE@XZ @ 38 NONAME ; CMMAEMCAudioPlayer::~CMMAEMCAudioPlayer(void)
+	?MMFactory@CMMAEMCPlayerBase@@QAEPAVCMultimediaFactory@multimedia@@XZ @ 39 NONAME ; class multimedia::CMultimediaFactory * CMMAEMCPlayerBase::MMFactory(void)
+	?Players@MMAFunctionServer@@QAEAAV?$RPointerArray@VCMMAPlayer@@@@XZ @ 40 NONAME ; class RPointerArray<class CMMAPlayer> & MMAFunctionServer::Players(void)
+	?PreparePluginSelectionParametersL@CMMAMMFPlayerFactory@@MAEXPAVCMMAMMFResolver@@PAVCMMFFormatSelectionParameters@@@Z @ 41 NONAME ; void CMMAMMFPlayerFactory::PreparePluginSelectionParametersL(class CMMAMMFResolver *, class CMMFFormatSelectionParameters *)
+	?PostActionCompleted@CMMAPlayer@@QAEXH@Z @ 42 NONAME ; void CMMAPlayer::PostActionCompleted(int)
+	?RealizeL@CMMAVideoUrlPlayer@@UAEXXZ @ 43 NONAME ; void CMMAVideoUrlPlayer::RealizeL(void)
+	?SetPlayerInstanceObserver@MMAFunctionServer@@QAEXPAVMMMAPlayerInstanceObserver@@@Z @ 44 NONAME ; void MMAFunctionServer::SetPlayerInstanceObserver(class MMMAPlayerInstanceObserver *)
+	?SetPlayerListenerObjectL@CMMAVideoPlayer@@UAEXPAV_jobject@@PAUJNIEnv_@@PAVMMMAEventPoster@@@Z @ 45 NONAME ; void CMMAVideoPlayer::SetPlayerListenerObjectL(class _jobject *, struct JNIEnv_ *, class MMMAEventPoster *)
+	?RealizeL@CMMAEMCAudioPlayer@@UAEXXZ @ 46 NONAME ; void CMMAEMCAudioPlayer::RealizeL(void)
+	?ControlCount@CMMAPlayer@@QAEHXZ @ 47 NONAME ; int CMMAPlayer::ControlCount(void)
+	?DoSetLevelL@CMMAEMCAudioVolumeControl@@UAEXH@Z @ 48 NONAME ; void CMMAEMCAudioVolumeControl::DoSetLevelL(int)
+	?PlayCompleteL@CMMAAudioPlayer@@MAEXH@Z @ 49 NONAME ; void CMMAAudioPlayer::PlayCompleteL(int)
+	?SourceSize@CMMAVideoPlayer@@UAE?AVTSize@@XZ @ 50 NONAME ; class TSize CMMAVideoPlayer::SourceSize(void)
+	?SnapshoterL@CMMAVideoPlayer@@UAEPAVMMMASnapshot@@XZ @ 51 NONAME ; class MMMASnapshot * CMMAVideoPlayer::SnapshoterL(void)
+	?GetDuration@CMMAMMFPlayerBase@@UAEXPA_J@Z @ 52 NONAME ; void CMMAMMFPlayerBase::GetDuration(long long *)
+	?AddPlayerFactoryL@CMMAManager@@QAEXPAVMMMAPlayerFactory@@@Z @ 53 NONAME ; void CMMAManager::AddPlayerFactoryL(class MMMAPlayerFactory *)
+	??0CMMAVideoControl@@QAE@PAVMMMAGuiPlayer@@@Z @ 54 NONAME ; CMMAVideoControl::CMMAVideoControl(class MMMAGuiPlayer *)
+	?ClassName@CMMAVideoControl@@UBEABVTDesC16@@XZ @ 55 NONAME ; class TDesC16 const & CMMAVideoControl::ClassName(void) const
+	??1CMMAMMFPlayerFactory@@UAE@XZ @ 56 NONAME ; CMMAMMFPlayerFactory::~CMMAMMFPlayerFactory(void)
+	?SetVolumeLevelL@CMMAVolumeControl@@QAEXHH@Z @ 57 NONAME ; void CMMAVolumeControl::SetVolumeLevelL(int, int)
+	?DoGetLevelL@CMMAEMCAudioVolumeControl@@UAEHXZ @ 58 NONAME ; int CMMAEMCAudioVolumeControl::DoGetLevelL(void)
+	?ReadCompletedL@CMMAVideoPlayer@@MAEXHABVTDesC8@@@Z @ 59 NONAME ; void CMMAVideoPlayer::ReadCompletedL(int, class TDesC8 const &)
+	?Type@CMMAEMCAudioPlayer@@UAEABVTDesC16@@XZ @ 60 NONAME ; class TDesC16 const & CMMAEMCAudioPlayer::Type(void)
+	?GetMediaTime@CMMAVideoUrlPlayer@@UAEXPA_J@Z @ 61 NONAME ; void CMMAVideoUrlPlayer::GetMediaTime(long long *)
+	?DeallocateL@CMMAVideoUrlPlayer@@UAEXXZ @ 62 NONAME ; void CMMAVideoUrlPlayer::DeallocateL(void)
+	??0CMMAMMFPlayerFactory@@QAE@XZ @ 63 NONAME ; CMMAMMFPlayerFactory::CMMAMMFPlayerFactory(void)
+	?AddStateListenerL@CMMAPlayer@@QAEXPAVMMMAPlayerStateListener@@@Z @ 64 NONAME ; void CMMAPlayer::AddStateListenerL(class MMMAPlayerStateListener *)
+	?StreamControl@CMMAEMCPlayerBase@@QAEPAVMStreamControl@multimedia@@XZ @ 65 NONAME ; class multimedia::MStreamControl * CMMAEMCPlayerBase::StreamControl(void)
+	?PrefetchFileL@CMMAAudioPlayer@@MAEXXZ @ 66 NONAME ; void CMMAAudioPlayer::PrefetchFileL(void)
+	?PrefetchL@CMMAVideoUrlPlayer@@UAEXXZ @ 67 NONAME ; void CMMAVideoUrlPlayer::PrefetchL(void)
+	?AddLevelL@CMMAVolumeControl@@QAEHXZ @ 68 NONAME ; int CMMAVolumeControl::AddLevelL(void)
+	?ConstructL@CMMAEMCAudioPlayer@@IAEXXZ @ 69 NONAME ; void CMMAEMCAudioPlayer::ConstructL(void)
+	?Control@CMMAPlayer@@QAEPAVCMMAControl@@H@Z @ 70 NONAME ; class CMMAControl * CMMAPlayer::Control(int)
+	?PrefetchL@CMMAEMCAudioPlayer@@UAEXXZ @ 71 NONAME ; void CMMAEMCAudioPlayer::PrefetchL(void)
+	?StopL@CMMAVideoUrlPlayer@@UAEXH@Z @ 72 NONAME ; void CMMAVideoUrlPlayer::StopL(int)
+	??1CMMAVideoControl@@UAE@XZ @ 73 NONAME ; CMMAVideoControl::~CMMAVideoControl(void)
+	?AddSourceStreamL@CMMAPlayer@@MAEPAVCMMASourceStream@@PAUJNIEnv_@@PAVMMAFunctionServer@@PAV_jobject@@@Z @ 74 NONAME ; class CMMASourceStream * CMMAPlayer::AddSourceStreamL(struct JNIEnv_ *, class MMAFunctionServer *, class _jobject *)
 
--- a/javauis/mmapi_qt/build/eabi/javamobilemediau.def	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/build/eabi/javamobilemediau.def	Thu Jul 22 16:31:34 2010 +0100
@@ -7,142 +7,143 @@
 	_ZN10CMMAPlayer15PostStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 6 NONAME
 	_ZN10CMMAPlayer16AddSourceStreamLEP7JNIEnv_P17MMAFunctionServerP8_jobject @ 7 NONAME
 	_ZN10CMMAPlayer17AddStateListenerLEP23MMMAPlayerStateListener @ 8 NONAME
-	_ZN10CMMAPlayer19RemoveStateListenerEP23MMMAPlayerStateListener @ 9 NONAME
-	_ZN10CMMAPlayer7ControlEi @ 10 NONAME
-	_ZN11CMMAManager17AddPlayerFactoryLEP17MMMAPlayerFactory @ 11 NONAME
-	_ZN13CTimeOutTimer4NewLEiR14MTimeOutNotify @ 12 NONAME
-	_ZN15CMMAAudioPlayer13PlayCompleteLEi @ 13 NONAME
-	_ZN15CMMAAudioPlayer13PrefetchDataLERK6TDesC8 @ 14 NONAME
-	_ZN15CMMAAudioPlayer13PrefetchFileLEv @ 15 NONAME
-	_ZN15CMMAAudioPlayer21ErrorPlaybackCompleteEi @ 16 NONAME
-	_ZN15CMMAAudioPlayer23HandlePlaybackCompleteLEv @ 17 NONAME
-	_ZN15CMMAVideoPlayer10SourceSizeEv @ 18 NONAME
-	_ZN15CMMAVideoPlayer11SetDisplayLEP11MMMADisplay @ 19 NONAME
-	_ZN15CMMAVideoPlayer11SnapshoterLEv @ 20 NONAME
-	_ZN15CMMAVideoPlayer13TakeSnapshotLEP14TRequestStatusRK5TSizeRK17CMMAImageSettings @ 21 NONAME
-	_ZN15CMMAVideoPlayer14ReadCompletedLEiRK6TDesC8 @ 22 NONAME
-	_ZN15CMMAVideoPlayer14SnapshotBitmapEv @ 23 NONAME
-	_ZN15CMMAVideoPlayer15SnapshotEncodedEv @ 24 NONAME
-	_ZN15CMMAVideoPlayer21NotifyWithStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 25 NONAME
-	_ZN15CMMAVideoPlayer24SetPlayerListenerObjectLEP8_jobjectP7JNIEnv_P15MMMAEventPoster @ 26 NONAME
-	_ZN15CMMAVideoPlayer4TypeEv @ 27 NONAME
-	_ZN16CMMAVideoControl13SnapshotReadyEv @ 28 NONAME
-	_ZN16CMMAVideoControlC1EP13MMMAGuiPlayer @ 29 NONAME
-	_ZN16CMMAVideoControlC2EP13MMMAGuiPlayer @ 30 NONAME
-	_ZN16CMMAVideoControlD0Ev @ 31 NONAME
-	_ZN16CMMAVideoControlD1Ev @ 32 NONAME
-	_ZN16CMMAVideoControlD2Ev @ 33 NONAME
-	_ZN17CMMAEMCPlayerBase13StreamControlEv @ 34 NONAME
-	_ZN17CMMAEMCPlayerBase9MMFactoryEv @ 35 NONAME
-	_ZN17CMMAMMFPlayerBase10ControllerEv @ 36 NONAME
-	_ZN17CMMAMMFPlayerBase11GetDurationEPx @ 37 NONAME
-	_ZN17CMMAMMFPlayerBase6DoOpenE4TUidRK6TDesC8S0_S3_20TMMFPrioritySettings @ 38 NONAME
-	_ZN17CMMAVolumeControl15SetVolumeLevelLEii @ 39 NONAME
-	_ZN17CMMAVolumeControl9AddLevelLEv @ 40 NONAME
-	_ZN17MMAFunctionServer25SetPlayerInstanceObserverEP26MMMAPlayerInstanceObserver @ 41 NONAME
-	_ZN17MMAFunctionServer26StaticAddObjectFromHandleLEPS_i @ 42 NONAME
-	_ZN17MMAFunctionServer7PlayersEv @ 43 NONAME
-	_ZN18CMMAEMCAudioPlayer10ConstructLEv @ 44 NONAME
-	_ZN18CMMAEMCAudioPlayer13PlayCompleteLEi @ 45 NONAME
-	_ZN18CMMAEMCAudioPlayer13PrefetchDataLERK6TDesC8 @ 46 NONAME
-	_ZN18CMMAEMCAudioPlayer13PrefetchFileLEv @ 47 NONAME
-	_ZN18CMMAEMCAudioPlayer14ReadCompletedLEiRK6TDesC8 @ 48 NONAME
-	_ZN18CMMAEMCAudioPlayer4TypeEv @ 49 NONAME
-	_ZN18CMMAEMCAudioPlayer8RealizeLEv @ 50 NONAME
-	_ZN18CMMAEMCAudioPlayer9PrefetchLEv @ 51 NONAME
-	_ZN18CMMAEMCAudioPlayerC1EP15CMMAEMCResolver @ 52 NONAME
-	_ZN18CMMAEMCAudioPlayerC2EP15CMMAEMCResolver @ 53 NONAME
-	_ZN18CMMAEMCAudioPlayerD0Ev @ 54 NONAME
-	_ZN18CMMAEMCAudioPlayerD1Ev @ 55 NONAME
-	_ZN18CMMAEMCAudioPlayerD2Ev @ 56 NONAME
-	_ZN18CMMAVideoUrlPlayer10ConstructLERK7TDesC16 @ 57 NONAME
-	_ZN18CMMAVideoUrlPlayer11DeallocateLEv @ 58 NONAME
-	_ZN18CMMAVideoUrlPlayer11HandleEventERK9TMMFEvent @ 59 NONAME
-	_ZN18CMMAVideoUrlPlayer12GetMediaTimeEPx @ 60 NONAME
-	_ZN18CMMAVideoUrlPlayer5StopLEi @ 61 NONAME
-	_ZN18CMMAVideoUrlPlayer6CloseLEv @ 62 NONAME
-	_ZN18CMMAVideoUrlPlayer6StartLEv @ 63 NONAME
-	_ZN18CMMAVideoUrlPlayer8RealizeLEv @ 64 NONAME
-	_ZN18CMMAVideoUrlPlayer9PrefetchLEv @ 65 NONAME
-	_ZN18CMMAVideoUrlPlayerC1EP15CMMAMMFResolver @ 66 NONAME
-	_ZN18CMMAVideoUrlPlayerC2EP15CMMAMMFResolver @ 67 NONAME
-	_ZN18CMMAVideoUrlPlayerD0Ev @ 68 NONAME
-	_ZN18CMMAVideoUrlPlayerD1Ev @ 69 NONAME
-	_ZN18CMMAVideoUrlPlayerD2Ev @ 70 NONAME
-	_ZN20CMMAMMFPlayerFactory13CreatePlayerLEP29CMMFFormatSelectionParametersPK7TDesC16 @ 71 NONAME
-	_ZN20CMMAMMFPlayerFactory33PreparePluginSelectionParametersLEP15CMMAMMFResolverP29CMMFFormatSelectionParameters @ 72 NONAME
-	_ZN20CMMAMMFPlayerFactoryC2Ev @ 73 NONAME
-	_ZN20CMMAMMFPlayerFactoryD0Ev @ 74 NONAME
-	_ZN20CMMAMMFPlayerFactoryD1Ev @ 75 NONAME
-	_ZN20CMMAMMFPlayerFactoryD2Ev @ 76 NONAME
-	_ZN22CMMAAudioVolumeControl4NewLEP15CMMAAudioPlayer @ 77 NONAME
-	_ZN25CMMAEMCAudioVolumeControl11DoGetLevelLEv @ 78 NONAME
-	_ZN25CMMAEMCAudioVolumeControl11DoSetLevelLEi @ 79 NONAME
-	_ZN25CMMAEMCAudioVolumeControl4NewLER18CMMAEMCAudioPlayer @ 80 NONAME
-	_ZN25CMMAEMCAudioVolumeControlC1ER18CMMAEMCAudioPlayer @ 81 NONAME
-	_ZN25CMMAEMCAudioVolumeControlC2ER18CMMAEMCAudioPlayer @ 82 NONAME
-	_ZNK11CMMAControl15PublicClassNameEv @ 83 NONAME
-	_ZNK14CMMAMIDIPlayer10MidiClientEv @ 84 NONAME
-	_ZNK16CMMAVideoControl9ClassNameEv @ 85 NONAME
-	_ZTI10CMMAPlayer @ 86 NONAME
-	_ZTI11CMMAControl @ 87 NONAME
-	_ZTI13CTimeOutTimer @ 88 NONAME
-	_ZTI14CMMAMIDIPlayer @ 89 NONAME
-	_ZTI16CMMAVideoControl @ 90 NONAME
-	_ZTI17CMMAMMFPlayerBase @ 91 NONAME
-	_ZTI17CMMAStreamRequest @ 92 NONAME
-	_ZTI17CMMAVolumeControl @ 93 NONAME
-	_ZTI17MMAFunctionServer @ 94 NONAME
-	_ZTI18CHXMetaDataUtility @ 95 NONAME
-	_ZTI18CMMAVideoUrlPlayer @ 96 NONAME
-	_ZTI20CMMAMMFPlayerFactory @ 97 NONAME
-	_ZTI26CPlaybackCompletedCallback @ 98 NONAME
-	_ZTIN15CMMAMIDIControl23CChannelVolumeEventWaitE @ 99 NONAME
-	_ZTIN18CMMAVideoUrlPlayer26CMMAVideoUrlPlayerDelegateE @ 100 NONAME
-	_ZTIN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerClipStreamDelegateE @ 101 NONAME
-	_ZTIN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerLiveStreamDelegateE @ 102 NONAME
-	_ZTIN19CMMAStopTimeControl10CStopTimerE @ 103 NONAME
-	_ZTV10CMMAPlayer @ 104 NONAME
-	_ZTV11CMMAControl @ 105 NONAME
-	_ZTV13CTimeOutTimer @ 106 NONAME
-	_ZTV14CMMAMIDIPlayer @ 107 NONAME
-	_ZTV16CMMAVideoControl @ 108 NONAME
-	_ZTV17CMMAMMFPlayerBase @ 109 NONAME
-	_ZTV17CMMAStreamRequest @ 110 NONAME
-	_ZTV17CMMAVolumeControl @ 111 NONAME
-	_ZTV17MMAFunctionServer @ 112 NONAME
-	_ZTV18CHXMetaDataUtility @ 113 NONAME
-	_ZTV18CMMAVideoUrlPlayer @ 114 NONAME
-	_ZTV20CMMAMMFPlayerFactory @ 115 NONAME
-	_ZTV26CPlaybackCompletedCallback @ 116 NONAME
-	_ZTVN15CMMAMIDIControl23CChannelVolumeEventWaitE @ 117 NONAME
-	_ZTVN18CMMAVideoUrlPlayer26CMMAVideoUrlPlayerDelegateE @ 118 NONAME
-	_ZTVN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerClipStreamDelegateE @ 119 NONAME
-	_ZTVN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerLiveStreamDelegateE @ 120 NONAME
-	_ZTVN19CMMAStopTimeControl10CStopTimerE @ 121 NONAME
-	_ZThn160_N18CMMAVideoUrlPlayer11HandleEventERK9TMMFEvent @ 122 NONAME
-	_ZThn288_N15CMMAAudioPlayer21ErrorPlaybackCompleteEi @ 123 NONAME
-	_ZThn288_N15CMMAAudioPlayer23HandlePlaybackCompleteLEv @ 124 NONAME
-	_ZThn296_N15CMMAVideoPlayer10SourceSizeEv @ 125 NONAME
-	_ZThn296_N15CMMAVideoPlayer11SetDisplayLEP11MMMADisplay @ 126 NONAME
-	_ZThn296_N15CMMAVideoPlayer11SnapshoterLEv @ 127 NONAME
-	_ZThn296_N15CMMAVideoPlayer21NotifyWithStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 128 NONAME
-	_ZThn296_N18CMMAVideoUrlPlayerD0Ev @ 129 NONAME
-	_ZThn296_N18CMMAVideoUrlPlayerD1Ev @ 130 NONAME
-	_ZThn300_N15CMMAVideoPlayer13TakeSnapshotLEP14TRequestStatusRK5TSizeRK17CMMAImageSettings @ 131 NONAME
-	_ZThn300_N15CMMAVideoPlayer14SnapshotBitmapEv @ 132 NONAME
-	_ZThn300_N15CMMAVideoPlayer15SnapshotEncodedEv @ 133 NONAME
-	_ZThn300_N18CMMAVideoUrlPlayerD0Ev @ 134 NONAME
-	_ZThn300_N18CMMAVideoUrlPlayerD1Ev @ 135 NONAME
-	_ZThn4_N15CMMAVideoPlayer14ReadCompletedLEiRK6TDesC8 @ 136 NONAME
-	_ZThn4_N18CMMAEMCAudioPlayer14ReadCompletedLEiRK6TDesC8 @ 137 NONAME
-	_ZThn4_N18CMMAEMCAudioPlayerD0Ev @ 138 NONAME
-	_ZThn4_N18CMMAEMCAudioPlayerD1Ev @ 139 NONAME
-	_ZThn4_N18CMMAVideoUrlPlayerD0Ev @ 140 NONAME
-	_ZThn4_N18CMMAVideoUrlPlayerD1Ev @ 141 NONAME
-	_ZThn4_N20CMMAMMFPlayerFactoryD0Ev @ 142 NONAME
-	_ZThn4_N20CMMAMMFPlayerFactoryD1Ev @ 143 NONAME
-	_ZThn8_N16CMMAVideoControl13SnapshotReadyEv @ 144 NONAME
-	_ZThn8_N16CMMAVideoControlD0Ev @ 145 NONAME
-	_ZThn8_N16CMMAVideoControlD1Ev @ 146 NONAME
+	_ZN10CMMAPlayer19PostActionCompletedEi @ 9 NONAME
+	_ZN10CMMAPlayer19RemoveStateListenerEP23MMMAPlayerStateListener @ 10 NONAME
+	_ZN10CMMAPlayer7ControlEi @ 11 NONAME
+	_ZN11CMMAManager17AddPlayerFactoryLEP17MMMAPlayerFactory @ 12 NONAME
+	_ZN13CTimeOutTimer4NewLEiR14MTimeOutNotify @ 13 NONAME
+	_ZN15CMMAAudioPlayer13PlayCompleteLEi @ 14 NONAME
+	_ZN15CMMAAudioPlayer13PrefetchDataLERK6TDesC8 @ 15 NONAME
+	_ZN15CMMAAudioPlayer13PrefetchFileLEv @ 16 NONAME
+	_ZN15CMMAAudioPlayer21ErrorPlaybackCompleteEi @ 17 NONAME
+	_ZN15CMMAAudioPlayer23HandlePlaybackCompleteLEv @ 18 NONAME
+	_ZN15CMMAVideoPlayer10SourceSizeEv @ 19 NONAME
+	_ZN15CMMAVideoPlayer11SetDisplayLEP11MMMADisplay @ 20 NONAME
+	_ZN15CMMAVideoPlayer11SnapshoterLEv @ 21 NONAME
+	_ZN15CMMAVideoPlayer13TakeSnapshotLEP14TRequestStatusRK5TSizeRK17CMMAImageSettings @ 22 NONAME
+	_ZN15CMMAVideoPlayer14ReadCompletedLEiRK6TDesC8 @ 23 NONAME
+	_ZN15CMMAVideoPlayer14SnapshotBitmapEv @ 24 NONAME
+	_ZN15CMMAVideoPlayer15SnapshotEncodedEv @ 25 NONAME
+	_ZN15CMMAVideoPlayer21NotifyWithStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 26 NONAME
+	_ZN15CMMAVideoPlayer24SetPlayerListenerObjectLEP8_jobjectP7JNIEnv_P15MMMAEventPoster @ 27 NONAME
+	_ZN15CMMAVideoPlayer4TypeEv @ 28 NONAME
+	_ZN16CMMAVideoControl13SnapshotReadyEv @ 29 NONAME
+	_ZN16CMMAVideoControlC1EP13MMMAGuiPlayer @ 30 NONAME
+	_ZN16CMMAVideoControlC2EP13MMMAGuiPlayer @ 31 NONAME
+	_ZN16CMMAVideoControlD0Ev @ 32 NONAME
+	_ZN16CMMAVideoControlD1Ev @ 33 NONAME
+	_ZN16CMMAVideoControlD2Ev @ 34 NONAME
+	_ZN17CMMAEMCPlayerBase13StreamControlEv @ 35 NONAME
+	_ZN17CMMAEMCPlayerBase9MMFactoryEv @ 36 NONAME
+	_ZN17CMMAMMFPlayerBase10ControllerEv @ 37 NONAME
+	_ZN17CMMAMMFPlayerBase11GetDurationEPx @ 38 NONAME
+	_ZN17CMMAMMFPlayerBase6DoOpenE4TUidRK6TDesC8S0_S3_20TMMFPrioritySettings @ 39 NONAME
+	_ZN17CMMAVolumeControl15SetVolumeLevelLEii @ 40 NONAME
+	_ZN17CMMAVolumeControl9AddLevelLEv @ 41 NONAME
+	_ZN17MMAFunctionServer25SetPlayerInstanceObserverEP26MMMAPlayerInstanceObserver @ 42 NONAME
+	_ZN17MMAFunctionServer26StaticAddObjectFromHandleLEPS_i @ 43 NONAME
+	_ZN17MMAFunctionServer7PlayersEv @ 44 NONAME
+	_ZN18CMMAEMCAudioPlayer10ConstructLEv @ 45 NONAME
+	_ZN18CMMAEMCAudioPlayer13PlayCompleteLEi @ 46 NONAME
+	_ZN18CMMAEMCAudioPlayer13PrefetchDataLERK6TDesC8 @ 47 NONAME
+	_ZN18CMMAEMCAudioPlayer13PrefetchFileLEv @ 48 NONAME
+	_ZN18CMMAEMCAudioPlayer14ReadCompletedLEiRK6TDesC8 @ 49 NONAME
+	_ZN18CMMAEMCAudioPlayer4TypeEv @ 50 NONAME
+	_ZN18CMMAEMCAudioPlayer8RealizeLEv @ 51 NONAME
+	_ZN18CMMAEMCAudioPlayer9PrefetchLEv @ 52 NONAME
+	_ZN18CMMAEMCAudioPlayerC1EP15CMMAEMCResolver @ 53 NONAME
+	_ZN18CMMAEMCAudioPlayerC2EP15CMMAEMCResolver @ 54 NONAME
+	_ZN18CMMAEMCAudioPlayerD0Ev @ 55 NONAME
+	_ZN18CMMAEMCAudioPlayerD1Ev @ 56 NONAME
+	_ZN18CMMAEMCAudioPlayerD2Ev @ 57 NONAME
+	_ZN18CMMAVideoUrlPlayer10ConstructLERK7TDesC16 @ 58 NONAME
+	_ZN18CMMAVideoUrlPlayer11DeallocateLEv @ 59 NONAME
+	_ZN18CMMAVideoUrlPlayer11HandleEventERK9TMMFEvent @ 60 NONAME
+	_ZN18CMMAVideoUrlPlayer12GetMediaTimeEPx @ 61 NONAME
+	_ZN18CMMAVideoUrlPlayer5StopLEi @ 62 NONAME
+	_ZN18CMMAVideoUrlPlayer6CloseLEv @ 63 NONAME
+	_ZN18CMMAVideoUrlPlayer6StartLEv @ 64 NONAME
+	_ZN18CMMAVideoUrlPlayer8RealizeLEv @ 65 NONAME
+	_ZN18CMMAVideoUrlPlayer9PrefetchLEv @ 66 NONAME
+	_ZN18CMMAVideoUrlPlayerC1EP15CMMAMMFResolver @ 67 NONAME
+	_ZN18CMMAVideoUrlPlayerC2EP15CMMAMMFResolver @ 68 NONAME
+	_ZN18CMMAVideoUrlPlayerD0Ev @ 69 NONAME
+	_ZN18CMMAVideoUrlPlayerD1Ev @ 70 NONAME
+	_ZN18CMMAVideoUrlPlayerD2Ev @ 71 NONAME
+	_ZN20CMMAMMFPlayerFactory13CreatePlayerLEP29CMMFFormatSelectionParametersPK7TDesC16 @ 72 NONAME
+	_ZN20CMMAMMFPlayerFactory33PreparePluginSelectionParametersLEP15CMMAMMFResolverP29CMMFFormatSelectionParameters @ 73 NONAME
+	_ZN20CMMAMMFPlayerFactoryC2Ev @ 74 NONAME
+	_ZN20CMMAMMFPlayerFactoryD0Ev @ 75 NONAME
+	_ZN20CMMAMMFPlayerFactoryD1Ev @ 76 NONAME
+	_ZN20CMMAMMFPlayerFactoryD2Ev @ 77 NONAME
+	_ZN22CMMAAudioVolumeControl4NewLEP15CMMAAudioPlayer @ 78 NONAME
+	_ZN25CMMAEMCAudioVolumeControl11DoGetLevelLEv @ 79 NONAME
+	_ZN25CMMAEMCAudioVolumeControl11DoSetLevelLEi @ 80 NONAME
+	_ZN25CMMAEMCAudioVolumeControl4NewLER18CMMAEMCAudioPlayer @ 81 NONAME
+	_ZN25CMMAEMCAudioVolumeControlC1ER18CMMAEMCAudioPlayer @ 82 NONAME
+	_ZN25CMMAEMCAudioVolumeControlC2ER18CMMAEMCAudioPlayer @ 83 NONAME
+	_ZNK11CMMAControl15PublicClassNameEv @ 84 NONAME
+	_ZNK14CMMAMIDIPlayer10MidiClientEv @ 85 NONAME
+	_ZNK16CMMAVideoControl9ClassNameEv @ 86 NONAME
+	_ZTI10CMMAPlayer @ 87 NONAME
+	_ZTI11CMMAControl @ 88 NONAME
+	_ZTI13CTimeOutTimer @ 89 NONAME
+	_ZTI14CMMAMIDIPlayer @ 90 NONAME
+	_ZTI16CMMAVideoControl @ 91 NONAME
+	_ZTI17CMMAMMFPlayerBase @ 92 NONAME
+	_ZTI17CMMAStreamRequest @ 93 NONAME
+	_ZTI17CMMAVolumeControl @ 94 NONAME
+	_ZTI17MMAFunctionServer @ 95 NONAME
+	_ZTI18CHXMetaDataUtility @ 96 NONAME
+	_ZTI18CMMAVideoUrlPlayer @ 97 NONAME
+	_ZTI20CMMAMMFPlayerFactory @ 98 NONAME
+	_ZTI26CPlaybackCompletedCallback @ 99 NONAME
+	_ZTIN15CMMAMIDIControl23CChannelVolumeEventWaitE @ 100 NONAME
+	_ZTIN18CMMAVideoUrlPlayer26CMMAVideoUrlPlayerDelegateE @ 101 NONAME
+	_ZTIN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerClipStreamDelegateE @ 102 NONAME
+	_ZTIN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerLiveStreamDelegateE @ 103 NONAME
+	_ZTIN19CMMAStopTimeControl10CStopTimerE @ 104 NONAME
+	_ZTV10CMMAPlayer @ 105 NONAME
+	_ZTV11CMMAControl @ 106 NONAME
+	_ZTV13CTimeOutTimer @ 107 NONAME
+	_ZTV14CMMAMIDIPlayer @ 108 NONAME
+	_ZTV16CMMAVideoControl @ 109 NONAME
+	_ZTV17CMMAMMFPlayerBase @ 110 NONAME
+	_ZTV17CMMAStreamRequest @ 111 NONAME
+	_ZTV17CMMAVolumeControl @ 112 NONAME
+	_ZTV17MMAFunctionServer @ 113 NONAME
+	_ZTV18CHXMetaDataUtility @ 114 NONAME
+	_ZTV18CMMAVideoUrlPlayer @ 115 NONAME
+	_ZTV20CMMAMMFPlayerFactory @ 116 NONAME
+	_ZTV26CPlaybackCompletedCallback @ 117 NONAME
+	_ZTVN15CMMAMIDIControl23CChannelVolumeEventWaitE @ 118 NONAME
+	_ZTVN18CMMAVideoUrlPlayer26CMMAVideoUrlPlayerDelegateE @ 119 NONAME
+	_ZTVN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerClipStreamDelegateE @ 120 NONAME
+	_ZTVN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerLiveStreamDelegateE @ 121 NONAME
+	_ZTVN19CMMAStopTimeControl10CStopTimerE @ 122 NONAME
+	_ZThn160_N18CMMAVideoUrlPlayer11HandleEventERK9TMMFEvent @ 123 NONAME
+	_ZThn288_N15CMMAAudioPlayer21ErrorPlaybackCompleteEi @ 124 NONAME
+	_ZThn288_N15CMMAAudioPlayer23HandlePlaybackCompleteLEv @ 125 NONAME
+	_ZThn296_N15CMMAVideoPlayer10SourceSizeEv @ 126 NONAME
+	_ZThn296_N15CMMAVideoPlayer11SetDisplayLEP11MMMADisplay @ 127 NONAME
+	_ZThn296_N15CMMAVideoPlayer11SnapshoterLEv @ 128 NONAME
+	_ZThn296_N15CMMAVideoPlayer21NotifyWithStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 129 NONAME
+	_ZThn296_N18CMMAVideoUrlPlayerD0Ev @ 130 NONAME
+	_ZThn296_N18CMMAVideoUrlPlayerD1Ev @ 131 NONAME
+	_ZThn300_N15CMMAVideoPlayer13TakeSnapshotLEP14TRequestStatusRK5TSizeRK17CMMAImageSettings @ 132 NONAME
+	_ZThn300_N15CMMAVideoPlayer14SnapshotBitmapEv @ 133 NONAME
+	_ZThn300_N15CMMAVideoPlayer15SnapshotEncodedEv @ 134 NONAME
+	_ZThn300_N18CMMAVideoUrlPlayerD0Ev @ 135 NONAME
+	_ZThn300_N18CMMAVideoUrlPlayerD1Ev @ 136 NONAME
+	_ZThn4_N15CMMAVideoPlayer14ReadCompletedLEiRK6TDesC8 @ 137 NONAME
+	_ZThn4_N18CMMAEMCAudioPlayer14ReadCompletedLEiRK6TDesC8 @ 138 NONAME
+	_ZThn4_N18CMMAEMCAudioPlayerD0Ev @ 139 NONAME
+	_ZThn4_N18CMMAEMCAudioPlayerD1Ev @ 140 NONAME
+	_ZThn4_N18CMMAVideoUrlPlayerD0Ev @ 141 NONAME
+	_ZThn4_N18CMMAVideoUrlPlayerD1Ev @ 142 NONAME
+	_ZThn4_N20CMMAMMFPlayerFactoryD0Ev @ 143 NONAME
+	_ZThn4_N20CMMAMMFPlayerFactoryD1Ev @ 144 NONAME
+	_ZThn8_N16CMMAVideoControl13SnapshotReadyEv @ 145 NONAME
+	_ZThn8_N16CMMAVideoControlD0Ev @ 146 NONAME
+	_ZThn8_N16CMMAVideoControlD1Ev @ 147 NONAME
 
--- a/javauis/mmapi_qt/build/javamobilemedia.pro	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/build/javamobilemedia.pro	Thu Jul 22 16:31:34 2010 +0100
@@ -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/inc/cmmadcdisplay.h	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/directcontent/inc/cmmadcdisplay.h	Thu Jul 22 16:31:34 2010 +0100
@@ -48,13 +48,14 @@
      * @param aPlayer provides content
      */
     static CMMADCDisplay* NewLC(MMMAGuiPlayer* aPlayer,
-    MMAFunctionServer* aEventSource,
-    jobject aGUIObject);
-    virtual ~CMMADCDisplay();
+							    MMAFunctionServer* aEventSource,
+							    JNIEnv* aJni,
+							    jobject aGUIObject);
+							    virtual ~CMMADCDisplay();
 
 public: // From MMMADisplay
     void DrawFrameL(const CFbsBitmap* aBitmap);
-    void SetDisplaySizeL(const TSize& aSize);
+    //void SetDisplaySizeL(const TSize& aSize);
     void SetDisplayLocationL(const TPoint& aPosition);
     TPoint DisplayLocation();
     void SetFullScreenL(TBool aFullScreen);
--- a/javauis/mmapi_qt/directcontent/src/cmmadcdisplay.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/directcontent/src/cmmadcdisplay.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmmetadatacontrol.h	Thu Jul 22 16:31:34 2010 +0100
@@ -21,7 +21,7 @@
 #define CMMADRMMETADATACONTROL_H
 
 //  INCLUDES
-#include <mmfcontroller.h>
+#include <mmf/common/mmfcontroller.h>
 
 #include "cmmadrmaudioplayer.h"
 #include "cmmametadatacontrol.h"
--- a/javauis/mmapi_qt/volumekeys/src/cmmaforeground.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/volumekeys/src/cmmaforeground.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -63,7 +63,7 @@
          eikEnv->RemoveForegroundObserver(*this);
          LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() : eikEnv RemoveForegroundObserver -");
      }
-    */
+
     if (iEventPoster && iDeleteRefEvent)
     {
         iEventPoster->PostEvent(iDeleteRefEvent);
@@ -71,7 +71,8 @@
     else
     {
         delete iDeleteRefEvent;
-    }
+    }*/
+    //TODO MemoryLeak need to delete the above object.
     delete iForegroundEvent;
     delete iActiveScheduler;
     LOG(EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() - ");
--- a/javauis/mmapi_qt/volumekeys/src/cmmavolumekeyslistener.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/mmapi_qt/volumekeys/src/cmmavolumekeyslistener.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -63,11 +63,12 @@
          iJavaRemConManager = NULL;
      }
     */
+    /*
     if (NULL != iTimer)
     {
         iTimer->Cancel();
         delete iTimer;
-    }
+    }*/
     LOG(EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::~CMMAVolumeKeysListener() -");
 }
 
@@ -83,7 +84,8 @@
     iJavaRemConManager->SetObserverL(*iJavaRemConObserver);
     */
     // Timer for implementing Pressed/Released/Clicked feature.
-    iTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+    //TODO For Mediakey(Hard VolumeKey)
+    //iTimer = CPeriodic::NewL(CActive::EPriorityStandard);
 
     iListener = aListener;
     LOG(EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::ConstructL -");
--- a/javauis/nokiasound/src/cmidsound.cpp	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/nokiasound/src/cmidsound.cpp	Thu Jul 22 16:31:34 2010 +0100
@@ -201,8 +201,8 @@
 TInt CMIDSound::Play(TInt aLoop)
 {
     JELOG2(EJavaUI);
-    TInt err;
-    CallMethodL(err, this, &CMIDSound::DoPlay, aLoop, this);
+    TInt err = 0;
+    CallMethod(err, this, &CMIDSound::DoPlay, aLoop, this);
     return err;
 }
 
@@ -256,8 +256,8 @@
 TInt CMIDSound::SoundVolume()
 {
     JELOG2(EJavaUI);
-    TInt result;
-    CallMethodL(result, this, &CMIDSound::Volume, this);
+    TInt result = 0;
+    CallMethod(result, this, &CMIDSound::Volume, this);
     return result;
 }
 
@@ -289,8 +289,8 @@
 TInt CMIDSound::PlayerState()
 {
     JELOG2(EJavaUI);
-    TInt result;
-    CallMethodL(result, this, &CMIDSound::State, this);
+    TInt result = 0;
+    CallMethod(result, this, &CMIDSound::State, this);
     return result;
 }
 
--- a/javauis/runtimeui_qt/tsrc.s60/javasrc/com/nokia/mj/impl/rt/ui/qt/RuntimeUiQtTests.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/runtimeui_qt/tsrc.s60/javasrc/com/nokia/mj/impl/rt/ui/qt/RuntimeUiQtTests.java	Thu Jul 22 16:31:34 2010 +0100
@@ -82,7 +82,6 @@
 
     private void doTest(RuntimeUi runtimeUi)
     {
-        System.out.println("+doTest()");
         // error message with details -> make sure both are available to the user
         ExceptionBase exc = new ExceptionBase(
             new ShortErrorMessage(),
@@ -103,13 +102,6 @@
             null,
             0,
             null /* no params for detailed msg */);
-        System.out.println("3");
-
-        runtimeUi.error("MyApplication", exc);
-
-        // Test no crash happen.
-        runtimeUi.error("NullException", null);
-
 
         boolean answerAvailable = false;
 
@@ -130,6 +122,5 @@
         runtimeUi.confirm("Null Application", nullConf);
 
         runtimeUi.destroy();
-        System.out.println("-doTest()");
     }
 }
--- a/javauis/tsrc/fute/lcdui/Midp_Alert_01/build.xml	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/tsrc/fute/lcdui/Midp_Alert_01/build.xml	Thu Jul 22 16:31:34 2010 +0100
@@ -28,7 +28,7 @@
     <property name="midlet.permissions" value=""/>
     <property name="package.name" value="Midp_Alert_01"/>
     <property name="company.name" value="Nokia"/>
-    <property name="midlet.version" value="1.1"/>
+    <property name="midlet.version" value="1.2"/>
     <property name="midlet.description" value=""/>
 
     <!-- Get settings for a basic MIDlet. -->
--- a/javauis/tsrc/fute/lcdui/Midp_Alert_01/src/AlertTests.java	Tue Jun 22 09:54:11 2010 +0100
+++ b/javauis/tsrc/fute/lcdui/Midp_Alert_01/src/AlertTests.java	Thu Jul 22 16:31:34 2010 +0100
@@ -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)
         {
--- a/rom/java_2_1.iby	Tue Jun 22 09:54:11 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +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:
-* 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_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.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
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/java_2_2.iby	Thu Jul 22 16:31:34 2010 +0100
@@ -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	Tue Jun 22 09:54:11 2010 +0100
+++ b/rom/java_3_1.iby	Thu Jul 22 16:31:34 2010 +0100
@@ -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