# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284701301 -10800 # Node ID 4ad59aaee88214d469db96221b455cd8a76a984d # Parent 773449708c84a09f1ef8dcca5b29bbfacf6955e7 Revision: v2.2.13 Kit: 201037 diff -r 773449708c84 -r 4ad59aaee882 build/Makefile.defs --- a/build/Makefile.defs Thu Sep 02 20:20:40 2010 +0300 +++ b/build/Makefile.defs Fri Sep 17 08:28:21 2010 +0300 @@ -42,13 +42,17 @@ export JAVA_HOME=$(JAVA_6_HOME) ifeq ($(notdir $(basename $(SHELL))),sh) - # Cygwin definitions + # Cygwin & Linux definitions BATPREFIX = RMFILE = rm $(call PATHFIX, $(1)) RMFILES = $(RMFILE) CATCOMMAND = cat $(call PATHFIX, $(1)) PATHFIX = $(subst \,/,$(1)) - ANT := sh ant + ifeq ($(OS),Windows_NT) + ANT := sh ant + else + ANT := ant + endif SBS = MAKELEVEL=&&MAKEFLAGS=&&MFLAGS=&&sbs CPPCMD = gcc -E -x assembler-with-cpp -P -undef -w -traditional-cpp IFNOTEXIST = if [ ! -f $(1) ]; then $(2); fi @@ -245,10 +249,12 @@ generateconffiles: @echo Writing $(BUILDDEFINEFILE) ... \ $(shell $(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/generated_header.txt) > $(BUILDDEFINEFILE)) \ - $(shell echo #define RD_JAVA_VERSION $(JAVA_VERSION_) >> $(BUILDDEFINEFILE)) \ + $(shell echo #define RD_JAVA_VERSION $(JAVA_VERSION_)>> $(BUILDDEFINEFILE)) \ + $(shell echo #define RD_JAVA_BIN_VERSION_NONQT $(shell python $(JAVA_SRC_ROOT)/build/buildutils/ver2binver.py mmp $(JAVA_VERSION))>> $(BUILDDEFINEFILE)) \ $(foreach d, $(PROJECT_DEFINES), $(shell echo #define $d >> $(BUILDDEFINEFILE))) @echo Writing $(QBUILDDEFINEFILE) ... \ $(shell $(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/generated_header_hash.txt) > $(QBUILDDEFINEFILE)) \ + $(shell echo RD_JAVA_BIN_VERSION = $(shell python $(JAVA_SRC_ROOT)/build/buildutils/ver2binver.py qmake $(JAVA_VERSION))>> $(QBUILDDEFINEFILE)) \ $(shell echo PROJECT_DEFINES *= $(PROJECT_DEFINES) >> $(QBUILDDEFINEFILE)) @echo Writing $(JAVAVERSIONFILE) \ $(shell echo $(JAVA_VERSION)>$(JAVAVERSIONFILE)) diff -r 773449708c84 -r 4ad59aaee882 build/Makefile.project --- a/build/Makefile.project Thu Sep 02 20:20:40 2010 +0300 +++ b/build/Makefile.project Fri Sep 17 08:28:21 2010 +0300 @@ -49,6 +49,9 @@ # Use release written in file include $(RD_JAVA_S60_RELEASE_FILE) else + ifneq ($(wildcard $(addsuffix Symbianv4.sis,$(S60_STUBSIS_DIRS))),) + RD_JAVA_S60_RELEASE = 10.1 + else ifneq ($(wildcard $(addsuffix Series60v5.2.sis,$(S60_STUBSIS_DIRS))),) RD_JAVA_S60_RELEASE = 9.2 else @@ -63,6 +66,7 @@ endif endif endif + endif # Export the release info, so that no autodetermination is needed after this export RD_JAVA_S60_RELEASE endif @@ -184,6 +188,14 @@ PROJECT_DEFINES += RD_JAVA_PROXIMITY_LISTENER_ENABLED endif +# Java PIM Multiple Calendar exsist in 9.2 only(can not be used if 5.0 and for 10.1 as native support doesn't exsist) +ifdef RD_JAVA_S60_RELEASE_9_2 + RD_JAVA_PIM_MULTICAL_ENABLED = 1 +endif +ifdef RD_JAVA_PIM_MULTICAL_ENABLED + PROJECT_DEFINES += RD_JAVA_PIM_MULTICAL_ENABLED +endif + ifeq ($(OPENC_BETA_PATCH),1) PROJECT_DEFINES += RD_JAVA_OPENC_BETA_PATCH endif diff -r 773449708c84 -r 4ad59aaee882 build/buildutils/checkwarnings.py --- a/build/buildutils/checkwarnings.py Thu Sep 02 20:20:40 2010 +0300 +++ b/build/buildutils/checkwarnings.py Fri Sep 17 08:28:21 2010 +0300 @@ -25,17 +25,15 @@ # Counters for various warnings totalWarnings = 0 badOnes = 0 - deprecatedWarnings = 0 + pragmaWarnings = 0 compilerWarnings = 0 linkerWarnings = 0 postlinkerWarnings = 0 flmWarnings = 0 - # Constants for matching warnings related to deprecation - deprecatedStart = "warning: preprocessor #warning directive" - deprecatedSecondLine = "warning: #warning This header file" - deprecatedOptionalThirdLine = "warning: (included from:" - deprecatedOptionalRest = "warning: " + # Constants for matching pragma generated warnings + pragmaStart = "warning: preprocessor #warning directive" + pragmaOptionalRest = "warning: " # This list includes strings from which the BAD warnings can be recognized. # Note that these must be in lower case! @@ -61,7 +59,7 @@ print "" print "Details:" print " FLM warnings: ", self.flmWarnings - print " Use of deprecated api: ", self.deprecatedWarnings + print " Pragma warnings: ", self.pragmaWarnings print " Other compiler warnings: ", self.compilerWarnings print " Linker warnings: ", self.linkerWarnings print " Post-linker warnings: ", self.postlinkerWarnings @@ -71,7 +69,7 @@ class PrintSettings: """Class parsing and maintaining the printing settings related to warnings""" - printDeprecatedWarnings = False + printPragmaWarnings = False printCompilerWarnings = False printLinkerWarnings = False printFlmWarnings = False @@ -87,8 +85,8 @@ default=False, help="Prints compiler warnings") parser.add_option("--pl", dest="printlinkerwarnings", action="store_true", default=False, help="Prints linker warnings") - parser.add_option("--pd", dest="printdeprecatedwarnings", action="store_true", - default=False, help="Prints deprecation warnings") + parser.add_option("--pp", dest="printpragmawarnings", action="store_true", + default=False, help="Prints pragma warnings") parser.add_option("--pf", dest="printflmwarnings", action="store_true", default=False, help="Prints FLM warnings") (opts, args) = parser.parse_args() @@ -98,12 +96,12 @@ sys.exit(-1) if opts.printall: - self.printDeprecatedWarnings = True + self.printPragmaWarnings = True self.printCompilerWarnings = True self.printLinkerWarnings = True self.printFlmWarnings = True else: - self.printDeprecatedWarnings = opts.printdeprecatedwarnings + self.printPragmaWarnings = opts.printpragmawarnings self.printCompilerWarnings = opts.printcompilerwarnings self.printLinkerWarnings = opts.printlinkerwarnings self.printFlmWarnings = opts.printflmwarnings @@ -119,7 +117,7 @@ # should have always zero of them. The related log message strings are defined # in the variable badWarnings above. # -# The warnings are further categorized as deprecated API warnings, compiler +# The warnings are further categorized as pragma warnings, compiler # warnings, linker, and post-linker warnings. # def main(): @@ -168,12 +166,12 @@ # Looking for any warning related to the current target if state == 1: - # Check first for the start of a multiline deprecation warning - if wh.deprecatedStart in line: - if settings.printDeprecatedWarnings: + # Check first for the start of a multiline pragma warning + if wh.pragmaStart in line: + if settings.printPragmaWarnings: print underCompilation, print line, - wh.deprecatedWarnings += 1 + wh.pragmaWarnings += 1 wh.totalWarnings += 1 return 2 @@ -220,37 +218,17 @@ return 1 - # Looking for the second line of the multiline deprecation warning + # Looking for the optional trailing lines of the multiline pragma warning if state == 2: - if wh.deprecatedSecondLine in line: - if settings.printDeprecatedWarnings: + if wh.pragmaOptionalRest in line: + if settings.printPragmaWarnings: print line, - return 3 - else: - print "Missing second line" - return 1 - - # Looking for the optional third line of the multiline deprecation warning - if state == 3: - if wh.deprecatedOptionalThirdLine in line: - if settings.printDeprecatedWarnings: - print line, - return 4 - else: - # Hmm... went one line too far -> need to check the current line again - # but now in the state 1 - return stateMachine(1, line, underCompilation, settings, wh) - - # Looking for the optional trailing lines of the multiline deprecation warning - if state == 4: - if wh.deprecatedOptionalRest in line: - if settings.printDeprecatedWarnings: - print line, - return 4 + return 2 else: # Hmm... went one line too far -> need to check the current line again # but now in the state 1 return stateMachine(1, line, underCompilation, settings, wh) + # Looking for MAKEDEF detailed information lines if state == 5: diff -r 773449708c84 -r 4ad59aaee882 build/buildutils/distribution.policy.s60.configuration.txt --- a/build/buildutils/distribution.policy.s60.configuration.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/build/buildutils/distribution.policy.s60.configuration.txt Fri Sep 17 08:28:21 2010 +0300 @@ -16,9 +16,11 @@ /swt/internal : 7 /swt/expanded/internal : 7 /swt/mobile/internal : 7 +/nokiauiapi_qt/src/com/nokia/mid/ui/internal : 7 /internal : 1 /releng : 1 ROOT/tools : 1 +ROOT/jrt_info : 1 ROOT/javacommons/jvms/j9/s60 : 810 /midprms : 102 /webservices/javasrc : 102 diff -r 773449708c84 -r 4ad59aaee882 build/buildutils/ver2binver.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/buildutils/ver2binver.py Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,64 @@ +# +# 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: +# +# This script changes a JRT version to a binary version usable as +# Symbian mmp-file version or qmake's version. +# - each version part is cut to three digits, and then to 8 bits +# - qmake's version is taken as is, mmp's version is mangled as by qmake (the +# resulting version is the same in binaries). +# - major version is always 10 + +import sys, re + + +USAGE = "usage: %s [qmake|mmp] 1.2.3\n" % sys.argv[0] + +def main(): + try: + if len(sys.argv) != 3: + raise Exception(USAGE) + + mode, javaversion = sys.argv[1:] + + if mode != "qmake" and mode != "mmp": + raise Exception(USAGE) + + # Match version + parts = re.match(r"^(\d+)\.(\d+)\.(\d+)$", javaversion) + if not parts: + raise Exception(USAGE) + + # Change to integer + parts = [int(p) for p in parts.groups()] + + # Modulo 1000, 256 + parts = [(p % 1000) % 256 for p in parts] + + # Print according to type + if mode == "qmake": + print "%d.%d.%d" % (10, parts[1], parts[2]) + else: + print "%d.%d" % (10, (parts[1] << 8) + parts[2]) + + + except Exception, e: + sys.stderr.write(e.__str__()) + sys.exit(1) + + +if __name__ == "__main__": + main() + + diff -r 773449708c84 -r 4ad59aaee882 build/makefile --- a/build/makefile Thu Sep 02 20:20:40 2010 +0300 +++ b/build/makefile Fri Sep 17 08:28:21 2010 +0300 @@ -73,11 +73,21 @@ ifdef RD_JAVA_S60_RELEASE_9_2 prep: configure qmake endif +ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS +prep: pkgdefsetup +endif SYSDEF_TEMPLATE = $(JAVA_SRC_ROOT)/build/templates/$(RD_JAVA_S60_RELEASE).layers.sysdef.xml sysdefsetup: $(call CATCOMMAND,$(wildcard $(SYSDEF_TEMPLATE)))>$(JAVA_SRC_ROOT)/layers.sysdef.xml +pkgdefsetup: + $(call MKDIR, $(call PATHFIX, $(JAVA_SRC_ROOT)/jrt_info)) + $(call MKDIR, $(call PATHFIX, $(JAVA_SRC_ROOT)/jrt_info/nokia_jrt_metadata)) + $(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/pkgmap_template.xml)>$(JAVA_SRC_ROOT)/package_map.xml + $(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/pkgdef_template.xml)>$(JAVA_SRC_ROOT)/package_definition.xml + $(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/nokia_pkgdef_template.xml)>$(JAVA_SRC_ROOT)/jrt_info/nokia_jrt_metadata/package_definition.xml + # Cleaning java from top level cleans also the API jars clean_java: cleanapijars cleanapijars: diff -r 773449708c84 -r 4ad59aaee882 build/makefile.javaversion --- a/build/makefile.javaversion Thu Sep 02 20:20:40 2010 +0300 +++ b/build/makefile.javaversion Fri Sep 17 08:28:21 2010 +0300 @@ -1,2 +1,2 @@ # Set Java version (must be dot separated, without spaces) -JAVA_VERSION = 2.2.11 +JAVA_VERSION = 2.2.13 diff -r 773449708c84 -r 4ad59aaee882 build/omj.pri --- a/build/omj.pri Thu Sep 02 20:20:40 2010 +0300 +++ b/build/omj.pri Fri Sep 17 08:28:21 2010 +0300 @@ -132,8 +132,12 @@ MMP_RULES += " OS_LAYER_STDCPP_SYSTEMINCLUDE" } } + } + # Set version if not defined + isEmpty(VERSION):!isEmpty(RD_JAVA_BIN_VERSION): VERSION = $${RD_JAVA_BIN_VERSION} + # Define generated paths JXE_SOURCE_PATH = $${JAVA_ARTIFACTS} LOOKUP_SOURCE_PATH = $${JAVA_ARTIFACTS} diff -r 773449708c84 -r 4ad59aaee882 build/properties.xml --- a/build/properties.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/build/properties.xml Fri Sep 17 08:28:21 2010 +0300 @@ -12,7 +12,7 @@ # # Contributors: # -# Description: +# Description: # --> @@ -58,7 +58,7 @@ - + @@ -71,29 +71,33 @@ - - - + - - + - - + - + + + @@ -102,20 +106,20 @@ - - - - - @@ -124,14 +128,14 @@ - - + - @@ -144,19 +148,19 @@ - - - - @@ -166,7 +170,7 @@ - + @@ -183,10 +187,10 @@ - + - + @@ -243,7 +247,7 @@ @@ -255,7 +259,7 @@ define.target.cfg, set.s60.properties, set.linux.properties, - define.bootclasspath, + define.bootclasspath, init.component.properties, define.javasrc.path, define.jar.filename, @@ -275,7 +279,7 @@ - + @@ -304,14 +308,14 @@ - + - + diff -r 773449708c84 -r 4ad59aaee882 build/sis/java_2_0.pkg --- a/build/sis/java_2_0.pkg Thu Sep 02 20:20:40 2010 +0300 +++ b/build/sis/java_2_0.pkg Fri Sep 17 08:28:21 2010 +0300 @@ -393,6 +393,8 @@ "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\tckrunner.odc"-"c:\resource\java\jvm\lib\jrt\tckrunner.odc" "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javacontrolpanel.odc"-"c:\resource\java\jvm\lib\jrt\javacontrolpanel.odc" +"\epoc32\release\armv5\urel\javacentrep.dll"-"c:\sys\bin\javacentrep.dll" +"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javacentrep.odc"-"c:\resource\java\jvm\lib\jrt\javacentrep.odc" ; Misc dlls #ifdef RD_JAVA_S60_RELEASE_5_0_IAD @@ -403,7 +405,7 @@ ; Application Manager 2 plugin #ifndef RD_JAVA_S60_RELEASE_5_0_IAD "\epoc32\release\armv5\urel\appmngr2midletplugin.dll"-"c:\sys\bin\appmngr2midletplugin.dll" -"\epoc32\data\z\resource\plugins\appmngr2midletplugin.rsc"-"c:\resource\plugins\appmngr2midletplugin.rsc" +"\epoc32\data\z\resource\java\iad\appmngr2midletplugin.rsc"-"c:\resource\plugins\appmngr2midletplugin.rsc" "\epoc32\data\z\resource\java\javaapplicationsettings.r01"-"c:\resource\java\javaapplicationsettings.r01" "\epoc32\data\z\resource\java\javaapplicationsettings.r02"-"c:\resource\java\javaapplicationsettings.r02" "\epoc32\data\z\resource\java\javaapplicationsettings.r03"-"c:\resource\java\javaapplicationsettings.r03" @@ -517,8 +519,8 @@ ; resources -"\epoc32\data\z\resource\plugins\ifeui.rsc" -"c:\resource\plugins\ifeui.rsc" -"\epoc32\data\z\resource\plugins\javaappschemeplugin.rsc" -"c:\resource\plugins\javaappschemeplugin.rsc" +"\epoc32\data\z\resource\java\iad\ifeui.rsc" -"c:\resource\plugins\ifeui.rsc" +"\epoc32\data\z\resource\java\iad\javaappschemeplugin.rsc" -"c:\resource\plugins\javaappschemeplugin.rsc" "\epoc32\winscw\c\private\102033E6\installer\inst_plugins.cfg"-"c:\private\102033E6\installer\inst_plugins.cfg" "\epoc32\data\Z\Resource\versions\java.txt"-"c:\resource\versions\java.txt" #ifdef RD_JAVA_S60_RELEASE_5_0_IAD @@ -532,9 +534,9 @@ "\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\plugins\javaunicertstoreplugin.rsc" -"c:\resource\plugins\javaunicertstoreplugin.rsc" -"\epoc32\data\z\resource\plugins\midp2backupplugin.rsc"-"c:\resource\plugins\midp2backupplugin.rsc" +"\epoc32\data\z\resource\java\iad\javasidchecker.rsc" -"c:\resource\plugins\javasidchecker.rsc" +"\epoc32\data\z\resource\java\iad\javaunicertstoreplugin.rsc" -"c:\resource\plugins\javaunicertstoreplugin.rsc" +"\epoc32\data\z\resource\java\iad\midp2backupplugin.rsc"-"c:\resource\plugins\midp2backupplugin.rsc" #ifndef RD_JAVA_S60_RELEASE_5_0_IAD "\epoc32\data\z\resource\java\javausermessages.r01"-"c:\resource\java\javausermessages.r01" "\epoc32\data\z\resource\java\javausermessages.r02"-"c:\resource\java\javausermessages.r02" @@ -670,13 +672,13 @@ "\epoc32\release\armv5\urel\lcdgr.dll"-"c:\sys\bin\lcdgr.dll" "\epoc32\release\armv5\urel\lcdui.dll"-"c:\sys\bin\lcdui.dll" "\epoc32\release\armv5\urel\LCDC16MA.dll"-"c:\sys\bin\LCDC16MA.dll" -"\epoc32\data\z\resource\plugins\LCDC16MA.rsc"-"c:\resource\plugins\LCDC16MA.rsc" +"\epoc32\data\z\resource\java\iad\LCDC16MA.rsc"-"c:\resource\plugins\LCDC16MA.rsc" "\epoc32\release\armv5\urel\LCDC16MU.dll"-"c:\sys\bin\LCDC16MU.dll" -"\epoc32\data\z\resource\plugins\LCDC16MU.rsc"-"c:\resource\plugins\LCDC16MU.rsc" +"\epoc32\data\z\resource\java\iad\LCDC16MU.rsc"-"c:\resource\plugins\LCDC16MU.rsc" "\epoc32\release\armv5\urel\LCDC4K.dll"-"c:\sys\bin\LCDC4K.dll" -"\epoc32\data\z\resource\plugins\LCDC4K.rsc"-"c:\resource\plugins\LCDC4K.rsc" +"\epoc32\data\z\resource\java\iad\LCDC4K.rsc"-"c:\resource\plugins\LCDC4K.rsc" "\epoc32\release\armv5\urel\LCDC64K.dll"-"c:\sys\bin\LCDC64K.dll" -"\epoc32\data\z\resource\plugins\LCDC64K.rsc"-"c:\resource\plugins\LCDC64K.rsc" +"\epoc32\data\z\resource\java\iad\LCDC64K.rsc"-"c:\resource\plugins\LCDC64K.rsc" "\epoc32\release\armv5\urel\lcdgdrv.dll"-"c:\sys\bin\lcdgdrv.dll" "\epoc32\release\armv5\urel\lcdgdrvi.dll"-"c:\sys\bin\lcdgdrvi.dll" "\epoc32\release\armv5\urel\lcduiphysicswrap.dll"-"c:\sys\bin\lcduiphysicswrap.dll" @@ -806,6 +808,10 @@ "\epoc32\data\z\resource\java\eswtcore.rsc"-"c:\resource\java\eswtcore.rsc" +#ifndef RD_JAVA_S60_RELEASE_5_0_IAD +"\epoc32\release\armv5\urel\javaiconsizenotifplugin.dll"-"c:\sys\bin\javaiconsizenotifplugin.dll" +"\epoc32\data\z\resource\java\iad\javaiconsizenotifplugin.rsc"-"c:\resource\plugins\javaiconsizenotifplugin.rsc" +#endif // RD_JAVA_S60_RELEASE_5_0_IAD #ifdef RD_JAVA_S60_RELEASE_5_0_IAD @@ -828,8 +834,7 @@ "\epoc32\release\armv5\urel\javaappbackconverter.exe"-"c:\sys\bin\javaappbackconverter.exe", FR, RR, RW #endif // RD_JAVA_S60_RELEASE_5_0_IAD - #ifndef RD_JAVA_S60_RELEASE_5_0_IAD -"\epoc32\release\armv5\urel\javaiconsizenotifplugin.dll"-"c:\sys\bin\javaiconsizenotifplugin.dll" -"\epoc32\data\z\resource\plugins\javaiconsizenotifplugin.rsc"-"c:\resource\plugins\javaiconsizenotifplugin.rsc" +; javafinishjrtinstall is ran after Jrt 2.2 installation +"\epoc32\release\armv5\urel\javafinishjrtinstall.exe"-"c:\sys\bin\javafinishjrtinstall.exe", FR, RI, RW #endif // RD_JAVA_S60_RELEASE_5_0_IAD diff -r 773449708c84 -r 4ad59aaee882 build/sis/java_3_1.pkg --- a/build/sis/java_3_1.pkg Thu Sep 02 20:20:40 2010 +0300 +++ b/build/sis/java_3_1.pkg Fri Sep 17 08:28:21 2010 +0300 @@ -163,7 +163,8 @@ "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\tckrunner.odc"-"c:\resource\java\jvm\lib\jrt\tckrunner.odc" "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javacontrolpanel.odc"-"c:\resource\java\jvm\lib\jrt\javacontrolpanel.odc" - +"\epoc32\release\armv5\urel\javacentrep.dll"-"c:\sys\bin\javacentrep.dll" +"\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javacentrep.odc"-"c:\resource\java\jvm\lib\jrt\javacentrep.odc" ; Misc dlls @@ -227,10 +228,10 @@ "\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" +"\epoc32\data\z\resource\java\iad\javaunicertstoreplugin.rsc" -"c:\resource\plugins\javaunicertstoreplugin.rsc" +"\epoc32\data\z\resource\java\iad\midp2backupplugin.rsc"-"c:\resource\plugins\midp2backupplugin.rsc" #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK -"\epoc32\data\z\resource\plugins\javasifplugin.rsc"-"c:\resource\plugins\javasifplugin.rsc" +"\epoc32\data\z\resource\java\iad\javasifplugin.rsc"-"c:\resource\plugins\javasifplugin.rsc" #endif "\epoc32\data\z\resource\java\javausermessages.r01"-"c:\resource\java\javausermessages.r01" @@ -323,9 +324,6 @@ "\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\z\system\sounds\digital\CamcorderJavaCapture.wav"-"c:\System\Sounds\Digital\CamcorderJavaCapture.wav" diff -r 773449708c84 -r 4ad59aaee882 build/symbian_uids.pri --- a/build/symbian_uids.pri Thu Sep 02 20:20:40 2010 +0300 +++ b/build/symbian_uids.pri Fri Sep 17 08:28:21 2010 +0300 @@ -124,6 +124,8 @@ contains(TARGET, javacontrolpanel): TARGET.UID3 = 0x2002FF62 contains(TARGET, eswtqtwebkit): TARGET.UID3 = 0x2002FFA9 contains(TARGET, javaopengles): TARGET.UID3 = 0x20031DD1 +contains(TARGET, javacentrep): TARGET.UID3 = 0x2002DCE1 +contains(TARGET, javachapi): TARGET.UID3 = 0x2002DCE4 isEmpty(TARGET.UID3): error($${TEMPLATE} $${TARGET} : UID3 not defined. Please allocate UID3 and configure it either on $${TARGET}.pro file or in command symbian_uids.pri) diff -r 773449708c84 -r 4ad59aaee882 build/templates/nokia_pkgdef_template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/templates/nokia_pkgdef_template.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 773449708c84 -r 4ad59aaee882 build/templates/pkgdef_template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/templates/pkgdef_template.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 773449708c84 -r 4ad59aaee882 build/templates/pkgmap_template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/templates/pkgmap_template.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 773449708c84 -r 4ad59aaee882 build/unittest.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/unittest.properties Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ + + + +no.rommizing = true +no.collection.update = true diff -r 773449708c84 -r 4ad59aaee882 build/utilities.xml --- a/build/utilities.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/build/utilities.xml Fri Sep 17 08:28:21 2010 +0300 @@ -12,7 +12,7 @@ # # Contributors: # -# Description: +# Description: # --> @@ -24,27 +24,27 @@ APIs can use default values, but if some property is not suitable, it can be overridden. - java.src.paths The source path. If there are more than one source path + java.src.paths The source path. If there are more than one source path concatenate the paths using ':' as separator. Default is '../javasrc - java.src.second.paths The source path for the second phase compilation. - If there are more than one source path concatenate the + java.src.second.paths The source path for the second phase compilation. + If there are more than one source path concatenate the paths using ':' as separator. Default is '../javasrc.cdc bootclasspath The bootclasspath used for compile time. Default is CLDC - bootclasspath.second The bootclasspath used for the second phase + bootclasspath.second The bootclasspath used for the second phase compilation.. Default is CDC - native.dll.name The name of the dll (without extension) which will - contain the rommized byte code. The default value is the + native.dll.name The name of the dll (without extension) which will + contain the rommized byte code. The default value is the name of the ant project. - - + + Following properties are optionals: - javah.classnames A list of classes using ',' as separator to be + javah.classnames A list of classes using ',' as separator to be "javah"ed. --> @@ -52,12 +52,12 @@ - + @@ -78,26 +78,30 @@ - + - - + + + + + @@ -114,10 +118,10 @@ @@ -126,12 +130,12 @@ - - @@ -168,12 +172,12 @@ - - @@ -229,7 +233,7 @@ - + @@ -241,7 +245,7 @@ @@ -253,12 +257,12 @@ - + - @@ -292,7 +296,7 @@ @@ -304,20 +308,20 @@ - - - - + + @@ -370,7 +374,7 @@ - + @@ -380,7 +384,7 @@ - @@ -396,9 +400,9 @@ update="true"/> - @@ -411,9 +415,9 @@ /> - @@ -421,7 +425,7 @@ - + @@ -446,7 +450,7 @@ if they have changed, then they are copied into a directory that is included to the component's makefile --> - @@ -468,7 +472,7 @@ in order to include platform specific utility xml file.--> - @@ -518,8 +522,17 @@ + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -555,10 +613,10 @@ - - - - + + + + @@ -575,6 +633,7 @@ + diff -r 773449708c84 -r 4ad59aaee882 inc/build_defines.hrh --- a/inc/build_defines.hrh Thu Sep 02 20:20:40 2010 +0300 +++ b/inc/build_defines.hrh Fri Sep 17 08:28:21 2010 +0300 @@ -15,7 +15,8 @@ * */ -#define RD_JAVA_VERSION 2,2,11 +#define RD_JAVA_VERSION 2,2,13 +#define RD_JAVA_BIN_VERSION_NONQT 10.525 #define RD_JAVA_SYMBIAN_TARGET #define RD_JAVA_S60_RELEASE_10_1 #define RD_JAVA_S60_RELEASE_10_1_ONWARDS diff -r 773449708c84 -r 4ad59aaee882 inc/build_defines.pri --- a/inc/build_defines.pri Thu Sep 02 20:20:40 2010 +0300 +++ b/inc/build_defines.pri Fri Sep 17 08:28:21 2010 +0300 @@ -13,4 +13,5 @@ # # Description: Generated file - do not edit manually # +RD_JAVA_BIN_VERSION = 10.2.13 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 diff -r 773449708c84 -r 4ad59aaee882 inc/java.txt --- a/inc/java.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/inc/java.txt Fri Sep 17 08:28:21 2010 +0300 @@ -1,1 +1,1 @@ -2.2.11 +2.2.13 diff -r 773449708c84 -r 4ad59aaee882 javacommons/fileutils/build/javafileutils.pro --- a/javacommons/fileutils/build/javafileutils.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/fileutils/build/javafileutils.pro Fri Sep 17 08:28:21 2010 +0300 @@ -19,7 +19,7 @@ CONFIG += omj java staticdata stl CONFIG -= qt -symbian : LIBS += -lefsrv -lPlatformEnv -lcaf +symbian : LIBS += -lefsrv -lplatformenv -lcaf LIBS+= -ljavautils -ljavacomms diff -r 773449708c84 -r 4ad59aaee882 javacommons/gcfprotocols/file/build/javafile.pro --- a/javacommons/gcfprotocols/file/build/javafile.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/gcfprotocols/file/build/javafile.pro Fri Sep 17 08:28:21 2010 +0300 @@ -20,7 +20,7 @@ CONFIG -= qt symbian { - LIBS+= -leuser -lefsrv -lPlatformEnv + LIBS+= -leuser -lefsrv -lplatformenv } include(../../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javacommons/gcfprotocols/socket/socket/inc/apnsettings.h --- a/javacommons/gcfprotocols/socket/socket/inc/apnsettings.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/inc/apnsettings.h Fri Sep 17 08:28:21 2010 +0300 @@ -27,7 +27,8 @@ public : static int setDefaultApn(int aType, int aApn); - + static void removeDefaultApn(); + static int retryConnection(int aErrCode,int aType, int aApn); }; diff -r 773449708c84 -r 4ad59aaee882 javacommons/gcfprotocols/socket/socket/src.s60/apnsettings.cpp --- a/javacommons/gcfprotocols/socket/socket/src.s60/apnsettings.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/src.s60/apnsettings.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -66,4 +66,29 @@ return def; } - +void ApnSettings::removeDefaultApn() +{ + #ifdef RD_JAVA_OPENC_BETA_PATCH + setdefaultif(0); + ILOG(ESOCKET, "sedefaultif called"); + ILOG1(ESOCKET, "remove default apn returned %d",setdefaultif(NULL)); + #endif +} +int ApnSettings::retryConnection(int aErrCode, int aType, int aApn) +{ + if ( aErrCode > __EMAXERRNO ) + { + // errno out of range, check for KErrNotReady + int errCode = -(aErrCode - __EMAXERRNO); + ELOG1(ESOCKET,"ApnSettings:: retryConnection symbian error : %d" , errCode); + if( (errCode == KErrNotReady) && (aType == 2) ) + { + // call reset and setDefaultif() again to make a new conn and use + ApnSettings::removeDefaultApn(); + int ret = ApnSettings::setDefaultApn(aType,aApn); + return ret; + } + } + return -(aErrCode); + +} diff -r 773449708c84 -r 4ad59aaee882 javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp --- a/javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -187,7 +187,24 @@ struct hostent* hp = gethostbyname(mHost); if (hp == NULL) { - return -(h_errno); + //error condition, we have to handle -18 error. + ELOG1(ESOCKET,"NativeSocketConnection:: gthostbyname error : %d" , h_errno); + int tmp = ApnSettings::retryConnection(h_errno,aType,aApn); + if(tmp == 0) + { + // connection reset done, attempt once again + hp = gethostbyname(mHost); + if(hp == NULL) + { + return -(h_errno); + } + } + else + { + // retry not supported/failed + return tmp; + + } } addr.sin_addr.s_addr = ((struct in_addr*)(hp->h_addr))->s_addr; } diff -r 773449708c84 -r 4ad59aaee882 javacommons/javaenv/build/javaenv.pro --- a/javacommons/javaenv/build/javaenv.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/javaenv/build/javaenv.pro Fri Sep 17 08:28:21 2010 +0300 @@ -23,7 +23,7 @@ TARGET.UID2 = 0x1000008d TARGET.UID3 = 0x2001B2A5 SOURCES += ../src.s60/*.cpp - LIBS += -lplatformEnv -lefsrv + LIBS += -lplatformenv -lefsrv } include(../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/msa_manufacturer.txt --- a/javacommons/security/data/msa_manufacturer.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/msa_manufacturer.txt Fri Sep 17 08:28:21 2010 +0300 @@ -31,6 +31,12 @@ permission javax.microedition.io.Connector.rtsp "*"; permission javax.microedition.PropertyPermission "mobinfo.imsi" "read"; permission javax.microedition.midlet.CmdLineArgsPermission; + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } grant assigned { diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/msa_operator.txt --- a/javacommons/security/data/msa_operator.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/msa_operator.txt Fri Sep 17 08:28:21 2010 +0300 @@ -31,6 +31,12 @@ permission javax.microedition.io.Connector.rtsp "*"; permission javax.microedition.PropertyPermission "mobinfo.imsi" "read"; permission javax.microedition.midlet.CmdLineArgsPermission; + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } grant assigned { diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/msa_trustedthirdparty.txt --- a/javacommons/security/data/msa_trustedthirdparty.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/msa_trustedthirdparty.txt Fri Sep 17 08:28:21 2010 +0300 @@ -66,11 +66,21 @@ permission javax.microedition.midlet.CmdLineArgsPermission; } +grant user "NFC Write Access" session,blanket,oneshot,no { + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; +} + grant allowed { permission javax.microedition.io.Connector.sms "sms://*" "open,receive"; permission javax.microedition.io.Connector.mms "mms://*" "open,receive"; permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } + grant assigned "Location" { permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/msa_untrusted.txt --- a/javacommons/security/data/msa_untrusted.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/msa_untrusted.txt Fri Sep 17 08:28:21 2010 +0300 @@ -55,11 +55,21 @@ permission javax.microedition.location.LocationPermission "landmarks://*" "read,write,category,management"; } +grant user "NFC Write Access" oneshot,session,no { + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; +} + grant allowed { permission javax.microedition.io.Connector.sms "sms://*" "open,receive"; permission javax.microedition.io.Connector.mms "mms://*" "open,receive"; permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } + grant assigned "Location" { permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/s60_manufacturer.txt --- a/javacommons/security/data/s60_manufacturer.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/s60_manufacturer.txt Fri Sep 17 08:28:21 2010 +0300 @@ -31,6 +31,12 @@ permission javax.microedition.io.Connector.rtsp "*"; permission javax.microedition.PropertyPermission "mobinfo.imsi" "read"; permission javax.microedition.midlet.CmdLineArgsPermission; + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } grant assigned { diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/s60_operator.txt --- a/javacommons/security/data/s60_operator.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/s60_operator.txt Fri Sep 17 08:28:21 2010 +0300 @@ -31,6 +31,12 @@ permission javax.microedition.io.Connector.rtsp "*"; permission javax.microedition.PropertyPermission "mobinfo.imsi" "read"; permission javax.microedition.midlet.CmdLineArgsPermission; + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } grant assigned { diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/s60_trustedthirdparty.txt --- a/javacommons/security/data/s60_trustedthirdparty.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/s60_trustedthirdparty.txt Fri Sep 17 08:28:21 2010 +0300 @@ -67,10 +67,19 @@ permission javax.microedition.midlet.CmdLineArgsPermission; } +grant user "NFC Write Access" session,blanket,oneshot,no { + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; +} + grant allowed { permission javax.microedition.io.Connector.sms "sms://*" "open,receive"; permission javax.microedition.io.Connector.mms "mms://*" "open,receive"; permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } grant assigned "Location" { diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/data/s60_untrusted.txt --- a/javacommons/security/data/s60_untrusted.txt Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/data/s60_untrusted.txt Fri Sep 17 08:28:21 2010 +0300 @@ -55,10 +55,19 @@ permission javax.microedition.location.LocationPermission "landmarks://*" "read,write,category,management"; } +grant user "NFC Write Access" oneshot,session,no { + permission javax.microedition.contactless.ndef.NDEFTagConnection.write "ndef://*" "write"; +} + grant allowed { permission javax.microedition.io.Connector.sms "sms://*" "open,receive"; permission javax.microedition.io.Connector.mms "mms://*" "open,receive"; permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive"; + permission javax.microedition.contactless.DiscoveryManager "DiscoveryManager" "get_instance"; + permission javax.microedition.io.Connector.ndef "ndef://*" "open"; + permission javax.microedition.io.Connector.rf "rf://*" "open"; + permission javax.microedition.io.Connector.sc "sc://*" "open"; + permission javax.microedition.io.Connector.vtag "vtag://*" "open"; } grant assigned "Location" { diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java --- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java Fri Sep 17 08:28:21 2010 +0300 @@ -178,22 +178,22 @@ "com.nokia.mj.impl.properties.mobinfo.MobileInfoPermission", "*", "read")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.contactless.ndef.NDEFTagConnection.write", new MIDPPermission( - "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "ndef://*", "write")); + "com.nokia.mj.impl.nfc.utils.ContactlessCommunicationPermission", "ndef://*", "write")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.contactless.DiscoveryManager", new MIDPPermission( - "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "discoveryManager", "get_instance")); + "com.nokia.mj.impl.nfc.utils.ContactlessCommunicationPermission", "DiscoveryManager", "get_instance")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.io.Connector.ndef", new MIDPPermission( - "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "ndef://*", "open")); + "com.nokia.mj.impl.nfc.utils.ContactlessCommunicationPermission", "ndef://*", "open")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.io.Connector.rf", new MIDPPermission( - "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "rf://*", "open")); + "com.nokia.mj.impl.nfc.utils.ContactlessCommunicationPermission", "rf://*", "open")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.io.Connector.sc", new MIDPPermission( - "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "sc://*", "open")); + "com.nokia.mj.impl.nfc.utils.ContactlessCommunicationPermission", "sc://*", "open")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.io.Connector.vtag", new MIDPPermission( - "com.nokia.mj.impl.ccapi.utils.ContactlessCommunicationPermission", "vtag://*", "open")); + "com.nokia.mj.impl.nfc.utils.ContactlessCommunicationPermission", "vtag://*", "open")); PERMISSION_MAPPING_TABLE.put( "javax.microedition.io.SocketProtocolPermission", new MIDPPermission( "com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl", "socket://*")); diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro --- a/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro Fri Sep 17 08:28:21 2010 +0300 @@ -35,6 +35,10 @@ MMP_RULES += "TARGETPATH /resource/plugins" MMP_RULES += "TARGET javaunicertstoreplugin.rsc" MMP_RULES += "END" + MMP_RULES += "START RESOURCE 200213A3_iad.rss" + MMP_RULES += "TARGETPATH /resource/java/iad" + MMP_RULES += "TARGET javaunicertstoreplugin.rsc" + MMP_RULES += "END" MMP_RULES += "START RESOURCE ../data/javausermessages.rss" MMP_RULES += "HEADER" MMP_RULES += "TARGETPATH /resource/java" diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss --- a/javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss Fri Sep 17 08:28:21 2010 +0300 @@ -24,6 +24,10 @@ // Some defines of useful values for attributes to simplify // writing resource files +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 1 +#endif + // True #define CT_TRUE 1,0,0,0 // False @@ -57,7 +61,7 @@ BINARY_IMPLEMENTATION_INFO { implementation_uid = 0x200213A3; - version_no = 1; + version_no = ECOM_VERSION_NO; display_name = "Java Certificate store"; default_data = { CT_CERT_STORE, CT_WRITEABLE_CERT_STORE }; opaque_data = { CT_SOFTWARE, CT_TRUE, diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/javaunicertstoreplugin/src.s60/200213A3_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/security/javaunicertstoreplugin/src.s60/200213A3_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 2 + +// Include actual rss +#include "200213A3.rss" + diff -r 773449708c84 -r 4ad59aaee882 javacommons/security/src/midpauthenticationmoduleimpl.cpp --- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -535,9 +535,16 @@ } // compute the root hash value if requested - if (x509_ctx->current_issuer != NULL) + if (x509_ctx->chain != NULL) { - sprintf(root_hash,"%08lX",X509_issuer_name_hash(x509_ctx->current_issuer)); + X509* root = sk_X509_value(x509_ctx->chain,sk_X509_num(x509_ctx->chain) - 1); + if (root != NULL) + { + sprintf(root_hash,"%08lX",X509_issuer_name_hash(root)); + // no need to free the root explicitly since it will be + // freed when freeing all the roots from roots_certs_st + // stack + } } // add the '\0' root_hash[MD5_DIGEST_LEN] = '\0'; diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/build/javautils.pro --- a/javacommons/utils/build/javautils.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/build/javautils.pro Fri Sep 17 08:28:21 2010 +0300 @@ -37,7 +37,7 @@ ../src.s60/*.cpp \ LIBS += -lflogger -lplatformver -lsysversioninfo -lsysutil -lbafl \ - -lefsrv -ljavaenvinfo -lhal -llibcrypto -lcommonengine -lplatformenv + -lefsrv -ljavaenvinfo -lhal -llibcrypto -lCommonEngine -lplatformenv !contains(PROJECT_DEFINES,RD_JAVA_UI_QT) { LIBS += -lavkon diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh Fri Sep 17 08:28:21 2010 +0300 @@ -59,5 +59,10 @@ OS_LAYER_STDCPP_SYSTEMINCLUDE LIBRARY libstdcpp.lib #endif +#ifndef RD_JAVA_NO_BIN_VERSION +#ifdef RD_JAVA_BIN_VERSION_NONQT + VERSION RD_JAVA_BIN_VERSION_NONQT +#endif +#endif #endif // JAVA_STDCPP_SUPPORT_FOR_DLL_HRH diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/inc.s60/java_stdcpp_support_for_exe.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_exe.hrh Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_exe.hrh Fri Sep 17 08:28:21 2010 +0300 @@ -55,5 +55,10 @@ OS_LAYER_STDCPP_SYSTEMINCLUDE LIBRARY libstdcpp.lib #endif +#ifndef RD_JAVA_NO_BIN_VERSION +#ifdef RD_JAVA_BIN_VERSION_NONQT + VERSION RD_JAVA_BIN_VERSION_NONQT +#endif +#endif #endif // JAVA_STDCPP_SUPPORT_FOR_DLL_HRH diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/inc.s60/java_stdcpp_support_for_stddll.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_stddll.hrh Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_stddll.hrh Fri Sep 17 08:28:21 2010 +0300 @@ -51,5 +51,10 @@ OS_LAYER_STDCPP_SYSTEMINCLUDE LIBRARY libstdcpp.lib #endif +#ifndef RD_JAVA_NO_BIN_VERSION +#ifdef RD_JAVA_BIN_VERSION_NONQT + VERSION RD_JAVA_BIN_VERSION_NONQT +#endif +#endif #endif // JAVA_STDCPP_SUPPORT_FOR_DLL_HRH diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/inc.s60/java_stdcpp_support_for_stdexe.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_stdexe.hrh Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_stdexe.hrh Fri Sep 17 08:28:21 2010 +0300 @@ -52,5 +52,10 @@ OS_LAYER_STDCPP_SYSTEMINCLUDE LIBRARY libstdcpp.lib #endif +#ifndef RD_JAVA_NO_BIN_VERSION +#ifdef RD_JAVA_BIN_VERSION_NONQT + VERSION RD_JAVA_BIN_VERSION_NONQT +#endif +#endif #endif // JAVA_STDCPP_SUPPORT_FOR_DLL_HRH diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/inc/logger.h --- a/javacommons/utils/inc/logger.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/inc/logger.h Fri Sep 17 08:28:21 2010 +0300 @@ -118,6 +118,7 @@ EJavaAMMS, // =37 EJavaSettings, // =38 EJavaQtServiceApp, // =39 + EJavaCentrep // =40 // add id of new components here }; @@ -177,6 +178,7 @@ {"JavaMMAPI.log", "[ MMAPPI ]"}, // EJavaAMMS {"JavaSettings.log", "[ JavaSettings ]"}, // EJavaSettings {"JavaQtServiceApp.log", "[ QtServiceApp ]"}, // EJavaQtServiceApp + {"JavaCentrep.log", "[ JavaCentrep ]"}, // EJavaCentrep // add new component file name and nickname here }; diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/javasrc/com/nokia/mj/impl/coreui/CoreUi.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/coreui/CoreUi.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/coreui/CoreUi.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -19,6 +19,7 @@ import java.util.Hashtable; +import com.nokia.mj.impl.utils.Logger; import com.nokia.mj.impl.utils.Uid; /** @@ -49,10 +50,12 @@ Class clazz = Class.forName(className); sInstance = (CoreUi)clazz.newInstance(); } - catch (Exception e) + catch (Throwable t) { - throw new RuntimeException("Not able to instantiate class " + - className+". Reason is: " + e); + String err = "Not able to instantiate class " + + className+". Reason is: "; + Logger.LOG(Logger.EJavaUI, Logger.EInfo, err, t); + throw new RuntimeException(err + t); } } } @@ -78,13 +81,18 @@ /** * For creating the UI from Java side. This is meant for the pre-warmed * VM use case. Calling this method will lead creation of the CoreUI. - * @param uid The UID of the application. + * @param uid The UID of the application. If null NullPointerException + * will be thrown. * @param backGroundStart Should the UI be put into background. */ public static void createUi(Uid uid, boolean backGroundStart) { if (sInstance != null) { + if (uid == null) + { + throw new NullPointerException("Null UID when creating UI"); + } sInstance.createUiImpl(uid, backGroundStart); } } @@ -125,9 +133,18 @@ return fg; } + public static void hideApplication(boolean hide) + { + if (sInstance != null) + { + sInstance.hideApplicationImpl(hide); + } + } + protected abstract boolean connectToUiImpl(); protected abstract void createUiImpl(Uid uid, boolean backGroundStart); protected abstract void shutdownRequestImpl(); protected abstract void foregroundRequestImpl(); protected abstract boolean isUiInForegroundImpl(); + protected abstract void hideApplicationImpl(boolean hide); } diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,13 +11,16 @@ * * Contributors: * -* Description: ?Description +* Description: * */ package com.nokia.mj.impl.utils; +import java.io.PrintStream; +import java.io.ByteArrayOutputStream; + import com.nokia.mj.impl.rt.support.Jvm; import com.nokia.mj.impl.utils.Logger; @@ -54,6 +57,19 @@ _closeThreadDumper(); } + public static String getStackTrace(Throwable t) + { + if (t == null) + { + throw new NullPointerException("Null when getting stack trace"); + } + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + _getStackTrace(t, new PrintStream(baos)); + return baos.toString(); + } + + private static native void _getStackTrace(Throwable t, PrintStream printStream); + private static native void _doThreadDump(); private static native void _closeThreadDumper(); } diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Fri Sep 17 08:28:21 2010 +0300 @@ -48,9 +48,10 @@ * *
* Limitation: more than 10 positional arguments are not supported (only 0...9) - * - * @author Nokia Corporation - * @version 1.0 + *
+ * Note that Formatter supports Avkon and Qt based localisation. + * Text parameter indices start from 0 when Avkon is used and from 1 + * when Qt is used. */ public class Formatter { @@ -60,8 +61,19 @@ /** String with latest replacements */ private String replaced; + /** + * Platform localisation type. + * Either ResourceLoader.AVKON or ResourceLoader.QT. */ + private final int locType; + + /** + * The first text parameter replacement index. For Avkon based + * localisation this is 0, for Qt based localisation this is 1. + */ + private final int startIndex; + /** Next replacement index */ - private int nextIndex = (ResourceLoader.getLocaleIdQt() == null? 0: 1); + private int nextIndex; /*** ----------------------------- PUBLIC ------------------------------ */ @@ -72,8 +84,22 @@ */ Formatter(String aPattern) { + this(aPattern, ResourceLoader.AVKON); + } + + /** + * Create a new formatter + * + * @param pattern formatter pattern + * @param aLocType platform localisation type + */ + Formatter(String aPattern, int aLocType) + { pattern = aPattern; replaced = aPattern; + locType = aLocType; + startIndex = (locType == ResourceLoader.QT? 1: 0); + nextIndex = startIndex; } /** @@ -215,24 +241,12 @@ // Reset for next usage replaced = pattern; - nextIndex = (ResourceLoader.getLocaleIdQt() == null? 0: 1); + nextIndex = startIndex; return result; } /** - * Gets a clone of this formatter. This can be used for caching preparsed - * Formatters. - * - * @return clone of the formatter, as if new Formatter were created with - * same pattern as current one. - */ - public Formatter getClone() - { - return new Formatter(pattern); - } - - /** * Formats localised text with specified parameters from an array. * * Note that the arg().arg().toString() is preferred method of @@ -268,11 +282,11 @@ return toString(); } /** - * Applies convertion from european digits into arabic-indic digits + * 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 + * @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) @@ -383,7 +397,7 @@ * based on existing language settings * * @param str String which might contain european digits - * @return A string identical with the provided string but with the + * @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); diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java Fri Sep 17 08:28:21 2010 +0300 @@ -82,6 +82,7 @@ public static final int EJavaBroadcast = 36; public static final int EJavaAMMS = 37; public static final int EJavaSettings = 38; + public static final int EJavaCentrep = 40; // add name of new components here @@ -140,6 +141,7 @@ false, //EJavaBroadcast = 36; false, //EJavaAMMS = 37; false, //EJavaSettings = 38; + false //EJavaCentrep = 40; // add new components here }; diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java Fri Sep 17 08:28:21 2010 +0300 @@ -34,9 +34,6 @@ * Label noteLabel = createLabel( * res.string("note"), horizontalSpan, labelStyle); * - * - * @author Nokia Corporation - * @version 1.0 */ public class ResourceLoader { @@ -67,8 +64,11 @@ String qtFileName, String qtPrefix) { - // Avkon name prefix pair is used as key and this is same between platforms. - String key = avkonFileName + ":" + avkonPrefix; + // Construct key from filenames and prefixes, this is the same + // between platforms. + String key = (new StringBuffer()).append(avkonFileName).append(":") + .append(avkonPrefix).append(":").append(qtFileName).append(":") + .append(qtPrefix).toString(); ResourceLoader result = (ResourceLoader)resourceLoaders.get(key); if (result == null) @@ -146,6 +146,7 @@ */ public ResourceLoader(String resourceName, String aPrefix) { + locType = AVKON; prefix = aPrefix; loadFile(resourceName, true); // Avkon } @@ -159,7 +160,7 @@ */ public Formatter format(String id) { - return new Formatter(string(id)); + return new Formatter(string(id), locType); } /** @@ -174,11 +175,11 @@ { if (locType == AVKON) { - return new Formatter(string(avkonId)); + return new Formatter(string(avkonId), locType); } else { - return new Formatter(string(qtId)); + return new Formatter(string(qtId), locType); } } @@ -195,11 +196,11 @@ { if (locType == AVKON) { - return new Formatter(string(avkonId)).format(textParameters); + return new Formatter(string(avkonId), locType).format(textParameters); } else { - return new Formatter(string(qtId)).format(textParameters); + return new Formatter(string(qtId), locType).format(textParameters); } } @@ -212,7 +213,7 @@ */ public Formatter format(Id id) { - return new Formatter(id.getString(locType)); + return new Formatter(id.getString(locType), locType); } /** @@ -225,7 +226,7 @@ */ public String format(String id, Object[] textParameters) { - return new Formatter(string(id)).format(textParameters); + return new Formatter(string(id), locType).format(textParameters); } /** @@ -238,7 +239,7 @@ */ public String format(Id id, Object[] textParameters) { - return new Formatter(string(id.getString(locType))).format(textParameters); + return new Formatter(string(id.getString(locType)), locType).format(textParameters); } @@ -331,13 +332,13 @@ if (!avkon) // Qt resources. { 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 + "_" + langName + ".loc"); diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/javasrc/com/nokia/mj/impl/utils/Version.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Version.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Version.java Fri Sep 17 08:28:21 2010 +0300 @@ -58,7 +58,12 @@ { return null; } - String str = aStr.trim(); + // Remove all invalid characters from string + String str = normalizeVersion(aStr); + if (str.length() == 0) + { + return null; + } int major = 0; int minor = 0; @@ -232,4 +237,23 @@ } return buf.toString(); } + + /** + * Remove the illegal characters from version string, + * for example "1.1 rev.2" becomes "1.1.2" + */ + private static String normalizeVersion(String aString) + { + StringBuffer buf = new StringBuffer(); + int len = aString.length(); + for (int ind = 0; ind < len; ind++) + { + char ch = aString.charAt(ind); + if ((ch == '.') || Character.isDigit(ch)) + { + buf.append(ch); + } + } + return buf.toString(); + } } diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/src/debugutils.cpp --- a/javacommons/utils/src/debugutils.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/src/debugutils.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -39,3 +39,28 @@ ThreadDump::closeDumper(); } +/** + * A utility for getting the stack trace for further processing. + * @param th The throwable from where the stack trace should be get. + * @param printStream Where to print the stack trace. + */ +JNIEXPORT void JNICALL +Java_com_nokia_mj_impl_utils_DebugUtils__1getStackTrace +(JNIEnv* jniEnv, jclass, jthrowable th, jobject printStream) +{ + /* + * call Throwable.printStackTrace(java.io.PrintStream) + * this method is not part of CLDC spec, but it's supported by VM vendor. + */ + jclass classThrowable = jniEnv->GetObjectClass(th); + if (classThrowable) + { + jmethodID methodId = jniEnv->GetMethodID(classThrowable, + "printStackTrace", + "(Ljava/io/PrintStream;)V"); + if (methodId) + { + jniEnv->CallVoidMethod(th, methodId, printStream); + } + } +} diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/src/javacommonutils.cpp --- a/javacommons/utils/src/javacommonutils.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/src/javacommonutils.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -285,7 +285,8 @@ std::string result; result.insert(0, bptr->data, bptr->length); BIO_free_all(b64); - + CRYPTO_cleanup_all_ex_data(); + return result; } @@ -313,7 +314,8 @@ result.push_back((wchar_t)*(bptr->data + i)); } BIO_free_all(b64); - + CRYPTO_cleanup_all_ex_data(); + return result; } @@ -338,7 +340,8 @@ BIO_free_all(bmem); delete[] buf; - + CRYPTO_cleanup_all_ex_data(); + return result; } diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/build/java/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/utils/tsrc/build/java/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,51 @@ + + + + + + + + + + + + Running BufferedReaderTests + + + + + Running ConcurrencyTests + + + + + Running SystemPropertyTests + + + + + Running DebugUtilsTests tests + + + + + + + + diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/build/java/dummy.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/utils/tsrc/build/java/dummy.pro Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,18 @@ +# +# 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: A dummy pro file for generating a Jar file. Keeping +# build system happy. +# + +TEMPLATE = subdirs diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/build/native/exports.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/utils/tsrc/build/native/exports.inf Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: +* +*/ + +PRJ_EXPORTS + +#include "../../../../inc/build_defines.hrh" +#ifdef RD_JAVA_SYMBIAN_TARGET +../../tst.bat /epoc32/winscw/c/tst.bat +#endif // RD_JAVA_SYMBIAN_TARGET diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/build/native/testjavautils.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/utils/tsrc/build/native/testjavautils.pro Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,37 @@ +# +# 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: +# + +TEMPLATE=app +TARGET=testjavautils +CONFIG += omj no_icon stl +CONFIG -= qt + +LIBS += -lCppUTest + +INCLUDEPATH += ../../../../../tools/cpputest/include/CppUTest + +INCLUDEPATH += ../../../../../tools/cpputest/include/Platforms/Symbian +INCLUDEPATH += ../testcoreui/src +TARGET.CAPABILITY = all -tcb + +#SOURCES += ../../src/SymbianAllTests.cpp +SOURCES += ../../src/AllTests.cpp +SOURCES += ../../src/uidtests.cpp +SOURCES += ../../src/testbase64.cpp +SOURCES += ../../src/testlanguageresource.cpp +SOURCES += ../../src/testoslayer.cpp + +include(../../../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/rt/SystemPropertyTests.java --- a/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/rt/SystemPropertyTests.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/rt/SystemPropertyTests.java Fri Sep 17 08:28:21 2010 +0300 @@ -19,7 +19,7 @@ package com.nokia.mj.impl.rt; -import com.nokia.mj.impl.installer.utils.InstallerMain; +import com.nokia.mj.impl.rt.test.UnitTestSuiteCreator; import com.nokia.mj.impl.rt.support.JvmInternal; import j2meunit.framework.Test; @@ -30,11 +30,11 @@ /** * SystemProperty unit tests. */ -public class SystemPropertyTests extends TestCase implements InstallerMain +public class SystemPropertyTests extends TestCase implements UnitTestSuiteCreator { // Begin j2meunit test framework setup - public void installerMain(String[] args) + public TestSuite createTestSuite(String[] args) { TestSuite suite = new TestSuite(this.getClass().getName()); @@ -62,8 +62,7 @@ } })); - - com.nokia.mj.impl.utils.OmjTestRunner.run(suite); + return suite; } @@ -118,7 +117,7 @@ res = System.getProperty(testPropertyKey1); assertTrue("Fail3, got: "+ res, testPropertyVal2.equals(res)); - // Set a null value to same system property and check that an + // Set a null value to same system property and check that an // exception is thrown and the value is not changed. try { @@ -146,7 +145,7 @@ res = System.getProperty(testPropertyKey2); assertTrue("Fail7, got: "+ res, testPropertyVal4.equals(res)); - // Set a null value to same user property and check that an + // Set a null value to same user property and check that an // exception is thrown and the value is not changed. try { @@ -159,7 +158,7 @@ res = System.getProperty(testPropertyKey2); assertTrue("Fail8, got: "+ res, testPropertyVal4.equals(res)); - // Set the same system and user property and check that the user property + // Set the same system and user property and check that the user property // doesn't override the system property. JvmInternal.setSystemProperty(testPropertyKey3, testPropertyVal5); JvmInternal.setUserProperty(testPropertyKey3, testPropertyVal6); diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/BufferedReaderTests.java --- a/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/BufferedReaderTests.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/BufferedReaderTests.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ package com.nokia.mj.impl.utils; -import com.nokia.mj.impl.installer.utils.InstallerMain; +import com.nokia.mj.impl.rt.test.UnitTestSuiteCreator; import com.nokia.mj.impl.utils.BufferedReader; import java.io.ByteArrayInputStream; @@ -33,14 +33,14 @@ /** * BufferedReader unit tests. */ -public class BufferedReaderTests extends TestCase implements InstallerMain +public class BufferedReaderTests extends TestCase implements UnitTestSuiteCreator { private static final String TEST_DATA = "one\ntwo\nthree"; private static final int MAX_BUF_SIZE = 16; // Begin j2meunit test framework setup - public void installerMain(String[] args) + public TestSuite createTestSuite(String[] args) { TestSuite suite = new TestSuite(this.getClass().getName()); @@ -80,7 +80,7 @@ } })); - com.nokia.mj.impl.utils.OmjTestRunner.run(suite); + return suite; } public BufferedReaderTests() diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/DebugUtilsTests.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/DebugUtilsTests.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.mj.impl.utils; + +import com.nokia.mj.impl.utils.DebugUtils; + +import com.nokia.mj.impl.rt.test.UnitTestSuiteCreator; +import j2meunit.framework.Test; +import j2meunit.framework.TestCase; +import j2meunit.framework.TestMethod; +import j2meunit.framework.TestSuite; + +/** + * DebugUtils unit tests. + */ +public class DebugUtilsTests extends TestCase implements UnitTestSuiteCreator +{ + // Create the test suite. + public TestSuite createTestSuite(String[] args) + { + TestSuite suite = new TestSuite(this.getClass().getName()); + + suite.addTest(new DebugUtilsTests("TestStackTrace", new TestMethod() + { + public void run(TestCase tc) + { + ((DebugUtilsTests)tc).testStackTrace(); + } + })); + + return suite; + } + + public DebugUtilsTests() + { + } + + public DebugUtilsTests(String aTestName, TestMethod aTestMethod) + { + super(aTestName, aTestMethod); + } + + // End j2meunit test framework setup + + protected void setUp() + { + } + + protected void tearDown() + { + } + + public void testStackTrace() + { + try + { + try + { + DebugUtils.getStackTrace(null); + assertTrue("No exception.", false); + } + catch (NullPointerException ne) + { + } + + Exception e1 = new Exception("Test 42"); + String res = DebugUtils.getStackTrace(e1); + boolean ok = res.indexOf("at com.nokia.mj.impl.utils.DebugUtilsTests.testStackTrace") >= 0; + assertTrue("Exception didn't contain: " + res, ok); + + } + catch (Throwable t) + { + assertTrue(t.toString(), false); + t.printStackTrace(); + } + } +} diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/concurrent/ConcurrentTests.java --- a/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/concurrent/ConcurrentTests.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/concurrent/ConcurrentTests.java Fri Sep 17 08:28:21 2010 +0300 @@ -21,8 +21,7 @@ import java.util.Enumeration; import java.util.Vector; -import com.nokia.mj.impl.installer.utils.InstallerMain; -import com.nokia.mj.impl.utils.DebugUtils; +import com.nokia.mj.impl.rt.test.UnitTestSuiteCreator; import j2meunit.framework.Test; import j2meunit.framework.TestCase; @@ -32,7 +31,7 @@ /** * BufferedReader unit tests. */ -public class ConcurrentTests extends TestCase implements InstallerMain +public class ConcurrentTests extends TestCase implements UnitTestSuiteCreator { private int mMaxThreadId; private int mReleaseThreadId; @@ -42,7 +41,7 @@ private Object mLockEnd; // Begin j2meunit test framework setup - public void installerMain(String[] args) + public TestSuite createTestSuite(String[] args) { createDumperThread(false); TestSuite suite = new TestSuite(this.getClass().getName()); @@ -123,9 +122,7 @@ } })); - - - com.nokia.mj.impl.utils.OmjTestRunner.run(suite); + return suite; } @@ -142,7 +139,8 @@ { if (doCreate) { - new Thread(new Runnable(){ + new Thread(new Runnable() + { public void run() { threadSleep(5000); @@ -189,8 +187,8 @@ { if (doTrace) { - //System.out.println(str); - mTrace.addElement(str); + //System.out.println(str); + mTrace.addElement(str); } } @@ -250,7 +248,7 @@ try { - + testLock(true); } catch (Throwable t) @@ -269,7 +267,7 @@ try { - + testLock(true); } catch (Throwable t) @@ -288,7 +286,7 @@ try { - + testLock(false); } catch (Throwable t) @@ -307,7 +305,7 @@ try { - + testLock(false); } catch (Throwable t) @@ -359,13 +357,13 @@ { private int mId; private boolean mCheck; - + private LockTestThread(int id, boolean check) { mId = id; mCheck = check; } - public void run() + public void run() { threadSleep(20); trace("run: "+mId); @@ -389,7 +387,7 @@ trace("Got lock: "+mId); if (mCheck) { - String errorTxt = "Incorrect release order. mId: "+ mId + + String errorTxt = "Incorrect release order. mId: "+ mId + ", next: " +mNextReleasedThreadId; assertTrue(errorTxt, mNextReleasedThreadId == mId); } @@ -500,12 +498,12 @@ private class ConditionTestThread extends Thread { private int mId; - + private ConditionTestThread(int id) { mId = id; } - public void run() + public void run() { threadSleep(20); trace("run: "+mId); diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/localisation/build/build.xml --- a/javacommons/utils/tsrc/localisation/build/build.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/javacommons/utils/tsrc/localisation/build/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -1,6 +1,6 @@ - - - - - - diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/runner/build/bwins/javaunittestrunneru.def --- a/javacommons/utils/tsrc/unittestrunner/runner/build/bwins/javaunittestrunneru.def Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) - diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/runner/build/eabi/javaunittestrunneru.def --- a/javacommons/utils/tsrc/unittestrunner/runner/build/eabi/javaunittestrunneru.def Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z10jni_lookupPKc @ 1 NONAME - diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/runner/build/javaunittestrunner.pro --- a/javacommons/utils/tsrc/unittestrunner/runner/build/javaunittestrunner.pro Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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: -# - -TARGET=javaunittestrunner -TEMPLATE=lib -CONFIG += omj java stl -CONFIG -= qt - -symbian { - TARGET.UID3 = 0xE0008435 -} -include(../../../../../../build/omj.pri) - diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/runner/javasrc/com/nokia/mj/impl/rt/test/UnitTestRunner.java --- a/javacommons/utils/tsrc/unittestrunner/runner/javasrc/com/nokia/mj/impl/rt/test/UnitTestRunner.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +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: -* -*/ - -package com.nokia.mj.impl.rt.test; - -import com.nokia.mj.impl.installer.utils.InstallerMain; -import com.nokia.mj.impl.rt.support.JvmInternal; -import com.nokia.mj.impl.rt.support.ThreadEventListener; -import com.nokia.mj.impl.utils.Logger; -import com.nokia.mj.impl.utils.Tokenizer; - - -public class UnitTestRunner -{ - /** - * UnitTestRunner main program. - * - * @param args command line arguments - */ - public static void main(String[] args) - { - int exitCode = 0; - - System.out.println("java.version: " + - System.getProperty("java.version")); - System.out.println("java.fullversion: " + - System.getProperty("java.fullversion")); - - if (args.length == 0) - { - Logger.ELOG(Logger.EJavaRuntime, "No args provided."); - exitCode = -2; - } - try - { - JvmInternal.setThreadEventListener(new ThreadEventListener() - { - public void threadStarting(Thread newThread, Thread parentThread) {} - public void threadDied(Thread thread) {} - public void uncaughtException(Thread thread, Throwable throwable) - { - String threadName = null; - if (thread != null) - { - threadName = thread.getName(); - } - Logger.ELOG(Logger.EJavaRuntime, "Unhandled exception in " + - threadName, throwable); - System.exit(-1); - } - }); - test(args); - } - catch (Throwable t) - { - Logger.ELOG(Logger.EJavaRuntime, "Unhandled exception in main", t); - exitCode = -1; - } - System.exit(exitCode); - } - - /** - * Main program for executing tests. - */ - private static void test(String[] args) - { - String mainClass = getMainClass(args[0]); - if (mainClass == null) - { - Logger.ELOG(Logger.EJavaRuntime, "Mainclass must be specified."); - return; - } - - try - { - // Instantiate mainclass and call its main() method. - Class clazz = Class.forName(mainClass); - InstallerMain instMain = (InstallerMain)clazz.newInstance(); - instMain.installerMain(args); - } - catch (Exception ex) - { - Logger.ELOG(Logger.EJavaRuntime, "Running mainclass failed", ex); - } - } - - /** - * Main program for executing tests. - */ - private static String getMainClass(String arg) - { - String[] mainClassArg = Tokenizer.split(arg, "="); - if (mainClassArg.length != 2) - { - return null; - } - if (!mainClassArg[0].equals("-mainclass")) - { - return null; - } - return mainClassArg[1]; - - } - - /** - * Logs arguments given to TCK Runner - */ - private static void logArgs(String[] args) - { - StringBuffer buf = new StringBuffer("UnitTestRunner args:"); - for (int i = 0; i < args.length; i++) - { - buf.append(" "); - buf.append(args[i]); - } - Logger.ILOG(Logger.EJavaRuntime, buf.toString()); - } - -} diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/runner/javasrc/com/nokia/mj/impl/rt/unittestrunner/ApplicationInfoImpl.java --- a/javacommons/utils/tsrc/unittestrunner/runner/javasrc/com/nokia/mj/impl/rt/unittestrunner/ApplicationInfoImpl.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +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: -* -*/ - -package com.nokia.mj.impl.rt.unittestrunner; - -import com.nokia.mj.impl.rt.support.ApplicationInfo; -import com.nokia.mj.impl.utils.Uid; - -public class ApplicationInfoImpl extends ApplicationInfo -{ - private String iProtectionDomain = null; - - /** - */ - public String getRuntimeType() - { - // See runtime types defined in ApplicationInfo class. - return "UnitTest_Runner"; - } - - /** - */ - public String getProtectionDomain() - { - return MANUFACTURER_DOMAIN; - } - - /** - */ - public Uid getUid() - { - return Uid.createUid("[ffffffff]"); - } - - /** - */ - public Uid getSuiteUid() - { - throw new RuntimeException - ("Get suite uid is not applicable for TckRunner"); - } - - /** - */ - public String getSuiteName() - { - return getName(); - } - - /** - */ - public String getName() - { - return "JavaUnitTester"; - } - - /** - */ - public String getVendor() - { - return "Nokia"; - } - - /** - */ - public String getVersion() - { - return "1.0.0"; - } - - /** - */ - public String getRootPath() - { - return "."; - } - - /** - */ - public String getMainClass() - { - throw new RuntimeException - ("Get main class is not applicable for UntiTestRunner"); - } - - /** - */ - public String getAttribute(String key) - { - return null; - } -} diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/runner/javasrc/com/nokia/mj/impl/rt/unittestrunner/ApplicationUtilsImpl.java --- a/javacommons/utils/tsrc/unittestrunner/runner/javasrc/com/nokia/mj/impl/rt/unittestrunner/ApplicationUtilsImpl.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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: -* -*/ - -package com.nokia.mj.impl.rt.unittestrunner; - -import com.nokia.mj.impl.rt.support.ApplicationInfo; -import com.nokia.mj.impl.rt.support.ApplicationUtils; -import com.nokia.mj.impl.utils.Uid; - -import java.security.Permission; -import java.security.AccessControlException; - -public class ApplicationUtilsImpl extends ApplicationUtils -{ - public static void doShutdownImpl() - { - // Send shutdown notification to all registered listeners. - ((ApplicationUtilsImpl)sInstance).doShutdown(); - } - - - public void notifyExitCmd() - { - } - - public void checkPermission(Permission aPermission) - throws AccessControlException, NullPointerException - { - checkPermission(null, aPermission); - } - - public void checkPermission(Uid aAppUid, Permission aPermission) - throws AccessControlException, NullPointerException - { - return; - } -} diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/starter/build/javauntitester.pro --- a/javacommons/utils/tsrc/unittestrunner/starter/build/javauntitester.pro Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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: -# - -TARGET=javaunittester -TEMPLATE=app - -CONFIG += omj no_icon stl -CONFIG -= qt - -INCLUDEPATH += ../../../../../../javaruntimes/inc - -LIBS += -ljavaruntimestarterutils -ljavastorage - -symbian { - TARGET.EPOCHEAPSIZE = 0x020000 0x800000 - TARGET.EPOCSTACKSIZE = 0x14000 - TARGET.CAPABILITY = all -tcb -allfiles -drm -} - - -include(../../../../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/starter/src/main.cpp --- a/javacommons/utils/tsrc/unittestrunner/starter/src/main.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +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: Main program for the Unit test process -* -*/ - -#include -#include - -#include "logger.h" -#include "exceptionbase.h" -#include "runtimeexception.h" -#include "javacommonutils.h" -#include "runtimestarterutils.h" -#include "jvmstarter.h" - -using namespace java::runtime; -using namespace java::util; - -int startJvm(int argc, char *argv[]); -const wchar_t* const UNIT_TEST_RUNNER_MAIN_CLASS = L"com.nokia.mj.impl.rt.test.UnitTestRunner"; -void findMidlet(); - -int main(int argc, char *argv[]) -{ - LOG(EJavaRuntime, EInfo, "UNIT TEST RUNNER main()"); - - int result = -1; - try - { - result = startJvm(argc, argv); - } - catch (RuntimeException& e) - { - ELOG1(EJavaRuntime, "UNIT TEST RUNNER main() RuntimeException caught: %s ", - e.toString().c_str()); - } - - catch (ExceptionBase& e) - { - ELOG1(EJavaRuntime, "UNIT TEST RUNNER main() ExceptionBase caught: %s ", - e.toString().c_str()); - } - - catch (std::exception& e) - { - ELOG1(EJavaRuntime, "UNIT TEST RUNNER main() Exception %s caught", e.what()); - } - - LOG1(EJavaRuntime, EInfo, "UNIT TEST RUNNER EXIT = %d", result); - return result; -} - -int startJvm(int argc, char *argv[]) -{ - JELOG2(EJavaRuntime); - - // Create instance of RuntimeStarterUtils for thread supervisioning. - std::auto_ptr starterUtils(new RuntimeStarterUtils()); - starterUtils->startThreadSupervisor(); - - JvmStarter::Configuration config = JvmStarter::CLDC; - int argInd = 1; - if (argc > 2) - { - if (strncmp(argv[1], "-conf", 5) == 0) - { - argInd = 2; - if (strcmp(argv[1]+5, "=cdc") == 0) - { - config = JvmStarter::CDC; - } - else if (strcmp(argv[1]+5, "=foundation") == 0) - { - config = JvmStarter::FOUNDATION; - } - } - } - // Create starter for starting the JVM - std::auto_ptr - jvm(JvmStarter::getJvmStarterInstance(config, - L"Unit_test_runner")); - - // starterUtils->enableDevelopmentFeatures(*jvm.get()); - jvm->enableThreadDumping(); - - jvm->appendSystemProperty(L"-Dcom.nokia.rt.port=unittestrunner"); - - jvm->setMainClass(UNIT_TEST_RUNNER_MAIN_CLASS); - - for (; argInd < argc; ++argInd) - { - jvm->appendApplicationArgument( - JavaCommonUtils::utf8ToWstring(argv[argInd])); - } - - // Start the JVM. - return jvm->startJvm(); -} diff -r 773449708c84 -r 4ad59aaee882 javacommons/utils/tsrc/unittestrunner/subsystem.mk --- a/javacommons/utils/tsrc/unittestrunner/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +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: -# - -include $(JAVA_SRC_ROOT)/build/Makefile.defs - -COMPONENTS += \ - starter/build \ - runner/build - -include ${JAVA_SRC_ROOT}/build/Makefile.subsystem diff -r 773449708c84 -r 4ad59aaee882 javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60bluetoothplatformcontrol.cpp --- a/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60bluetoothplatformcontrol.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60bluetoothplatformcontrol.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -358,7 +358,7 @@ */ std::wstring *S60BluetoothPlatformControl::getBluetoothName() { - TBuf16 bluetoothName; + TBuf16 bluetoothName; JELOG2(EJavaBluetooth); TInt error = RProperty::Get(KPropertyUidBluetoothCategory, diff -r 773449708c84 -r 4ad59aaee882 javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java --- a/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java Fri Sep 17 08:28:21 2010 +0300 @@ -65,7 +65,7 @@ private static final int MASTER_SWITCH = 7; - private static final int SD_TRANS_MAX = 1; + private static final int SD_TRANS_MAX = 8; private static final int SD_ATTR_RETRIEVE_MAX = 9; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/build/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,42 @@ + + + + + Builds Central Repository Component + + + + + + + + + + + + + + + + diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/build/bwins/javacentrepu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/bwins/javacentrepu.def Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) + diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/build/eabi/javacentrepu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/eabi/javacentrepu.def Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z10jni_lookupPKc @ 1 NONAME + _ZTI22CJavaCentralRepository @ 2 NONAME + _ZTV22CJavaCentralRepository @ 3 NONAME + diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/build/javacentrep.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/javacentrep.pro Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,32 @@ +# +# 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: +# + +TARGET=javacentrep +TEMPLATE=lib +CONFIG += omj java stl +CONFIG -= qt + +include(../../../inc/build_defines.pri) + +symbian { + INCLUDEPATH += ../inc + SOURCES += ../src/*.cpp + + LIBS += -lcentralrepository \ + -leuser +} + +include(../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/inc/centrepfunctionserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/inc/centrepfunctionserver.h Fri Sep 17 08:28:21 2010 +0300 @@ -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: +* +*/ + + +#ifndef CENTREPFUNCTIONSERVER_H +#define CENTREPFUNCTIONSERVER_H + +#include "monitor.h" +#include "functionserver.h" +#include "legacyeventserverwrapper.h" + +namespace java +{ +namespace centrep +{ + +/** + * If we have to execute some operation that essentially + * needs ActiveScheduler, then we use this CentrepFunctionServer. + * + * We must however be careful not to make callbacks through FunctionServer. + * Reason: If in callback, app calls another method that needs FunctionServer + * to execute, we enter a deadlock. + */ + +class CentrepFunctionServer: public java::util::FunctionServer, + public LegacyEventServerWrapper +{ +public: + + CentrepFunctionServer() : + java::util::FunctionServer("JavaCentrepFunctionServer") + { + JELOG2(EJavaCentrep); + + //Creates a new thread and starts active scheduler + //This results in call to doServerSideInit() + createServerToNewThread(); + mServer = reinterpret_cast(this); + } + + ~CentrepFunctionServer() + { + JELOG2(EJavaCentrep); + stopServer(); + } + + java::util::FunctionServer* getFunctionServer() const + { + JELOG2(EJavaCentrep); + return mServer; + } + +private: + + void doServerSideInit() + { + JELOG2(EJavaCentrep); + FunctionServer::doServerSideInit(); + } + +private: + + java::util::FunctionServer* mServer; +}; + +} //end namespace centrep +} //end namespace java + +#endif // CENTREPFUNCTIONSERVER_H diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/inc/cjavacentralrepository.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/inc/cjavacentralrepository.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,116 @@ +/* +* 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 C_JAVACENTRALREPOSITORY_H +#define C_JAVACENTRALREPOSITORY_H + + +#include + +class CRepository; + +/** + * Java Central Repository. + */ +class CJavaCentralRepository : public CBase +{ +public: + + /** + * Two-phased constructor. + * @param aRepositoryUid The UID of the repository to be accessed + */ + static CJavaCentralRepository* NewL(TUid aRepositoryUid); + + /** + * Two-phased constructor. + * @param aRepositoryUid The UID of the repository to be accessed + */ + static CJavaCentralRepository* NewLC(TUid aRepositoryUid); + + /** + * Destructor. + */ + virtual ~CJavaCentralRepository(); + + /** + * Closes opened central repository. + */ + void Close(); + + /** + * Reads a descriptor setting. + * + * @param aKey Key of setting to be read. + * @param aValue Returns the value of the setting if it is a descriptor. + * @leave System wide code if setting can not be read. + */ + void GetL(TUint32 aKey, TDes& aValue); + + /** + * Reads a integer setting. + * + * @param aKey Key of setting to be read. + * @param aValue Returns the value of the setting if it is an integer. + * @leave System wide code if setting can not be read. + */ + void GetL(TUint32 aKey, TInt& aValue); + + /** + * Stores descriptor setting. + * + * @param key The key of setting to be stored. + * @param value The value of the setting to be stored. + * @leave System wide error code if value cannot be stored. + */ + void SetL(TUint32 aKey, TDesC& aValue); + + /** + * Stores integer setting. + * + * @param aKey Key of setting to be stored. + * @param aValue The value of the setting to be stored. + * @leave System wide error code if value cannot be stored. + */ + void SetL(TUint32 aKey, TInt aValue); + + HBufC* GetStringL(TUint32 aKey); + + TInt GetIntL(TUint32 aKey); + +private: + + CJavaCentralRepository(TUid aRepositoryUid); + + void ConstructL(); + +private: // data + + /** + * Access to a repository + * Own + */ + CRepository* iRepository; + + /** + * Repository ID + */ + TUid iRepositoryUid; + +}; + +#endif // C_JAVACENTRALREPOSITORY_H diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepository.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepository.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,124 @@ +/* +* 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.mid.cenrep; + +import com.nokia.mj.impl.cenrep.CentralRepositoryImpl; + +/** + * The CentralRepository is class to manage application + * settings and share data with other runtimes. In S60 this API can be used + * to set and get values in Symbian Central Repositories.

+ * + * Example of usage:

+ * + * + * class CentralRepositoryExample { + * private static final String EXAMPLE_REPOSITORY= "0x20000000"; + * private static final String EXAMPLE_KEY1 = "0x00000001"; + * private static final String EXAMPLE_KEY2 = "0x00000002"; + * + * public modifySetting() throws CentralRepositoryException { + * CentralRepository cenrep = CentralRepository.open(EXAMPLE_REPOSITORY); + * try { + * String value1 = cenrep.getString(EXAMPLE_KEY1); + * int value2 = cenrep.getInt(EXAMPLE_KEY2); + + * cenrep.setString(EXAMPLE_KEY1, value3); + * cenrep.setInt(EXAMPLE_KEY2, value4); + * } + * catch (CentralRepositoryException cre) { + * System.out.println(cre); + * } + * finally { + * cenrep.close(); + * } + * } + * } + */ +public abstract class CentralRepository +{ + + /** + * Hidden default constructor. + */ + protected CentralRepository() + { + } + + /** + * Opens central repository. + * + * @param repositoryId it is platform specific and in S60 it is + * Symbian Central Repository UID. + * @return An instance of CentralRepository class + * for accessing a repository. + * @throws CentralRepositoryException if openning fails. + */ + static public CentralRepository open(String repositoryId) + throws CentralRepositoryException + { + return CentralRepositoryImpl.open(repositoryId); + } + + /** + * Closes central repository. If get or set methods are used after + * close operation, exception will be thrown. + */ + public abstract void close() + throws CentralRepositoryException; + + /** + * Returns string stored in given key. + * + * @param key the key of setting to be read. + * @return the value of the setting if it is the string. + * @throws CentralRepositoryException if key is not found or + * stored data is not string. + */ + public abstract String getString(String key) + throws CentralRepositoryException; + + /** + * Returns integer stored in given key. + * + * @param key the key of setting to be read. + * @return the value of the setting if it is an integer. + * @throws CentralRepositoryException if key is not found or + * stored data is not integer. + */ + public abstract int getInt(String key) + throws CentralRepositoryException; + + /** Stores string value in key. + * + * @param key the key of setting to be stored. + * @param value the string value of the setting to be stored. + * @throws CentralRepositoryException if string value cannot be stored. + */ + public abstract void setString(String key, String value) + throws CentralRepositoryException; + + /** Stores integer value in key. + * + * @param key the key of setting to be stored. + * @param value the integer value of the setting to be stored. + * @throws CentralRepositoryException if integer value cannot be stored. + */ + public abstract void setInt(String key, int value) + throws CentralRepositoryException; +} diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepositoryException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepositoryException.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.mid.cenrep; + +/** + * Generic exception class for Central Repository API. + */ +public class CentralRepositoryException extends Exception +{ + + /** + * Default constructor is not allowed. + */ + protected CentralRepositoryException() + { + } + + /** + * Constructs an exception instance with a textual information. + * + * @param message human readable information about the exception. + */ + public CentralRepositoryException(String message) + { + super(message); + } + +} diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryImpl.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,354 @@ +/* +* 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.cenrep; + +import com.nokia.mid.cenrep.CentralRepository; +import com.nokia.mid.cenrep.CentralRepositoryException; +import com.nokia.mj.impl.gcf.utils.NativeError; +import com.nokia.mj.impl.rt.support.ApplicationInfo; +import com.nokia.mj.impl.utils.Logger; +import com.nokia.mj.impl.rt.support.Finalizer; +import com.nokia.mj.impl.rt.support.Jvm; + +/** + * CentralRepositoryImpl implements the functionality specified in + * com.nokia.mid.cenrep.CentralRepository class. + */ +public class CentralRepositoryImpl extends CentralRepository +{ + + static + { + try + { + Jvm.loadSystemLibrary("javacentrep"); + } + catch (Exception e) + { + Logger.ELOG(Logger.EJavaCentrep, + "Unable to load javacentrep dll."); + } + } + + private static final int INITIAL = 0; + + private static final int OPEN = 1; + + private static final int CLOSED = 2; + + /* + * Central Repository API Function server. + */ + private int iFunctionSourceHandle; + + /** + * Handle to the native side peer object. + */ + private int iCenrepHandle = 0; + + /** + * Repository ID + */ + private String iRepositoryId = null; + + private Finalizer iFinalizer; + + private int iState; + + /** + * Hidden default constructor. + */ + private CentralRepositoryImpl() + { + } + + /** + * Hidden constructor. + * + * @param repositoryId it is platform specific and in S60 it is + * Symbian Central Repository UID. + */ + private CentralRepositoryImpl(String repositoryId) + throws CentralRepositoryException + { + checkAccess(); + iState = INITIAL; + int cenrepUid = CentralRepositoryUid.getIntValue(repositoryId); + this.iRepositoryId = repositoryId; + iFinalizer = registerFinalize(); + + iFunctionSourceHandle = _createFunctionSource(); + iCenrepHandle = _createNativePeer(iFunctionSourceHandle, cenrepUid); + iState = OPEN; + } + + /** + * See class CentralRepository for comments. + */ + static public CentralRepository open(String repositoryId) + throws CentralRepositoryException + { + return new CentralRepositoryImpl(repositoryId); + } + + /** + * See class CentralRepository for comments. + */ + public void close() throws CentralRepositoryException + { + synchronized (this) + { + + if (iState != CLOSED) + { + iState = CLOSED; + _close(iFunctionSourceHandle, iCenrepHandle); + _dispose(iFunctionSourceHandle, iCenrepHandle); + } + iRepositoryId = null; + } + } + + /** + * See class CentralRepository for comments. + */ + public String getString(String key) + throws CentralRepositoryException + { + synchronized (this) + { + + if (iState == CLOSED) + { + throw new CentralRepositoryException("Connection Already Closed"); + } + long cenrepKey = CentralRepositoryKey.getLongValue(key); + String value = _getString(iFunctionSourceHandle, iCenrepHandle, cenrepKey); + return value; + } + } + + /** + * See class CentralRepository for comments. + */ + public int getInt(String key) + throws CentralRepositoryException + { + synchronized (this) + { + + if (iState == CLOSED) + { + throw new CentralRepositoryException("Connection Already Closed"); + } + long cenrepKey = CentralRepositoryKey.getLongValue(key); + int res = _getInt(iFunctionSourceHandle, iCenrepHandle, cenrepKey); + return res; + } + } + + /** + * See class CentralRepository for comments. + */ + public void setString(String key, String value) + throws CentralRepositoryException + { + synchronized (this) + { + + if (iState == CLOSED) + { + throw new CentralRepositoryException("Connection Already Closed"); + } + long cenrepKey = CentralRepositoryKey.getLongValue(key); + if (value == null) + { + throw new CentralRepositoryException("Value is null"); + } + _setString(iFunctionSourceHandle, iCenrepHandle, cenrepKey, value); + } + } + + /** + * See class CentralRepository for comments. + */ + public void setInt(String key, int value) + throws CentralRepositoryException + { + synchronized (this) + { + + if (iState == CLOSED) + { + throw new CentralRepositoryException("Connection Already Closed"); + } + long cenrepKey = CentralRepositoryKey.getLongValue(key); + _setInt(iFunctionSourceHandle, iCenrepHandle, cenrepKey, value); + } + } + + /** + * Registers with Finalizer to call a method when the object gets collected + * by GC + * + * @return Finalizer object that will be notified when GC happens + */ + private Finalizer registerFinalize() + { + return new Finalizer() + { + public void finalizeImpl() + { + registeredFinalize(); + } + }; + } + + /** + * Called when the object is finalized by the garbage collector. + */ + final void registeredFinalize() + { + try + { + close(); + } + catch (CentralRepositoryException e) + { + // Ignore + } + } + + /** + * Creates a native side function source. + * + * @return handle to the native function source. + */ + private native int _createFunctionSource(); + + /** + * Create native side peer of this Java class. It opens a repository. + * + * @param FunctionSource Handle handle to the native function source. + * @param arepositoryId is platform specific and in S60 it is + * Symbian Central Repository UID. + * @return handle to the native side peer. + * @return Symbian OS error code, if openning fails. + */ + private native int _createNativePeer( + int aFunctionSourceHandle, + int repositoryId); + + /** + * Closes a repository. + * + * @param FunctionSourceHandle handle to the native function source. + * @param cenrepHandle handle to the native side peer object. + * @return Symbian OS error code, if closing fails. + */ + private native void _close(int aFunctionSourceHandle, int cenrepHandle); + + /** + * Dispose native side resources owned by this class. + * + * @param FunctionSourceHandle handle to the native function source. + * @param cenrepHandle handle to the native side peer object. + */ + private native void _dispose(int aFunctionSourceHandle, int cenrepHandle); + + /** + * Returns string stored in given key. + * + * @param FunctionSourceHandle handle to the native function source. + * @param cenrepHandle handle to the native side peer object. + * @param key the key of setting to be read. + * @param value returns the value of the setting if it is the string. + * @return Symbian OS error code, if key is not found or + * stored data is not string. + */ + private native String _getString( + int aFunctionSourceHandle, + int cenrepHandle, + long key); + + /** + * Returns integer stored in given key. + * + * @param FunctionSourceHandle handle to the native function source. + * @param cenrepHandle handle to the native side peer object. + * @param key the key of setting to be read. + * @param value the value of the setting if it is an integer. + * @return Symbian OS error code, if key is not found or + * stored data is not integer. + */ + private native int _getInt( + int aFunctionSourceHandle, + int cenrepHandle, + long key); + + /** Stores string value in key. + * + * @param FunctionSourceHandle handle to the native function source. + * @param cenrepHandle handle to the native side peer object. + * @param key the key of setting to be stored. + * @param value the string value of the setting to be stored. + * @return Symbian OS error code, if string value cannot be stored. + */ + private native void _setString( + int aFunctionSourceHandle, + int cenrepHandle, + long key, + String value); + + /** Stores integer value in key. + * + * @param FunctionSourceHandle handle to the native function source. + * @param cenrepHandle handle to the native side peer object. + * @param key the key of setting to be stored. + * @param value the integer value of the setting to be stored. + * @return Symbian OS error code, if integer value cannot be stored. + */ + private native void _setInt( + int aFunctionSourceHandle, + int cenrepHandle, + long key, + int value); + + + /** + * Checks if MIDlet is permited to access the central repository. + * Only MIDlets in manufacturer or operator domain are allowed. + * @throws CentralRepositoryException if MIDlet is not in manufacturer or + * operator domain. + */ + private void checkAccess() + throws SecurityException + { + + ApplicationInfo appInfo = ApplicationInfo.getInstance(); + String protectionDomain = appInfo.getProtectionDomain(); + + if (protectionDomain.equals(ApplicationInfo.MANUFACTURER_DOMAIN) == false && + protectionDomain.equals(ApplicationInfo.OPERATOR_DOMAIN) == false) + { + Logger.ELOG(Logger.EJavaCentrep, "Protection Domain: " + protectionDomain + + ", Access denied"); + throw new SecurityException("Access denied!"); + } + } +} diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryKey.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryKey.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.mj.impl.cenrep; + +import com.nokia.mid.cenrep.CentralRepositoryException; +/** + * Class for central repository key representation + */ +class CentralRepositoryKey +{ + + /** + * Default constructor. + */ + protected CentralRepositoryKey() + { + } + + /** + * Returns long value represantion. + * + * @param value string represantion of key. + * @throws CentralRepositoryException, if key is null, empty, negative + * or not valid. + */ + static long getLongValue(String value) + throws CentralRepositoryException + { + if (value == null || value.length() == 0) + { + throw new CentralRepositoryException("Key is null or empty!"); + } + + String numStr = value; + + // Negative value is not allowed + if (numStr.startsWith("-")) + { + throw new CentralRepositoryException("Nagative value is not allowed!"); + } + + // Check for optional radix prefix. + int radix = 10; + if (numStr.startsWith("0x")) + { + radix = 16; + numStr = numStr.substring(2); + } + + return Long.parseLong(numStr, radix); + } + +}; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryUid.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryUid.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,90 @@ +/* +* 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.cenrep; + +import com.nokia.mj.impl.utils.Uid; +import com.nokia.mid.cenrep.CentralRepositoryException; + +/** + * Class for central repository UID. + */ +class CentralRepositoryUid extends Uid +{ + + /** + * Default constructor. + */ + protected CentralRepositoryUid() + { + super(); + } + + /** + * Returns int value + * + * @param value string representation of uid. + * @throws CentralRepositoryException, if value is null, empty or not valid. + */ + static int getIntValue(String value) + throws CentralRepositoryException + { + Uid uid = Uid.createUid(value); + if (uid == null) + { + throw new CentralRepositoryException("Uid is null or empty"); + } + + String numStr = uid.getStringValue(); + + // Check if value is negative. + boolean negative = false; + if (numStr.startsWith("-")) + { + negative = true; + numStr = numStr.substring(1); + } + + // Check for optional radix prefix. + int radix = 10; + if (numStr.startsWith("0x")) + { + radix = 16; + numStr = numStr.substring(2); + } + + // Check if numStr is in Symbian TUid form [12345678]. + if (numStr.length() <= 10 && numStr.startsWith("[") && numStr.endsWith("]")) + { + radix = 16; + numStr = numStr.substring(1, numStr.length()-1); + } + + int result = 0; + long val = Long.parseLong(numStr, radix); + if (negative) + { + result = (int)-val; + } + else + { + result = (int)val; + } + return result; + } + +}; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/src/cjavacentralrepository.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/src/cjavacentralrepository.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,134 @@ +/* +* 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 // CRepository + +#include "cjavacentralrepository.h" // CJavaCentralRepository +#include "logger.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::NewL +// --------------------------------------------------------------------------- +CJavaCentralRepository* CJavaCentralRepository::NewL(TUid aRepositoryUid) +{ + CJavaCentralRepository* self = CJavaCentralRepository::NewLC(aRepositoryUid); + CleanupStack::Pop(self); + return self; +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::NewLC +// --------------------------------------------------------------------------- +CJavaCentralRepository* CJavaCentralRepository::NewLC(TUid aRepositoryUid) +{ + CJavaCentralRepository* self = + new(ELeave) CJavaCentralRepository(aRepositoryUid); + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::~CJavaCentralRepository +// --------------------------------------------------------------------------- +CJavaCentralRepository::~CJavaCentralRepository() +{ + Close(); +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::Close +// --------------------------------------------------------------------------- +void CJavaCentralRepository::Close() +{ + iRepositoryUid = TUid::Null(); + delete iRepository; + iRepository = NULL; +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::CJavaCentralRepository +// --------------------------------------------------------------------------- +CJavaCentralRepository::CJavaCentralRepository(TUid aRepositoryUid) +{ + iRepositoryUid = aRepositoryUid; +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::ConstructL +// --------------------------------------------------------------------------- +void CJavaCentralRepository::ConstructL() +{ + iRepository = CRepository::NewL(iRepositoryUid); +} + +/** + * GetStringL + */ +HBufC* CJavaCentralRepository::GetStringL(TUint32 aKey) +{ + HBufC* value = HBufC::NewLC(NCentralRepositoryConstants::KMaxUnicodeStringLength); + TPtr ptr(value->Des()); + GetL(aKey, ptr); + + //aValue = value; + CleanupStack::Pop(value); + return value; +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::Get +// --------------------------------------------------------------------------- +void CJavaCentralRepository::GetL(TUint32 aKey, TDes& aValue) +{ + User::LeaveIfError(iRepository->Get(aKey, aValue)); +} + +/** + * GetIntL + */ +TInt CJavaCentralRepository::GetIntL(TUint32 aKey/*, TInt& aValue*/) +{ + TInt value(0); + GetL(aKey, value); + return value; +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::Get +// --------------------------------------------------------------------------- +void CJavaCentralRepository::GetL(TUint32 aKey, TInt& aValue) +{ + User::LeaveIfError(iRepository->Get(aKey, aValue)); +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::Set +// --------------------------------------------------------------------------- +void CJavaCentralRepository::SetL(TUint32 aKey, TDesC& aValue) +{ + User::LeaveIfError(iRepository->Set(aKey, aValue)); +} + +// --------------------------------------------------------------------------- +// CJavaCentralRepository::Set +// --------------------------------------------------------------------------- +void CJavaCentralRepository::SetL(TUint32 aKey, TInt aValue) +{ + User::LeaveIfError(iRepository->Set(aKey, aValue)); +} diff -r 773449708c84 -r 4ad59aaee882 javaextensions/centralrepository/src/javacentralrepositoryjni.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/src/javacentralrepositoryjni.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,277 @@ +/* +* 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 // KMaxUnicodeStringLength + +#include "com_nokia_mj_impl_cenrep_CentralRepositoryImpl.h" +#include "cjavacentralrepository.h" +#include "centrepfunctionserver.h" +#include "javajniutils.h" +#include "jstringutils.h" +#include "s60commonutils.h" +#include "logger.h" +#include "fs_methodcall.h" + +using namespace java::util; +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _createFunctionSource + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1createFunctionSource +(JNIEnv *aJni, jobject /*aPeer*/) +{ + JELOG2(EJavaCentrep); + java::centrep::CentrepFunctionServer* mFunctionServer; + mFunctionServer = new java::centrep::CentrepFunctionServer(); + TInt handle = reinterpret_cast(mFunctionServer); + if (handle < KErrNone) + { + JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" , + JavaCommonUtils::intToString(handle)); + } + return handle; +} + +/** + * CreateCentralRepositoryL + */ +void CreateCentralRepositoryL(CJavaCentralRepository*& aCenRep, + TUid aRepositoryId) +{ + CJavaCentralRepository* cenrep = + CJavaCentralRepository::NewL(aRepositoryId); + aCenRep = cenrep; +} + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _createNativePeer + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1createNativePeer +(JNIEnv *aJni, jobject, jint aFunctionSourceHandle, jint aRepositoryId) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>(aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = NULL; + + TUid uid = TUid::Uid(aRepositoryId); + TRAPD(err,CallMethodL(CreateCentralRepositoryL, cenrep, uid, mFunctionServer)); + + if (err != KErrNone) + { + JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" , + JavaCommonUtils::intToString(err)); + } + return reinterpret_cast(cenrep); +} + +/** + * Close + */ +void CloseCentralRepository(CJavaCentralRepository* aCenRep) +{ + aCenRep->Close(); +} + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _close + * Signature: (II)I + */ +JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1close +(JNIEnv *, jobject, jint aFunctionSourceHandle, jint aCenrepHandle) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>( + aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = + reinterpret_cast(aCenrepHandle); + + CallMethod(CloseCentralRepository, cenrep, mFunctionServer); +} + +/** + * Dispose + */ +void Dispose(CJavaCentralRepository* aCenRep) +{ + delete aCenRep; + aCenRep = NULL; +} + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _dispose + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1dispose +(JNIEnv *, jobject, jint aFunctionSourceHandle, jint aCenrepHandle) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>( + aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = + reinterpret_cast(aCenrepHandle); + + CallMethod(Dispose, cenrep, mFunctionServer); + delete mFunctionServer; +} + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _getString + * Signature: (IIJLcom/nokia/mj/impl/cenrep/CentralRepositoryImpl$StringValue;)I + */ +JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1getString +(JNIEnv * aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle, + jlong aKey) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>( + aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = + reinterpret_cast(aCenrepHandle); + + HBufC* buf = NULL; + + TUint32 key = (TUint32)aKey; + TRAPD(err, CallMethodL(buf, cenrep, &CJavaCentralRepository::GetStringL, key, mFunctionServer)); + + jstring val = NULL; + if (err == KErrNone && buf) + { + val = java::util::S60CommonUtils::NativeToJavaString(*aJni, *buf); + } + else + { + JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" , + JavaCommonUtils::intToString(err)); + } + + delete buf; + return val; +} + + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _getInt + * Signature: (IIJLcom/nokia/mj/impl/cenrep/CentralRepositoryImpl$IntValue;)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1getInt +(JNIEnv * aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle, + jlong aKey) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>( + aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = + reinterpret_cast(aCenrepHandle); + + TInt val = 0; + TUint32 key = (TUint32)aKey; + + TRAPD(err, CallMethodL(val, cenrep, &CJavaCentralRepository::GetIntL, key, mFunctionServer)); + + if (err != KErrNone) + { + JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" , + JavaCommonUtils::intToString(err)); + } + return val; +} + +/** + * SetStringL + */ +void SetStringL(CJavaCentralRepository* aCenRep, TUint32 aKey, TDesC* aValue) +{ + aCenRep->SetL(aKey, *aValue); +} + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _setString + * Signature: (IIJLjava/lang/String;)I + */ +JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1setString +(JNIEnv *aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle, + jlong aKey, jstring aValue) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>( + aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = + reinterpret_cast(aCenrepHandle); + + JStringUtils string(*aJni, aValue); + TUint32 key = (TUint32)aKey; + + TDesC* tstring = (TDesC*) &string; + TRAPD(err, CallMethodL(SetStringL, cenrep, key, tstring, mFunctionServer)); + + if (err != KErrNone) + { + JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" , + JavaCommonUtils::intToString(err)); + } +} + +/** + * SetIntL + */ +void SetIntL(CJavaCentralRepository* aCenRep, TUint32 aKey, TInt aValue) +{ + aCenRep->SetL(aKey, aValue); +} + +/* + * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl + * Method: _setInt + * Signature: (IIJI)I + */ +JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1setInt +(JNIEnv *aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle, + jlong aKey, jint aValue) +{ + java::centrep::CentrepFunctionServer* mFunctionServer = + reinterpret_cast< java::centrep::CentrepFunctionServer*>( + aFunctionSourceHandle); + + CJavaCentralRepository* cenrep = + reinterpret_cast(aCenrepHandle); + + TUint32 key = (TUint32)aKey; + TInt value = (TInt)aValue; + + TRAPD(err, CallMethodL(SetIntL, cenrep, key, value, mFunctionServer)); + if (err != KErrNone) + { + JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" , + JavaCommonUtils::intToString(err)); + } +} + + diff -r 773449708c84 -r 4ad59aaee882 javaextensions/javaextensions.pro --- a/javaextensions/javaextensions.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/javaextensions.pro Fri Sep 17 08:28:21 2010 +0300 @@ -22,6 +22,7 @@ SUBDIRS += satsa/build/javasatsa.pro SUBDIRS += location/build/javalocation.pro SUBDIRS += sensor/build/javasensor.pro +SUBDIRS += centralrepository/build/javacentrep.pro SUBDIRS += midppush SUBDIRS += bluetooth SUBDIRS += datagram diff -r 773449708c84 -r 4ad59aaee882 javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java --- a/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java Fri Sep 17 08:28:21 2010 +0300 @@ -88,8 +88,8 @@ private void insertRecordId(int aRecordId) { int[] temp = new int[iRecordIds.length + 1]; - temp[0] = aRecordId; - System.arraycopy(iRecordIds, 0, temp, 1, iRecordIds.length); + temp[iRecordIds.length] = aRecordId; + System.arraycopy(iRecordIds, 0, temp, 0, iRecordIds.length); iRecordIds = temp; } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/midprms_db/tsrc/build/rmsintersuite.jad --- a/javaextensions/midprms_db/tsrc/build/rmsintersuite.jad Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/build/rmsintersuite.jad Fri Sep 17 08:28:21 2010 +0300 @@ -4,6 +4,6 @@ MicroEdition-Profile: MIDP-2.0 MIDlet-1: InterSuite,,j2meunitomj.MIDletTestRunner MIDlet-Name: InterSuite -MIDlet-Jar-Size: 69754 +MIDlet-Jar-Size: 70421 MIDlet-Jar-URL: rmsintersuite.jar J2MEUnitTestClasses: com.nokia.mj.test.rms.TestInterSuiteAccess diff -r 773449708c84 -r 4ad59aaee882 javaextensions/midprms_db/tsrc/build/rmssharedtests.jad --- a/javaextensions/midprms_db/tsrc/build/rmssharedtests.jad Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/build/rmssharedtests.jad Fri Sep 17 08:28:21 2010 +0300 @@ -4,6 +4,6 @@ MicroEdition-Profile: MIDP-2.0 MIDlet-1: SharedStore,,j2meunitomj.MIDletTestRunner MIDlet-Name: SharedStore -MIDlet-Jar-Size: 69757 +MIDlet-Jar-Size: 70423 MIDlet-Jar-URL: rmssharedtests.jar J2MEUnitTestClasses: com.nokia.mj.test.rms.CreateSharedStore diff -r 773449708c84 -r 4ad59aaee882 javaextensions/midprms_db/tsrc/build/rmstests.jad --- a/javaextensions/midprms_db/tsrc/build/rmstests.jad Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/build/rmstests.jad Fri Sep 17 08:28:21 2010 +0300 @@ -4,7 +4,7 @@ MicroEdition-Profile: MIDP-2.0 MIDlet-1: RmsUnitTests,,j2meunitomj.MIDletTestRunner MIDlet-Name: RmsUnitTests -MIDlet-Jar-Size: 69757 +MIDlet-Jar-Size: 70423 MIDlet-Jar-URL: rmstests.jar J2MEUnitTestClasses: com.nokia.mj.test.rms.AllTests diff -r 773449708c84 -r 4ad59aaee882 javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java --- a/javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java Fri Sep 17 08:28:21 2010 +0300 @@ -139,6 +139,14 @@ } })); + aSuite.addTest(new TestRecordEnumeration("testEnumerationOrder", new TestMethod() + { + public void run(TestCase tc) + { + ((TestRecordEnumeration) tc).testEnumerationOrder(); + } + })); + return aSuite; } @@ -1147,5 +1155,56 @@ } } + public void testEnumerationOrder() + { + // This test checks that record enumeration returns records in FIFO order + // if null RecordComparator is provided + // MIDP spec says that order is undefined in this case but many acceptance tests + // assume this order + System.out.println("TestRecordEnumeration.testEnumerationOrder()"); + RecordStore store = null; + String rec_store_name = "testEnumerationOrder"; + + try + { + // 0: Init + System.out.println("0: Init"); + try + { + RecordStore.deleteRecordStore(rec_store_name); + } + catch (Exception e) {} + store = RecordStore.openRecordStore(rec_store_name, true); + populateRecordStore(store); + + // 1: check order + System.out.println("1: check order"); + RecordEnumeration enumeration = store.enumerateRecords(null, null, false); + for(int i = 0; enumeration.hasNextElement(); i++) + { + byte[] r = enumeration.nextRecord(); + assertEquals(r, iData[i].getBytes()); + } + } + catch (Exception e) + { + e.printStackTrace(); + fail("Unexpected exception " + e); + } + finally + { + try + { + store.closeRecordStore(); + } + catch (Exception e) {} + try + { + RecordStore.deleteRecordStore(rec_store_name); + } + catch (Exception e) {} + } + } + } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Fri Sep 17 08:28:21 2010 +0300 @@ -225,7 +225,8 @@ GetExternalItemModificationsByEntryTypeL( CCalEntry::TType aEntryType); - void DoExternalItemModificationsByEntryTypeL(CCalEntry::TType aEntryType); + void CPIMAgnListAdapter::DoExternalItemModificationsByEntryTypeL( + CCalEntry::TType aEntryType); /** * Fetches a CAgnEntry from the native Agenda Model. @@ -267,7 +268,8 @@ * * @param aEntryType Entry type for change callbacks (ToDo/Event/all). */ - void ConstructL(MCalChangeCallBack::TChangeEntryType aEntryType); + void ConstructL(MCalChangeCallBack::TChangeEntryType aEntryType, + CCalSession* aCalSession); void DoClose(); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Fri Sep 17 08:28:21 2010 +0300 @@ -73,13 +73,17 @@ MPIMLocalizationData** aRetLocalizationData); TBool OpenEventListL( - const TDesC* aListName, + CCalSession* aCalSession, + + const TDesC* aCalNameArg, MPIMEventAdapterManager** aRetAdapterManager, MPIMEventListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData); TBool OpenToDoListL( - const TDesC* aListName, + CCalSession* aCalSession, + + const TDesC* aCalNameArg, MPIMToDoAdapterManager** aRetAdapterManager, MPIMToDoListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Fri Sep 17 08:28:21 2010 +0300 @@ -27,6 +27,7 @@ // FORWARD DECLARATIONS class MPIMEventItem; class CPIMAgnEventAdapter; +class CCalSession; // CLASS DECLARATION @@ -47,7 +48,8 @@ static CPIMEventListAdapter* NewL( CCalEntry::TType aEntryType, CPIMAgnEventAdapter* aEventAdapter, - java::util::FunctionServer* aFuncServer); + java::util::FunctionServer* aFuncServer, + CCalSession *aCalSession); /** * Destructor. @@ -137,7 +139,8 @@ */ void CreateEventItemL(MPIMEventItem& aEventItem); - void DoCreateEventItemL(MPIMEventItem& aEventItem); + void CPIMEventListAdapter::DoCreateEventItemL( + MPIMEventItem& aEventItem); /** * Reads an existing event item from the Agenda File. @@ -162,7 +165,8 @@ */ void ReadEventItemL(MPIMEventItem& aEventItem); - void DoReadEventItemL(MPIMEventItem& aEventItem); + void CPIMEventListAdapter::DoReadEventItemL( + MPIMEventItem& aEventItem); /** * Writes an existing event item to the native Agenda File. @@ -188,7 +192,8 @@ */ void WriteEventItemL(MPIMEventItem& aEventItem); - void DoWriteEventItemL(MPIMEventItem& aEventItem); + void CPIMEventListAdapter::DoWriteEventItemL( + MPIMEventItem& aEventItem); /** * Removes an existing event from the native Agenda File. @@ -208,7 +213,8 @@ */ void RemoveEventItemL(TPIMItemID aItemID); - void DoRemoveEventItemL(TPIMItemID aItemID); + void CPIMEventListAdapter::DoRemoveEventItemL( + TPIMItemID aItemID); protected: @@ -222,7 +228,9 @@ */ void ConstructL( CCalEntry::TType aEntryType, - CPIMAgnEventAdapter* aEventAdapter); + + CPIMAgnEventAdapter* aEventAdapter, + TInt aCalSessionInt); private: // Member data diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Fri Sep 17 08:28:21 2010 +0300 @@ -67,13 +67,17 @@ MPIMLocalizationData** aRetLocalizationData); TBool OpenEventListL( - const TDesC* aListName, + CCalSession* aCalSession, + + const TDesC* aCalNameArg, MPIMEventAdapterManager** aRetAdapterManager, MPIMEventListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData); TBool OpenToDoListL( - const TDesC* aListName, + CCalSession* aCalSession, + + const TDesC* aCalNameArg, MPIMToDoAdapterManager** aRetAdapterManager, MPIMToDoListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Fri Sep 17 08:28:21 2010 +0300 @@ -44,7 +44,8 @@ /** * Two-phased constructor. */ - static CPIMToDoListAdapter* NewL(java::util::FunctionServer* aFuncServer); + static CPIMToDoListAdapter* NewL(java::util::FunctionServer* aFuncServer, + CCalSession *aCalSession); /** * Destructor. @@ -134,7 +135,8 @@ */ void CreateToDoItemL(MPIMToDoItem& aToDoItem); - void DoCreateToDoItemL(MPIMToDoItem& aToDoItem); + void CPIMToDoListAdapter::DoCreateToDoItemL( + MPIMToDoItem& aToDoItem); /** * Reads an existing To-Do item from the Agenda File. @@ -159,7 +161,8 @@ */ void ReadToDoItemL(MPIMToDoItem& aToDoItem); - void DoReadToDoItemL(MPIMToDoItem& aToDoItem); + void CPIMToDoListAdapter::DoReadToDoItemL( + MPIMToDoItem& aToDoItem); /** * Writes an existing To-Do item to the native Agenda File. @@ -185,7 +188,8 @@ */ void WriteToDoItemL(MPIMToDoItem& aToDoItem); - void DoWriteToDoItemL(MPIMToDoItem& aToDoItem); + void CPIMToDoListAdapter::DoWriteToDoItemL( + MPIMToDoItem& aToDoItem); /** * Removes an existing To-Do from the native Agenda File. @@ -205,7 +209,8 @@ */ void RemoveToDoItemL(TPIMItemID aItemID); - void DoRemoveToDoItemL(TPIMItemID aItemID); + void CPIMToDoListAdapter::DoRemoveToDoItemL( + TPIMItemID aItemID); protected: @@ -217,7 +222,7 @@ /** * By default Symbian 2nd phase constructor is private. */ - void ConstructL(); + void ConstructL(TInt aCalSessionInt); private: // Member data diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -46,6 +46,7 @@ CPIMAgnApptAdapter* self = new(ELeave) CPIMAgnApptAdapter(aFuncServer); CleanupStack::PushL(self); CallMethodL(self, &CPIMAgnApptAdapter::ConstructL, self->iFuncServer); + CleanupStack::Pop(self); return self; } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -19,7 +19,7 @@ // INCLUDE FILES #include "cpimagnlistadapter.h" #include "mpimitemdata.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include "cpimagnserverwait.h" #include "logger.h" @@ -54,12 +54,14 @@ // ----------------------------------------------------------------------------- // void CPIMAgnListAdapter::ConstructL( - MCalChangeCallBack::TChangeEntryType aEntryType) + + MCalChangeCallBack::TChangeEntryType aEntryType, + CCalSession* aCalSession) { JELOG2(EPim); + iServerWait = CPIMAgnServerWait::NewL(); - iCalSession = CCalSession::NewL(); - iCalSession->OpenL(iCalSession->DefaultFileNameL()); + iCalSession = aCalSession; iCalEntryView = CCalEntryView::NewL(*iCalSession, *iServerWait); iServerWait->WaitCompleteL(KServerMaxWait); @@ -285,10 +287,9 @@ void CPIMAgnListAdapter::CloseAgendaSession() { JELOG2(EPim); + iCalSession->StopChangeNotification(); delete iCalEntryView; iCalEntryView = NULL; - - delete iCalSession; iCalSession = NULL; iChangesRead = ETrue; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -139,7 +139,8 @@ return EFalse; } -TBool CPIMEventAdapterAccess::OpenEventListL(const TDesC* aListName, +TBool CPIMEventAdapterAccess::OpenEventListL(CCalSession* aCalSession, + const TDesC* aListName, MPIMEventAdapterManager** aRetAdapterManager, MPIMEventListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData) @@ -181,8 +182,8 @@ CPIMAgnApptAdapter* adapter = CPIMAgnApptAdapter::NewL(iFuncServer); CleanupStack::PushL(adapter); - listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAppt, adapter, - iFuncServer); + listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAppt,adapter, + iFuncServer, aCalSession); CleanupStack::Pop(adapter); CleanupStack::Pop(adapterManager); @@ -200,8 +201,8 @@ CPIMAgnMemoAdapter* adapter = CPIMAgnMemoAdapter::NewL(iFuncServer); CleanupStack::PushL(adapter); - listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EEvent, adapter, - iFuncServer); + listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EEvent,adapter, + iFuncServer, aCalSession); CleanupStack::Pop(adapter); CleanupStack::Pop(adapterManager); @@ -219,8 +220,8 @@ CPIMAgnAnnivAdapter* adapter = CPIMAgnAnnivAdapter::NewL(iFuncServer); CleanupStack::PushL(adapter); - listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAnniv, adapter, - iFuncServer); + listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAnniv,adapter, + iFuncServer, aCalSession); CleanupStack::Pop(adapter); CleanupStack::Pop(adapterManager); @@ -244,9 +245,11 @@ return ETrue; } -TBool CPIMEventAdapterAccess::OpenToDoListL(const TDesC* /*aListName*/, +TBool CPIMEventAdapterAccess::OpenToDoListL(CCalSession* /*aCalSession*/, + const TDesC* /*aListName*/, MPIMToDoAdapterManager** /*aRetAdapterManager*/, - MPIMToDoListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/) + MPIMToDoListAdapter** /*aRetListAdapter*/, + MPIMLocalizationData** /*aRetLocalizationData*/) { JELOG2(EPim); // no ToDo lists diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -49,10 +49,13 @@ // ----------------------------------------------------------------------------- // void CPIMEventListAdapter::ConstructL(CCalEntry::TType aEntryType, - CPIMAgnEventAdapter* aEventAdapter) + + CPIMAgnEventAdapter* aEventAdapter, + TInt aCalSessionInt) { JELOG2(EPim); - CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryEvent); + CCalSession* calSession = reinterpret_cast (aCalSessionInt); + CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryEvent, calSession); iEntryType = aEntryType; iAgnAdapter = aEventAdapter; } @@ -63,13 +66,17 @@ // ----------------------------------------------------------------------------- // CPIMEventListAdapter* CPIMEventListAdapter::NewL(CCalEntry::TType aEntryType, - CPIMAgnEventAdapter* aEventAdapter, java::util::FunctionServer* aFuncServer) + CPIMAgnEventAdapter* aEventAdapter, + java::util::FunctionServer* aFuncServer, CCalSession *aCalSession + ) { JELOG2(EPim); CPIMEventListAdapter* self = new(ELeave) CPIMEventListAdapter(aFuncServer); CleanupStack::PushL(self); + TInt calSessionInt = reinterpret_cast (aCalSession); CallMethodL(self, &CPIMEventListAdapter::ConstructL, aEntryType, - aEventAdapter, self->iFuncServer); + aEventAdapter, calSessionInt,self->iFuncServer); + CleanupStack::Pop(self); return self; } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -106,16 +106,20 @@ return EFalse; } -TBool CPIMToDoAdapterAccess::OpenEventListL(const TDesC* /*aListName*/, +TBool CPIMToDoAdapterAccess::OpenEventListL(CCalSession* /*aCalSession*/, + const TDesC* /*aListName*/, MPIMEventAdapterManager** /*aRetAdapterManager*/, - MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/) + MPIMEventListAdapter** /*aRetListAdapter*/, + MPIMLocalizationData** /*aRetLocalizationData*/ + ) { JELOG2(EPim); // no Event lists return EFalse; } -TBool CPIMToDoAdapterAccess::OpenToDoListL(const TDesC* aListName, +TBool CPIMToDoAdapterAccess::OpenToDoListL(CCalSession* aCalSession, + const TDesC* aListName, MPIMToDoAdapterManager** aRetAdapterManager, MPIMToDoListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData) @@ -136,7 +140,7 @@ (*iToDoListNames)[0]); CleanupDeletePushL(adapterManager); - MPIMToDoListAdapter* listAdapter = CPIMToDoListAdapter::NewL(iFuncServer); + MPIMToDoListAdapter* listAdapter = CPIMToDoListAdapter::NewL(iFuncServer, aCalSession); CleanupStack::Pop(adapterManager); MPIMLocalizationData* localizationData = iToDoLocalizationData; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -49,10 +49,11 @@ // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CPIMToDoListAdapter::ConstructL() +void CPIMToDoListAdapter::ConstructL(TInt aCalSessionInt) { JELOG2(EPim); - CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryTodo); + CCalSession* calSession = reinterpret_cast (aCalSessionInt); + CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryTodo, calSession); iAgnToDoAdapter = CPIMAgnToDoAdapter::NewL(iFuncServer); } @@ -61,13 +62,14 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -CPIMToDoListAdapter* CPIMToDoListAdapter::NewL( - java::util::FunctionServer* aFuncServer) +CPIMToDoListAdapter* CPIMToDoListAdapter::NewL(java::util::FunctionServer* aFuncServer, + CCalSession *aCalSession) { JELOG2(EPim); CPIMToDoListAdapter* self = new(ELeave) CPIMToDoListAdapter(aFuncServer); CleanupStack::PushL(self); - CallMethodL(self, &CPIMToDoListAdapter::ConstructL, self->iFuncServer); + TInt calSessionInt = reinterpret_cast (aCalSession); + CallMethodL(self, &CPIMToDoListAdapter::ConstructL,calSessionInt,self->iFuncServer); CleanupStack::Pop(self); return self; } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/build/build.xml --- a/javaextensions/pim/build/build.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/build/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -39,6 +39,7 @@ + com.nokia.mid.calendars=:pim.DynamicPropertyHandler microedition.pim.version=1.0 diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/build/javapim.pro --- a/javaextensions/pim/build/javapim.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/build/javapim.pro Fri Sep 17 08:28:21 2010 +0300 @@ -44,21 +44,21 @@ LIBS += -lbafl \ - -lBitmapTransforms \ + -lbitmaptransforms \ -lcaleninterimutils2 \ -lcalinterimapi \ -lcntmodel \ -lefsrv \ -lestor \ -lfbscli \ - -lImageConversion \ + -limageconversion \ -ltzclient \ -lvcal \ -lversit \ -lvcard \ -lefsrv \ - -lcommonengine \ - -lPlatformEnv + -lCommonEngine \ + -lplatformenv # Resource files diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h --- a/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Fri Sep 17 08:28:21 2010 +0300 @@ -26,6 +26,7 @@ // FORWARD DECLARATIONS class MPIMLocalizationManager; class MPIMLocalizationData; +class CCalSession; // CLASS DECLARATION /** @@ -63,12 +64,14 @@ MPIMLocalizationData** aRetLocalizationData); TBool OpenEventListL( + CCalSession* aCalSession, const TDesC* aListName, MPIMEventAdapterManager** aRetAdapterManager, MPIMEventListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData); TBool OpenToDoListL( + CCalSession* aCalSession, const TDesC* aListName, MPIMToDoAdapterManager** aRetAdapterManager, MPIMToDoListAdapter** aRetListAdapter, diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h --- a/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Fri Sep 17 08:28:21 2010 +0300 @@ -195,7 +195,7 @@ */ void Close(); - void DoClose(); + void CPIMContactListAdapter::DoClose(); public: // MPIMContactListAdapter @@ -223,7 +223,8 @@ */ void CreateContactItemL(MPIMContactItem& aContactItem); - void DoCreateContactItemL(MPIMContactItem& aContactItem); + void CPIMContactListAdapter::DoCreateContactItemL( + MPIMContactItem& aContactItem); /** * Reads an existing contact item from the native database. @@ -248,7 +249,8 @@ */ void ReadContactItemL(MPIMContactItem& aContactItem); - void DoCallReadContactItemL(MPIMContactItem& aContactItem); + void CPIMContactListAdapter::DoCallReadContactItemL( + MPIMContactItem& aContactItem); /** * Reads an existing contact item from the native database @@ -269,9 +271,11 @@ * native database. * @li Other - The list adapter is non-functional. */ - void ReadMinimalContactItemL(MPIMContactItem& aContactItem); + void ReadMinimalContactItemL( + MPIMContactItem& aContactItem); - void DoCallReadMinimalContactItemL(MPIMContactItem& aContactItem); + void CPIMContactListAdapter::DoCallReadMinimalContactItemL( + MPIMContactItem& aContactItem); /** * Reads an existing contact item from the native database @@ -311,7 +315,7 @@ void ReadContactFieldL(MPIMContactItem& aContactItem, TPIMContactField aContactField); - void DoReadContactFieldL( + void CPIMContactListAdapter::DoReadContactFieldL( MPIMContactItem& aContactItem, TPIMContactField aContactField); @@ -339,7 +343,8 @@ */ void WriteContactItemL(MPIMContactItem& aContactItem); - void DoWriteContactItemL(MPIMContactItem& aContactItem); + void CPIMContactListAdapter::DoWriteContactItemL( + MPIMContactItem& aContactItem); /** * Removes an existing contact from the native database. @@ -410,7 +415,7 @@ * @param aContactItemViewDef View definition which is used for * reading the contact item from the database */ - void DoReadContactItemL( + void CPIMContactListAdapter::DoReadContactItemL( MPIMContactItem& aContactItem, const CContactItemViewDef& aContactItemViewDef); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp --- a/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -75,16 +75,16 @@ return ETrue; } -TBool CPIMCMAdapterAccess::OpenEventListL(const TDesC* /*aListName*/, +TBool CPIMCMAdapterAccess::OpenEventListL(CCalSession* /*aCalSession*/, const TDesC* /*aListName*/, MPIMEventAdapterManager** /*aRetAdapterManager*/, - MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData */) + MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/) { JELOG2(EPim); // no Event lists return EFalse; } -TBool CPIMCMAdapterAccess::OpenToDoListL(const TDesC* /*aListName*/, +TBool CPIMCMAdapterAccess::OpenToDoListL(CCalSession* /*aCalSession*/, const TDesC* /*aListName*/, MPIMToDoAdapterManager** /*aRetAdapterManager*/, MPIMToDoListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData */) { diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp --- a/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -193,12 +193,12 @@ JELOG2(EPim); const CDesCArray& pimCategories = aItem.ItemData().Categories(); const TInt pimCategoryCount = pimCategories.Count(); - CArrayFix* newCategoryTable = new(ELeave) CArrayFixFlat (pimCategoryCount); - CleanupStack::PushL(newCategoryTable); + TBool* newCategoryTable = new(ELeave) TBool[pimCategoryCount]; + CleanupArrayDeletePushL(newCategoryTable); TInt i = 0; for (i = 0; i < pimCategoryCount; i++) { - newCategoryTable->InsertL(TRUE,i); + newCategoryTable[i] = ETrue; } CContactIdArray* cardCategories = aCard.GroupsJoinedLC(); @@ -220,14 +220,14 @@ } else { - // old group - newCategoryTable->InsertL(FALSE,pos); + // old group + newCategoryTable[pos] = EFalse; } } // then add new categories for (i = 0; i < pimCategoryCount; i++) { - if (newCategoryTable->At(i)) + if (newCategoryTable[i]) { TPtrC category = pimCategories[i]; iCategoryManager.AddToGroupL(id, category); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp --- a/javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -809,8 +809,7 @@ EPIMPanicInvalidItemID)); // Read contact item using the item view definition CContactCard* contactItem = - static_cast(iDatabase->ReadContactLC(id, - aContactItemViewDef)); + static_cast(iDatabase->ReadContactLC(id,aContactItemViewDef)); // Set date and fill the PIM item TTime lastModified = contactItem->LastModified(); aContactItem.SetLastModifiedL(lastModified); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/common/inc.s60/mpimadapteraccess.h --- a/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Fri Sep 17 08:28:21 2010 +0300 @@ -31,6 +31,7 @@ class MPIMToDoAdapterManager; class MPIMToDoListAdapter; class MPIMLocalizationData; +class CCalSession; // CLASS DECLARATION @@ -129,7 +130,9 @@ * @li \c KErrNotFound - The native database does not exist any more. * @li Other - The system is non-functional. */ - virtual TBool OpenEventListL(const TDesC* aListName, + virtual TBool OpenEventListL(CCalSession* aCalSession, + const TDesC* aListName, + //const TDesC* aCalNameArg, MPIMEventAdapterManager** aRetAdapterManager, MPIMEventListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData) = 0; @@ -163,7 +166,9 @@ * @li \c KErrNotFound - The native database does not exist any more. * @li Other - The system is non-functional. */ - virtual TBool OpenToDoListL(const TDesC* aListName, + virtual TBool OpenToDoListL(CCalSession* aCalSession, + const TDesC* aListName, + //const TDesC* aCalNameArg, MPIMToDoAdapterManager** aRetAdapterManager, MPIMToDoListAdapter** aRetListAdapter, MPIMLocalizationData** aRetLocalizationData) = 0; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/inc.s60/cleanupresetanddestroy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/framework/inc.s60/cleanupresetanddestroy.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,114 @@ +/* +* 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: Cleanup Stack "reset and destroy" push operation. + * +*/ + + +#ifndef CLEANUPRESETANDDESTROY_H +#define CLEANUPRESETANDDESTROY_H + +// INCLUDE FILES +#include + +/** + * An operation for pushing objects to cleanup stack with \c TCleanupItems + * that will perform a \c ResetAndDestroy() operation on the pushed object + * if a leave occurs. + * + * Note that the object itself will not be deleted. + * + * @par Example: + * Here is an example of using \c CleanupResetAndDestroy with a dynamically + * allocated \c RPointerArray. \c RPointerArray clears its contents with a + * \cResetAndDestroy() operation. + * @code + * + * // A function which creates a pointer array with couple of initialized + * // CThings. The function must return a pointer to the pointer array, + * // because the array has to be allocated dynamically. CThing is some + * // simple CBase-derived class. + * + * RPointerArray< CThing >* CreateThingArrayL( ) + * { + * // Create an array of pointers to CThings with granularity of 4 + * + * RPointerArray< CThing >* things = + * new( ELeave ) RPointerArray< CThing >( 4 ); + * + * // Push pointer to the array to the cleanup stack; then push reference + * // to the array and a ResetAndDestroy operation to the cleanup stack. + * + * // (Note that order of these operations matters: the ResetAndDestroy + * // operation must be performed before the array itself is deleted.) + * + * CleanupStack::PushL( things ); + * CleanupResetAndDestroyPushL( *things ); + * + * // Add couple of CThings with magic numbers to the array. + * // If any of the NewL() operations leaves, the array will be cleared + * // with ResetAndDestroy() and the array itself will destroyed. + * + * User::LeaveIfError( things->Append( CThing::NewL( 7 ) ) ); + * User::LeaveIfError( things->Append( CThing::NewL( 96 ) ) ); + * User::LeaveIfError( things->Append( CThing::NewL( 999 ) ) ); + * + * // Pop the array reference with ResetAndDestroy from cleanup stack + * // then pop the pointer to the array itself. + * + * CleanupStack::Pop(); // *things + * CleanupStack::Pop(); // things + * + * // Now we're ready to return the results (a pointer to the array) + * return things; + * } + * + * @endcode + */ +template +inline void CleanupResetAndDestroyPushL(T& aRef); + +/** + * See \ref CleanupResetAndDestroyPushL() documentation. + */ +template +class CleanupResetAndDestroy +{ +public: + inline static void PushL(T& aRef); + +private: + static void ResetAndDestroy(TAny *aPtr); +}; + +template +inline void CleanupResetAndDestroy::PushL(T& aRef) +{ + CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef)); +} + +template +void CleanupResetAndDestroy::ResetAndDestroy(TAny *aPtr) +{ + static_cast(aPtr)->ResetAndDestroy(); +} + +template +inline void CleanupResetAndDestroyPushL(T& aRef) +{ + CleanupResetAndDestroy::PushL(aRef); +} + +#endif // CLEANUPRESETANDDESTROY_H +// End of File diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/inc.s60/cpimmanager.h --- a/javaextensions/pim/framework/inc.s60/cpimmanager.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/inc.s60/cpimmanager.h Fri Sep 17 08:28:21 2010 +0300 @@ -43,6 +43,7 @@ class CPIMEventValidator; class CPIMToDoValidator; class MPIMAdapterAccess; +class CCalSession; // CLASS DECLARATION @@ -77,6 +78,7 @@ * Destructor. */ virtual ~CPIMManager(); + void DeleteSessions(); public: // New functions @@ -113,6 +115,8 @@ * @param aPimListName Name of the list. The name must be valid list * name. If not present, name is resolved to the default list * of the given type. + * @param aCalName Name of the Canlendar. The name must be valid Canlendar + * name. If not present, name is resolved to the default Canlendar. * * @return PIM list. Type of the list corresponds to * \a aPimListType argument. @@ -130,6 +134,7 @@ pimbaselist* openPimList( const TPIMListType& aPimListType, jstring aPimListName, + jstring aCalName, JNIEnv* aJniEnv); /** @@ -149,6 +154,48 @@ const TPIMListType& aPimListType, jintArray aError, JNIEnv* aJniEnv); + /** + * Lists list of Calendars existsing the mobile database. + * + * @return Array of list names. + * Caller takes the ownership of the returned object. + * + */ + jobjectArray listCalendars(jintArray aError, JNIEnv* aJniEnv); + + /** + * Lists list of Calendars names existsing the mobile database. + * + * @return Array of list names. + * Caller takes the ownership of the returned object. + */ + jobjectArray listCalendarNames(jintArray aError, JNIEnv* aJniEnv); + + /** + * create new calendar which you given name. + * + * @param calendar name Sting type this is used as filename. + * + * @param calendar name Sting type this is used as diaplay to the user. + * + * @return void. + * + * @par Leaving: + * @li \c KErrArgument - \if name already exists + */ + void createCalendar(jstring aCalName, jstring aDisplayName, JNIEnv* aJniEnv); + + /** + * delete the calendar which you given name. + * + * @param calendar name Sting type this is used as canlader filename + * which it will delete. + * @return void. + * + * @par Leaving: + * @li \c KErrArgument - \a calendar name is not valid or not exists. + */ + void deleteCalendar(jstring aCalName, JNIEnv* aJniEnv); /** * Provides a Contact validator. @@ -187,28 +234,102 @@ * @return A new list or NULL if no matching list was found. */ CPIMEventList* DoOpenEventListL( - const TDesC* aListName); + const TDesC* aListName, const TDesC* aCalName); /** * Opens a to-do list. * * @param aListName Name of the list or NULL to indicate * default list. - * - * @return A new list or NULL if no matching list was found. + * @param aCalName Name of the calendar or NULL to indicate + * default calendar. + * @return A new list or NULL if no matching list and calendar was found. */ - CPIMToDoList* DoOpenToDoListL( - const TDesC* aListName); + CPIMToDoList* DoOpenToDoListL(const TDesC* aListName, const TDesC* aCalName); + - CDesCArray* DoListPimListsL( + /** + * Opens a to-do list. + * + * @param aPimListType Name of the list or NULL to indicate + * default list. + * @return A new list or NULL if no matching list and calendar was found. + */ + CDesCArray* CPIMManager::DoListPimListsL( const TPIMListType& aPimListType); - pimbaselist* DoOpenPimListL( + /** + * list all the calendars this function will call by ListCalendars function + * + * @return void. + */ + void CPIMManager::DoListCalendarsL(); + + /** + * list all the calendars names this function will call by ListCalendatNames function + * + * @return void. + */ + void CPIMManager::DoListCalendarNamesL(); + + + /** + * creates the new calendar by given name. + * + * @param aFileName name of the calendar file this is string type. + * + * @param aDisplayName name of the calendar to display this is string type + * + * @return void. + */ + void CPIMManager::DoCreateCalFileL(const TDesC &aFileName,const TDesC &aDisplayName); + + /** + * delets the calendar by given name. + * + * @param aFileName name of the calendar file this is string type. + * + * @return void. + */ + void CPIMManager::DoDeleteCalFileL(const TDesC& aFileName); + + /** + * Opens a PIM list of given type. + * + * @param aPimListType List type. + * @param aPimListName Name of the list. The name must be valid list + * name. If not present, name is resolved to the default list + * of the given type. + * @param aCalName Name of the Canlendar. The name must be valid Canlendar + * name. If not present, name is resolved to the default Canlendar. + * + * @return PIM list. Type of the list corresponds to + * \a aPimListType argument. + * + * @par Leaving: + * The method leaves on error. Error codes should be interpreted as + * follows: + * @li \c KErrArgument - \a aPimListType is invalid. + * @li \c KErrNotSupported - \a aPimListType is not supported. + * @li \c KErrNotFound - No list was found by \a aPimListName. + * @li \c KErrAlreadyExists - The list was already opened and multiple + * instances of the list are not supported. + * @li Other - Internal error. + */ + pimbaselist* CPIMManager::DoOpenPimListL( const TPIMListType& aPimListType, - const TDesC* aPimListName); + const TDesC* aPimListName, + const TDesC* aCalName); + /** + * this method will create the Sessions with every calendar using file server. + * + */ + + void CPIMManager::createCalSessionL(); void dispose(); + private: // Constructors /** @@ -240,6 +361,23 @@ /** Owned. */ CPIMToDoValidator* iToDoValidator; + /** (Owned.) */ + RLibrary iLocalizationLibrary; + + CDesCArray* iCalList; + /** Session to calendar server. Owned. */ + //CCalSession* iCalSession; + + RPointerArray iCalSessions; + + CDesCArray* iCalendarNamesDesCArray; + + CDesCArray* iCalSessionArray; + + CDesCArray* iCalListName; + CDesCArrayFlat* iDesCArray; + CCalSession* iCalSession; + }; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/inc/pimbasemanager.h --- a/javaextensions/pim/framework/inc/pimbasemanager.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/inc/pimbasemanager.h Fri Sep 17 08:28:21 2010 +0300 @@ -35,13 +35,22 @@ virtual MPIMLocalizationManager* localizationManager() const = 0; virtual pimbaselist* openPimList(const TPIMListType& aPimListType, - jstring aPimListName, JNIEnv* aJniEnv) = 0; + jstring aPimListName, jstring aCalName, + JNIEnv* aJniEnv) = 0; virtual jobjectArray listPimLists(const TPIMListType& aPimListType, jintArray aError, JNIEnv* aJniEnv) = 0; + virtual jobjectArray listCalendars(jintArray aError, + JNIEnv* aJniEnv) = 0; + virtual jobjectArray listCalendarNames(jintArray aError, + JNIEnv* aJniEnv) = 0; virtual void dispose()= 0; + virtual void createCalendar(jstring aCalName, jstring aDisplayName, JNIEnv* aJniEnv) = 0; + + virtual void deleteCalendar(jstring aCalName, JNIEnv* aJniEnv) = 0; + static pimbasemanager* getInstance(); }; diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/src.s60/cpimeventlist.cpp --- a/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -29,7 +29,7 @@ #include "pimjnitools.h" #include "pimutils.h" #include "s60commonutils.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include "logger.h" CPIMEventList::CPIMEventList(const CPIMEventValidator& aValidator) : diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/src.s60/cpimlist.cpp --- a/javaextensions/pim/framework/src.s60/cpimlist.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimlist.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -25,7 +25,7 @@ #include "cpimitem.h" #include "cpimitemmatcher.h" #include "cpimstringmatcher.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include "pimexternalchanges.h" #include "pimpanics.h" #include "pimjnitools.h" @@ -927,9 +927,9 @@ User::LeaveIfError(newAndRemovedItems->Append( tempRemovedItems[i])); } - CleanupStack::Pop(newAndRemovedItems); + CleanupStack::Pop(); // newAndRemovedItems cleanup close - + CleanupStack::Pop(newAndRemovedItems); CleanupStack::PopAndDestroy(); // tempRemovedItems cleanup close CleanupStack::PopAndDestroy(); // tempNewItems cleanup close @@ -1163,6 +1163,7 @@ RPointerArray& aTempNewItems, CPIMItem* aMatchingItem) { JELOG2(EPim); + // Create new item CPIMItem* newItem = NULL; TRAPD(errCreateItem, newItem = DoCreateItemL(aNewItemId, @@ -1179,13 +1180,10 @@ { User::LeaveIfError(errCreateItem); } - - // OK newItem->SetModified(EFalse); CleanupStack::PushL(newItem); User::LeaveIfError(iItems.Append(newItem)); CleanupStack::Pop(newItem); - // Add to list of new items CleanupClosePushL(aTempNewItems); TInt errAddToNewItems = aTempNewItems.Append(newItem); @@ -1217,8 +1215,6 @@ { User::LeaveIfError(errUpdateItem); } - - // OK aModifiedItem.SetModified(EFalse); } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/src.s60/cpimmanager.cpp --- a/javaextensions/pim/framework/src.s60/cpimmanager.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimmanager.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -17,35 +17,44 @@ // INCLUDE FILES -#include "cpimmanager.h" + #include #include -#include "pimcommon.h" +#include +#include +#ifdef RD_JAVA_PIM_MULTICAL_ENABLED +#include +#include +#endif +#include "cpimmanager.h" +#include "cpimcontactlist.h" +#include "cpimcontactvalidator.h" +#include "cpimeventvalidator.h" +#include "cpimtodovalidator.h" +#include "cpimeventlist.h" +#include "cpimtodolist.h" +#include "cpimversit.h" +#include "cpimcmadapteraccess.h" +#include "cpimeventadapteraccess.h" +#include "cpimtodoadapteraccess.h" +#include "cpimlocalizationmanager.h" +#include "fs_methodcall.h" +#include "jstringutils.h" +#include "logger.h" #include "mpimcontactadaptermanager.h" #include "mpimeventadaptermanager.h" #include "mpimtodoadaptermanager.h" #include "mpimcontactlistadapter.h" #include "mpimeventlistadapter.h" #include "mpimtodolistadapter.h" -#include "cpimversit.h" #include "mpimlocalizationmanager.h" #include "mpimlocalizationdata.h" -#include "cpimcontactlist.h" -#include "cpimeventlist.h" -#include "cpimtodolist.h" -#include "cpimcontactvalidator.h" -#include "cpimeventvalidator.h" -#include "cpimtodovalidator.h" #include "mpimadapteraccess.h" -#include "cpimcmadapteraccess.h" -#include "cpimeventadapteraccess.h" -#include "cpimtodoadapteraccess.h" +#include "pimcommon.h" #include "pimpanics.h" #include "pimjnitools.h" #include "pimutils.h" -#include "jstringutils.h" -#include "logger.h" -#include "cpimlocalizationmanager.h" +#include "s60commonutils.h" // CONSTANTS @@ -55,10 +64,12 @@ * low, at the time of writing 1 to 4. */ const TInt KManagerArrayGranularity = 2; - +#ifdef RD_JAVA_PIM_MULTICAL_ENABLED +const TInt KBuffLength = 24; +#endif CPIMManager::CPIMManager() : - java::util::FunctionServer("CPIMManager"), iAdapterAccesses() + java::util::FunctionServer("CPIMManager"), iAdapterAccesses(), iCalSessions() { JELOG2(EPim); } @@ -69,18 +80,86 @@ iContactValidator = CPIMContactValidator::NewL(); iEventValidator = CPIMEventValidator::NewL(); iToDoValidator = CPIMToDoValidator::NewL(); - + iDesCArray = new(ELeave) CDesCArrayFlat(KManagerArrayGranularity); iLocalizationManager = (MPIMLocalizationManager*)(CPIMLocalizationManager::NewL()); createServerToNewThread(); + CallMethodL(this, &CPIMManager::createCalSessionL, this); +} + +void CPIMManager::createCalSessionL() +{ + iCalSession = CCalSession::NewL(); + //CleanupStack::PushL(iCalSession); + iCalSessionArray = iCalSession->ListCalFilesL(); + + TInt index = 0; + TInt find = iCalSessionArray->Find(iCalSession->DefaultFileNameL(),index); + + if (!find) + { + iCalSessionArray->Delete(index); + } + + TRAPD(err, iCalSession->OpenL(iCalSession->DefaultFileNameL())); + if (KErrNotFound == err) + { + iCalSession->CreateCalFileL(iCalSession->DefaultFileNameL()); + iCalSession->OpenL(iCalSession->DefaultFileNameL()); + } + else + { + User::LeaveIfError(err); + } + //CleanupStack::Pop(iCalSession); + +#ifdef RD_JAVA_PIM_MULTICAL_ENABLED + TInt iterate = 0; + TBool softDelete = EFalse; + + while (iterate < iCalSessionArray->Count()) + { + CCalSession* aCalSession = CCalSession::NewL(*iCalSession); + CleanupStack::PushL(aCalSession); + aCalSession->OpenL(iCalSessionArray->MdcaPoint(iterate)); + CCalCalendarInfo* caleninfo = aCalSession->CalendarInfoL(); + CleanupStack::PushL(caleninfo); + aCalSession->SetCalendarInfoL(*caleninfo); + + TBuf8 keyBuff; + keyBuff.Zero(); + keyBuff.AppendNum(EMarkAsDelete); + TPckgC pkgSoftDelete(softDelete); + TRAPD(err,pkgSoftDelete.Set(caleninfo->PropertyValueL(keyBuff))); + if (KErrNone == err) + { + softDelete = pkgSoftDelete(); + } + + if (softDelete) + { + + CleanupStack::PopAndDestroy(caleninfo); + CleanupStack::PopAndDestroy(aCalSession); + } + else + { + iCalSessions.AppendL(aCalSession); + iDesCArray->AppendL(iCalSessionArray->MdcaPoint(iterate)); + CleanupStack::PopAndDestroy(caleninfo); + CleanupStack::Pop(aCalSession); + } + iterate++; + } + delete iCalSessionArray; + iCalSessionArray = NULL; +#endif } pimbasemanager* pimbasemanager::getInstance() { JELOG2(EPim); - // Create CPIMManager - CPIMManager* self = NULL; TInt error = KErrNone; TRAP(error, self = CPIMManager::NewL()); @@ -135,9 +214,18 @@ delete iEventValidator; iEventValidator = NULL; delete iToDoValidator; + CallMethod(this, &CPIMManager::DeleteSessions, this); + delete iDesCArray; iToDoValidator = NULL; stopServer(); } +void CPIMManager::DeleteSessions() +{ + JELOG2(EPim); + iCalSessions.ResetAndDestroy(); + delete iCalSession; + iCalSession = NULL; +} void CPIMManager::dispose() { @@ -163,21 +251,24 @@ } pimbaselist* CPIMManager::openPimList(const TPIMListType& aPimListType, - jstring aPimListName, JNIEnv* aJniEnv) + jstring aPimListName, jstring aCalName, + JNIEnv* aJniEnv) { JELOG2(EPim); const JStringUtils listName(*aJniEnv, aPimListName); const TDesC* listNameArg = (aPimListName ? &listName : NULL); + const JStringUtils calName(*aJniEnv, aCalName); + const TDesC* calNameArg = (aCalName ? &calName : NULL); pimbaselist* list = NULL; TInt error = KErrNone; - TRAP(error, list = DoOpenPimListL(aPimListType, listNameArg)); + TRAP(error, list = DoOpenPimListL(aPimListType, listNameArg, calNameArg)); if (error != KErrNone) throw error; return list; } pimbaselist* CPIMManager::DoOpenPimListL(const TPIMListType& aPimListType, - const TDesC* aPimListName) + const TDesC* aPimListName, const TDesC* aCalNameArg) { JELOG2(EPim); pimbaselist* list = NULL; @@ -188,20 +279,18 @@ } else if (aPimListType == EPIMEventList) { - list = DoOpenEventListL(aPimListName); + list = DoOpenEventListL(aPimListName, aCalNameArg); } else if (aPimListType == EPIMToDoList) { - list = DoOpenToDoListL(aPimListName); + list = DoOpenToDoListL(aPimListName, aCalNameArg); } else { // invalid list type User::Leave(KErrArgument); } - // Check results - if (!list) { if (aPimListName) @@ -241,9 +330,6 @@ retVal->AppendL(lists[listIndex]); } } - - // Done - CleanupStack::Pop(retVal); return retVal; @@ -276,6 +362,276 @@ return javaStringArray; } + + + + +void CPIMManager::DoListCalendarsL() +{ + +#ifdef RD_JAVA_PIM_MULTICAL_ENABLED + iCalList = iCalSession->ListCalFilesL(); + + TInt index = 0; + TInt find = iCalList->Find(iCalSession->DefaultFileNameL(),index); + + if (!find) + { + iCalList->Delete(index); + } + iCalSessionArray = iCalList; + TInt iterate = 0; + TInt aPosition = 0; + while (iterate < iCalList->Count()) + { + aPosition = 0; + + TInt findInCurrentArray = iDesCArray->Find(iCalList->MdcaPoint(iterate),aPosition, ECmpNormal16); + CCalSession* aCalSession; + if (findInCurrentArray == 0) + { + aCalSession = iCalSessions[aPosition]; + } + else + { + aCalSession = CCalSession::NewL(*iCalSession); + CleanupStack::PushL(aCalSession); + aCalSession->OpenL(iCalList->MdcaPoint(iterate)); + } + // check for soft deleted calendars, incase of calendars being held by other applications, this will be followed. + CCalCalendarInfo* caleninfo = aCalSession->CalendarInfoL(); + CleanupStack::PushL(caleninfo); + aCalSession->SetCalendarInfoL(*caleninfo); + TBool softDelete = EFalse; + TBuf8 keyBuff; + keyBuff.Zero(); + keyBuff.AppendNum(EMarkAsDelete); + + TPckgC pkgSoftDelete(softDelete); + + TRAPD(err,pkgSoftDelete.Set(caleninfo->PropertyValueL(keyBuff))); + + if (KErrNone == err) + { + softDelete = pkgSoftDelete(); + } + + if (!softDelete && findInCurrentArray != 0) + { + iCalSessions.AppendL(aCalSession); + CleanupStack::Pop(aCalSession); + iDesCArray->AppendL(iCalList->MdcaPoint(iterate)); + } + else if (softDelete && findInCurrentArray == 0) + { + CleanupStack::PopAndDestroy(caleninfo); + caleninfo = NULL; + delete aCalSession; + iCalSessions[aPosition] = NULL; + iCalSessions.Remove(aPosition); + iDesCArray->Delete(aPosition); + + } + else if (softDelete && findInCurrentArray != 0) + { + CleanupStack::PopAndDestroy(caleninfo); + CleanupStack::PopAndDestroy(aCalSession); + caleninfo=NULL; + aCalSession = NULL; + } + if (caleninfo != NULL) + { + CleanupStack::PopAndDestroy(caleninfo); + caleninfo = NULL; + } + iterate++; + + } + + iCalList = iDesCArray; + iCalList->AppendL(iCalSession->DefaultFileNameL()); + delete iCalSessionArray; + iCalSessionArray = NULL; +#endif + +} + + +jobjectArray CPIMManager::listCalendars(jintArray aError, + JNIEnv* aJniEnv) +{ + + jobjectArray javaStringArray = NULL; + TInt error = KErrNone; + TRAP(error, CallMethodL(this, &CPIMManager::DoListCalendarsL, this)); + if (error == KErrNone) + { + javaStringArray = CreateJavaStringArray(aJniEnv, *iCalList, EFalse); + if (!javaStringArray) + { + SetJavaErrorCode(aJniEnv, aError, KErrNoMemory); + } + iCalList = NULL; + TInt index = 0; + TInt find = 0; + TRAPD(error,find = iDesCArray->Find(iCalSession->DefaultFileNameL(),index)); + if (error == KErrNone) + if (!find) + { + iDesCArray->Delete(index); + } + else + { + SetJavaErrorCode(aJniEnv, aError, error); + } + } + else + { + + SetJavaErrorCode(aJniEnv, aError, error); + } + return javaStringArray; +} + +jobjectArray CPIMManager::listCalendarNames(jintArray aError, + JNIEnv* aJniEnv) +{ + jobjectArray javaStringArray = NULL; + TInt error = KErrNone; + TRAP(error, CallMethodL(this, &CPIMManager::DoListCalendarNamesL, this)); + if (error == KErrNone) + { + javaStringArray = CreateJavaStringArray(aJniEnv, *iCalListName, EFalse); + if (!javaStringArray) + { + SetJavaErrorCode(aJniEnv, aError, KErrNoMemory); + } + delete iCalListName; + iCalListName = NULL; + } + else + { + SetJavaErrorCode(aJniEnv, aError, error); + } + return javaStringArray; +} + +void CPIMManager::DoListCalendarNamesL() +{ +#ifdef RD_JAVA_PIM_MULTICAL_ENABLED + iCalListName = new(ELeave) CDesCArrayFlat(KManagerArrayGranularity); + //CleanupStack::PushL(iCalListName); + for (int iterate = 0; iterate < iDesCArray->Count(); iterate++) + { + CCalCalendarInfo* caleninfo = iCalSessions[iterate]->CalendarInfoL(); + CleanupStack::PushL(caleninfo); + iCalListName->AppendL(caleninfo->NameL()); + + CleanupStack::PopAndDestroy(caleninfo); + } + CCalCalendarInfo* caleninfo = iCalSession->CalendarInfoL(); + CleanupStack::PushL(caleninfo); + iCalListName->AppendL(caleninfo->NameL()); + + CleanupStack::PopAndDestroy(caleninfo); + //CleanupStack::Pop(iCalListName); +#endif +} +void CPIMManager::createCalendar(jstring aCalName,jstring aDisplayName, JNIEnv* aJniEnv) +{ + const JStringUtils calName(*aJniEnv, aCalName); + const JStringUtils displayName(*aJniEnv, aDisplayName); + const TDesC* displayNameArg = (aDisplayName ? &displayName : NULL); + const TDesC* calNameArg = (aCalName ? &calName : NULL); + TInt error = KErrNone; + TRAP(error, CallMethodL(this, &CPIMManager::DoCreateCalFileL, *calNameArg,*displayNameArg, this)); + if (error != KErrNone) + throw error; +} + +void CPIMManager::DoCreateCalFileL(const TDesC& aFileName, const TDesC& aDisplayName) +{ + #ifdef RD_JAVA_PIM_MULTICAL_ENABLED + + CCalSession* aCalSession = CCalSession::NewL(*iCalSession); + CleanupStack::PushL(aCalSession); + CCalCalendarInfo* calendarInfo = CCalCalendarInfo::NewL(); + CleanupStack::PushL(calendarInfo); + + aCalSession->CreateCalFileL(aFileName,*calendarInfo); + CleanupStack::PopAndDestroy(calendarInfo); + aCalSession->OpenL(aFileName); + CCalCalendarInfo* calendarinfostack = aCalSession->CalendarInfoL(); + CleanupStack::PushL(calendarinfostack); + + calendarinfostack->SetNameL(aDisplayName); + calendarinfostack->SetEnabled(ETrue); + aCalSession->SetCalendarInfoL(*calendarinfostack); + CleanupStack::PopAndDestroy(calendarinfostack); + iCalSessions.AppendL(aCalSession); + iDesCArray->AppendL(aFileName); + CleanupStack::Pop(aCalSession); + + #endif +} + +void CPIMManager::deleteCalendar(jstring aCalName, JNIEnv* aJniEnv) +{ + const JStringUtils calName(*aJniEnv, aCalName); + const TDesC* calNameArg = (aCalName ? &calName : NULL); + TInt error = KErrNone; + TRAP(error, CallMethodL(this, &CPIMManager::DoDeleteCalFileL, *calNameArg, this)); + if (error != KErrNone) + throw error; + +} + + +void CPIMManager::DoDeleteCalFileL(const TDesC& aFileName) +{ + #ifdef RD_JAVA_PIM_MULTICAL_ENABLED + + if (aFileName != iCalSession->DefaultFileNameL()) + { + TInt aPosition = 0; + TInt findInCurrentArray = iDesCArray->Find(aFileName, aPosition, ECmpNormal16); + if (findInCurrentArray == 0) + { + CCalCalendarInfo* caleninfo = iCalSessions[aPosition]->CalendarInfoL(); + CleanupStack::PushL(caleninfo); + + caleninfo->SetEnabled(EFalse); + + TBuf8 keyBuff; + + keyBuff.Zero(); + keyBuff.AppendNum(EMarkAsDelete); + TPckgC pkgSoftDelete(ETrue); + caleninfo->SetPropertyL(keyBuff, pkgSoftDelete); + + CleanupStack::PopAndDestroy(caleninfo); + TRAP_IGNORE(iCalSessions[aPosition]->DeleteCalFileL(aFileName)); + + delete iCalSessions[aPosition]; + iCalSessions[aPosition]= NULL; + iCalSessions.Remove(aPosition); + + iDesCArray->Delete(aPosition); + } + else + { + User::Leave(KErrNotFound); + } + + } + else + { + User::Leave(KErrAccessDenied); + } + + #endif +} + const CPIMContactValidator& CPIMManager::ContactValidator() { JELOG2(EPim); @@ -309,26 +665,20 @@ if (iAdapterAccesses[i]->OpenContactListL(aListName, &contactAdapterManager, &contactListAdapter, &localizationData)) { - // got one CleanupDeletePushL(contactAdapterManager); CleanupDeletePushL(contactListAdapter); - contactList = CPIMContactList::NewL(contactAdapterManager, contactListAdapter, localizationData, *iContactValidator); - CleanupStack::Pop(contactListAdapter); CleanupStack::Pop(contactAdapterManager); - break; } - - // else try next Adapter Access } return contactList; } -CPIMEventList* CPIMManager::DoOpenEventListL(const TDesC* aListName) +CPIMEventList* CPIMManager::DoOpenEventListL(const TDesC* aListName, const TDesC* aCalNameArg) { JELOG2(EPim); CPIMEventList* eventList = NULL; @@ -337,22 +687,40 @@ MPIMEventListAdapter* eventListAdapter = NULL; MPIMLocalizationData* localizationData = NULL; + + CCalSession* calSession = NULL; + TInt findInCurrentArray = 0; + TInt aPosition = 0; + if (aCalNameArg == NULL || *aCalNameArg == iCalSession->DefaultFileNameL()) + { + calSession = iCalSession; + } + else + { + findInCurrentArray = iDesCArray->Find(*aCalNameArg, aPosition); + + if (findInCurrentArray == 0) + { + calSession = iCalSessions[aPosition]; + } + else + { + User::Leave(KErrNotFound); + } + } + const TInt n = iAdapterAccesses.Count(); for (TInt i = 0; i < n; i++) { - if (iAdapterAccesses[i]->OpenEventListL(aListName, + if (iAdapterAccesses[i]->OpenEventListL(calSession, aListName, &eventAdapterManager, &eventListAdapter, &localizationData)) { - // got one CleanupDeletePushL(eventAdapterManager); CleanupDeletePushL(eventListAdapter); - eventList = CPIMEventList::NewL(eventAdapterManager, eventListAdapter, localizationData, *iEventValidator); - CleanupStack::Pop(eventListAdapter); CleanupStack::Pop(eventAdapterManager); - break; } @@ -362,7 +730,7 @@ return eventList; } -CPIMToDoList* CPIMManager::DoOpenToDoListL(const TDesC* aListName) +CPIMToDoList* CPIMManager::DoOpenToDoListL(const TDesC* aListName, const TDesC* aCalNameArg) { JELOG2(EPim); CPIMToDoList* toDoList = NULL; @@ -370,12 +738,34 @@ MPIMToDoAdapterManager* toDoAdapterManager = NULL; MPIMToDoListAdapter* toDoListAdapter = NULL; MPIMLocalizationData* localizationData = NULL; + TInt aPosition = 0; + TInt findInCurrentArray = 0; + + CCalSession* calSession = NULL; + + if (aCalNameArg == NULL || *aCalNameArg == iCalSession->DefaultFileNameL()) + { + calSession = iCalSession; + } + else + { + findInCurrentArray = iDesCArray->Find(*aCalNameArg, aPosition); + + if (findInCurrentArray == 0) + { + calSession = iCalSessions[aPosition]; + } + else + { + User::Leave(KErrNotFound); + } + } const TInt n = iAdapterAccesses.Count(); for (TInt i = 0; i < n; i++) { - if (iAdapterAccesses[i]->OpenToDoListL(aListName, &toDoAdapterManager, - &toDoListAdapter, &localizationData)) + if (iAdapterAccesses[i]->OpenToDoListL(calSession, aListName, + &toDoAdapterManager, &toDoListAdapter,&localizationData)) { // got one CleanupDeletePushL(toDoAdapterManager); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/src.s60/cpimtodolist.cpp --- a/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -24,7 +24,7 @@ #include "cpimtodoitem.h" #include "mpimadaptermanager.h" #include "pimtodo.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include "pimjnitools.h" #include "pimutils.h" #include "s60commonutils.h" diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/framework/src.s60/pimjnitools.cpp --- a/javaextensions/pim/framework/src.s60/pimjnitools.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/pimjnitools.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -174,10 +174,12 @@ JELOG2(EPim); const TInt numElems = aNativeArray.Count(); + // Initializes the array with NULLs jobjectArray javaStringArray = aJniEnv->NewObjectArray(numElems, aJniEnv->FindClass("java/lang/String"), NULL); + if (!javaStringArray) { return NULL; @@ -208,7 +210,6 @@ // Avoid running out of local references aJniEnv->DeleteLocalRef(javaElem); } - return javaStringArray; } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/inc.s60/dummy.txt diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/inc.s60/mpimlocalizationdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/inc.s60/mpimlocalizationdata.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2004 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: Access interface to list-specific localization data. +* +*/ + +#ifndef MPIMLOCALIZATIONDATA_H +#define MPIMLOCALIZATIONDATA_H + +// INCLUDES +#include "pimtypes.h" + +// CLASS DECLARATION + +/** +* Provides localized strings for the various labels used in the PIM API +*/ +class MPIMLocalizationData +{ +public: // destructor + /** + * Destructor is public virtual in order to allow deletion through + * M-class + */ + virtual ~MPIMLocalizationData() { } + +public: // New functions + + /** + * Provides a string label associated with the given field. The caller + * takes ownership of the returned object. + * + * @param aField The field for which the label is being queried. + * + * @return String label for the field. The label is locale specific. + */ + virtual HBufC* GetFieldLabelL(TPIMField aField) = 0; + + /** + * Provides a string label associated with the given attribute. + * The caller takes ownership of the returned object. + * + * @param aAttribute The attribute for which the label is being queried. + * + * @return String label for the attribute. The label is locale specific. + */ + virtual HBufC* GetAttributeLabelL(TPIMAttribute aAttribute) = 0; + + /** + * Provides a string label associated with the given array element. + * The caller takes ownership of the returned object. + * + * @param aStringArrayField The field which has a EPIMFieldStringArray + * data type. + * @param aArrayElement The element in the array. + * + * @return String label for the array element + */ + virtual HBufC* GetArrayElementLabelL(TPIMField aStringArrayField, + TPIMArrayElement aArrayElement) = 0; + /** + * Provides the name of the list. + * The caller takes ownership of the returned object. + * + * @return the list name. + */ + virtual HBufC* GetListNameL() = 0; + +}; + + + +#endif // MPIMLOCALIZATIONDATA_H diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/inc.s60/mpimlocalizationmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/inc.s60/mpimlocalizationmanager.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2004-2007 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: Access interface to different list localization data sets. +* +*/ + +#ifndef MPIMLOCALIZATIONMANAGER_H +#define MPIMLOCALIZATIONMANAGER_H + +// INCLUDES +#include "pimtypes.h" +#include + +// FORWARD DECLARATIONS +class MPIMLocalizationData; +class MPIMConfirmationDialogue; + +/** + * PIM Item and category operations + */ +enum TPIMOperationType +{ + EPIMOperationItemDeletion = 1, + EPIMOperationItemCommit, + EPIMOperationCategoryDeletion, + EPIMOperationContactListRead, + EPIMOperationContactListWrite, + EPIMOperationEventListRead, + EPIMOperationEventListWrite, + EPIMOperationToDoListRead, + EPIMOperationToDoListWrite +}; + +// CLASS DECLARATION +/** + * A Factory class for MPIMLocalizationData objects + */ +class MPIMLocalizationManager +{ +public: // destructor + /** + * Destructor is public virtual in order to allow deletion through + * M-class + */ + virtual ~MPIMLocalizationManager() { } + +public: + /** + * Creates an instance of MPIMLocalizationData. + * Caller takes ownership of the returned object. + * + * @param aType Type of the list, which of data to localize. + * This can be KPIMLocalizationIdContact, + * KPIMLocalizationIdSIM, KPIMLocalizationIdEvent or + * KPIMLocalizationidToDo + * + * @return MPIMLocalizationData object for the requested list type. + * @par Leaving: + * The method leaves on error. Error codes should be interpreted as + * follows: + * @li \c KErrArgument - \a aType is not valid + * @li \c KErrNotFound - The resource file cannot be read + */ + virtual MPIMLocalizationData* GetPIMLocalizationDataL( + TPIMLocalizationDataID aType) = 0; + + /** + * Creates an instance of MPIMLocalizationData. + * Caller takes ownership of the returned object. + * + * @param aType Type of the list, which of data to localize. + * This can be KPIMLocalizationIdContact, + * KPIMLocalizationIdSIM, KPIMLocalizationIdEvent or + * KPIMLocalizationidToDo + * + * @param aSubType List name identifier. Currently only Event lists + * can have list name identifiers (all other list should + * use zero). + * + * @return MPIMLocalizationData object for the requested list type. + * @par Leaving: + * The method leaves on error. Error codes should be interpreted as + * follows: + * @li \c KErrArgument - \a aType is not valid, or \a aSubType is not + * valid for \a aType. + * @li \c KErrNotFound - The resource file cannot be read + */ + virtual MPIMLocalizationData* GetPIMLocalizationDataL( + TPIMLocalizationDataID aType, + TPIMLocalizationDataID aSubType) = 0; + + + +}; + + + +#endif // MPIMLOCALIZATIONMANAGER_H + +// End of file diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/inc.s60/pimlocalizationids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/inc.s60/pimlocalizationids.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2004 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: Localization data identifiers. +* +*/ + + + +#ifndef PIMLOCALIZATIONIDS_H +#define PIMLOCALIZATIONIDS_H + +// INCLUDE FILES +#include "pimtypes.h" + +/** +* @file +* This file contains constants that map the lists provided by adapters +* with label sets provided with the localization module. A constant may +* apply to one or several related lists. +* +* There are two types of IDs: +* @li Localization IDs +* @li List name IDs +* Both of them are of type TPIMLocalizationDataID. +* +* Localization IDs define a set of localized labels for fields, attributes +* and array elements and a default name for the list. +* +* List name IDs specify a name among a set of localized labels defined by +* a localization ID. The default list name can be thus overridden using +* a list name ID. A localization set may or may not define several list name +* IDs. If only single name is defined for a localization set, it may not be +* documented but it can be used using the localization operations that rely +* on the default list name id. +* +* Naming: +* @li Localization IDs are of form \c KPIMLocalizationIDXXX. +* @li List name IDs are of form \c KPIMListNameIdYYY. +*/ + +// CONSTANTS + + +// Localization data IDs + +/** +* Localization data identifier for Contacts Model contact list. The labels +* associated with this identifier apply only on that list. +*/ +const TPIMLocalizationDataID KPIMLocalizationIdContacts = 1; + +/** +* Localization data identifier for SIM contact list. The labels associated +* with this identifier apply only on that list. +* +* NOTE: Currently unused, defined for future purposes. +*/ +const TPIMLocalizationDataID KPIMLocalizationIdSIM = 2; + +/** +* Localization data identifier for all Agenda Event lists (Meeting, Memo and +* Anniversary). The labels are valid for any of those lists. Each of the lists +* uses only a subset of the labels associated with this identifier. +*/ +const TPIMLocalizationDataID KPIMLocalizationIdEvent = 3; + +/** +* Localization data identifier for Agenda to-do list. The labels associated +* with this identifier apply only on that list. +*/ +const TPIMLocalizationDataID KPIMLocalizationIdToDo = 4; + + +// List name IDs +// NOTE! It is essential that these IDs are sequential and start from zero. + +/** +* List name identifier for "Appointment" Agenda Event list. +* Applies with the localization data identifier \c KPIMLocalizationIdEvent. +*/ +const TPIMLocalizationDataID KPIMListNameIdAppointment = 0; + +/** +* List name identifier for "Event" Agenda Event list. +* Applies with the localization data identifier \c KPIMLocalizationIdEvent. +*/ +const TPIMLocalizationDataID KPIMListNameIdEvent = 1; + +/** +* List name identifier for "Anniversary" Agenda Event list. +* Applies with the localization data identifier \c KPIMLocalizationIdEvent. +*/ +const TPIMLocalizationDataID KPIMListNameIdAnniversary = 2; + + +#endif // PIMLOCALIZATIONIDS_H + + +// End of File diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java --- a/javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java Fri Sep 17 08:28:21 2010 +0300 @@ -644,7 +644,81 @@ } } } + public static void handleCreateCalendarError(int aNativeErrorCode, String aCalName) + { + + if (aNativeErrorCode == OsErrorMessage.SUCCESS) + { + return; // OK + } + + switch (aNativeErrorCode) + { + case OsErrorMessage.KERR_ARGUMENT: + { + throw new IllegalArgumentException( + "Creation of calendar failed: calendar name is invalid" + + aCalName); + } + case OsErrorMessage.KERR_BAD_NAME: + { + throw new IllegalArgumentException( + "Creation of calendar failed: calendar name is not valid " + + aCalName); + } + case OsErrorMessage.KERR_ALREADY_EXISTS: + { + throw new RuntimeException(ErrorString.CALENDAR_ALREADY_EXISTS); + } + default: + { + throw new GenericException(ErrorString.GENERAL_ERROR_COLON + aNativeErrorCode); + } + } + } + + public static void handleDeleteCalendarError(int aNativeErrorCode, String aCalName) + { + + + if (aNativeErrorCode == OsErrorMessage.SUCCESS) + { + return; // OK + } + + switch (aNativeErrorCode) + { + case OsErrorMessage.KERR_ACCESS_DENIED: + { + throw new IllegalArgumentException( + "Deletion of calendar failed: phone default calendar cannot be deleted"); + } + case OsErrorMessage.KERR_ARGUMENT: + { + // we should never end up here since the calendar name is + // verified to be not empty before making the native call + throw new IllegalArgumentException( + "Deletion of calendar failed: calendar name is null"); + } + case OsErrorMessage.KERR_NOT_FOUND: + { + throw new IllegalArgumentException( + "Deletion of calendar failed: calendar by name " + + aCalName + " cannot be found"); + } + case OsErrorMessage.KERR_BAD_NAME: + { + throw new IllegalArgumentException( + "Deletion of calendar failed: calendar name " + + aCalName + " includes a path explicitly"); + } + default: + { + throw new GenericException(ErrorString.GENERAL_ERROR_COLON + aNativeErrorCode); + } + } + } /** * Construction prohibited. */ diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/Calendar.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/Calendar.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,106 @@ +/* +* 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: Abstract PIMExtension class. + * +*/ + +// PACKAGE +package com.nokia.mj.impl.pim; + +// CLASS DEFINITION +/** + *

+ * Nokia propritery class for holding the calendar file name and calendar display name. + *

+ + *

General

+ * The object of the class will be returned to user when listcalendars is called from the MIDlet. + * Using the object user can obtain either calendar file name or calendar display name. These names should be used in appropriate places. + *
    + *
  • + *

    Sample MIDlet code snippet

    + * + *

    Opening a Memo List from a calendar name Personal available on C drive

    + * + * + * import javax.microedition.pim.*;
    + * import com.nokia.mid.pimextension.PIMExtension;
    + * import com.nokia.mid.pimextension.calendar;
    + *
    + *     ...
    + *     // Gets a PIMExtended class instance
    + *     PIM pim = PIM.getInstance();
    + *     try {
    + *     PIMExtension pimExtension = (PIMExtension) pim;
    + *     }
    + *     catch (ClassCastException e){
    + *     // extension is not avaialable
    + *     }
    + *
    + *     // Gets the list of calendars available on the device
    + *     calendar[] calList = pimExtension.listCalendars();
    + *
    + *     // Opens the memo list from the "Personal" calendar
    + *     EventList memoList = ( EventList )
    + *         calPIM.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE, "Memos", calList.getCalendarFileName);
    + *  ...
    + *  
    + *
    + */ +public final class Calendar +{ + /* + * + * two strings to hold calendar File Name and Calendar name. These should not be accesible, hence they are private. + * + */ + private String calendarFileName; + private String calendarName; + /* + * + *constructor accessed by jrt implementation to construct the object with the 2 different names of the calendar. + * + */ + public Calendar(String fileName, String userName) + { + calendarFileName = fileName; + calendarName = userName; + } + /* + * + * + * This functions getCalendarFileName() returns the calendar file name in the database. + * This string should be passed to all the operations on calendar. + * + */ + public String getCalendarFileName() + { + return calendarFileName; + } + + /* + * + * + * This functions getCalendarName() returns the display name of the calendar. + * This should be used for user display purposes. + * Note: When user creates a calendar from java side, both the names will be same. + * The file created will be named as the string passed by user. + * The calendar will also be named with the string. + * + */ + public String getCalendarName() + { + return calendarName; + } +} \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java Fri Sep 17 08:28:21 2010 +0300 @@ -217,4 +217,7 @@ /** Error description. */ public final static String SEARCHING_FAILED_COLON = "Searching failed:"; + + /** Error description. */ + public final static String CALENDAR_ALREADY_EXISTS = "Calendar already Exists:"; } \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java Fri Sep 17 08:28:21 2010 +0300 @@ -111,12 +111,14 @@ PIMListImpl(int aListHandle, int aMode) { iListHandle = aListHandle; + iMode = aMode; Logger.LOG(Logger.EPim,Logger.EInfo,"+PIMListImpl() = iListHandle = "+iListHandle); + if (iListHandle != 0) + { + iItems = new ItemTable(); + } setShutdownListener(); iFinalizer = registerForFinalization(); - iMode = aMode; - - iItems = new ItemTable(); } public Finalizer registerForFinalization() @@ -359,8 +361,11 @@ if (iIsOpen == true) { iIsOpen = false; - int err = _close(iListHandle); - NativeError.handlePIMListCloseError(err); + if (iListHandle != 0) + { + int err = _close(iListHandle); + NativeError.handlePIMListCloseError(err); + } iItems = null; } else diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java Fri Sep 17 08:28:21 2010 +0300 @@ -20,12 +20,13 @@ package com.nokia.mj.impl.pim; // IMPORTS - import javax.microedition.pim.PIM; import javax.microedition.pim.PIMException; import javax.microedition.pim.PIMItem; import javax.microedition.pim.PIMList; import java.io.UnsupportedEncodingException; +import java.util.Enumeration; +import java.util.Vector; import com.nokia.mj.impl.pim.ErrorString; import com.nokia.mj.impl.pim.GenericException; import com.nokia.mj.impl.rt.support.ApplicationUtils; @@ -33,7 +34,8 @@ import com.nokia.mj.impl.rt.support.ShutdownListener; import com.nokia.mj.impl.security.utils.SecurityPromptMessage; import com.nokia.mj.impl.pim.utils.NativeError; - +import com.nokia.mj.impl.utils.Tokenizer; +import com.nokia.mj.impl.pim.Calendar; // CLASS DEFINITION /** @@ -72,6 +74,7 @@ /** Serializer. */ private Serializer iSerializer; + private Vector iCalInfo; // Methods @@ -98,7 +101,7 @@ * Creates PIMManager. * Direct creation of a PIMManager is prohibited. */ - private PIMManager() + public PIMManager() { super(); setShutdownListener(); @@ -111,6 +114,7 @@ } iSerializer = new Serializer(iManagerHandle); + iCalInfo = new Vector(); } /** @@ -164,7 +168,6 @@ iManagerHandle = 0; } } - }); } @@ -178,13 +181,18 @@ } // Methods from PIM - public synchronized PIMList openPIMList(int aPimListType, int aMode) throws PIMException { - return doOpenPIMList(aPimListType, aMode, null); + return doOpenPIMList(aPimListType, aMode, null, null); } + + /** + * this method is used to open existsing calendar, create new calendar and delete existsing calendar by passing string as name. + * function will parse the string and do the operation. + * user as to pass the string in given format only + */ public synchronized PIMList openPIMList(int aPimListType, int aMode, String aName) throws PIMException { @@ -193,17 +201,130 @@ throw new NullPointerException(ErrorString.OPENING_LISTS_FAILED_COLON + ErrorString.LIST_NAME_IS_NULL); } + //Check if the aName is as per the MultipleCalendar Parameter definition + //aName = [calendarname "/"] listname ["?operation=" ["create" | "delete"]] + if (isMultiCalendarParam(aName)) + { - return doOpenPIMList(aPimListType, aMode, aName); + String calendarName = null; + String operation = null; + String listName = null; + + listName = getListName(aName); + operation = getOperation(aName); + calendarName = aName.substring(0, aName.indexOf("/")); + if (isListNameValid(listName)) + { + if (operation == null) + { + if (calendarName != null) + { + //This is the case of opening an existing calendar + return doOpenPIMList(aPimListType, aMode, listName, "C:" + calendarName); + } + else + { + //This is the case with IllegalArgumentException + throw new IllegalArgumentException("Calendar Name is NULL"); + } + } + else if (operation.equals("create")) + { + createCalendar(calendarName); + int[] error = new int[1]; + int listHandle = _openPIMList(iManagerHandle, aPimListType, listName, calendarName, error); + PIMListImpl pimList = new EventListImpl(listHandle, aMode); + return pimList; + } + else if (operation.equals("delete")) + { + deleteCalendar(calendarName); + int listHandle = 0; + PIMListImpl pimList = new EventListImpl(listHandle, aMode); + return pimList; + } + else + { + throw new IllegalArgumentException("Invalid operation"); + } + } // if isListNameValid(listName) block ends here + else + { + throw new IllegalArgumentException("Invalid List name"); + } + } // if isMultiCalendarParam(aName) block ends here + else + { + //This is not the case of Multiple Calendar, so follow the default calendar path + return doOpenPIMList(aPimListType, aMode, aName); + } + } + + private boolean isMultiCalendarParam(String aListTypeName) + { + //If there is "?" and/or "=" is present in aListTypeName + //return true + boolean ret = false; + if ((aListTypeName.indexOf("/") != -1) || (aListTypeName.indexOf("?") != -1) || (aListTypeName.indexOf("=") != -1)) + { + ret = true; + } + return ret; + } + + private String getListName(String aName) + { + // Get Operation + String operation = "?operation="; + int operationIndex = aName.indexOf(operation); + + if (operationIndex == -1) + { + operationIndex = aName.length(); + } + + return aName.substring(aName.indexOf("/") + 1, operationIndex); + } + + private boolean isListNameValid(String aListName) + { + String lists[] = listPIMLists(PIM.EVENT_LIST); + boolean listExist = false; + + for (int i = 0; i < lists.length; i++) + { + if (aListName.trim().equalsIgnoreCase(lists[i])) + { + listExist = true; + break; + } + } + + return listExist; + } + + private String getOperation(String aName) + { + String aOperation = null; + String operation = "?operation="; + int operationIndex = aName.indexOf(operation); + + if (operationIndex != -1) + { + aOperation = aName.substring(operationIndex + operation.length()); + } + + + return aOperation; + } public synchronized String[] listPIMLists(int aPimListType) { - if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST - && aPimListType != PIM.TODO_LIST) + + if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST && aPimListType != PIM.TODO_LIST) { - throw new java.lang.IllegalArgumentException(ErrorString.LISTING_FAILED_DOT + - ErrorString.INVALID_LIST_TYPE_COLON + aPimListType); + throw new java.lang.IllegalArgumentException(ErrorString.LISTING_FAILED_DOT + ErrorString.INVALID_LIST_TYPE_COLON + aPimListType); } // Ensure permission getPermission(aPimListType, PIM.READ_ONLY); @@ -233,7 +354,121 @@ { return iSerializer.supportedSerialFormats(aPimListType); } + /** + * Enumerates the calendars currently present in the device. + * + * @return A list of Calendar names + * @throws java.lang.SecurityException + * if the application is not given permission to read PIM lists + */ + public synchronized Calendar[] listCalendars() + { + // security check + ApplicationUtils appUtils = ApplicationUtils.getInstance(); + PIMPermissionImpl per = new PIMPermissionImpl("pim://*", PIMPermissionImpl.ACTION_READ_EVENTS + "," + PIMPermissionImpl.ACTION_READ_TODOS); + appUtils.checkPermission(per); + int[] error = new int[1]; + String[] calendarFileLists = _listCalendars(iManagerHandle, error); + String[] calendarNameLists = _listCalendarNames(iManagerHandle, error); + if (!NativeError.checkSuccess(error[0])) + { + throw new GenericException(ErrorString.GENERAL_ERROR_COLON + error[0]); + } + Vector tokens = new Vector(); + Vector tokenNames = new Vector(); + int length = calendarFileLists.length; + for (int i = 0; i < length; i++) + { + String str[] = Tokenizer.split(calendarFileLists[i], ":"); + String strname[] = Tokenizer.split(calendarNameLists[i], ":"); + + + if (str[0].equals("C")) + { + tokens.addElement(str[1]); + + } + if (strname[0].equals("C")) + { + + tokenNames.addElement(strname[1]); + } + else + { + + tokenNames.addElement(strname[0]); + } + } + String[] calendarLists = new String[tokens.size()]; + String[] calendarNames = new String[tokenNames.size()]; + tokens.copyInto(calendarLists); + tokenNames.copyInto(calendarNames); + Calendar[] calendarobjlist = new Calendar[calendarLists.length]; + for (int i = 0; i < calendarLists.length; i++) + { + Calendar cal = new Calendar(calendarLists[i], calendarNames[i]); + calendarobjlist[i] = cal; + } + //return calendarLists; + return calendarobjlist; + } + + + private synchronized void createCalendar(String aCalName) + { + + String displayName = aCalName; + // security check + ApplicationUtils appUtils = ApplicationUtils.getInstance(); + PIMPermissionImpl per = new PIMPermissionImpl("pim://*", PIMPermissionImpl.ACTION_WRITE_EVENTS + "," + PIMPermissionImpl.ACTION_WRITE_TODOS); + appUtils.checkPermission(per); + String fileName = "C:" + aCalName; + int error = _createCalendar(iManagerHandle, fileName,displayName); + NativeError.handleCreateCalendarError(error, aCalName); + } + + private synchronized void deleteCalendar(String aCalName) + { + // security check + ApplicationUtils appUtils = ApplicationUtils.getInstance(); + PIMPermissionImpl per = new PIMPermissionImpl(PIMPermissionImpl.ACTION_WRITE_EVENTS + "," + PIMPermissionImpl.ACTION_WRITE_TODOS, aCalName, null, -1); + appUtils.checkPermission(per); + + boolean isCalPresent = false; + String fileName = "C:" + aCalName; + int index; + for (index = 0; index < iCalInfo.size(); index++) + { + CalendarListInfo calList = (CalendarListInfo) iCalInfo.elementAt(index); + String calName = calList.iCalName; + if (calName.equals(fileName)) + { + Enumeration e = calList.iList.elements(); + while (e.hasMoreElements()) + { + PIMList list = (PIMList) e.nextElement(); + try + { + list.close(); + } + catch (PIMException ex) + { + //throw new GenericException("Delete entry failed. " + ex.toString()); + } + } + calList.iList.removeAllElements(); + isCalPresent = true; + break; + } + } + int error = _deleteCalendar(iManagerHandle, fileName); + NativeError.handleDeleteCalendarError(error, aCalName); + if (isCalPresent) + { + iCalInfo.removeElementAt(index); + } + } /** * getPermission @@ -297,27 +532,17 @@ appUtils.checkPermission(per); } - - // New private methods - /** - * Common implementation of the list opening. Arguments and permissions are - * pre-checked. - * - * @param aName - * If null, default list is opened. - */ private PIMList doOpenPIMList(int aPimListType, int aMode, String aName) throws PIMException { - if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST - && aPimListType != PIM.TODO_LIST) + + if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST && aPimListType != PIM.TODO_LIST) { throw new java.lang.IllegalArgumentException( ErrorString.INVALID_LIST_TYPE_COLON + aPimListType); } - if (aMode != PIM.READ_ONLY && aMode != PIM.WRITE_ONLY - && aMode != PIM.READ_WRITE) + if (aMode != PIM.READ_ONLY && aMode != PIM.WRITE_ONLY && aMode != PIM.READ_WRITE) { throw new java.lang.IllegalArgumentException( ErrorString.INVALID_MODE_COLON + aMode); @@ -339,8 +564,7 @@ } int[] error = new int[1]; int listHandle = _openPIMList( - - iManagerHandle, aPimListType, aName, error); // if null, open default + iManagerHandle, aPimListType, aName, null, error); // if null, open default // list NativeError.handleOpenPIMListError(error[0], aPimListType, aName); @@ -378,6 +602,86 @@ return pimList; } +/////////////////////// + // New private methods + + /** + * Common implementation of the list opening. Arguments and permissions are + * pre-checked. + * + * @param aName + * If null, default list is opened. + */ + private PIMList doOpenPIMList(int aPimListType, int aMode, String aName, String aCalName) + throws PIMException + { + + if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST && aPimListType != PIM.TODO_LIST) + { + throw new java.lang.IllegalArgumentException( + ErrorString.INVALID_LIST_TYPE_COLON + aPimListType); + } + + if (aMode != PIM.READ_ONLY && aMode != PIM.WRITE_ONLY && aMode != PIM.READ_WRITE) + { + throw new java.lang.IllegalArgumentException( + ErrorString.INVALID_MODE_COLON + aMode); + } + + // Both permissions must be checked separately if aMode is + // PIM.READ_WRITE + if (aMode == PIM.READ_WRITE) + { + // First ensure read access permission + // Get localized text info for the security dialog + getPermission(aPimListType, PIM.READ_ONLY); + getPermission(aPimListType, PIM.WRITE_ONLY); + + } + else + { + getPermission(aPimListType, aMode); + } + int[] error = new int[1]; + + int listHandle = _openPIMList( + iManagerHandle, aPimListType, aName, aCalName, error); + // list + NativeError.handleOpenPIMListError(error[0], aPimListType, aName); + + // Create new pim list of right type + PIMListImpl pimList = null; + + switch (aPimListType) + { + case PIM.CONTACT_LIST: + { + pimList = new ContactListImpl(listHandle, aMode); + break; + } + + case PIM.EVENT_LIST: + { + pimList = new EventListImpl(listHandle, aMode); + break; + } + + case PIM.TODO_LIST: + { + pimList = new ToDoListImpl(listHandle, aMode); + break; + } + + default: + { + // We should never end up here + throw new PIMException(ErrorString.GENERAL_ERROR, + PIMException.GENERAL_ERROR); + } + } + + return pimList; + } // Native operations @@ -398,11 +702,33 @@ * value on error. */ private native int _openPIMList(int aManagerHandle, int aPimListType, - String aPimListName, int[] aError); + String aPimListName, String aCalName, + int[] aError); private native String[] _listPIMLists(int aManagerHandle, int aPimListType, int[] aError); + private native String[] _listCalendars(int aManagerHandle, int[] aError); + + private native String[] _listCalendarNames(int aManagerHandle, int[] aError); + + private native int _createCalendar(int aManagerHandle, String aCalName, String aDisplayName); + + private native int _deleteCalendar(int aManagerHandle, String aCalName); + + class CalendarListInfo + { + + String iCalName; + Vector iList; + + CalendarListInfo(String aCalName, PIMList aPIMList) + { + iCalName = aCalName; + iList = new Vector(); + iList.addElement(aPIMList); + } + } } // End of file diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java Fri Sep 17 08:28:21 2010 +0300 @@ -96,7 +96,7 @@ { return (SecurityPromptMessage.getInstance()).getText( SecurityPromptMessage.QUESTION_ID_DELETING_ITEM, - new String[] {iListName}); + new String[] {iItemInfo, iListName}); } } else if (iOperation == OPERATION_ITEM_COMMIT) @@ -111,7 +111,7 @@ { return (SecurityPromptMessage.getInstance()).getText( SecurityPromptMessage.QUESTION_ID_UPDATING_ITEM, - new String[] {iListName}); + new String[] {iItemInfo, iListName}); } } else if (iOperation == OPERATION_CATEGORY_DELETION) diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/com/nokia/mj/impl/properties/pim/DynamicPropertyHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/properties/pim/DynamicPropertyHandler.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,67 @@ +/* +* 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: +* +*/ + + +package com.nokia.mj.impl.properties.pim; + +import com.nokia.mj.impl.pim.PIMManager; +import com.nokia.mj.impl.pim.Calendar; +import com.nokia.mj.impl.rt.support.SystemPropertyProvider; + +/** + * This class implements SystemPropertyProvider and provides getProperty to + * retrieve dynamic system property. + */ +public final class DynamicPropertyHandler implements SystemPropertyProvider +{ + + public String getProperty(String key) + { + + //Code for list calendars - Call Open PIM List + // MIDlet should know about its own calendars, but we could offer also system property (e.g.) com.nokia.mid.calendars, which lists comma-separated local calendarnames: + // String calendarNames = System.getProperty("com.nokia.mid.calendars"); + + PIMManager pim = new PIMManager(); + + Calendar calendarList[] = pim.listCalendars(); + + StringBuffer calendarListString = new StringBuffer();; + + if (calendarList != null) + { + for (int i = 0; i < calendarList.length; i++) + { + calendarListString.append(calendarList[i].getCalendarName()+","); + + } + } + else + { + return null; + } + pim = null; + calendarListString.deleteCharAt(calendarListString.length() - 1); + return calendarListString.toString(); + } + + public boolean isStatic(String key) + { + return false; + } + +} \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/javasrc/javax/microedition/pim/PIM.java --- a/javaextensions/pim/javasrc/javax/microedition/pim/PIM.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/javasrc/javax/microedition/pim/PIM.java Fri Sep 17 08:28:21 2010 +0300 @@ -80,20 +80,63 @@ { } + /** + * @param aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST. + * @param aMode list open mode READ_ONLY or WRITE_ONLY or READ_WRITE + * @return PIMList + * @throws javax.microedition.pim.PIMException + */ public abstract PIMList openPIMList(int aPimListType, int aMode) throws PIMException; + /** + * + * @param aPimListType aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST. + * @param aMode list open mode READ_ONLY or WRITE_ONLY or READ_WRITE + * @param aName List name + * @return PIMList + * @throws javax.microedition.pim.PIMException + */ public abstract PIMList openPIMList(int aPimListType, int aMode, String aName) throws PIMException; + /** + * + * @param aPimListType aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST. + * @return String which contains list of PIMList names + */ public abstract String[] listPIMLists(int aPimListType); + /** + * @param aIs an inputstream object containing PIM information + * @param aEnc encoding of the characters in the input stream + * @return PIMItem Array + * @throws javax.microedition.pim.PIMException + * @throws java.io.UnsupportedEncodingException + */ public abstract PIMItem[] fromSerialFormat(java.io.InputStream aIs, String aEnc) throws PIMException, UnsupportedEncodingException; + /** + * + * @param aItem the item to export + * @param aOs the OutputStream object that where is written to as a character stream. + * @param aEnc encoding of the characters in the input stream + * @param aDataFormat PIM data format to use + * @throws javax.microedition.pim.PIMException + * @throws java.io.UnsupportedEncodingException + */ public abstract void toSerialFormat(PIMItem aItem, java.io.OutputStream aOs, String aEnc, String aDataFormat) throws PIMException, UnsupportedEncodingException; + /** + * + * @param aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST. + * @return String object + */ public abstract String[] supportedSerialFormats(int aPimListType); + + + } diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/jni/src/pimmanager.cpp --- a/javaextensions/pim/jni/src/pimmanager.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/jni/src/pimmanager.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -69,6 +69,7 @@ jint aManagerHandle, jint aPimListType, jstring aPimListName, + jstring aCalName, jintArray aError) { JELOG2(EPim); @@ -77,13 +78,15 @@ int error = 0; try { + list = manager->openPimList( - static_cast< TPIMListType>(aPimListType),aPimListName, aJniEnv); + static_cast< TPIMListType>(aPimListType),aPimListName,aCalName, aJniEnv); } catch (int aError) { error = aError; } + SetJavaErrorCode(aJniEnv, aError, error); // We now own the list (through the handle). The ownership of @@ -114,6 +117,86 @@ return javaStringArray; } +JNIEXPORT jint +JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1createCalendar( + JNIEnv* aJniEnv, + jobject /*aPeer*/, + jint aManagerHandle, + jstring aCalName, + jstring aDisplayName) +{ + JELOG2(EPim); + pimbasemanager* manager = + reinterpret_cast< pimbasemanager *>(aManagerHandle); + TInt error = 0; + try + { + manager->createCalendar(aCalName, aDisplayName,aJniEnv); + } + catch (int aError) + { + error = aError; + } + return error; +} + +JNIEXPORT jint +JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1deleteCalendar( + JNIEnv* aJniEnv, + jobject /*aPeer*/, + jint aManagerHandle, + jstring aCalName) +{ + JELOG2(EPim); + pimbasemanager* manager = + reinterpret_cast< pimbasemanager *>(aManagerHandle); + TInt error = 0; + + try + { + manager->deleteCalendar(aCalName,aJniEnv); + } + catch (int aError) + { + error = aError; + } + + return error; + +} + +JNIEXPORT jobjectArray +JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1listCalendars( + JNIEnv* aJniEnv, + jobject /*aPeer*/, + jint aManagerHandle, + jintArray aError) +{ + JELOG2(EPim); + pimbasemanager* manager = + reinterpret_cast< pimbasemanager *>(aManagerHandle); + jobjectArray javaStringArray = NULL; + javaStringArray = manager->listCalendars(aError, + aJniEnv); + return javaStringArray; +} + +JNIEXPORT jobjectArray +JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1listCalendarNames( + JNIEnv* aJniEnv, + jobject /*aPeer*/, + jint aManagerHandle, + jintArray aError) +{ + JELOG2(EPim); + pimbasemanager* manager = + reinterpret_cast< pimbasemanager *>(aManagerHandle); + + jobjectArray javaStringArray = NULL; + javaStringArray = manager->listCalendarNames(aError, + aJniEnv); + return javaStringArray; +} // End of File diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp --- a/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -30,7 +30,7 @@ #include "cpimeventpropertyconverter.h" #include "fs_methodcall.h" #include "logger.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" // EXTERNAL INCLUDES #include @@ -165,8 +165,6 @@ RPointerArray& aItemArray, Versit::TVersitCharSet aCharset) { JELOG2(EPim); - - CParserVCal* parser = CParserVCal::NewL(); CleanupStack::PushL(parser); parser->SetDefaultCharSet(aCharset); @@ -201,8 +199,6 @@ } } CleanupStack::PopAndDestroy(3, parser); // parser, eventArray, todoArray - - } // ----------------------------------------------------------------------------- @@ -242,7 +238,7 @@ RPointerArray& aItemArray) { JELOG2(EPim); - + CleanupClosePushL(aItemArray); CPIMEventItem* item = CPIMEventItem::NewLC(iEventValidator); TPIMDate alarm(TInt64(0)); // We don't take the ownership of the propertyArray, so the properties @@ -269,7 +265,6 @@ item->addInt(EPIMEventAlarm, KPIMAttrNone, interval.Int()); } } - CleanupClosePushL(aItemArray); User::LeaveIfError(aItemArray.Append(item)); CleanupStack::Pop(item); // item CleanupStack::Pop(&aItemArray); @@ -284,7 +279,7 @@ RPointerArray& aItemArray) { JELOG2(EPim); - + CleanupClosePushL(aItemArray); CPIMToDoItem* item = CPIMToDoItem::NewLC(iToDoValidator); TPIMDate alarm(TInt64(0)); // We don't take the ownership of the propertyArray, so the properties @@ -319,7 +314,6 @@ { item->AddBooleanL(EPIMToDoCompleted, KPIMAttrNone, ETrue); } - CleanupClosePushL(aItemArray); User::LeaveIfError(aItemArray.Append(item)); CleanupStack::Pop(item); // item CleanupStack::Pop(&aItemArray); diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/versit/src.s60/cpimcardconverter.cpp --- a/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -26,7 +26,7 @@ #include "cpimcardpropertyconverter.h" #include "fs_methodcall.h" #include "logger.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include // ============================ MEMBER FUNCTIONS =============================== diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp --- a/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -27,7 +27,7 @@ #include "cpimitem.h" #include "cpimeventitem.h" #include "mpimrepeatruledata.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include "logger.h" // EXTERNAL INCLUDES diff -r 773449708c84 -r 4ad59aaee882 javaextensions/pim/versit/src.s60/cpimversit.cpp --- a/javaextensions/pim/versit/src.s60/cpimversit.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimversit.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -22,7 +22,7 @@ #include "cpimcardconverter.h" #include "cpimcalendarconverter.h" #include "cpimitem.h" -#include "javasymbianoslayer.h" +#include "cleanupresetanddestroy.h" #include "logger.h" #include // RBufWriteStream #include diff -r 773449708c84 -r 4ad59aaee882 javaextensions/subsystem.mk --- a/javaextensions/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/subsystem.mk Fri Sep 17 08:28:21 2010 +0300 @@ -44,6 +44,10 @@ wma \ pim +ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS + COMPONENTS += centralrepository/build +endif + ifdef RD_JAVA_MIDPRMS_DB SUBSYSTEMS += midprms_db else diff -r 773449708c84 -r 4ad59aaee882 javaextensions/wma/mms/build/javawmamms.pro --- a/javaextensions/wma/mms/build/javawmamms.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javaextensions/wma/mms/build/javawmamms.pro Fri Sep 17 08:28:21 2010 +0300 @@ -27,7 +27,7 @@ ../src.s60/*.cpp LIBS += -lapmime \ - -lPlatformEnv \ + -lplatformenv \ -lcharconv \ -lCommonUI \ -lefsrv \ diff -r 773449708c84 -r 4ad59aaee882 javamanager/javaappscheme/build/javaappscheme.pro --- a/javamanager/javaappscheme/build/javaappscheme.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javaappscheme/build/javaappscheme.pro Fri Sep 17 08:28:21 2010 +0300 @@ -12,7 +12,7 @@ # Contributors: # # Description: QT Service application the implements support for -# starting Java applications using "javaapp:" QUrl +# starting Java applications using "javaapp:" QUrl # TEMPLATE=app diff -r 773449708c84 -r 4ad59aaee882 javamanager/javaappscheme/build/service_conf.xml --- a/javamanager/javaappscheme/build/service_conf.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javaappscheme/build/service_conf.xml Fri Sep 17 08:28:21 2010 +0300 @@ -8,6 +8,5 @@ 1.0 Interface for showing URIs javaapp - com.nokia.services.serviceapp \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javamanager/javaappscheme/src.s60/serviceapp.cpp --- a/javamanager/javaappscheme/src.s60/serviceapp.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javaappscheme/src.s60/serviceapp.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -56,6 +56,7 @@ void ServiceApp::quit() { LOG(EJavaQtServiceApp, EInfo, "ServiceApp quit() called"); + exit(KErrNone); // Exit with OK status } @@ -88,13 +89,8 @@ LOG(EJavaQtServiceApp, EInfo, "UriService::view(uri, retValue) called"); std::wstring stdWStrUri = uri.toStdWString(); LOG1(EJavaQtServiceApp, EInfo, "url is %S", stdWStrUri.c_str()); - if (retValue) - { - LOG(EJavaQtServiceApp, EInfo, "UriService::view retValue parameter is true"); - } XQRequestInfo info = requestInfo(); - bool asyncAnswer = !info.isSynchronous(); // Start javalauncher.exe and pass the Url to it _LIT(KJavaLauncherExe, "javalauncher.exe"); diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp --- a/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp Fri Sep 17 08:28:21 2010 +0300 @@ -50,9 +50,13 @@ USERINCLUDE ../../inc.s60 USERINCLUDE ../../../../inc -start resource ../data/10282474.rss +START RESOURCE ../data/10282474.rss TARGET midp2backupplugin.rsc -end +END +START RESOURCE ../data/10282474_iad.rss +TARGET midp2backupplugin.rsc +TARGETPATH resource/java/iad +END LIBRARY ecom.lib LIBRARY estor.lib diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup/data/10282474.rss --- a/javamanager/javabackup/midp2backup/data/10282474.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup/data/10282474.rss Fri Sep 17 08:28:21 2010 +0300 @@ -19,6 +19,10 @@ #include #include "javauids.h" +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 1 +#endif + // Declares info for one implementation RESOURCE REGISTRY_INFO theInfo { @@ -36,7 +40,7 @@ IMPLEMENTATION_INFO { implementation_uid = KBackupEcomImplUid; - version_no = 1; + version_no = ECOM_VERSION_NO; display_name = "MIDP2 Backup Plugin"; default_data = "midp2"; opaque_data = "test_params"; diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup/data/10282474_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javabackup/midp2backup/data/10282474_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 2 + +// Include actual rss +#include "10282474.rss" + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp --- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -39,6 +39,9 @@ using namespace java::storage; using namespace java::backup; +const wchar_t * const JBNULLSTRING = L"ABBAABBA_NULL"; +const int JBNULLSTRINGLENGTH = -1; + // ======== MEMBER FUNCTIONS ======== CStorageBackupUtil::CStorageBackupUtil() @@ -82,60 +85,134 @@ // clear the vectors to free all the heap data. iStringVector.clear(); + if (iBufForJavaStorageItemsPtr) + { + delete iBufForJavaStorageItemsPtr; + iBufForJavaStorageItemsPtr = 0; + } + } void CStorageBackupUtil::BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft) { - LOG(EBackup, EInfo, "CStorageBackupUtil::BackupStorageDataL"); + ILOG(EBackup, "CStorageBackupUtil::BackupStorageDataL()"); iBufferSpaceLeft = aBufferSpaceLeft; if (iFirstCalltoBackupStorageData) { + ILOG(EBackup, "First call to BackupStorageData()"); int err = FillVectorWithStorageData(); if (err != KErrNone) { + ELOG1(EBackup, "Error (%d) in filling wstring vector", err); User::Leave(err); } - LOG1(EBackup, EInfo, "Total no of rows in vector: %d", iStringVector.size()); + ILOG1(EBackup, "Total no of rows in vector: %d", iStringVector.size()); - // First write the total no of rows in the vector to the stream + // 1. Find out the size of the buffer needed for containing JavaStorage + // data in "streamed" format. + TUint totalStringLengthInBytes = 0; + for (int i = 0; i < iStringVector.size(); ++i) + { + if (iStringVector[i] == JBNULLSTRING ){ + continue; + } + totalStringLengthInBytes += iStringVector[i].length()*sizeof(wchar_t); + } + ILOG1(EBackup, "Total string length calculated: %d", totalStringLengthInBytes); - aStream.WriteInt32L(iStringVector.size()); - iBufferSpaceLeft -= sizeof(TInt32); + // Calculate the total length of the buffer. + // The content of the buffer will be as follows: + + TUint totalBuffSize = sizeof(TInt32) + NUMBER_OF_TABLES*sizeof(TInt16) + + iStringVector.size()*sizeof(TInt16) + totalStringLengthInBytes; + + // 2. Reserve the buffer with adequate space + iBufForJavaStorageItemsPtr = HBufC8::NewL(totalBuffSize); + ILOG1(EBackup, "javaStorage Buffer(size %d) allocated SUCCESSFULLY", totalBuffSize); - /* 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++) + // 3. Create temporary stream operator and with it write stuff to buffer + TPtr8 buffPtr(iBufForJavaStorageItemsPtr->Des()); + RDesWriteStream buffStream(buffPtr); + CleanupClosePushL(buffStream); + buffStream.WriteInt32L(iStringVector.size()); + for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; ++tableNumber) + { + buffStream.WriteInt16L(iTableSize[tableNumber]); + } + ILOG(EBackup, "JavaStorage table sizes writen to buffer"); + TUint writenStringLength = 0; + for (int i = 0; i < iStringVector.size(); ++i) { - aStream.WriteInt16L(iTableSize[tableNumber]); - iBufferSpaceLeft -= sizeof(TInt16); + TInt16 lenOf8byteString = JBNULLSTRINGLENGTH; + if ( iStringVector[i] == JBNULLSTRING ) + { + buffStream.WriteInt16L(lenOf8byteString); + continue; + } + lenOf8byteString = iStringVector[i].length()*sizeof(wchar_t); + buffStream.WriteInt16L(lenOf8byteString); + if (lenOf8byteString > 0 ) + { + HBufC* tempstring = java::util::S60CommonUtils::wstringToDes( + iStringVector[i].c_str()); + if (!tempstring) + { + ELOG(EBackup, "Out of memory in JavaStorage backup(in wstring -> des conv)!"); + User::Leave(KErrNoMemory); + } + CleanupStack::PushL(tempstring); + TPtrC tempStr = tempstring->Des(); + writenStringLength += tempStr.Size(); + buffStream.WriteL(tempStr); //length of the string will not be written + CleanupStack::PopAndDestroy(tempstring); + } } + ILOG1(EBackup, "Total string length writen: %d", writenStringLength); + ILOG(EBackup, "Whole Java Storage String vector writen to streambuffer"); + // 4. Clear not needed resources + iStringVector.clear(); + CleanupStack::PopAndDestroy(&buffStream); + ILOG(EBackup, "Not needed resources cleared"); + + // 5. Set the read pointer to the beginning of the buffer data + // Note that the length of the HBufC8 buffer is exact. + iBuffReadPointer.Set(iBufForJavaStorageItemsPtr->Des()); iFirstCalltoBackupStorageData = EFalse; } - // Now write the actual string data into the stream. - - while (iBufferSpaceLeft > 0 && iStrCount < iStringVector.size()) + // 6. Start to provide data to SBE from the buffer. + ILOG(EBackup, "Extracting data from buffer to SBE"); + ILOG1(EBackup, "Length of the data in stream buffer: %d", iBuffReadPointer.Length()); + ILOG1(EBackup, "Space available in SBE buffer: %d", aBufferSpaceLeft); + if (iBuffReadPointer.Length() <= aBufferSpaceLeft ) { - WriteStringtoStreamL(aStream, iStringVector[iStrCount]); - LOG1(EBackup, EInfo, "StrCount = %d", iStrCount); + aStream.WriteL(iBuffReadPointer); + aBufferSpaceLeft -= iBuffReadPointer.Length(); + iBuffReadPointer.Set(NULL,0); + delete iBufForJavaStorageItemsPtr; + iBufForJavaStorageItemsPtr = 0; + ILOG(EBackup, "BACKUP OF STORAGE DATA FINISHED"); + aBackupNotFinished = EFalse; // Indicate to caller that we are ready } - - if (iStrCount >= iStringVector.size()) + else // All data from internal buffer does not fit at once to buffer received from SBE { - LOG(EBackup, EInfo, "Backup of storage data finished"); - aBackupNotFinished = EFalse; + aStream.WriteL(iBuffReadPointer, aBufferSpaceLeft); + TInt lengthOfWritenData = aBufferSpaceLeft; + iBuffReadPointer.Set(iBuffReadPointer.Ptr() + lengthOfWritenData, + iBuffReadPointer.Length() - lengthOfWritenData); + aBufferSpaceLeft = 0; + ILOG(EBackup, "Not all of the storage data fit into SBE buffer, new buffer from SBE needed."); } } void CStorageBackupUtil::RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft) { - LOG(EBackup, EInfo, "CStorageBackupUtil::RestoreStorageDataL()"); + ILOG(EBackup, "+CStorageBackupUtil::RestoreStorageDataL()"); iBufferSpaceLeft = aBufferSpaceLeft; @@ -177,49 +254,11 @@ updater.update(); // Storage restore is over; Set state to EAppArc + ILOG(EBackup, "JAVASTORAGE RESTORED SUCCESSFULLY"); aRestoreState = EAppArc; 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++; - } - } + ILOG(EBackup, "-CStorageBackupUtil::RestoreStorageDataL()"); } void CStorageBackupUtil::ReadStringfromStreamL(RDesReadStream& aStream) @@ -271,7 +310,7 @@ } } - else + else /* handling new string */ { iLenOfString = aStream.ReadInt16L(); iBufferSpaceLeft -= sizeof(TInt16); @@ -326,6 +365,12 @@ delete data; } } + /* */ + else if (iLenOfString == JBNULLSTRINGLENGTH ) + { + iStringVector.push_back(JBNULLSTRING); + iStrCount--; + } /* if length of string is 0, do not read anything from the stream; just push an empty string into the vector */ else @@ -657,6 +702,20 @@ } +void CStorageBackupUtil::WriteItemToStorageEntry( + const std::wstring& aEntryName, + const std::wstring& aEntryValue, + JavaStorageApplicationEntry_t& aInsertEntry + ) +{ + JavaStorageEntry attribute; + if (aEntryValue != JBNULLSTRING ) + { + attribute.setEntry(aEntryName, aEntryValue); + aInsertEntry.insert(attribute); + } +} + int CStorageBackupUtil::WriteDataToStorage() { JELOG2(EBackup); @@ -706,7 +765,7 @@ js->remove(RUNTIME_SETTINGS_TABLE, emptyEntry); js->remove(PREINSTALL_TABLE, emptyEntry); - ILOG(EBackup, "Data removed successfully from table"); + ELOG(EBackup, "Data removed successfully from table"); } catch (JavaStorageException jse) { @@ -716,7 +775,6 @@ } } - JavaStorageEntry attribute; JavaStorageApplicationEntry_t insertEntry; ILOG(EBackup, "Start transaction for writing into the database"); @@ -728,47 +786,20 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(PACKAGE_NAME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(VENDOR, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(VERSION, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(ROOT_PATH, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(MEDIA_ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(INITIAL_SIZE, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(JAD_PATH, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(JAR_PATH, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(JAD_URL, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(JAR_URL, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(ACCESS_POINT, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(CONTENT_INFO, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(CONTENT_ID, iStringVector[count++], insertEntry); try { @@ -791,20 +822,11 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(PACKAGE_ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(MAIN_CLASS, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(AUTORUN, iStringVector[count++], insertEntry); try { @@ -827,17 +849,10 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(VALUE, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(TRUSTED, iStringVector[count++], insertEntry); try { @@ -860,35 +875,16 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(TYPE, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(SECURITY_DOMAIN, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(HASH, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(CERT_HASH, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(RMS, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(VALID_CERTS, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(ON_SCREEN_KEYPAD, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(SECURITY_WARNINGS, iStringVector[count++], insertEntry); try { @@ -911,20 +907,11 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(CLASS, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(ACTION, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(FUNCTION_GROUP, iStringVector[count++], insertEntry); try { @@ -947,20 +934,11 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(FUNCTION_GROUP, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(ALLOWED_SETTINGS, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(CURRENT_SETTING, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(BLANKET_PROMPT, iStringVector[count++], insertEntry); try { @@ -983,20 +961,11 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(URL, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(FILTER, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(REGISTRATION_TYPE, iStringVector[count++], insertEntry); try { @@ -1019,11 +988,8 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(ALARM_TIME, iStringVector[count++], insertEntry); try { @@ -1047,8 +1013,7 @@ for (int rowNumber = 0; rowNumber < iTableSize[8]; rowNumber++) { - attribute.setEntry(EXTENSIONS, iStringVector[count++]); - insertEntry.insert(attribute); + WriteItemToStorageEntry(EXTENSIONS, iStringVector[count++], insertEntry); try { @@ -1071,17 +1036,10 @@ 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); + WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(VENDOR, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(VERSION, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(INSTALL_STATE, iStringVector[count++], insertEntry); try { @@ -1170,26 +1128,13 @@ 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); + WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(CREATION_TIME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(TYPE, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(OTA_CODE, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(URL, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(LATEST_RETRY_TIME, iStringVector[count++], insertEntry); + WriteItemToStorageEntry(RETRY_COUNT, iStringVector[count++], insertEntry); try { @@ -1247,144 +1192,46 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(PACKAGE_NAME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(VENDOR, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(VERSION, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(ROOT_PATH, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(MEDIA_ID, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(INITIAL_SIZE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(JAD_PATH, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(JAR_PATH, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(JAD_URL, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(JAR_URL, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(ACCESS_POINT, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(CONTENT_INFO, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(CONTENT_ID, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1408,54 +1255,19 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(PACKAGE_ID, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(NAME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(MAIN_CLASS, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(AUTORUN, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1479,44 +1291,16 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(NAME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(VALUE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(TRUSTED, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1524,6 +1308,24 @@ return rowsCount; } +void CStorageBackupUtil::FetchStorageEntryToStringVector(const JavaStorageEntry& aAttribute, + JavaStorageApplicationList_t::const_iterator& aApplicationsIter) +{ + const wstring emptyString; + wstring str; + JavaStorageApplicationEntry_t::const_iterator findIterator; + str = emptyString; + findIterator = (*aApplicationsIter).find(aAttribute); + + if (findIterator != (*aApplicationsIter).end()) + { + str = (*findIterator).entryValue(); + iStringVector.push_back(str); + } else { + iStringVector.push_back(JBNULLSTRING); + } +} + int CStorageBackupUtil::FillVectorwithMidpPackageTableData(JavaStorageApplicationList_t& afoundEntries) { const wstring emptyString; @@ -1534,110 +1336,39 @@ /* 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(TYPE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(SECURITY_DOMAIN, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(SECURITY_DOMAIN_CATEGORY, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(HASH, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(CERT_HASH, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(RMS, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(VALID_CERTS, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(ON_SCREEN_KEYPAD, L""); - str = emptyString; - findIterator = (*applications).find(attribute); + FetchStorageEntryToStringVector(attribute, applications); - 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); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1661,54 +1392,19 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(CLASS, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(NAME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(ACTION, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(FUNCTION_GROUP, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1732,54 +1428,19 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(FUNCTION_GROUP, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(ALLOWED_SETTINGS, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(CURRENT_SETTING, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(BLANKET_PROMPT, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1803,54 +1464,19 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(URL, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(NAME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(FILTER, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(REGISTRATION_TYPE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1874,24 +1500,10 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(ALARM_TIME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1915,14 +1527,7 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -1946,44 +1551,16 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(VENDOR, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(VERSION, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(INSTALL_STATE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } @@ -2007,74 +1584,25 @@ 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); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(CREATION_TIME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(TYPE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(OTA_CODE, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(URL, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(LATEST_RETRY_TIME, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); attribute.setEntry(RETRY_COUNT, L""); - str = emptyString; - findIterator = (*applications).find(attribute); - - if (findIterator != (*applications).end()) - { - str = (*findIterator).entryValue(); - } - iStringVector.push_back(str); + FetchStorageEntryToStringVector(attribute, applications); rowsCount++; } diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h --- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h Fri Sep 17 08:28:21 2010 +0300 @@ -172,16 +172,6 @@ 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. * @@ -200,6 +190,17 @@ * has completed successfully or not. */ int WriteDataToStorage(); + + + void FetchStorageEntryToStringVector( + const java::storage::JavaStorageEntry& aAttribute, + java::storage::JavaStorageApplicationList_t::const_iterator& aApplicationsIter + ); + + void WriteItemToStorageEntry(const std::wstring& aEntryName, + const std::wstring& aEntryValue, + java::storage::JavaStorageApplicationEntry_t& aInsertEntry); + public: /** * Utility function which fills the vector with data got from storage. @@ -396,6 +397,19 @@ * Own */ int iBufferSpaceLeft; + + /** + * During backup data fromJavaStorage will be temporarily stored + * in serialised format in this buffer. + */ + HBufC8* iBufForJavaStorageItemsPtr; + + /** + * Stores the position in iBufForJavaStorageItemsPtr from where data is + * being read during backup operation. + */ + TPtrC8 iBuffReadPointer; + }; } // namespace backup diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp --- a/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -125,7 +125,7 @@ void CMidp2BackupPlugin::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished) { - LOG(EBackup, EInfo, "CMidp2BackupPlugin::GetBackupDataSectionL"); + ILOG(EBackup, "+CMidp2BackupPlugin::GetBackupDataSectionL()"); iBufferSpaceLeft = aBuffer.MaxLength(); RDesWriteStream stream(aBuffer); @@ -144,7 +144,7 @@ aFinished = EFalse; } - else + if (!iStorageDataBackup) { if (iFirstCallToGetBackupDataSection) { @@ -301,12 +301,13 @@ { aFinished = ETrue; iFirstCallToGetBackupDataSection = ETrue; - iStorageDataBackup = ETrue; + // iStorageDataBackup = ETrue; } delete fullFileName; } CleanupStack::PopAndDestroy(&stream); + ILOG(EBackup, "-CMidp2BackupPlugin::GetBackupDataSectionL()"); } @@ -318,7 +319,7 @@ void CMidp2BackupPlugin::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished) { - LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreBaseDataSectionL"); + ILOG(EBackup, "+CMidp2BackupPlugin::RestoreBaseDataSectionL()"); iBufferSpaceLeft = aBuffer.Size(); RDesReadStream stream(aBuffer); @@ -349,6 +350,7 @@ if (iRestoreState == EStorage) { + ILOG1(EBackup, "Restoring Storage for drive %d", iDrive); iStorageBackupUtil -> RestoreStorageDataL(stream, iRestoreState, iBufferSpaceLeft); } @@ -372,12 +374,14 @@ if (aFinished) { // Set state to EStorage - iRestoreState = EStorage; + ILOG1(EBackup, "Restore of drive %d complete, resetting statemachine for next drive", iDrive); + iRestoreState = EAppArc; } } - aFinished = ETrue; + // aFinished = ETrue; CleanupStack::PopAndDestroy(&stream); + ILOG(EBackup, "-CMidp2BackupPlugin::RestoreBaseDataSectionL()"); } void CMidp2BackupPlugin::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */) diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp --- a/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp Fri Sep 17 08:28:21 2010 +0300 @@ -55,9 +55,13 @@ USERINCLUDE ../../inc.s60 USERINCLUDE ../../../../inc -start resource ../data/10282474.rss +START RESOURCE ../data/10282474.rss TARGET midp2backupplugin.rsc -end +END +START RESOURCE ../data/10282474_iad.rss +TARGET midp2backupplugin.rsc +TARGETPATH resource/java/iad +END LIBRARY ecom.lib LIBRARY efsrv.lib diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup_usif/data/10282474.rss --- a/javamanager/javabackup/midp2backup_usif/data/10282474.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javabackup/midp2backup_usif/data/10282474.rss Fri Sep 17 08:28:21 2010 +0300 @@ -19,6 +19,10 @@ #include #include "javauids.h" +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 1 +#endif + // Declares info for one implementation RESOURCE REGISTRY_INFO theInfo { @@ -36,7 +40,7 @@ IMPLEMENTATION_INFO { implementation_uid = KBackupEcomImplUid; - version_no = 1; + version_no = ECOM_VERSION_NO; display_name = "MIDP2 Backup Plugin"; default_data = "midp2"; opaque_data = "test_params"; diff -r 773449708c84 -r 4ad59aaee882 javamanager/javabackup/midp2backup_usif/data/10282474_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javabackup/midp2backup_usif/data/10282474_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 2 + +// Include actual rss +#include "10282474.rss" + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro --- a/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro Fri Sep 17 08:28:21 2010 +0300 @@ -20,7 +20,7 @@ CONFIG -= qt symbian { - LIBS += -lcommonengine \ + LIBS += -lCommonEngine \ -lcentralrepository \ -lcenrepnotifhandler \ -ljavacomms diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp --- a/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp Fri Sep 17 08:28:21 2010 +0300 @@ -40,6 +40,10 @@ START RESOURCE ../data/101F875F.rss TARGET ifeui.rsc END +START RESOURCE ../data/101F875F_iad.rss +TARGET ifeui.rsc +TARGETPATH resource/java/iad +END // Sources SOURCEPATH ../src diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/appinstuiplugin/data/101F875F.rss --- a/javamanager/javainstaller/appinstuiplugin/data/101F875F.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/appinstuiplugin/data/101F875F.rss Fri Sep 17 08:28:21 2010 +0300 @@ -23,6 +23,10 @@ // RESOURCE DEFINITIONS +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 2 +#endif + RESOURCE REGISTRY_INFO registry_info { resource_format_version = RESOURCE_FORMAT_VERSION_2; @@ -42,8 +46,7 @@ IMPLEMENTATION_INFO { implementation_uid = KInstallerFrontEndEcomImplUid; - // Version number is 2 so that this implementation should override the old one in ROM - version_no = 2; + version_no = ECOM_VERSION_NO; display_name = "Midlet installation ui implementation"; default_data = "application/java-archive||text/vnd.sun.j2me.app-descriptor||application/x-java-archive||application/java"; opaque_data = " "; diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/appinstuiplugin/data/101F875F_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javainstaller/appinstuiplugin/data/101F875F_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 3 + +// Include actual rss +#include "101F875F.rss" + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp --- a/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp Fri Sep 17 08:28:21 2010 +0300 @@ -16,8 +16,12 @@ */ +#include <../../../../inc/project_defines.hrh> +#include #include +#include <../../../../inc/java_stdcpp_support_for_dll.hrh> + TARGET javaiconsizenotifplugin.dll TARGETTYPE PLUGIN @@ -33,6 +37,10 @@ START RESOURCE ../data/javaiconsizenotifplugin.rss TARGET javaiconsizenotifplugin.rsc END +START RESOURCE ../data/javaiconsizenotifplugin_iad.rss +TARGET javaiconsizenotifplugin.rsc +TARGETPATH resource/java/iad +END SOURCEPATH ../src SOURCE iconsizenotifier.cpp @@ -43,8 +51,8 @@ LIBRARY euser.lib LIBRARY eiksrv.lib // MEikSrvNotifierBase2 -LIBRARY cdlengine.lib // AknLayoutScalable_Avkon -LIBRARY aknlayout2scalable.lib // TAknWindowComponentLayout +LIBRARY CdlEngine.lib // AknLayoutScalable_Avkon +LIBRARY AknLayout2Scalable.lib // TAknWindowComponentLayout LIBRARY avkon.lib // TAknLayoutRect LIBRARY eikcore.lib // TAknLayoutRect diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss --- a/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss Fri Sep 17 08:28:21 2010 +0300 @@ -18,6 +18,10 @@ #include #include +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 1 +#endif + RESOURCE REGISTRY_INFO r_registry { resource_format_version = RESOURCE_FORMAT_VERSION_2; @@ -32,7 +36,7 @@ IMPLEMENTATION_INFO { implementation_uid = 0x101FD68A; - version_no = 1; + version_no = ECOM_VERSION_NO; display_name = "JavaIconSizeNotifPlugin"; default_data = ""; opaque_data = "0"; diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 2 + +// Include actual rss +#include "javaiconsizenotifplugin.rss" + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java --- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Fri Sep 17 08:28:21 2010 +0300 @@ -18,8 +18,11 @@ package com.nokia.mj.impl.installer.applicationregistrator; +import com.nokia.mj.impl.installer.ui.InstallerUi; import com.nokia.mj.impl.installer.utils.InstallerException; import com.nokia.mj.impl.installer.utils.Log; +import com.nokia.mj.impl.installer.utils.PropertyListener; +import com.nokia.mj.impl.installer.utils.PropertyProvider; /** * Sends installation and uninstallation progress notifications @@ -28,24 +31,26 @@ public final class SifNotifier { /** Install operation. */ - public static final int OP_INSTALL = 1; + public static final int OP_INSTALL = 1; // TSifOperationPhase::EInstalling /** Uninstall operation. */ - public static final int OP_UNINSTALL = 2; + public static final int OP_UNINSTALL = 2; // TSifOperationPhase::EUninstalling /** Update operation. */ - public static final int OP_UPDATE = 3; + public static final int OP_UPDATE = 3; // TSifOperationPhase::EUpgrading - /** Indicates installaion or uninstallation without + /** Indicates installation or uninstallation without specific suboperation. */ - public static final int SUB_OP_NO = 1; + public static final int SUB_OP_NO = 1; // TSifOperationSubPhase::ENoSubPhase /** OCSP phase during installation. */ - public static final int SUB_OP_OCSP = 2; + public static final int SUB_OP_OCSP = 2; // TSifOperationSubPhase::EOCSPCheck /** Download phase during installation. */ - public static final int SUB_OP_DOWNLOAD = 3; + public static final int SUB_OP_DOWNLOAD = 3; // TSifOperationSubPhase::EDownload /** Maximum progress notification value. */ private static final int MAX_PROGRESS = 100; /** Operation being notified. */ private int iOperation = 0; + /** Suboperation during installation. */ + private int iSubOperation = 0; /** Global component id for the application. */ private String iGlobalComponentId = null; /** Component name (i.e. suite name). */ @@ -64,11 +69,26 @@ /** Sending progress notifications is only allowed between start * and end notifications. */ private boolean iNotifyProgressAllowed = false; - /** Value of the last progress notification that has been sent. */ + /** + * Value of the last progress notification that has been sent with + * SUB_OP_NO suboperation. + */ private int iLastProgressSent = 0; + /** Current value of the last progress notification that has been sent. */ + private int iCurrentValue = 0; + /** total value of the last progress notification that has been sent. */ + private int iTotalValue = 0; - /** Native object handle. */ + /** Native notifier object handle. */ private int iHandle = 0; + /** Native indicator object handle. */ + private int iIndicatorHandle = 0; + /** InstallerUi handle. */ + private InstallerUi iInstallerUi = null; + /** Provider for indicator status events. */ + private PropertyProvider iIndicatorStatusProvider = null; + /** Indicator state. */ + private int iIndicatorState = -1; /*** ----------------------------- PUBLIC ------------------------------ */ @@ -81,6 +101,164 @@ } /** + * Set InstallerUi used when handling indicator. + */ + public void setInstallerUi(InstallerUi aInstallerUi) + { + iInstallerUi = aInstallerUi; + } + + /** + * Activates and updates indicator which displays installation + * progress to user while installer UI is hidden. The notifyStart + * and notifyProgress methods must be called at least once before + * calling this method. + */ + public void activateIndicator() + { + if (iInstallerUi == null) + { + return; + } + + if (iIndicatorHandle == 0) + { + int ret = _initIndicator(); + if (ret < 0) + { + Log.logError( + "Initializing SifNotifier indicator failed with code " + + ret); + } + else + { + Log.log("SifNotifier indicator created"); + } + iIndicatorHandle = ret; + } + + if (iIndicatorHandle == 0) + { + return; + } + + int phase = 0; + switch (iSubOperation) + { + case SUB_OP_OCSP: phase = 2; break; // TInstallingPhase::ECheckingCerts + case SUB_OP_DOWNLOAD: phase = 1; break; // TInstallingPhase::EDownloading + default: phase = 0; // TInstallingPhase::EInstalling + } + int progress = (iTotalValue == 0? 0: iCurrentValue*100/iTotalValue); + updateIndicator(iComponentName, phase, progress); + + if (iIndicatorStatusProvider == null) + { + // Create PropertyListener which listens indicator status events + // and unhides UI when necessary. + final int indicatorCategory = 0x20022FC5; // sifuiinstallindicatorplugin + final int indicatorKey = 0x2002E690; // /SifUiInstallIndicator/Status + iIndicatorStatusProvider = new PropertyProvider(); + iIndicatorStatusProvider.subscribe( + indicatorCategory, indicatorKey, new PropertyListener() + { + public void valueChanged(int aCategory, int aKey, int aValue) + { + Log.log("SifNotifier indicator status " + aValue + + " (category=" + aCategory + ", key=" + aKey + ")"); + iIndicatorState = aValue; + if (iIndicatorState == 0) + { + // Indicator has been closed, unhide the UI. + iInstallerUi.hide(false); + } + } + }); + Log.log("SifNotifier indicator status provider subscribed"); + } + } + + /** + * Updates indicator which displays installation progress to user + * while installer UI is hidden. The activateindicator method must + * be called before calling this method. + */ + public void updateIndicator(String aName, int aPhase, int aProgress) + { + if (iInstallerUi == null || iIndicatorHandle == 0) + { + return; + } + + final String name = aName; + final int phase = aPhase; + final int progress = aProgress; + iInstallerUi.syncExec(new Runnable() + { + // Indicator must be updated from UI thread. + public void run() + { + int ret = _updateIndicator( + iIndicatorHandle, name, phase, progress); + if (ret < 0) + { + Log.logError( + "Updating SifNotifier indicator failed with code " + + ret); + } + else + { + Log.log("SifNotifier indicator updated: " + name + + ", " + phase + ", " + progress + "%"); + } + } + }); + } + + /** + * Deactivates indicator which displays installation + * progress to user while installer UI is hidden. + */ + public void deactivateIndicator() + { + if (iIndicatorStatusProvider != null) + { + iIndicatorStatusProvider.unsubscribe(); + iIndicatorStatusProvider = null; + Log.log("SifNotifier indicator status provider unsubscribed"); + } + + if (iInstallerUi == null) + { + return; + } + + iInstallerUi.syncExec(new Runnable() + { + // Indicator must be deactivated from UI thread. + public void run() + { + if (iIndicatorHandle == 0) + { + return; + } + int ret = _destroyIndicator(iIndicatorHandle, iIndicatorState); + if (ret < 0) + { + Log.logError( + "Destroying SifNotifier indicator failed with code " + + ret); + } + else + { + Log.log("SifNotifier indicator destroyed"); + } + iIndicatorHandle = 0; + } + }); + } + + /** * Returns true if SIF progress notifications are enabled, false otherwise. */ public static boolean enabled() @@ -109,7 +287,7 @@ checkHandle(); int ret = _notifyStart( - iHandle, aGlobalComponentId, aComponentName, + iHandle, aOperation, aGlobalComponentId, aComponentName, aApplicationNames, aApplicationIcons, aComponentSize, aIconDir, aComponentIcon); if (ret < 0) @@ -176,6 +354,16 @@ { return; } + + iSubOperation = aSubOperation; + iCurrentValue = aCurrent; + iTotalValue = aTotal; + if (iIndicatorHandle != 0) + { + // Call activateIndicator so that indicator gets updated. + activateIndicator(); + } + checkHandle(); if (aSubOperation == SUB_OP_NO) { @@ -209,6 +397,7 @@ */ public void destroy() { + deactivateIndicator(); checkHandle(); int ret = _destroy(iHandle); if (ret < 0) @@ -309,6 +498,7 @@ * Notifies SIF about installation/uinstallation start. * * @param aHandle + * @param aOperation * @param aGlobalComponentId * @param aComponentName * @param aApplicationNames @@ -320,9 +510,10 @@ * otherwise 0 */ private static native int _notifyStart( - int aHandle, String aGlobalComponentId, String aComponentName, - String[] aApplicationNames, String[] aApplicationIcons, - int aComponentSize, String aIconDir, String aComponentIcon); + int aHandle, int aOperation, String aGlobalComponentId, + String aComponentName, String[] aApplicationNames, + String[] aApplicationIcons, int aComponentSize, + String aIconDir, String aComponentIcon); /** * Notifies SIF about installation/uinstallation completion. @@ -362,7 +553,7 @@ * other methods are called. * * @return Symbian error code (negative number) if operation fails, - * otherwise handle to the natie side object + * otherwise handle to the native side object */ private static native int _init(); @@ -376,4 +567,35 @@ */ private static native int _destroy(int aHandle); + /** + * Initializes SifNotifier indicator. + * + * @return Symbian error code (negative number) if operation fails, + * otherwise handle to the native side object + */ + private static native int _initIndicator(); + + /** + * Updates SifNotifier indicator. + * + * @param aHandle handle to indicator object + * @param aName application name + * @param aPhase operation phase + * @param aProgress progress in percentage + * @return Symbian error code (negative number) if operation fails, + * otherwise handle to the native side object + */ + private static native int _updateIndicator( + int aHandle, String aName, int aPhase, int aProgress); + + /** + * Destroys SifNotifier indicator. + * + * @param aHandle handle to indicator object + * @param aState indicator state + * @return Symbian error code (negative number) if operation fails, + * otherwise 0 + */ + private static native int _destroyIndicator(int aHandle, int aState); + } diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Fri Sep 17 08:28:21 2010 +0300 @@ -47,7 +47,7 @@ // 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; + private static final int MAX_SIF_PROGRESS_UPDATES = 8; // Maximum number of progress updates to UI. private static final int MAX_UI_PROGRESS_UPDATES = 20; @@ -132,18 +132,6 @@ public void ended() { Log.log("InstallationNotifier.ended"); - if (iInstallerUi != null) - { - try - { - iInstallerUi.ended(); - } - catch (Throwable t) - { - Log.logError( - "InstallationNotifier: InstallerUi.ended threw exception", t); - } - } if (iSifNotifier != null) { // After this SifNotifier is no longer used, destroy it. @@ -157,6 +145,18 @@ Log.logError("InstallationNotifier: SifNotifier.destroy failed", t); } } + if (iInstallerUi != null) + { + try + { + iInstallerUi.ended(); + } + catch (Throwable t) + { + Log.logError( + "InstallationNotifier: InstallerUi.ended threw exception", t); + } + } } /** diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Fri Sep 17 08:28:21 2010 +0300 @@ -589,6 +589,8 @@ table.add(new com.nokia.mj.impl.installer.midp2.install.steps. ConfirmPermissions()); // Show UI confirmation dialog. table.add(new com.nokia.mj.impl.installer.midp2.install.steps. + AddSecurityData()); + table.add(new com.nokia.mj.impl.installer.midp2.install.steps. HandleCustomAttributes()); table.add(new com.nokia.mj.impl.installer.midp2.install.steps. CheckJarPackages()); @@ -596,8 +598,6 @@ StopApplication()); // Update new application info in the following steps. table.add(new com.nokia.mj.impl.installer.midp2.install.steps. - AddSecurityData()); - table.add(new com.nokia.mj.impl.installer.midp2.install.steps. AddToStorage()); table.add(new com.nokia.mj.impl.installer.midp2.install.steps. RegisterPush()); @@ -607,12 +607,13 @@ RegisterApplicationToSif()); table.add(new com.nokia.mj.impl.installer.midp2.install.steps. CopyAppFiles()); - if (Platform.isS60()) // PrepareSplashScreen uses eSWT which is + if (Platform.isS60()) { - // not available in Linux. + // PrepareSplashScreen uses eSWT which is not available in Linux. + // Create splash screen images after app dir exists, + // that is after CopyAppFiles step. table.add(new com.nokia.mj.impl.installer.midp2.install.steps. - PrepareSplashScreen()); // Create splash screen images - // after app dir exists (after CopyAppFiles step). + PrepareSplashScreen()); } table.add(new com.nokia.mj.impl.installer.midp2.install.steps. NotifyJsrPlugins()); diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -77,41 +77,6 @@ * When this object is used for registering applications, all * params must be valid. When used for unregistering applications, * only aUid is really needed. - * Use default values for optional information. - * - * @param aUid Java application Uid (MIDlet Uid). - * @param aGroupName The value of Nokia-MIDlet-Category attribute or empty. - * Note that in Symbian only 16 first characters are stored to - * application registry. - * @param aMIDletName MIDlet name from MIDlet- attribute. - * @param aTargetDrive The installation drive, e.g. "C:" in S60 - * @param aIconFileName The full path name to the icon file in file system. - * The file must be accessible and the path must have \\ chars. - * @param aJarFileName Full path name to jar file. - * @see ApplicationRegistrator - */ - public AppRegInfo( - Uid aUid, - String aGroupName, - String aMIDletName, - String aTargetDrive, - String aIconFileName, - String aJarFileName) - { - iUid = aUid; - iGroupName = aGroupName; - iMIDletName = aMIDletName; - iTargetDrive = aTargetDrive; - iIconFileName = aIconFileName; - iJarFileName = aJarFileName; - } - - - /** - * Construct new AppRegInfo object. - * When this object is used for registering applications, all - * params must be valid. When used for unregistering applications, - * only aUid is really needed. * Specify all information. * * @param aUid Java application Uid (MIDlet Uid). diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -18,38 +18,54 @@ package com.nokia.mj.impl.installer.jsrpluginnotifier; +import com.nokia.mj.impl.storage.StorageSession; import com.nokia.mj.impl.utils.Logger; import com.nokia.mj.impl.utils.Uid; import java.util.Hashtable; /** * Information passed to JSR plugins when installing or uninstalling - * Java applications + * Java applications. * @see JsrPluginNotifier */ public final class InstallerExtensionInfo { /** - * MIDlet Suite Uid. Can be null. + * MIDlet Suite Uid. */ - public Uid iUid; + public Uid iUid = null; + + /** + * Application Uids. + */ + public Uid[] iAppUids = null; /** - * true if upgrade installation + * Application suite root directory path. */ - public boolean iUpgrade; + public String iRootPath = null; /** - * true if silent installation + * True if upgrade installation. */ - public boolean iSilent; + public boolean iUpgrade = false; /** - * Combined jad./.jar attributes. + * True if silent installation. + */ + public boolean iSilent = false; + + /** + * Combined jad/jar attributes. * Key is attribute name, value is com.nokia.mj.impl.utils.Attribute object * Can be null. */ - public Hashtable iAttributes; + public Hashtable iAttributes = null; + + /** + * JavaStorage session where installation/uninstallation changes are made. + */ + public StorageSession iStorageSession = null; /*** ----------------------------- PUBLIC ------------------------------ */ diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Fri Sep 17 08:28:21 2010 +0300 @@ -42,15 +42,8 @@ public void execute(ExeBall aBall) { InstallBall ball = (InstallBall)aBall; - int initialSize = ball.iSuite.calculateInitialSize(); - if (initialSize == 0 && ball.iJarFilename != null) - { - // Get initialSize from jar file size. - initialSize = (int)FileUtils.getSize(ball.iJarFilename); - - } - int requiredSize = initialSize + (100 * 1024); // +100kB + int requiredSize = getRequiredSize(ball); if (ball.iUserConfirmation == null) { @@ -103,6 +96,25 @@ } /** + * Returns amount of disk space this application requires. + */ + static int getRequiredSize(InstallBall aBall) + { + int initialSize = aBall.iSuite.getInitialSize(); + if (initialSize <= 0) + { + initialSize = aBall.iSuite.calculateInitialSize(); + } + if (initialSize == 0 && aBall.iJarFilename != null) + { + // Get initialSize from jar file size. + initialSize = (int)FileUtils.getSize(aBall.iJarFilename); + + } + return initialSize + (100 * 1024); // +100kB + } + + /** * Checks if given drive has enough free disk space. Throws * InstallerException if there is not enough free disk space. */ @@ -139,9 +151,9 @@ int driveId = drive.getNumber(); if (SysUtil.isDiskSpaceBelowCriticalLevel(aSizeInBytes, driveId)) { - Log.logWarning("Drive " + driveId + - " space below critical level, required space " + - aSizeInBytes + " bytes"); + Log.log("Drive " + driveId + + " space below critical level, required space " + + aSizeInBytes + " bytes"); } else { diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Fri Sep 17 08:28:21 2010 +0300 @@ -126,6 +126,7 @@ installInfo.setDriveId(ball.iInstallationDrive); Vector drives = new Vector(); SysUtil.getUserVisibleDrives(drives); + removeFullDrives(ball, drives); int[] driveIds = new int[drives.size()]; int[] driveTypes = new int[drives.size()]; long[] driveFreeSpaces = new long[drives.size()]; @@ -385,4 +386,34 @@ } return size; } + + /** + * Removes drives which do not have enough free space for the + * application from the aDrives vector. + */ + private void removeFullDrives(InstallBall aBall, Vector aDrives) + { + int requiredSize = CheckDiskSpace.getRequiredSize(aBall); + for (int i = 0; i < aDrives.size(); i++) + { + DriveInfo drive = (DriveInfo)aDrives.elementAt(i); + int driveId = drive.getNumber(); + if (SysUtil.isDiskSpaceBelowCriticalLevel(requiredSize, driveId)) + { + Log.logWarning("Drive " + FileUtils.getDriveName(driveId) + + " (" + driveId + ") does not have enough " + + " free space, required space " + requiredSize + + " bytes"); + aDrives.removeElementAt(i); + i--; // Decrease index because drive was removed from Vector. + } + } + if (aDrives.size() == 0) + { + // None of the available drives has enough space, + // throw an exception. + throw InstallerException.getOutOfDiskSpaceException( + requiredSize, null); + } + } } diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Fri Sep 17 08:28:21 2010 +0300 @@ -233,6 +233,31 @@ } /** + * Called when InstallerUi is hidden or unhidden. + * + * @param aHidden true if UI was hidden, false if UI was unhidden. + */ + public void uiIsHidden(boolean aHidden) + { + log("InstallBall.uiIsHidden " + aHidden); + if (iSifNotifier == null) + { + Log.logWarning("InstallBall.uiIsHidden(" + aHidden + + ") called when SifNotifier does not exist"); + return; + } + iSifNotifier.setInstallerUi(getInstallerUi()); + if (aHidden) + { + iSifNotifier.activateIndicator(); + } + else + { + iSifNotifier.deactivateIndicator(); + } + } + + /** * Called when user cancels the execution from the InstallerUi. * This method must return quickly. */ diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -34,17 +34,11 @@ { InstallBall ball = (InstallBall)aBall; - // If any Jsr plugins, notify plugins + // If any Jsr plugins, notify plugins. if (ball.iJsrPluginNotifier.anyJsrPlugins()) { - // Create info object to be passed to plugins - InstallerExtensionInfo info = new InstallerExtensionInfo(); - info.iUid = ball.iSuite.getUid(); - info.iUpgrade = (ball.iOldSuite != null); - info.iSilent = ball.isSilent(); - info.iAttributes = ball.iCombinedAttributes; - - ball.iJsrPluginNotifier.notifyInstallation(info); + ball.iJsrPluginNotifier.notifyInstallation( + createInstallerExtensionInfo(ball)); } } @@ -52,26 +46,31 @@ { InstallBall ball = (InstallBall)aBall; - // Notify possible plugins that installation can been cancelled + // Notify possible plugins that installation has been cancelled. if (ball.iJsrPluginNotifier.anyJsrPlugins()) { - // Create info object to be passed to plugins - InstallerExtensionInfo info = new InstallerExtensionInfo(); - // Beware, it is possible that aBall has not been fully - // initialized - if (null == ball.iSuite) - { - info.iUid = null; - } - else - { - info.iUid = ball.iSuite.getUid(); - } - info.iUpgrade = (ball.iOldSuite != null); - info.iSilent = ball.isSilent(); - info.iAttributes = ball.iCombinedAttributes; - - ball.iJsrPluginNotifier.notifyRollbackInstall(info); + ball.iJsrPluginNotifier.notifyRollbackInstall( + createInstallerExtensionInfo(ball)); } } + + private InstallerExtensionInfo createInstallerExtensionInfo(InstallBall aBall) + { + InstallerExtensionInfo info = new InstallerExtensionInfo(); + // Beware, it is possible that aBall has not been fully initialized. + if (aBall.iSuite != null) + { + info.iUid = aBall.iSuite.getUid(); + info.iAppUids = aBall.iSuite.getApplicationUids(); + info.iRootPath = aBall.iSuite.getRootDir(); + } + info.iUpgrade = (aBall.iOldSuite != null); + info.iSilent = aBall.isSilent(); + info.iAttributes = aBall.iCombinedAttributes; + if (aBall.iStorageHandler != null) + { + info.iStorageSession = aBall.iStorageHandler.getSession(); + } + return info; + } } diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -34,17 +34,11 @@ { UninstallBall ball = (UninstallBall)aBall; - // If any Jsr plugins, notify plugins + // If any Jsr plugins, notify plugins. if (ball.iJsrPluginNotifier.anyJsrPlugins()) { - // Create info object to be passed to plugins - InstallerExtensionInfo info = new InstallerExtensionInfo(); - info.iUid = ball.iSuite.getUid(); - info.iUpgrade = false; - info.iSilent = ball.isSilent(); - info.iAttributes = ball.iSuite.getAttributes(); - - ball.iJsrPluginNotifier.notifyUninstallation(info); + ball.iJsrPluginNotifier.notifyUninstallation( + createInstallerExtensionInfo(ball)); } } @@ -52,27 +46,31 @@ { UninstallBall ball = (UninstallBall)aBall; - // Notify possible plugins that uninstallation can been cancelled + // Notify possible plugins that uninstallation has been cancelled. if (ball.iJsrPluginNotifier.anyJsrPlugins()) { - // Create info object to be passed to plugins - InstallerExtensionInfo info = new InstallerExtensionInfo(); - // Beware, it is possible that aBall has not been fully - // initialized - if (null == ball.iSuite) - { - info.iUid = null; - info.iAttributes = null; - } - else - { - info.iUid = ball.iSuite.getUid(); - info.iAttributes = ball.iSuite.getAttributes(); - } - info.iUpgrade = false; - info.iSilent = ball.isSilent(); - - ball.iJsrPluginNotifier.notifyRollbackUninstall(info); + ball.iJsrPluginNotifier.notifyRollbackUninstall( + createInstallerExtensionInfo(ball)); } } + + private InstallerExtensionInfo createInstallerExtensionInfo(UninstallBall aBall) + { + InstallerExtensionInfo info = new InstallerExtensionInfo(); + // Beware, it is possible that aBall has not been fully initialized. + if (aBall.iSuite != null) + { + info.iUid = aBall.iSuite.getUid(); + info.iAppUids = aBall.iSuite.getApplicationUids(); + info.iAttributes = aBall.iSuite.getAttributes(); + info.iRootPath = aBall.iSuite.getRootDir(); + } + info.iUpgrade = false; + info.iSilent = aBall.isSilent(); + if (aBall.iStorageHandler != null) + { + info.iStorageSession = aBall.iStorageHandler.getSession(); + } + return info; + } } diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp --- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -23,6 +23,9 @@ #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK +#include +#include +#include #include #include @@ -51,7 +54,7 @@ * This method makes calls that may leave (the actual notifying). */ void NotifyStartL( - JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier, + JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier, jint aOperation, jstring aGlobalComponentId, jstring aComponentName, jobjectArray aApplicationNames, jobjectArray aApplicationIcons, jint aComponentSize, jstring aIconDir, jstring /*aComponentIcon*/) @@ -106,7 +109,8 @@ CSifOperationStartData::NewLC( *globalComponentId, *componentName, applicationNames, applicationIcons, aComponentSize, /*aIconPath=*/ (NULL != aIconDir? *iconDir: KNullDesC()), - /*aComponentIcon=*/ KNullDesC(), Usif::KSoftwareTypeJava); + /*aComponentIcon=*/ KNullDesC(), Usif::KSoftwareTypeJava, + (TSifOperationPhase)aOperation); aNotifier->PublishStartL(*startData); @@ -130,16 +134,17 @@ * Signature: (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;I)I */ JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyStart -(JNIEnv *aEnv, jclass, jint aHandle, jstring aGlobalComponentId, - jstring aComponentName, jobjectArray aApplicationNames, - jobjectArray aApplicationIcons, jint aComponentSize, - jstring aIconDir, jstring aComponentIcon) +(JNIEnv *aEnv, jclass, jint aHandle, jint aOperation, + jstring aGlobalComponentId, jstring aComponentName, + jobjectArray aApplicationNames, jobjectArray aApplicationIcons, + jint aComponentSize, jstring aIconDir, jstring aComponentIcon) { CPublishSifOperationInfo *pNotifier = reinterpret_cast(aHandle<<2); - TRAPD(err, NotifyStartL(aEnv, pNotifier, aGlobalComponentId, aComponentName, - aApplicationNames, aApplicationIcons, - aComponentSize, aIconDir, aComponentIcon)); + TRAPD(err, NotifyStartL(aEnv, pNotifier, aOperation, aGlobalComponentId, + aComponentName, aApplicationNames, + aApplicationIcons, aComponentSize, + aIconDir, aComponentIcon)); return err; } @@ -297,6 +302,103 @@ return KErrNone; } +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier + * Method: _initIndicator + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1initIndicator +(JNIEnv *, jclass) +{ + CHbIndicatorSymbian *pIndicator = NULL; + TRAPD(err, pIndicator = CHbIndicatorSymbian::NewL()); + if (KErrNone != err) + { + ELOG1(EJavaInstaller, + "SifNotifier.initIndicator: Creating indicator failed, error %d", + err); + return err; + } + // Return handle to the object. Utilize the fact that in Symbian + // all pointer addresses are MOD 4 so the last 2 bits are 0 + // and can be shifted out. This way the returned handle is + // always positive whereas Symbian error codes are always negative. + return reinterpret_cast(pIndicator)>>2; +} + +/** + * See JNI method __1updateIndicator. + * This method makes calls that may leave (the actual notifying). + */ +void UpdateIndicatorL( + JNIEnv *aEnv, CHbIndicatorSymbian *pIndicator, jstring aName, jint aPhase, jint aProgress) +{ + HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); + + CHbSymbianVariantMap *variantMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(variantMap); + CHbSymbianVariant *variantName = CHbSymbianVariant::NewL(name, CHbSymbianVariant::EDes); + variantMap->Add(KSifUiInstallIndicatorAppName, variantName); + CHbSymbianVariant *variantPhase = CHbSymbianVariant::NewL(&aPhase, CHbSymbianVariant::EInt); + variantMap->Add(KSifUiInstallIndicatorPhase, variantPhase); + CHbSymbianVariant *variantProgress = CHbSymbianVariant::NewL(&aProgress, CHbSymbianVariant::EInt); + variantMap->Add(KSifUiInstallIndicatorProgress, variantProgress); + + CHbSymbianVariant *variant = CHbSymbianVariant::NewL(variantMap, CHbSymbianVariant::EVariantMap); + CleanupStack::PushL(variant); + + TInt err = KErrNone; + if (!pIndicator->Activate(KSifUiInstallIndicatorType, variant)) + { + err = pIndicator->Error(); + ELOG1(EJavaInstaller, + "SifNotifier.updateIndicator: activating indicator failed, error %d", + err); + err = KErrGeneral; + } + + CleanupStack::PopAndDestroy(variant); + CleanupStack::PopAndDestroy(variantMap); + CleanupStack::PopAndDestroy(name); +} + +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier + * Method: _updateIndicator + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1updateIndicator +(JNIEnv *aEnv, jclass, jint aHandle, jstring aName, jint aPhase, jint aProgress) +{ + CHbIndicatorSymbian *pIndicator = + reinterpret_cast(aHandle<<2); + TRAPD(err, UpdateIndicatorL(aEnv, pIndicator, aName, aPhase, aProgress)); + return err; +} + +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier + * Method: _destroyIndicator + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1destroyIndicator +(JNIEnv *, jclass, jint aHandle, jint aState) +{ + CHbIndicatorSymbian *pIndicator = + reinterpret_cast(aHandle<<2); + TInt err = KErrNone; + if (aState && !pIndicator->Deactivate(KSifUiInstallIndicatorType)) + { + err = pIndicator->Error(); + ELOG1(EJavaInstaller, + "SifNotifier.destroyIndicator: Deactivating indicator failed, error %d", + err); + err = KErrGeneral; + } + delete pIndicator; + return err; +} + #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK /* @@ -316,7 +418,7 @@ * Signature: (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;I)I */ JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyStart -(JNIEnv *, jclass, jint, jstring, jstring, jobjectArray, jobjectArray, jint, jstring, jstring) +(JNIEnv *, jclass, jint, jint, jstring, jstring, jobjectArray, jobjectArray, jint, jstring, jstring) { LOG(EJavaInstaller, EInfo, "SifNotifier.notifyStart"); return KErrNone; @@ -381,4 +483,40 @@ return KErrNone; } +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier + * Method: _initIndicator + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1initIndicator +(JNIEnv *, jclass) +{ + LOG(EJavaInstaller, EInfo, "SifNotifier.initIndicator"); + return 1; // return dummy object handle +} + +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier + * Method: _updateIndicator + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1updateIndicator +(JNIEnv *, jclass, jint, jstring, jint, jint) +{ + LOG(EJavaInstaller, EInfo, "SifNotifier.updateIndicator"); + return KErrNone; +} + +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier + * Method: _destroyIndicator + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1destroyIndicator +(JNIEnv *, jclass, jint, jint) +{ + LOG(EJavaInstaller, EInfo, "SifNotifier.destroyIndicator"); + return KErrNone; +} + #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/build/build.xml --- a/javamanager/javainstaller/installer/tsrc/build/build.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/build/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -1,6 +1,6 @@ @@ -96,7 +96,7 @@ tofile="${dist.dir}/${junit.omj.jar.filename}"/> - + @@ -108,6 +108,9 @@ + + + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/build/jiut.bat --- a/javamanager/javainstaller/installer/tsrc/build/jiut.bat Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/build/jiut.bat Fri Sep 17 08:28:21 2010 +0300 @@ -11,11 +11,12 @@ @rem @rem Contributors: @rem -@rem Description: +@rem Description: @rem rem Script for running JavaInstaller unit tests from S60 eshell rem Start SifServer before running any tests sifserver +javainstaller uninstallall -silent -forceuninstall 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 diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java --- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -216,14 +216,16 @@ // second possible drive drive = (String)value.get(1); assertTrue("PossibleInstallationDrives is null", (drive != null)); - assertTrue("Second PossibleInstallationDrive is not E:, it is " + drive, drive.equals("E:")); + //assertTrue("Second PossibleInstallationDrive is not E:, it is " + drive, drive.equals("E:")); + assertTrue("Second PossibleInstallationDrive is not T:, it is " + drive, drive.equals("T:")); 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 not E:, it is " + idrive, idrive.intValue() == 4); + //assertTrue("Second PossibleInstallationDrive is not E:, it is " + idrive, idrive.intValue() == 4); + assertTrue("Second PossibleInstallationDrive is not T:, it is " + idrive, idrive.intValue() == 19); } public void testTypesOfPossibleInstallationDrives() diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandlerTest.java --- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandlerTest.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandlerTest.java Fri Sep 17 08:28:21 2010 +0300 @@ -448,7 +448,8 @@ { Uid[] uids = iStorageHandler.getSuiteUids(); assertTrue("expected uids to be not null", uids != null); - assertTrue("expected uids.length to be suites.length", + assertTrue("expected uids.length (" + uids.length + + ") to be suites.length (" + suites.length + ")", uids.length == suites.length); } catch (Exception ex) diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/AttributeValidatorTest.java --- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/AttributeValidatorTest.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/AttributeValidatorTest.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -183,16 +183,16 @@ Hashtable tbl = getTestTbl(); String attrName = "MIDlet-Version"; assertValidValue(tbl, attrName, "1"); - assertValidValue(tbl, attrName, "1."); // OPEN: Is this valid? If we are lenient it is. + assertValidValue(tbl, attrName, "1."); assertValidValue(tbl, attrName, "1.1"); - assertValidValue(tbl, attrName, "1.1."); // OPEN: Is this valid? If we are lenient it is. + assertValidValue(tbl, attrName, "1.1."); assertValidValue(tbl, attrName, "1.1.1"); + assertValidValue(tbl, attrName, "1.1:1"); // invalid chars are ignored assertInvalidValue(tbl, attrName, ""); // invalid, attr is mandatory assertInvalidValue(tbl, attrName, " "); // invalid, attr is mandatory - assertInvalidValue(tbl, attrName, "1.1:1"); // invalid char assertInvalidValue(tbl, attrName, "1.1.1."); // invalid, only three parts allowed assertInvalidValue(tbl, attrName, "1.1.1.1"); // invalid, only three parts allowed - assertInvalidValue(tbl, attrName, "abc"); // invalid chars + assertInvalidValue(tbl, attrName, "abc"); // invalid, version is mandatory } public void testRuntimeExecutionEnvironment() diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad --- a/javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad Fri Sep 17 08:28:21 2010 +0300 @@ -5,6 +5,7 @@ MIDlet-Jar-Size: 29967 MIDlet-Name: BCExchanger MIDlet-Vendor: Forum Nokia -MIDlet-Version: 1.0.0 + +MIDlet-Version: 1.0 rev.2 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.0 diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.zip Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.zip has changed diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java Fri Sep 17 08:28:21 2010 +0300 @@ -102,7 +102,6 @@ } iInstallerUi.loadCss(); setVisible(true); - iInstallerUi.unhide(); } }); // The UI thread must not be blocked. Let's wait for the answer diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Fri Sep 17 08:28:21 2010 +0300 @@ -104,6 +104,9 @@ /** Flag telling if the first progress bar update has been traced. */ private boolean iProgressBarUpdateTraced = false; + /** Certificate details view, owned by the view where it was opened. */ + private CertificateDetailsView iCertificateDetailsView = null; + /** Hashtable for storing the loaded icons. */ private static Hashtable iImageTable = null; /** Best size for application icon. */ @@ -253,6 +256,10 @@ public void cancelConfirmations() { super.cancelConfirmations(); + if (iCertificateDetailsView != null) + { + iCertificateDetailsView.confirmCancel(); + } if (iInstallConfirmationView != null) { iInstallConfirmationView.confirmCancel(); @@ -390,6 +397,9 @@ return true; } + // Ensure that UI is visible when this prompt is displayed. + unhide(); + synchronized (iProgressSyncObject) { // Do not display progress bar during dialog. @@ -471,7 +481,8 @@ // do not display installation progress. return; } - if (iDisplayProgress && !iProgressView.isVisible()) + if (iDisplayProgress && !iProgressView.isVisible() && + iCertificateDetailsView == null) { // Re-create iProgressView here so that it gets // application info that was set when confirm() @@ -605,7 +616,8 @@ synchronized (iProgressSyncObject) { - if (iDisplayProgress && !iDlProgressView.isVisible()) + if (iDisplayProgress && !iDlProgressView.isVisible() && + iCertificateDetailsView == null) { iDlProgressView.setVisible(true); } @@ -641,7 +653,8 @@ } synchronized (iProgressSyncObject) { - if (iDisplayProgress && !iProgressView.isVisible()) + if (iDisplayProgress && !iProgressView.isVisible() && + iCertificateDetailsView == null) { iProgressView.setVisible(true); } @@ -682,7 +695,8 @@ } if (iOcspProgressView != null) { - if (!iOcspProgressView.isVisible()) + if (!iOcspProgressView.isVisible() && + iCertificateDetailsView == null) { iOcspProgressView.setVisible(true); } @@ -761,7 +775,8 @@ if (DISABLE_UI) return; // Disable UI temporarily. waitForUi(); - if (!isUiReady()) { + waitForCertificateDetailsView(); + if (!isUiReady() || iHidden || iConfirmationsCanceled) { return; } @@ -821,6 +836,14 @@ if (!isUiReady()) { return true; } + waitForCertificateDetailsView(); + if (iConfirmationsCanceled) + { + return false; + } + + // Ensure that UI is visible when this prompt is displayed. + unhide(); if (iRuntimeConfirmationView == null) { @@ -857,11 +880,15 @@ { if (DISABLE_UI) return new String[] { "", "" }; // Disable UI temporarily. waitForUi(); - if (!isUiReady()) + waitForCertificateDetailsView(); + if (!isUiReady() || iConfirmationsCanceled) { return null; } + // Ensure that UI is visible when this prompt is displayed. + unhide(); + synchronized (iProgressSyncObject) { // Do not display progress bar during dialog. @@ -913,10 +940,13 @@ { if (DISABLE_UI) return false; // Disable UI temporarily. waitForUi(); - if (!isUiReady() || iConfirmationsCanceled || getInstallInfo() == null) + waitForCertificateDetailsView(); + if (!isUiReady() || iConfirmationsCanceled || + iHidden || getInstallInfo() == null) { - // Either UI is not yet ready, or user has cancelled - // installation, in both cases do nothing. + // Either UI is not yet ready, user has cancelled + // installation or UI is hidden; in all these cases + // do nothing. return false; } @@ -954,7 +984,10 @@ */ public void syncExec(Runnable aRunnable) { - iParent.getDisplay().syncExec(aRunnable); + if (!iParent.getDisplay().isDisposed()) + { + iParent.getDisplay().syncExec(aRunnable); + } } /** @@ -962,14 +995,14 @@ */ public void hide(boolean aHide) { - final boolean hide = aHide; - if (iParent != null) + iHidden = aHide; + if (iDialog != null) { - iParent.getDisplay().syncExec(new Runnable() + iDialog.getDisplay().syncExec(new Runnable() { public void run() { - iParent.setMinimized(hide); + iDialog.setMinimized(iHidden); } }); } @@ -988,6 +1021,45 @@ } /** + * Sets flag telling if certificate details view is open. + */ + protected void setCertificateDetailsView(CertificateDetailsView aView) + { + if (iCertificateDetailsView != null && aView == null) + { + // Certificate details view has been closed, + // notify possible waiters. + synchronized (iCertificateDetailsView) + { + iCertificateDetailsView.notify(); + } + } + iCertificateDetailsView = aView; + } + + /** + * Waits until certificate details view is closed. + */ + protected void waitForCertificateDetailsView() + { + if (iCertificateDetailsView != null) + { + // If certificate details view is open, wait until + // user closes it. + synchronized (iCertificateDetailsView) + { + try + { + iCertificateDetailsView.wait(); + } + catch (InterruptedException ie) + { + } + } + } + } + + /** * Returns string title basing on mode of this InstallerUi. */ protected String getTitle() diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java Fri Sep 17 08:28:21 2010 +0300 @@ -80,7 +80,7 @@ if (iInstallerUi != null && iInstallerUi.getInstallInfo() != null) { // Add header. - addHeader(aMsg, iInstallerUi.getInstallInfo(), null, false); + addHeader(aMsg, iInstallerUi.getInstallInfo(), null); } else { @@ -174,10 +174,9 @@ public void run() { // Set horizontalSpan to 2 for one button, - // and to 1 for one two buttons. - int horizontalSpan = 2; + // and to 1 for two buttons. + int horizontalSpan = 1; GridData gridData = null; - /* iHideCommand = new Button(getCommandComposite(), SWT.PUSH); setCssId(iHideCommand, "softKeyButton"); gridData = new GridData(GridData.FILL_HORIZONTAL); @@ -196,10 +195,10 @@ } }); addSoftKeyListenerFor(iHideCommand); - */ iCancelCommand = new Button(getCommandComposite(), SWT.PUSH); - setCssId(iCancelCommand, "softKeyButtonWide"); + setCssId(iCancelCommand, "softKeyButton"); + //setCssId(iCancelCommand, "softKeyButtonWide"); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = horizontalSpan; iCancelCommand.setLayoutData(gridData); diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Fri Sep 17 08:28:21 2010 +0300 @@ -78,7 +78,7 @@ private int iColumns = 1; /** Default content size. */ private Point iDefaultContentSize = null; - /** Certificate details view. */ + /** Certificate details view. */ private CertificateDetailsView iCertificateDetailsView = null; /** Certificates for this application. */ protected SigningCertificate[] iCertificates = null; @@ -803,6 +803,7 @@ { public void run() { + iInstallerUi.setCertificateDetailsView(iCertificateDetailsView); if (iCertificateDetailsView.confirm()) { log("certificateDetailsView confirmed"); @@ -813,6 +814,7 @@ } iCertificateDetailsView.dispose(); iCertificateDetailsView = null; + iInstallerUi.setCertificateDetailsView(null); setVisible(true); } }, "InstallerUiCertViewThread").start(); diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp --- a/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp Fri Sep 17 08:28:21 2010 +0300 @@ -39,6 +39,10 @@ START RESOURCE ../data/2002BC6F.rss TARGET javasifplugin.rsc END +START RESOURCE ../data/2002BC6F_iad.rss +TARGET javasifplugin.rsc +TARGETPATH resource/java/iad +END // Sources SOURCEPATH ../src diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/javasifplugin/data/2002BC6F.rss --- a/javamanager/javainstaller/javasifplugin/data/2002BC6F.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javainstaller/javasifplugin/data/2002BC6F.rss Fri Sep 17 08:28:21 2010 +0300 @@ -21,6 +21,10 @@ // RESOURCE DEFINITIONS +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 1 +#endif + RESOURCE REGISTRY_INFO registry_info { resource_format_version = RESOURCE_FORMAT_VERSION_2; @@ -40,7 +44,7 @@ IMPLEMENTATION_INFO { implementation_uid = 0x2002BC70; - version_no = 1; + version_no = ECOM_VERSION_NO; display_name = "Midlet installation implementation"; default_data = ""; opaque_data = ""; diff -r 773449708c84 -r 4ad59aaee882 javamanager/javainstaller/javasifplugin/data/2002BC6F_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javainstaller/javasifplugin/data/2002BC6F_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 2 + +// Include actual rss +#include "2002BC6F.rss" + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javamanager.pro --- a/javamanager/javamanager.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javamanager.pro Fri Sep 17 08:28:21 2010 +0300 @@ -25,6 +25,5 @@ SUBDIRS += javainstaller SUBDIRS += javaregistry SUBDIRS += javabackup -SUBDIRS += javasettings BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javarecognizer/build/bld.inf\"" BLD_INF_RULES.prj_extensions += "prj_extensions" diff -r 773449708c84 -r 4ad59aaee882 javamanager/javarecognizer/build/recjar.mmp --- a/javamanager/javarecognizer/build/recjar.mmp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javarecognizer/build/recjar.mmp Fri Sep 17 08:28:21 2010 +0300 @@ -19,8 +19,11 @@ #include <../../../inc/project_defines.hrh> +#include #include +#include <../../../inc/java_stdcpp_support_for_dll.hrh> + TARGET recjar.dll CAPABILITY TrustedUI ProtServ @@ -43,6 +46,10 @@ START RESOURCE ../data/102031FB.rss TARGET recjar.rsc END +START RESOURCE ../data/102031FB_iad.rss +TARGET recjar.rsc +TARGETPATH resource/java/iad +END LIBRARY euser.lib apmime.lib efsrv.lib diff -r 773449708c84 -r 4ad59aaee882 javamanager/javarecognizer/data/102031FB.rss --- a/javamanager/javarecognizer/data/102031FB.rss Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javarecognizer/data/102031FB.rss Fri Sep 17 08:28:21 2010 +0300 @@ -11,8 +11,8 @@ * * Contributors: * -* Description: ECOM resource definition for MIME type recognizer for Symbian -* application framework +* Description: ECOM resource definition for MIME type recognizer for Symbian +* application framework * */ @@ -20,6 +20,10 @@ #include #include "javauids.h" +#ifndef ECOM_VERSION_NO +#define ECOM_VERSION_NO 2 +#endif + RESOURCE REGISTRY_INFO r_registry { resource_format_version = RESOURCE_FORMAT_VERSION_2; @@ -34,12 +38,11 @@ IMPLEMENTATION_INFO { implementation_uid = KRecognizerEcomImplUid; - // Version number is 2 so that this implementation should override the old one in ROM - version_no = 2; + version_no = ECOM_VERSION_NO; display_name = "recjar"; default_data = ""; // This means it accepts ALL types opaque_data = ""; - rom_only = 0; + rom_only = 0; } }; } diff -r 773449708c84 -r 4ad59aaee882 javamanager/javarecognizer/data/102031FB_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javarecognizer/data/102031FB_iad.rss Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: ECOM resource definition for IAD +* +*/ + +// Version for IAD +#define ECOM_VERSION_NO 3 + +// Include actual rss +#include "102031FB.rss" + diff -r 773449708c84 -r 4ad59aaee882 javamanager/javasettings/javasettings.pro --- a/javamanager/javasettings/javasettings.pro Thu Sep 02 20:20:40 2010 +0300 +++ /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 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: Generated file - do not edit manually -# -TEMPLATE = subdirs -BLD_INF_RULES.prj_extensions += "prj_extensions" diff -r 773449708c84 -r 4ad59aaee882 javamanager/javasettings/subsystem.mk --- a/javamanager/javasettings/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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: -# - -include $(JAVA_SRC_ROOT)/build/Makefile.defs - - -ifndef RD_JAVA_APPLICATION_SETTINGS_QT -ifndef RD_JAVA_S60_RELEASE_5_0_IAD -NONQTSUBSYSTEMS += appmngrplugin/build -SYMBIAN_ONLY += appmngrplugin/build -endif -endif - -# Declare that release preparation removes subdirectories not in build, except -# listed special cases -REMOVE_NOTBUILT_EXCLUDING = dummy - -include ${JAVA_SRC_ROOT}/build/Makefile.subsystem diff -r 773449708c84 -r 4ad59aaee882 javamanager/javasettings_qt/build/javaapplicationsettingsview.pro --- a/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro Fri Sep 17 08:28:21 2010 +0300 @@ -16,7 +16,6 @@ TEMPLATE = lib TARGET = javaapplicationsettingsview CONFIG += qt hb stl plugin mobility -MOBILITY += bearer LIBS += -ljavastorage -lcmapplsettingsui -ljavaconnectionmanager -ljavautils TRANSLATIONS = javaruntimeapplicationsettings.ts diff -r 773449708c84 -r 4ad59aaee882 javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp --- a/javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -41,8 +41,6 @@ #include "logger.h" -QTM_USE_NAMESPACE - using namespace java::settings; using namespace java::storage; using namespace java::util; diff -r 773449708c84 -r 4ad59aaee882 javamanager/preinstaller/build/javapreinstaller.pro --- a/javamanager/preinstaller/build/javapreinstaller.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/preinstaller/build/javapreinstaller.pro Fri Sep 17 08:28:21 2010 +0300 @@ -24,7 +24,7 @@ SOURCES += ../src.s60/*.cpp LIBS += -lefsrv \ - -lPlatformEnv \ + -lplatformenv \ -ljavacomms \ -lcharconv \ -ljavastorage \ diff -r 773449708c84 -r 4ad59aaee882 javamanager/preinstaller/src.s60/silentmidletinstall.cpp --- a/javamanager/preinstaller/src.s60/silentmidletinstall.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/preinstaller/src.s60/silentmidletinstall.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -155,16 +155,17 @@ { iISRollbackNeeded = ETrue; // If JavaInstaller is running, then existence of the Java Installer - // integrity service directory is ok and rollback is not needed + // integrity service directory is ok and rollback is not needed. TFullName processName; - _LIT(KJavaInstallerProcess, "*Installer*"); + _LIT(KJavaInstallerProcess, "Installer*"); TFindProcess finder(KJavaInstallerProcess); err = finder.Next(processName); if (err == KErrNone) { iISRollbackNeeded = EFalse; - WLOG(EJavaPreinstaller, - "Java Installer is running while checking need to rollback"); + WLOG1(EJavaPreinstaller, + "Java Installer is running while checking need to rollback (%S)", + (wchar_t *)(processName.PtrZ())); } } diff -r 773449708c84 -r 4ad59aaee882 javamanager/subsystem.mk --- a/javamanager/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ b/javamanager/subsystem.mk Fri Sep 17 08:28:21 2010 +0300 @@ -20,8 +20,7 @@ javacaptain \ javainstaller \ javaregistry \ - javabackup \ - javasettings + javabackup COMPONENTS = \ preinstaller/build \ @@ -53,6 +52,8 @@ ifdef RD_JAVA_APPLICATION_SETTINGS_QT COMPONENTS += javasettings_qt/build SYMBIAN_ONLY += javasettings_qt/build +else +SUBSYSTEMS += javasettings endif # Declare that release preparation removes subdirectories not in build, except diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/SchemeHandlerBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/SchemeHandlerBase.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,39 @@ +/* +* 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.rt.midp; + +import javax.microedition.io.ConnectionNotFoundException; + +/** + * Java based platform request scheme handler base class. + */ +public abstract class SchemeHandlerBase +{ + + /*** ----------------------------- PUBLIC ------------------------------ */ + + /** + * Execute scheme. + * + * @param url to be invoked. + * @return true if MIDlet must be closed prior content fetch. + * @throws ConnectionNotFoundException if URL execution fails. + */ + public abstract boolean execute(String url) throws ConnectionNotFoundException; +} + diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/taskmanager/SchemeHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/taskmanager/SchemeHandler.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,60 @@ +/* +* 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: java://taskmanager scheme handler. +* +*/ +package com.nokia.mj.impl.rt.taskmanager; + +import javax.microedition.io.ConnectionNotFoundException; + +import com.nokia.mj.impl.coreui.CoreUi; +import com.nokia.mj.impl.rt.midp.SchemeHandlerBase; + +/** + * TaskManager platform request scheme handler. These are java: taskmanager?hide + * java: taskmanager?show. Using hide URL query application is hided + * from the TaskManager and brought visible using show query. + */ +public class SchemeHandler extends SchemeHandlerBase +{ + + /*** ----------------------------- PUBLIC ------------------------------ */ + + /** + * Execute scheme. If url contains query ?hide application is removed + * from the TaskManager and if it contains ?show application is shown on + * TaskManager. + * + * @return false. Since MIDlet needs never be closed before content fetch. + * @throws ConnectionNotFoundException if URL was invalid. + */ + public boolean execute(String url) throws ConnectionNotFoundException + { + if (url.indexOf("?hide") != -1) + { + CoreUi.hideApplication(true); + } + else if (url.indexOf("?show") != -1) + { + CoreUi.hideApplication(false); + } + else + { + throw new ConnectionNotFoundException("Invalid URL"); + } + + return false; + } +} + diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java --- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java Fri Sep 17 08:28:21 2010 +0300 @@ -25,6 +25,8 @@ import com.nokia.mj.impl.rt.ui.RuntimeUi; import com.nokia.mj.impl.rt.ui.RuntimeUiFactory; +import com.nokia.mj.impl.rt.midp.SchemeHandlerBase; + import com.nokia.mj.impl.rt.support.ApplicationInfo; import com.nokia.mj.impl.security.midp.authorization.AccessControllerFactoryImpl; @@ -34,6 +36,7 @@ import com.nokia.mj.impl.utils.Id; import com.nokia.mj.impl.utils.Logger; + /** * A class to be extended by the MIDlet applcation. See MIDP spec for * further details. @@ -56,6 +59,8 @@ */ private static boolean mConstructionAllowed = true; + private static final int DOMAIN_MANUFACTURER_OR_OPERATOR = 1; + /*** ----------------------------- PUBLIC ------------------------------ */ /** @@ -139,6 +144,7 @@ { Logger.PLOG(Logger.EJavaRuntime, "MIDlet.platformRequest(): " + url); + if (null == url) { throw new NullPointerException( @@ -153,24 +159,30 @@ return false; } + ApplicationInfo appInfo = ApplicationInfo.getInstance(); + String domain = appInfo.getProtectionDomain(); + + // Handling for java scheme. + /*if (url.startsWith("java://")) + { + String handlerName = parseHandlerName(url); + + if (handlerName.equals("taskmanager")) + { + // Check application is bound either Manufacturer or Operator domain. + enforceSecurityDomain(DOMAIN_MANUFACTURER_OR_OPERATOR, domain); + } + + return invokeSchemeHandler(handlerName, url); + }*/ + // If the platform request is used to start arbitrary native application, // check that MIDlet is in manufacturer or operator domain if (startsArbitraryNativeApp(url)) { - ApplicationInfo appInfo = ApplicationInfo.getInstance(); - String domain = appInfo.getProtectionDomain(); - if ((ApplicationInfo.MANUFACTURER_DOMAIN.equals(domain) != true) && - (ApplicationInfo.OPERATOR_DOMAIN.equals(domain) != true)) - { - Logger.WLOG(Logger.EJavaRuntime, - "Only manufacturer or operator domain MIDlets can start arbitrary native apps."); - - throw new ConnectionNotFoundException( - "Request allowed only for manufacturer or operator MIDlets"); - } + enforceSecurityDomain(DOMAIN_MANUFACTURER_OR_OPERATOR, domain); } - Logger.ILOG(Logger.EJavaRuntime, "Before handleConfirmationNote()"); @@ -362,6 +374,72 @@ return false; } + private String parseHandlerName(String url) throws ConnectionNotFoundException + { + // Parse handler name from URL. Remove java:// prefix. + String handlerName = url.substring(7).trim(); + + // name format: handlername?query + int nameEndIndex = handlerName.indexOf('?'); + + if (nameEndIndex != -1) + { + handlerName = handlerName.substring(0, nameEndIndex); + return handlerName; + } + else + { + throw new ConnectionNotFoundException("Handler not found for URL"); + } + } + + private boolean invokeSchemeHandler(String handlerName, String url) + throws ConnectionNotFoundException + { + try + { + // Avoid loading whatever class from the system using handler + // as package name. + Class clazz = Class.forName("com.nokia.mj.impl.rt." + handlerName + ".SchemeHandler"); + + SchemeHandlerBase handler = (SchemeHandlerBase)clazz.newInstance(); + + handler.execute(url); + return false; // No need to close MIDlet. + } + catch (Throwable t) + { + Logger.ELOG(Logger.EJavaRuntime, "Cannot invoke scheme handler: " + t.toString()); + // ClassNotFoundException, IllegalAccessException or InstantionException. + throw new ConnectionNotFoundException("Handler not found for URL"); + } + } + + private void enforceSecurityDomain(int type, String domain) + throws ConnectionNotFoundException + { + if (DOMAIN_MANUFACTURER_OR_OPERATOR == type) + { + if ((ApplicationInfo.MANUFACTURER_DOMAIN.equals(domain) != true) && + (ApplicationInfo.OPERATOR_DOMAIN.equals(domain) != true)) + { + Logger.WLOG(Logger.EJavaRuntime, + "Only manufacturer or operator domain MIDlets can invoke scheme"); + + throw new ConnectionNotFoundException( + "Request allowed only for manufacturer or operator MIDlets"); + } + } + else + { + Logger.ELOG(Logger.EJavaRuntime, + "Security enforcement failed: unknown domain category"); + + throw new ConnectionNotFoundException( + "Security enforcement failed: unknown domain category"); + } + } + /*** ----------------------------- NATIVE ----------------------------- */ private native void _managePlatformRequest(String url); diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp --- a/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -63,7 +63,7 @@ MidpRuntimeStarter::MidpRuntimeStarter(): mMidletInfo(new MidletInfo()), // codescanner::nonleavenew - mRuntimeState(Constructed), mShudownOk(false) + mRuntimeState(Constructed), mShudownOk(false) { JELOG2(EJavaRuntime); } @@ -350,8 +350,6 @@ void MidpRuntimeStarter::startCoreUi(std::auto_ptr& coreUiLoader) { - CoreUi& coreUi = CoreUi::getUiInstance(coreUiLoader); - // Create the default UI only if not going into pre-warmed state. if (!mMidletInfo->mPreWarmStart) { @@ -442,7 +440,7 @@ // Start the coreUI. JavaOsLayer::startUpTrace("Starting CoreUI", -1, -1); - coreUi.start(mMidletInfo->mMIDletUid, &uiParams); + CoreUi::start(coreUiLoader, mMidletInfo->mMIDletUid, &uiParams); JavaOsLayer::startUpTrace("CoreUI started", -1, -1); getMIDletSuiteInfoFromStorage(javaStorage.get(), JAR_PATH, @@ -610,16 +608,16 @@ if (c & 0xFF00) { // 16 bit char, must send all bits - res += ( L'A' + (c >> 12) ); - res += ( L'A' + ((c & 0x0F00) >> 8) ); - res += ( L'A' + ((c & 0x00F0) >> 4) ); - res += ( L'A' + ((c & 0x000F)) ); + res += (L'A' + (c >> 12)); + res += (L'A' + ((c & 0x0F00) >> 8)); + res += (L'A' + ((c & 0x00F0) >> 4)); + res += (L'A' + ((c & 0x000F))); } else { // 8 bit char, send only lowest 8 bits - res += ( L'a' + ((c & 0x00F0) >> 4) ); - res += ( L'a' + ((c & 0x000F)) ); + res += (L'a' + ((c & 0x00F0) >> 4)); + res += (L'a' + ((c & 0x000F))); } } diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/standalone/src/javastarterimpl.cpp --- a/javaruntimes/standalone/src/javastarterimpl.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaruntimes/standalone/src/javastarterimpl.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -171,12 +171,12 @@ } JavaStarterImpl::JavaStarterImpl(const std::list& args): - mJvmStarter(0), - mRuntimeStarterUtils(0), - mOriginalArgs(args), - mShudownOk(false), - mIsMainApp(true), - mConfiguration(JvmStarter::UNDEFINED) + mJvmStarter(0), + mRuntimeStarterUtils(0), + mOriginalArgs(args), + mShudownOk(false), + mIsMainApp(true), + mConfiguration(JvmStarter::UNDEFINED) { JELOG2(EJavaRuntime); @@ -212,14 +212,21 @@ // Create the start screen and start it if needed. std::auto_ptr coreUiLoader; - CoreUi& coreUi = CoreUi::getUiInstance(coreUiLoader); if (mUiParams.getScreenMode() != NO_START_SCREEN) { LOG(EJavaRuntime, EInfo, "StartUI"); - coreUi.start(mAppUid, &mUiParams); + CoreUi::start(coreUiLoader, mAppUid, &mUiParams); LOG(EJavaRuntime, EInfo, "StartUI ok"); } + // Add the rest of the JVM args. + for (std::list::const_iterator iter = mFlagArgs.begin(); + iter != mFlagArgs.end(); ++iter) + { + LOG1(EJavaRuntime, EInfo, "Adding args %S", iter->c_str()); + mJvmStarter->appendRawJvmArgument(*iter); + } + // Sets the -jar, -jad, -cp (or -classpath) args if were provided. // Also a main class is set if needed. handleJadJarCpArgs(); diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/starterutils/build/exports.inf --- a/javaruntimes/starterutils/build/exports.inf Thu Sep 02 20:20:40 2010 +0300 +++ b/javaruntimes/starterutils/build/exports.inf Fri Sep 17 08:28:21 2010 +0300 @@ -17,6 +17,8 @@ PRJ_EXPORTS +#include "../../../inc/build_defines.hrh" + ../inc/jvmstarter.h |../../../javaruntimes/inc/jvmstarter.h ../inc/runtimestarterutils.h |../../../javaruntimes/inc/runtimestarterutils.h diff -r 773449708c84 -r 4ad59aaee882 javaruntimes/starterutils/src.s60/j9starters60.cpp --- a/javaruntimes/starterutils/src.s60/j9starters60.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javaruntimes/starterutils/src.s60/j9starters60.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -55,8 +55,8 @@ J9StarterS60::J9StarterS60() #ifdef __WINSCW__ - : - mVariant(0) + : + mVariant(0) #endif // __WINSCW__ { JELOG2(EJavaRuntime); @@ -65,8 +65,8 @@ J9StarterS60::J9StarterS60(const Configuration configuration, const std::wstring& indetifier) #ifdef __WINSCW__ - : - mVariant(0) + : + mVariant(0) #endif // __WINSCW__ { JELOG2(EJavaRuntime); @@ -112,7 +112,6 @@ mJvmArgs.push_back(L"-Xmso16k"); // Native thread stack size. mJvmArgs.push_back(L"-Dcom.nokia.mj.impl.rt.ui=" L"com.nokia.mj.impl.rt.ui.avkon.RuntimeUiAvkon"); - mJvmArgs.push_back(L"-Dcom.nokia.coreui=coreuiavkon"); #endif // RD_JAVA_UI_QT mJvmArgs.push_back(L"-Dfile.encoding=ISO-8859-1"); @@ -184,7 +183,7 @@ void J9StarterS60::doOverideHeap(const std::wstring& arg, const std::wstring& size) { JELOG2(EJavaRuntime); - std::wstring maxHeapArg(arg); + std::wstring maxHeapArg(arg); maxHeapArg += size; maxHeapArg += L"K"; mJvmArgs.push_back(maxHeapArg); diff -r 773449708c84 -r 4ad59aaee882 javatools/javafinishjrtinstall/build/javafinishjrtinstall.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javatools/javafinishjrtinstall/build/javafinishjrtinstall.pro Fri Sep 17 08:28:21 2010 +0300 @@ -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: This application is executed by the native installer +# after a new version of Jrt has been installed from +# .sisx package on top of older Jrt version (e.g. when +# updating Jrt 2.1 to Jrt 2.2 via IAD). +# This application restarts Java Captain so that new +# version of the Jrt dlls is taken into use. +# All running MIDlets exit when Java Captain closes. +# + +TEMPLATE=app +TARGET=javafinishjrtinstall +CONFIG += omj no_icon stl +CONFIG -= qt + +symbian { + TARGET.EPOCSTACKSIZE = 0x5000 + TARGET.UID3 = 0x20031E4D + TARGET.CAPABILITY = PowerMgmt + + SOURCES += ../src.s60/*.cpp + + LIBS += -ljavautils -ljavacomms + } + +include(../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javatools/javafinishjrtinstall/src.s60/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javatools/javafinishjrtinstall/src.s60/main.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,90 @@ +/* +* 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: This application is executed by the native installer +* after a new version of Jrt has been installed from +* .sisx package on top of older Jrt version (e.g. when +* updating Jrt 2.1 to Jrt 2.2 via IAD). +* This application restarts Java Captain so that new +* version of the Jrt dlls is taken into use. +* All running MIDlets exit when Java Captain closes. +*/ + + +#include +#include +#include +#include + +#include "comms.h" +#include "commsclientendpoint.h" +#include "commsmessage.h" +#include "coremessages.h" +#include "logger.h" +#include "rtcmessages.h" + +using namespace java::comms; +using namespace java::captain; + + +void stopJavaCaptain() +{ + CommsMessage message; + message.setModuleId(PLUGIN_ID_JAVACAPTAIN_CORE_C); + message.setMessageId(CORE_MSG_ID_STOP_JAVACAPTAIN); + CommsClientEndpoint comms; + comms.connect(IPC_ADDRESS_JAVA_CAPTAIN_C); + int rc = comms.send(message); + while (rc == 0) + { + sleep(1); + WLOG(EJavaConverters, "javafinishjrtinstall: Waiting JavaCaptain to exit..."); + rc = comms.send(message); + } + comms.disconnect(); +} + + +void startJavaCaptain() +{ + _LIT(KJavaCaptainExe, "javacaptain.exe"); + _LIT(KJavaCaptainArg, ""); + RProcess proc; + int err = proc.Create(KJavaCaptainExe, KJavaCaptainArg); + if (err == KErrNone) + { + proc.Resume(); + LOG(EJavaConverters, EInfo, + "javafinishjrtinstall: startJavaCaptain javacaptain.exe was started ok"); + } + else + { + ELOG1(EJavaConverters, + "javafinishjrtinstall: startJavaCaptain start javacaptain.exe failed: %d", err); + } + proc.Close(); +} + + +/** + * Create cleanup stack and run the cleaner code inside TRAP harness + * to log unexpected leaves. + */ +TInt E32Main() +{ + CTrapCleanup* cleanupStack = CTrapCleanup::New(); + stopJavaCaptain(); + startJavaCaptain(); + delete cleanupStack; + return KErrNone; +} diff -r 773449708c84 -r 4ad59aaee882 javatools/javatools.pro --- a/javatools/javatools.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javatools/javatools.pro Fri Sep 17 08:28:21 2010 +0300 @@ -19,5 +19,6 @@ SUBDIRS += javacontrolpanel/starter/build/javacontrolpanel.pro SUBDIRS += javacontrolpanel/controlpanel/build/javacontrolpanel.pro SUBDIRS += javasecuritycustomization/build/javasecuritycustomization.pro +SUBDIRS += javafinishjrtinstall/build/javafinishjrtinstall.pro BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"testcerts/bld.inf\"" BLD_INF_RULES.prj_extensions += "prj_extensions" diff -r 773449708c84 -r 4ad59aaee882 javatools/subsystem.mk --- a/javatools/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ b/javatools/subsystem.mk Fri Sep 17 08:28:21 2010 +0300 @@ -42,6 +42,11 @@ usersettingsconfigurator/build \ javarestoreconverter/build +else + +COMPONENTS += \ + javafinishjrtinstall/build + endif NONQTSUBSYSTEMS += \ diff -r 773449708c84 -r 4ad59aaee882 javauis/amms_qt/jni/src/effectcontrol.cpp --- a/javauis/amms_qt/jni/src/effectcontrol.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/amms_qt/jni/src/effectcontrol.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -25,7 +25,6 @@ #include "jstringutils.h" #include "s60commonutils.h" using namespace java::util; -#include /** * wrapper for CAMMSEffectControlGroup::PresetNamesL() diff -r 773449708c84 -r 4ad59aaee882 javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp --- a/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -25,7 +25,6 @@ #include #include #include -#include // CONSTANTS _LIT(KErrAudioOutputControlError, "AMMS AudioOutputControl error: %d"); const TInt KEventMessageSize = 64; diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/inc/javacoreui.h --- a/javauis/coreui/inc/javacoreui.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/coreui/inc/javacoreui.h Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -20,9 +20,11 @@ #include +#include "libraryloaderexception.h" #include "dynamiclibloader.h" #include "javauid.h" #include "javacoreuiparams.h" +#include "logger.h" namespace java // codescanner::namespace { @@ -72,93 +74,88 @@ * @param[out] loader User must store this argument as long as it needs * to run any code in the shared library. No other APIs of the loader is needed to use. - * @return A reference to instance implementing CoreUi in + * @return true if the dll could be loaded and the start method was + * succesfully called. * success case. * @throws java::util::ExceptionBase or std::exception in error cases. */ - static CoreUi& - getUiInstance(std::auto_ptr& loader); + static bool start(std::auto_ptr& loader, + const java::util::Uid& appUid, + CoreUiParams* uiParams = 0); /** * This inline method will close the core UI unless already closed and * clean resources. * * @param[in] loader A loeader that was used to load the dll. + * @return true if the dll could be loaded and the release method was + * succesfully called. * @throws java::util::ExceptionBase or std::exception in error cases. */ - static void releaseUi(const std::auto_ptr& loader); + static bool releaseUi(std::auto_ptr& loader); }; -#if defined RD_JAVA_UI_QT -// This is an empty CoreUi impl for Java 3.0 -class CoreUiStub : public CoreUi -{ -public: - CoreUiStub() {} - virtual ~CoreUiStub() {} - virtual void init(const java::util::Uid& /*midletUid*/, - CoreUiParams* /*uiParams*/) {} - - virtual void start(const java::util::Uid& appUid, - CoreUiParams* uiParams = 0) {} -}; -#endif // RD_JAVA_UI_QT - -} //end namespace ui -} //end namespace java +} // end namespace ui +} // end namespace java -//START OF INLINE METHODS +const char* const COREUI_LIB_NAME = "javacoreui"; +// START OF INLINE METHODS inline java::ui::CoreUi::~CoreUi() {} -inline java::ui::CoreUi& java::ui::CoreUi::getUiInstance -(std::auto_ptr& loader) +inline bool java::ui::CoreUi::start( + std::auto_ptr& loader, + const java::util::Uid& appUid, + CoreUiParams* uiParams) { -#if defined RD_JAVA_UI_QT - - // The stub impl leaks memory, but is ok, since this - // is not in use in MCL, but is for future development - // enabler. - CoreUiStub* stub = new CoreUiStub(); - return *stub; - -#else // RD_JAVA_UI_QT - if (loader.get() == 0) { - //Create an instance of DynamicLibLoader. - loader.reset(new java::util::DynamicLibLoader("javacoreui")); + // Create an instance of DynamicLibLoader. + loader.reset(new java::util::DynamicLibLoader(COREUI_LIB_NAME)); } - //Load the javaui and locates method getUiInstance. If getFunction - //succeeds were are certain that createUiFunc points to valid method. - GetUiInstance getUiInstance = - reinterpret_cast(loader->getFunction("getUiInstance", - true)); - - //Call the method which will create the UI. - return getUiInstance(); - -#endif // RD_JAVA_UI_QT + try + { + // Load the javaui and locates method getUiInstance. If getFunction + // succeeds were are certain that createUiFunc points to valid method. + GetUiInstance getUiInstance = + reinterpret_cast(loader->getFunction("getUiInstance", + true)); + // Call the method which will create the UI. + getUiInstance().start(appUid, uiParams); + return true; + } + catch (java::util::LibraryLoaderException& ex) + { + loader.reset(); + LOG1(EJavaUI, EInfo, "No coreUi available (start): %s", ex.toString().c_str()); + } + return false; } -inline void java::ui::CoreUi::releaseUi( - const std::auto_ptr& loader) +inline bool java::ui::CoreUi::releaseUi( + std::auto_ptr& loader) { -#ifndef RD_JAVA_UI_QT - //Load the javaui and locates method getUiInstance. If getFunction - //succeeds were are certain that createUiFunc points to valid method. - ReleaseUi releaseUi = - reinterpret_cast(loader->getFunction("releaseUi", true)); + if (loader.get() == 0) + { + // Create an instance of DynamicLibLoader. + loader.reset(new java::util::DynamicLibLoader(COREUI_LIB_NAME)); + } + try + { + ReleaseUi releaseUi = + reinterpret_cast(loader->getFunction("releaseUi", true)); - //Call the method which will release UI resources. - releaseUi(); - -#else // RD_JAVA_UI_QT - - return; - -#endif // RD_JAVA_UI_QT + // Call the method which will release UI resources. + releaseUi(); + return true; + } + catch (java::util::LibraryLoaderException& ex) + { + loader.reset(); + LOG1(EJavaUI, EInfo, "No coreUi available (release): %s", ex.toString().c_str()); + } + return false; } #endif // JAVACOREUI_H diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/build/exports.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/build/exports.inf Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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: +* +*/ + +PRJ_EXPORTS + +#include "../../../../inc/build_defines.hrh" +#ifdef RD_JAVA_SYMBIAN_TARGET +../tst.bat /epoc32/winscw/c/tst.bat +../tst2.bat /epoc32/winscw/c/tst2.bat +#endif // RD_JAVA_SYMBIAN_TARGET + diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/build/testcoreui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/build/testcoreui.pro Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,39 @@ +# +# 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: +# + +TEMPLATE=app +TARGET=testcoreui +CONFIG += omj no_icon stl +CONFIG -= qt + +LIBS += -lCppUTest + +INCLUDEPATH += ../../../../tools/cpputest/include/CppUTest +INCLUDEPATH += ../testcoreui/src + +symbian { + INCLUDEPATH += ../../../../tools/cpputest/include/Platforms/Symbian + TARGET.CAPABILITY = all -tcb +} + +!symbian { +INCLUDEPATH += ../../../../tools/cpputest/include/Platforms/Gcc +LIBPATH += ../../../../tools/cpputest/lib +} + +SOURCES += ../src/*.cpp + +include(../../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/readme.txt Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,11 @@ +This test set tests the coreui framework - both native and Java. + +Precoditions: + -This test will override the javacoreui.dll. This requirtes that before + compiling the test set run clean first. + -Compile the test sets from the root of the tsrc. + +To run test start eshell and run tst.bat. Then remove the javacoreui.dll from +epoc32\release\winscw\udeb\ directory and run tst2.bat. + +After tests recompile coreui_akn or coreui_qt. \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/src/alltests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/src/alltests.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AllTests +* +*/ + +#include "Platform.h" +#include "CommandLineTestRunner.h" + +int main(int ac, char** av) +{ + return CommandLineTestRunner::RunAllTests(ac, av); +} diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/src/testcoreui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/src/testcoreui.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,285 @@ +/* +* 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: Tests for JvmStarter class +* +*/ + +#include +#include +#include + +#include "coreuitestimpl.h" +#include "dynamiclibloader.h" + +#include "TestHarness.h" +#include "testutils.h" +#include "javaoslayer.h" +#include "logger.h" + +using namespace java::util; +using namespace java::ui; + + +class CoreUiTestHandlerImpl : public CoreUiTestHandler +{ +public: + CoreUiTestHandlerImpl() : mUiParams(0) + { + reset(); + } + ~CoreUiTestHandlerImpl() + { + delete mUiParams; + mUiParams = 0; + } + + virtual void startCalled(const Uid& midletUid, CoreUiParams* uiParams) + { + mMidletUid = midletUid; + if (mUiParams) + { + delete mUiParams; + mUiParams = 0; + } + if (uiParams) + { + mUiParams = new CoreUiParams(); + *mUiParams = *uiParams; + } + mStartCalledCount++; + } + virtual void releaseCalled() + { + mReleaseCalledCount++; + } + virtual void error(const std::string& info) + { + CHECKWITHNOTE(false, info) + } + + void reset() + { + mStartCalledCount = 0; + mReleaseCalledCount = 0; + } + int mStartCalledCount; + int mReleaseCalledCount; + CoreUiParams* mUiParams; + Uid mMidletUid; +}; + +#define UIPARAMSCHECK(check1, check2, fname, info) \ + CHECKWITHNOTE(check1 == check2, info << ": " << fname << " failed: 1=" << check1 << " 2=" << check2); + + +void compare(const CoreUiParams* uiParams1, const CoreUiParams* uiParams2, const std::string& info) +{ + bool pass = false; + if ((uiParams1 == 0 && uiParams2 != 0) || (uiParams1 != 0 && uiParams2 == 0)) + { + CHECKWITHNOTE(false, info << ": pointer mismatch 1=" << std::hex << uiParams1 << ", 2=" << std::hex << uiParams2); + return; + } + + if (uiParams1 == 0 && uiParams2 == 0) + { + return; + } + else if (uiParams1 != uiParams2) + { + pass = true; + } + CHECKWITHNOTE(pass, info << ": pointer mismatch 1=" << std::hex << uiParams1 << ", 2=" << std::hex << uiParams2); + UIPARAMSCHECK(uiParams1->getOrientation(), uiParams2->getOrientation(), "getOrientation", info); + UIPARAMSCHECK(uiParams1->getScreenMode(), uiParams2->getScreenMode(), "getScreenMode", info); + UIPARAMSCHECK(uiParams1->getImagePath(), uiParams2->getImagePath(), "getImagePath", info); + UIPARAMSCHECK(uiParams1->isBackgroundStart(), uiParams2->isBackgroundStart(), "isBackgroundStart", info); + +} + +void checkCallCounts(const CoreUiTestHandlerImpl& testHandler, int start, int release, const std::string& info) +{ + CHECKWITHNOTE(testHandler.mStartCalledCount == start, info <<". Start call count incorrect: " << testHandler.mStartCalledCount + <<", expecting: "< basicCoreUiLoader; + TEST_SETUP() + { + basicCoreUiLoader.reset(new java::util::DynamicLibLoader(COREUI_LIB_NAME)); + SetTestHandler setTestHandler = + reinterpret_cast(basicCoreUiLoader->getFunction("setTestHandler", + true)); + setTestHandler(&testHandler); + } + + TEST_TEARDOWN() + { + } +}; + + +// Run these tests with tst2.bat. These tests require that the javacoreui.dll +// doesn't exist at all. +TEST_GROUP(NoDllCoreUiTest) +{ + Uid uid; + TEST_SETUP() + { + } + + TEST_TEARDOWN() + { + } +}; + +TEST(TestCoreUi, testBasic) +{ + std::auto_ptr coreUiLoader; + // __BREAKPOINT(); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testBasic, start"); + checkCallCounts(testHandler, 1, 0, "Before release"); + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testBasic release"); + checkCallCounts(testHandler, 1, 1, "After release"); + compare(testHandler.mUiParams, &uiParams, "Final check basic"); +} + +TEST(TestCoreUi, testNullUiParams) +{ + std::auto_ptr coreUiLoader; + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid), "testNullUiParams, start"); + checkCallCounts(testHandler, 1, 0, "Before release"); + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testNullUiParams release"); + checkCallCounts(testHandler, 1, 1, "After release"); + compare(testHandler.mUiParams, 0, "Final check Null ui"); +} + +TEST(TestCoreUi, testModifiedOrientationArgs) +{ + std::auto_ptr coreUiLoader; + + uiParams.setOrientation(UNDEFINED); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedOrientationArgs, start1"); + checkCallCounts(testHandler, 1, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "OrientationArgs UNDEFINED"); + + uiParams.setOrientation(LANDSCAPE); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedOrientationArgs, start2"); + checkCallCounts(testHandler, 2, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "OrientationArgs LANDSCAPE"); + + uiParams.setOrientation(PORTRAIT); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedOrientationArgs, start3"); + checkCallCounts(testHandler, 3, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "OrientationArgs PORTRAIT"); + + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testModifiedOrientationArgs release"); + checkCallCounts(testHandler, 3, 1, "After release"); +} + +TEST(TestCoreUi, testModifiedScreenModeArgs) +{ + std::auto_ptr coreUiLoader; + + uiParams.setScreenMode(NO_START_SCREEN); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedScreenModeArgs, start1"); + checkCallCounts(testHandler, 1, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ScreenModeArgs NO_START_SCREEN"); + + uiParams.setScreenMode(DEFAULT_START_SCREEN); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedScreenModeArgs, start2"); + checkCallCounts(testHandler, 2, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ScreenModeArgs DEFAULT_START_SCREEN"); + + uiParams.setScreenMode(MIDLET_DEFINED_SCREEN); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedScreenModeArgs, start3"); + checkCallCounts(testHandler, 3, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ScreenModeArgs MIDLET_DEFINED_SCREEN"); + + uiParams.setScreenMode(USER_DEFINED_SCREEN); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedScreenModeArgs, start4"); + checkCallCounts(testHandler, 4, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ScreenModeArgs USER_DEFINED_SCREEN"); + + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testModifiedScreenModeArgs release"); + checkCallCounts(testHandler, 4, 1, "After release"); +} + +TEST(TestCoreUi, testModifiedImagePathArgs) +{ + std::auto_ptr coreUiLoader; + + uiParams.setImagePath(L"c:\\logs\\java\\"); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedImagePathArgs start"); + checkCallCounts(testHandler, 1, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ImagePathArgs"); + + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testModifiedImagePathArgs release"); + checkCallCounts(testHandler, 1, 1, "After release"); +} + +TEST(TestCoreUi, testModifiedForeGroundArgs) +{ + std::auto_ptr coreUiLoader; + + uiParams.setBackgroundStart(true); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedForeGroundArgs start1"); + checkCallCounts(testHandler, 1, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ForeGround"); + + uiParams.setBackgroundStart(false); + CHECKWITHNOTE(CoreUi::start(coreUiLoader, uid, &uiParams), "testModifiedForeGroundArgs start2"); + checkCallCounts(testHandler, 2, 0, "Before release"); + compare(testHandler.mUiParams, &uiParams, "ForeGround"); + + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testModifiedForeGroundArgs release"); + checkCallCounts(testHandler, 2, 1, "After release"); +} + +TEST(TestCoreUi, testNoStartCall) +{ + std::auto_ptr coreUiLoader; + CHECKWITHNOTE(CoreUi::releaseUi(coreUiLoader), "testNoStartCall release"); + checkCallCounts(testHandler, 0, 1, "After release"); +} + +TEST(NoDllCoreUiTest, testBasic) +{ + std::auto_ptr coreUiLoader; + CHECKWITHNOTE(!CoreUi::start(coreUiLoader, uid), "testBasic NO_DLL start"); + CHECKWITHNOTE(!CoreUi::releaseUi(coreUiLoader), "testBasic NO_DLL release"); +} + +TEST(NoDllCoreUiTest, testOnlyStart) +{ + std::auto_ptr coreUiLoader; + CHECKWITHNOTE(!CoreUi::start(coreUiLoader, uid), "testOnlyStart NO_DLL start"); +} + +TEST(NoDllCoreUiTest, testOnlyRelease) +{ + std::auto_ptr coreUiLoader; + CHECKWITHNOTE(!CoreUi::releaseUi(coreUiLoader), "testOnlyRelease NO_DLL release"); +} diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/src/testutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/src/testutils.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,33 @@ +/* +* 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: Test util +* +*/ + +#include + +#define CHECKWITHNOTE(check, note) \ +{\ + std::stringstream stream;\ + stream << note;\ + if (!(check))\ + {\ + ELOG1(EJavaRuntime, "TEST FAILURE: %s", stream.str().c_str());\ + FAIL(stream.str().c_str());\ + }\ + else\ + {\ + CHECK(true) /* Just to increase the check count*/ \ + }\ +} diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/subsystem.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/subsystem.mk Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,29 @@ +# +# 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 $(JAVA_SRC_ROOT)/build/Makefile.defs + +# Include the test frameworks. +SUBSYSTEMS = \ + $(JAVA_SRC_ROOT)/tools + +COMPONENTS = \ + testcoreui/build \ + build + +# Make dependency to those. +testcoreui/build build: $(JAVA_SRC_ROOT)/tools +include ${JAVA_SRC_ROOT}/build/Makefile.subsystem diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/build/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/build/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + Running CoreUiTests 1 + + + + + + Running CoreUiTests 01 + + + + + + Running CoreUiTests 001 + + + + + + + + + + diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/build/bwins/javacoreuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/build/bwins/javacoreuiu.def Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,9 @@ +EXPORTS + ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) + ?findDllMethod@@YAP6APAXXZPBD@Z @ 2 NONAME ; void * (*)(void) findDllMethod(char const *) + ??_ERuntimeException@runtime@java@@UAE@I@Z @ 3 NONAME ; java::runtime::RuntimeException::~RuntimeException(unsigned int) + ??_ELibraryLoaderException@util@java@@UAE@I@Z @ 4 NONAME ; java::util::LibraryLoaderException::~LibraryLoaderException(unsigned int) + ?setTestHandler@CoreUiTestImpl@ui@java@@SAXPAVCoreUiTestHandler@23@@Z @ 5 NONAME ; void java::ui::CoreUiTestImpl::setTestHandler(class java::ui::CoreUiTestHandler *) + ??0RuntimeException@runtime@java@@QAE@ABV012@@Z @ 6 NONAME ; java::runtime::RuntimeException::RuntimeException(class java::runtime::RuntimeException const &) + ??0LibraryLoaderException@util@java@@QAE@ABV012@@Z @ 7 NONAME ; java::util::LibraryLoaderException::LibraryLoaderException(class java::util::LibraryLoaderException const &) + diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/build/eabi/javacoreuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/build/eabi/javacoreuiu.def Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z10jni_lookupPKc @ 1 NONAME + _Z13findDllMethodPKc @ 2 NONAME + _ZN4java2ui14CoreUiTestImpl14setTestHandlerEPNS0_17CoreUiTestHandlerE @ 3 NONAME + diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/build/javacoreui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/build/javacoreui.pro Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: The build file of the Core UI test +# + +TEMPLATE=lib +TARGET=javacoreui +CONFIG += omj staticdata java stl +CONFIG -= qt + +include(../../../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/javasrc/com/nokia/mj/impl/coreuitest/CoreUiImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/javasrc/com/nokia/mj/impl/coreuitest/CoreUiImpl.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,116 @@ +/* +* 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: Java side Core UI tester. +* +*/ +package com.nokia.mj.impl.coreuitest; + +import com.nokia.mj.impl.utils.Uid; +import com.nokia.mj.impl.coreui.CoreUi; + + +/** + * A gate to CoreUi test implementation. + */ +public class CoreUiImpl extends CoreUi +{ + private static int[] mCounters = new int[6]; + + static void resetCounters() + { + for (int i = 0; i < mCounters.length; ++i) + { + mCounters[i] = 0; + } + } + + static void checkCounters(int[] expected) + { + if (expected.length != mCounters.length) + { + throw new RuntimeException("expected.length != mCounters.length"); + } + for (int i = 0; i < mCounters.length; ++i) + { + if (mCounters[i] != expected[i]) + { + throw new RuntimeException("Index: " + i + " didn't match. Expected: " + + expected[i] + ", was: " + mCounters[i]); + } + } + } + + protected boolean connectToUiImpl() + { + mCounters[0]++; + return true; + } + + private static Uid mUid = null; + private static boolean mBackGroundStart = false; + + static void createUiImplCheck(Uid uid, boolean backGroundStart) + { + if (uid != mUid) + { + throw new RuntimeException("createUiImplCheck uid mismatch"); + } + if (backGroundStart != mBackGroundStart) + { + throw new RuntimeException("createUiImplCheck backGroundStart mismatch"); + } + mUid = null; + mBackGroundStart = false; + } + + protected void createUiImpl(Uid uid, boolean backGroundStart) + { + mCounters[1]++; + mUid = uid; + mBackGroundStart = backGroundStart; + } + + protected void shutdownRequestImpl() + { + mCounters[2]++; + } + + protected void foregroundRequestImpl() + { + mCounters[3]++; + } + + protected boolean isUiInForegroundImpl() + { + mCounters[4]++; + return true; + } + + private static boolean mHide = false; + + static void hideApplicationImplCheck(boolean hide) + { + if (mHide != hide) + { + throw new RuntimeException("hideApplicationImplCheck hide mismatch"); + } + mHide = false; + } + + protected void hideApplicationImpl(boolean hide) + { + mCounters[5]++; + mHide = hide; + } +} diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/javasrc/com/nokia/mj/impl/coreuitest/CoreUiTests.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/javasrc/com/nokia/mj/impl/coreuitest/CoreUiTests.java Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,213 @@ +/* +* 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.coreuitest; + + +import com.nokia.mj.impl.coreui.CoreUi; +import com.nokia.mj.impl.coreuitest.CoreUiImpl; +import com.nokia.mj.impl.rt.support.JvmInternal; +import com.nokia.mj.impl.utils.Uid; + + +import com.nokia.mj.impl.rt.test.UnitTestSuiteCreator; +import j2meunit.framework.Test; +import j2meunit.framework.TestCase; +import j2meunit.framework.TestMethod; +import j2meunit.framework.TestSuite; + +/** + * SystemProperty unit tests. + */ +public class CoreUiTests extends TestCase implements UnitTestSuiteCreator +{ + // Begin j2meunit test framework setup + public TestSuite createTestSuite(String[] args) + { + TestSuite suite = new TestSuite(this.getClass().getName()); + String testSelector = "0000000000000000"; + if (args.length > 1 && args[1] != null) + { + testSelector = args[1] + "0000000000000000"; + } + + if (testSelector.charAt(0) != '0') + { + suite.addTest(new CoreUiTests("AbNormalTests", new TestMethod() + { + public void run(TestCase tc) + { + ((CoreUiTests)tc).abNormalTests(); + } + })); + } + + if (testSelector.charAt(1) != '0') + { + suite.addTest(new CoreUiTests("AbNormalTests2", new TestMethod() + { + public void run(TestCase tc) + { + ((CoreUiTests)tc).abNormalTests2(); + } + })); + } + + if (testSelector.charAt(2) != '0') + { + suite.addTest(new CoreUiTests("NormalTests", new TestMethod() + { + public void run(TestCase tc) + { + ((CoreUiTests)tc).normalTests(); + } + })); + } + + return suite; + + } + + public CoreUiTests() + { + } + + public CoreUiTests(String aTestName, TestMethod aTestMethod) + { + super(aTestName, aTestMethod); + } + + // End j2meunit test framework setup + + protected void setUp() + { + } + + protected void tearDown() + { + } + + // Test cases + + private void abNormalTests() + { + System.out.println("abNormalTests"); + // Don't set the com.nokia.coreui property yet. + try + { + boolean res = CoreUi.connectToUi(); + assertTrue("Fail1, got: "+ res, res); + CoreUi.createUi(null, false); + + CoreUi.createUi(null, false); + CoreUi.shutdownRequest(); + CoreUi.foregroundRequest(); + + res = CoreUi.isUiInForeground(); + assertTrue("Fail2, got: "+ res, res); + CoreUi.hideApplication(false); + } + catch (Throwable t) + { + t.printStackTrace(); + assertTrue(t.toString(), false); + } + } + + + private void abNormalTests2() + { + System.out.println("abNormalTests2"); + // Set the com.nokia.coreui property to point nonexisitng class. + try + { + JvmInternal.setSystemProperty("com.nokia.coreui", "nonvalid"); + boolean res = CoreUi.connectToUi(); + assertTrue("No exception.", false); + } + catch (Error re) + { + int ind = re.toString().indexOf("Not able to instantiate class com.nokia.mj.impl.nonvalid.CoreUiImpl"); + boolean ok = ind >= 0; + if (!ok) + { + // Accept also java.lang.ExceptionInInitializerError. + ok = re.toString().equals("java.lang.ExceptionInInitializerError"); + } + assertTrue(re.toString(), ok); + } + catch (Throwable t2) + { + System.out.println("JOU2 "+ t2); + t2.printStackTrace(); + assertTrue(t2.toString(), false); + } + } + + private void normalTests() + { + // Set the com.nokia.coreui property to point valid class. + System.out.println("normalTests"); + try + { + JvmInternal.setSystemProperty("com.nokia.coreui", "coreuitest"); + boolean res = CoreUi.connectToUi(); + assertTrue("Fail1, got: "+ res, res); + + // Set a null value to UID and check that an exception is thrown. + try + { + CoreUi.createUi(null, false); + assertTrue("No exception.", false); + } + catch (NullPointerException ne) + { + } + + Uid uid = Uid.createUid("[12345678]"); + CoreUi.createUi(uid, true); + CoreUiImpl.createUiImplCheck(uid, true); + CoreUi.createUi(uid, false); + CoreUiImpl.createUiImplCheck(uid, false); + + CoreUi.shutdownRequest(); + + CoreUi.foregroundRequest(); + + res = CoreUi.isUiInForeground(); + assertTrue("Fail2, got: "+ res, res); + + CoreUi.hideApplication(true); + CoreUiImpl.hideApplicationImplCheck(true); + CoreUi.hideApplication(false); + CoreUiImpl.hideApplicationImplCheck(false); + + CoreUiImpl.checkCounters(new int[] {1,2,1,1,1,2}); + } + catch (Throwable t) + { + t.printStackTrace(); + assertTrue(t.toString(), false); + } + + } + +} + + + diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/src/coreuitestimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/src/coreuitestimpl.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,121 @@ +/* +* 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: A CoreUi TEST implementation. +* +*/ + +#include + +#include "logger.h" +#include "coreuitestimpl.h" +#include "runtimeexception.h" +#include "javacommonutils.h" + +using namespace java::ui; +using namespace java::util; + +// ======== STATIC VARIABLES ======== + +/** +* Singleton +*/ +static CoreUiTestImpl* sCoreUiTestImpl = 0; + +CoreUiTestImpl* getCoreUi() +{ + if (sCoreUiTestImpl == 0) + { + sCoreUiTestImpl = new CoreUiTestImpl(); // codescanner::nonleavenew + } + return sCoreUiTestImpl; +} + +OS_EXPORT void CoreUiTestImpl::setTestHandler(CoreUiTestHandler* testHandler) +{ + getCoreUi()->mTestHandler = testHandler; +} + +#ifndef __SYMBIAN32__ +extern "C" +#endif // __SYMBIAN32__ +void setTestHandler(CoreUiTestHandler* testHandler) +{ + CoreUiTestImpl::setTestHandler(testHandler); +} + +#ifndef __SYMBIAN32__ +extern "C" +#endif // __SYMBIAN32__ +CoreUi& getUiInstance() +{ + JELOG2(EJavaUI); + return *getCoreUi(); +} + +#ifndef __SYMBIAN32__ +extern "C" +#endif // __SYMBIAN32__ +void releaseUi() +{ + JELOG2(EJavaUI); + if (getCoreUi()->mTestHandler) + { + getCoreUi()->mTestHandler->releaseCalled(); + } + delete sCoreUiTestImpl; + sCoreUiTestImpl = 0; +} + +#ifdef __SYMBIAN32__ +EXPORT_C FuncPtr findDllMethod(const char* funcName) +{ + JELOG2(EJavaUI); + FuncPtr ptr = 0; + if (strcmp(funcName, "getUiInstance") == 0) + { + ptr = (FuncPtr)getUiInstance; + } + else if (strcmp(funcName, "releaseUi") == 0) + { + ptr = (FuncPtr)releaseUi; + } + else if (strcmp(funcName, "setTestHandler") == 0) + { + ptr = (FuncPtr)CoreUiTestImpl::setTestHandler; + } + return ptr; +} +#endif // __SYMBIAN32__ + +CoreUiTestImpl::CoreUiTestImpl() : mTestHandler(0) +{ + JELOG2(EJavaUI); +} + + +CoreUiTestImpl::~CoreUiTestImpl() +{ + JELOG2(EJavaUI); +} + + +void CoreUiTestImpl::start(const java::util::Uid& midletUid, + CoreUiParams* uiParams) +{ + JELOG2(EJavaUI); + if (mTestHandler) + { + mTestHandler->startCalled(midletUid, uiParams); + } +} diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/testcoreui/src/coreuitestimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/testcoreui/src/coreuitestimpl.h Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,85 @@ +/* +* 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 COREUITESTIMPL_H +#define COREUITESTIMPL_H + + +#include "javacoreui.h" + +#ifdef __SYMBIAN32__ + +#include "javasymbianoslayer.h" +/** + * For accessing the static methods using dynamic dll loading. + * @param funcName The name of the method to be searched. + * @return a pointer to found function, 0 if not found. + */ +IMPORT_C FuncPtr findDllMethod(const char* funcName); + +#endif //__SYMBIAN32__ + +namespace java // codescanner::namespace +{ +namespace ui // codescanner::namespace +{ + +OS_NONSHARABLE_CLASS(CoreUiTestHandler) +{ +public: + virtual void startCalled(const java::util::Uid& midletUid, + CoreUiParams* uiParams) = 0; + virtual void releaseCalled() = 0; + virtual void error(const std::string& info) = 0; +}; + +OS_NONSHARABLE_CLASS(CoreUiTestImpl) : public CoreUi +{ +public: + /** + * CoreUiTestImpl default constructor. + */ + CoreUiTestImpl(); + + /** + * CoreUiTestImpl destructor. + */ + virtual ~CoreUiTestImpl(); + + OS_IMPORT static void setTestHandler(CoreUiTestHandler* testHadler); + +public: // From CoreUi + /** + * This method will ask the UI to start the splash screen. + * @param appUid The Uid of the application. + * @param uiParams Ui configuration parameters. If it + * is null, the default arguments will be used. + * @throws java::util::ExceptionBase or std::exception in error cases. + */ + virtual void start(const java::util::Uid& midletUid, + CoreUiParams* uiParams); + +public: + CoreUiTestHandler* mTestHandler; +}; + + +} // end namespace ui +} // end namespace java + + +#endif // COREUITESTIMPL_H diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/tst.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/tst.bat Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,20 @@ +@rem +@rem Copyright (c) 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" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem +@rem Script for running CoreUi unit tests from S60 eshell +testcoreui -nomemleaks -g TestCoreUi +javaunittester -conf=cldc -mainclass=com.nokia.mj.impl.coreuitest.CoreUiTests 1 +javaunittester -conf=cldc -mainclass=com.nokia.mj.impl.coreuitest.CoreUiTests 01 +javaunittester -conf=cldc -mainclass=com.nokia.mj.impl.coreuitest.CoreUiTests 001 diff -r 773449708c84 -r 4ad59aaee882 javauis/coreui/tsrc/tst2.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/tst2.bat Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,1 @@ +testcoreui -nomemleaks -g NoDllCoreUiTest diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/build/eswtqt/bwins/eswtqtu.def --- a/javauis/eswt_qt/build/eswtqt/bwins/eswtqtu.def Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/build/eswtqt/bwins/eswtqtu.def Fri Sep 17 08:28:21 2010 +0300 @@ -3,4 +3,6 @@ ?Throw@JniUtils@eSWT@Java@@QAEXPAUJNIEnv_@@ABH@Z @ 2 NONAME ; void Java::eSWT::JniUtils::Throw(struct JNIEnv_ *, int const &) ?JavaStringToQString@JniUtils@eSWT@Java@@QAE?AVQString@@PAUJNIEnv_@@PAV_jstring@@@Z @ 3 NONAME ; class QString Java::eSWT::JniUtils::JavaStringToQString(struct JNIEnv_ *, class _jstring *) ?QStringToJavaString@JniUtils@eSWT@Java@@QAEPAV_jstring@@PAUJNIEnv_@@ABVQString@@@Z @ 4 NONAME ; class _jstring * Java::eSWT::JniUtils::QStringToJavaString(struct JNIEnv_ *, class QString const &) + ??1SwtScopeLog@eSWT@Java@@UAE@XZ @ 5 NONAME ; Java::eSWT::SwtScopeLog::~SwtScopeLog(void) + ??0SwtScopeLog@eSWT@Java@@QAE@PBDABW4SwtLogType@12@1@Z @ 6 NONAME ; Java::eSWT::SwtScopeLog::SwtScopeLog(char const *, enum Java::eSWT::SwtLogType const &, enum Java::eSWT::SwtLogType const &) diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/build/eswtqt/eabi/eswtqtu.def --- a/javauis/eswt_qt/build/eswtqt/eabi/eswtqtu.def Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/build/eswtqt/eabi/eswtqtu.def Fri Sep 17 08:28:21 2010 +0300 @@ -3,4 +3,6 @@ _ZN4Java4eSWT8JniUtils19JavaStringToQStringEP7JNIEnv_P8_jstring @ 2 NONAME _ZN4Java4eSWT8JniUtils19QStringToJavaStringEP7JNIEnv_RK7QString @ 3 NONAME _ZN4Java4eSWT8JniUtils5ThrowEP7JNIEnv_RKi @ 4 NONAME + _ZN4Java4eSWT11SwtScopeLogC1EPKcRKNS0_10SwtLogTypeES6_ @ 5 NONAME + _ZN4Java4eSWT11SwtScopeLogD1Ev @ 6 NONAME diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/TextExtension.java --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/TextExtension.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/TextExtension.java Fri Sep 17 08:28:21 2010 +0300 @@ -658,7 +658,6 @@ void qt_signal_requestCompleted( int value ) { - System.out.println("qt_signal_requestCompleted "+value); if (value < 1) { serviceDone = true; return; diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri Sep 17 08:28:21 2010 +0300 @@ -331,14 +331,14 @@ public Image(Device device, String filename) { this(device, filename, true); } - + private Image(Device device, String filename, boolean securityCheck) { this(device); if (filename == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } init(); - + if (securityCheck == true) { // Drop the "file:///" prefix String trimmedFileName = filename.trim(); @@ -391,35 +391,35 @@ SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); } } - + static Image createImageWithoutSecurityCheck(Device device, String filename) { return new Image(device, filename, false); } - + /* * Returns the bounds of an image without creating an Image instance. */ static Point getImageSize(Device device, String filename) { - + if (filename == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } - + InputStream is = device.getClass().getResourceAsStream(filename); - + if (is == null) { SWT.error(SWT.ERROR_IO); } - + return getImageSize(is); } - + /* * Returns the bounds of an image without creating an Image instance. */ static Point getImageSize(InputStream stream) { Point point = null; - + try { point = org.eclipse.swt.internal.qt.graphics.ImageLoader.getImageSize(stream); } catch (IOException e) { @@ -429,7 +429,7 @@ } catch (IllegalArgumentException e) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } - + return point; } @@ -564,9 +564,6 @@ int width = image.width; int height = image.height; PaletteData palette = image.palette; - if (!(((image.depth == 1 || image.depth == 2 || image.depth == 4 || image.depth == 8) && !palette.isDirect) || - ((image.depth == 8) || (image.depth == 16 || image.depth == 24 || image.depth == 32) && palette.isDirect))) - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); byte[] buffer = image.data; if (image.depth != 32 || image.bytesPerLine != width*4) { buffer = new byte[width * 4 * height]; @@ -697,9 +694,13 @@ if(isDisposed()) { SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); } - if(icon == SWT.NULL) { - icon = OS.QIcon_new(cgImage.getNativePixmapHandle()); + // Delete any previous icons if there is one + // QIcon instances are deleted on Image + if( icon != SWT.NULL ){ + OS.QIcon_delete(icon); } + + icon = OS.QIcon_new(cgImage.getNativePixmapHandle()); return icon; } @@ -828,7 +829,7 @@ } return Device.nullIconHandle; } - + /** * Creates new Image instance. *

    diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Table.java --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Table.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Table.java Fri Sep 17 08:28:21 2010 +0300 @@ -140,8 +140,8 @@ boolean wrap; /* - * Flag to check between the press and release event, - * mouse is not moved over the clicked item. + * Flag to indicate that selection is happening with mouse in RADIO + * style Table */ boolean mouseSelection; @@ -1396,74 +1396,61 @@ return retval; } - /* - * Three Mouse events(press, move and release) are needed to select the radio button, - * when the user clicks(press event) on tableItem and release event is also - * happened without moving away(move event) from that time - */ + + // Returns row index based on mouse event handle and coordinates + int getRow(int widgetHandle, int x, int y) { + int row = -1; + if (widgetHandle == handle) { + // User has pressed on a TableItem + row = OS.QTableView_rowAt(topHandle, y); + } else { + // User has pressed on a radio button (the coordinates are + // relative to the button, not the Table) + Point mapped = OS.QWidget_mapTo(widgetHandle, handle, x, y); + row = OS.QTableView_rowAt(topHandle, mapped.y); + } + return row; + } + boolean qt_event_mouseButtonPress_pp(int widgetHandle, int button, int x, int y, int state, int buttons) { - - if(widgetHandle == handle && (style & SWT.SINGLE) != 0 && (style & SWT.RADIO) != 0){ + + if (button == OS.QT_LEFTBUTTON && + (style & SWT.SINGLE) != 0 && (style & SWT.RADIO) != 0) { - int itemHandle = OS.QTableWidget_itemAt(topHandle, x, y); + int row = getRow(widgetHandle, x, y); - if (itemHandle != 0) { - oldIndex = OS.QTableWidget_row(topHandle, itemHandle); + if (row != -1 && row != OS.QTableWidget_currentRow(topHandle)) { + apiSelection = true; + mouseSelection = true; + OS.QTableWidget_setCurrentCell(topHandle, row, 1); + apiSelection = false; } - mouseSelection = true; } + return super.qt_event_mouseButtonPress_pp(widgetHandle, button, x, y, state, buttons); } + + boolean qt_event_mouseButtonRelease_pp ( int widgetHandle, int button, int x, int y, int state, int buttons ) { + // Update the radio button manually in case of SWT.RADIO Table. + // In such a Table we have manually added QRadioButtons to QTableWidget + // cells, so that table selection would not happen automatically + if (button == OS.QT_LEFTBUTTON && + (style & SWT.SINGLE) != 0 && (style & SWT.RADIO) != 0) { + int row = getRow(widgetHandle, x, y); - boolean qt_event_mouseButtonRelease_pp(int widgetHandle, int button, - int x, int y, int state, int buttons) { - - if(widgetHandle == handle && mouseSelection && (style & SWT.SINGLE) != 0 && (style & SWT.RADIO) != 0){ - // there is a chance that if we click on radio button, oldIndex is not going to update - // in the mouseButtonPress. - if(oldIndex != -1){ - OS.QAbstractButton_setChecked(items[oldIndex].radioButtonHandle, true); - sendSelectionEvent(); - } else if(currentItem != null){ - Rectangle rect = OS.QTableWidget_visualItemRect(topHandle, currentItem.topHandle()); - if((rect.y <= y) && (y <= (rect.y+rect.height)) && (x<=rect.x+rect.width)){ - OS.QAbstractButton_setChecked(currentItem.radioButtonHandle, true); + // Update selection if the row is valid + if (row != -1) { + TableItem item = _getItem(row); + OS.QAbstractButton_setChecked(item.radioButtonHandle, true); + if (mouseSelection) { sendSelectionEvent(); - } - } - mouseSelection = false; - oldIndex = -1; - } - return super.qt_event_mouseButtonRelease_pp(widgetHandle, button, x, y, state, buttons); - } - - boolean qt_event_mouseMove(int widgetHandle, int button, int x, int y, - int state, int buttons) { - if( mouseSelection && widgetHandle == handle && (style & SWT.SINGLE) != 0 && (style & SWT.RADIO) != 0){ - int itemHandle = OS.QTableWidget_itemAt(topHandle, x, y); - int index = -1; - if (itemHandle != 0) { - index = OS.QTableWidget_row(topHandle, itemHandle); - } - Rectangle rect = OS.QTableWidget_visualItemRect(topHandle, currentItem.topHandle()); - if(index != oldIndex){ - if (!((rect.y <= y) && (y <= (rect.y+rect.height)) &&(x<=rect.x+rect.width))){ - mouseSelection = false; - oldIndex = -1; - } - } else if(index == -1){ - if (!((rect.y <= y) && (y <= (rect.y+rect.height)) && (xscreenNumber( widget ); @@ -11620,7 +11620,7 @@ SWT_TRY { SWT_LOG_JNI_CALL(); - SWT_LOG_DATA_1( "handle=%x", aHandle ); + SWT_LOG_DATA_1( "handle=%x", swtApp ); swtApp->destroyMobileDevice(); } SWT_CATCH @@ -11976,7 +11976,7 @@ SWT_TRY { SWT_LOG_JNI_CALL(); - SWT_LOG_DATA_1("peer=%x", aPeer); + SWT_LOG_DATA_2("widget=%x signalId=%d", aWidget, aSignalId); HANDLE_TO_POINTER( QObject*, widget, aWidget ); diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtfontcache.cpp --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtfontcache.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtfontcache.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. This 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 @@ -19,12 +19,12 @@ SwtFontCache::SwtFontCache() : mFonts(NULL), mSize(0), mCount(0) { - SWT_LOG_JNI_CALL(); + SWT_LOG_FUNC_CALL(); } SwtFontCache::~SwtFontCache() { - SWT_LOG_JNI_CALL(); + SWT_LOG_FUNC_CALL(); for(int i = 0; i < mCount; ++i) { @@ -37,7 +37,7 @@ QFont* SwtFontCache::cache(QFont* aFont) { - SWT_LOG_JNI_CALL(); + SWT_LOG_FUNC_CALL(); QFont* cached = findEqual( aFont ); if( cached ) @@ -55,7 +55,7 @@ bool SwtFontCache::isCached(const QFont* const aFont) { - SWT_LOG_JNI_CALL(); + SWT_LOG_FUNC_CALL(); for(int i = 0; i < mCount; ++i) { @@ -69,7 +69,7 @@ QFont* SwtFontCache::findEqual(QFont* aFont) { - SWT_LOG_JNI_CALL(); + SWT_LOG_FUNC_CALL(); if(aFont == NULL) { @@ -87,7 +87,7 @@ void SwtFontCache::add(QFont* aFont) { - SWT_LOG_JNI_CALL(); + SWT_LOG_FUNC_CALL(); if(mSize == mCount) { diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.cpp --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. This 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 @@ -16,25 +16,25 @@ using namespace Java::eSWT; -SwtScopeLog::SwtScopeLog( const char* aFunctionName, const SwtLogType& aEnterType, const SwtLogType& aExitType ) +SWTQT_EXPORT SwtScopeLog::SwtScopeLog( const char* aFunctionName, const SwtLogType& aEnterType, const SwtLogType& aExitType ) : mExitLogType( aExitType ) - { - mFunctionName = new QString( aFunctionName ); - SwtDataLog::LogData( "%s", mFunctionName->toLatin1().data(), aEnterType ); - } + { + mFunctionName = new QString( aFunctionName ); + SwtDataLog::LogData( "%s", mFunctionName->toLatin1().data(), aEnterType ); + } SwtScopeLog::SwtScopeLog() - { - // Not used - } + { + // Not used + } -SwtScopeLog::~SwtScopeLog() - { - if( mFunctionName ) - { - SwtDataLog::LogData( "%s", mFunctionName->toLatin1().data(), mExitLogType ); - delete mFunctionName; - mFunctionName = NULL; - } - } +SWTQT_EXPORT SwtScopeLog::~SwtScopeLog() + { + if( mFunctionName ) + { + SwtDataLog::LogData( "%s", mFunctionName->toLatin1().data(), mExitLogType ); + delete mFunctionName; + mFunctionName = NULL; + } + } diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. This 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 @@ -14,6 +14,7 @@ #include #include +#include "swtexport.h" // Un-comment the following line to enable JNI logging //#define SWT_ENABLE_LOGGING @@ -64,7 +65,8 @@ #ifdef SWT_ENABLE_LOGGING -#ifdef Q_CC_NOKIAX86 +// For some reason Symbian Q_FUNC_INFO doesn't use __LINE__ but "(line number unavailable)" +#ifdef Q_OS_SYMBIAN #define SWT_FUNC_INFO (QString(__FILE__ ":") += QString::number(__LINE__)).toLatin1().data() #else #define SWT_FUNC_INFO Q_FUNC_INFO @@ -126,8 +128,8 @@ class SwtScopeLog { public: - SwtScopeLog( const char* aFunctionName, const SwtLogType& aEnterType, const SwtLogType& aExitType ); - virtual ~SwtScopeLog(); + SWTQT_EXPORT SwtScopeLog( const char* aFunctionName, const SwtLogType& aEnterType, const SwtLogType& aExitType ); + SWTQT_EXPORT virtual ~SwtScopeLog(); protected: SwtScopeLog(); private: diff -r 773449708c84 -r 4ad59aaee882 javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/BaseCSSEngine.java --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/BaseCSSEngine.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/BaseCSSEngine.java Fri Sep 17 08:28:21 2010 +0300 @@ -19,6 +19,7 @@ *

    NOTE: This class is intended for internal use only.

    */ public final class BaseCSSEngine { + private static final String FILE_SCHEME = "file:///"; private Display parent; /** @@ -63,7 +64,7 @@ public void applyCSS( String style ){ checkEngine(); if( style == null ) SWT.error (SWT.ERROR_NULL_ARGUMENT); - if( style.startsWith("file:///") ) SWT.error (SWT.ERROR_INVALID_ARGUMENT); + if( style.startsWith(FILE_SCHEME) ) SWT.error (SWT.ERROR_INVALID_ARGUMENT); OS.QApplication_setStyleSheet(style); } @@ -90,7 +91,7 @@ if( style == null ) SWT.error (SWT.ERROR_NULL_ARGUMENT); if( widget == null ) SWT.error (SWT.ERROR_NULL_ARGUMENT); if( widget.isDisposed() ) SWT.error( SWT.ERROR_WIDGET_DISPOSED); - if( style.startsWith("file:///") ) SWT.error (SWT.ERROR_INVALID_ARGUMENT); + if( style.startsWith(FILE_SCHEME) ) SWT.error (SWT.ERROR_INVALID_ARGUMENT); OS.QWidget_setStyleSheet(Internal_PackageSupport.handle(widget), style); } /** @@ -111,7 +112,7 @@ public void loadCSS( String filename ){ checkEngine(); if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - OS.QApplication_setStyleSheet("file:///"+filename); + OS.QApplication_setStyleSheet(FILE_SCHEME+filename); } /** @@ -134,7 +135,7 @@ if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if( widget == null ) SWT.error (SWT.ERROR_NULL_ARGUMENT); if( widget.isDisposed() ) SWT.error( SWT.ERROR_WIDGET_DISPOSED); - OS.QWidget_setStyleSheet(Internal_PackageSupport.handle(widget), "file:///"+filename); + OS.QWidget_setStyleSheet(Internal_PackageSupport.handle(widget), FILE_SCHEME+filename); } /** diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/build/build.xml --- a/javauis/javalegacyutils/build/build.xml Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/build/bwins/javalegacyutilsu.def --- a/javauis/javalegacyutils/build/bwins/javalegacyutilsu.def Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -EXPORTS - ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) - ?GetValidJniRef@JniEnvWrapper@@SAPAUJNIEnv_@@XZ @ 2 NONAME ; struct JNIEnv_ * JniEnvWrapper::GetValidJniRef(void) - ??0CJavaEventSourceBase@@IAE@XZ @ 3 NONAME ; CJavaEventSourceBase::CJavaEventSourceBase(void) - ??0CJesServer@@QAE@PAVMJesShutdown@@@Z @ 4 NONAME ; CJesServer::CJesServer(class MJesShutdown *) - ??0RJString@@QAE@AAUJNIEnv_@@PAV_jstring@@@Z @ 5 NONAME ; RJString::RJString(struct JNIEnv_ &, class _jstring *) - ??0TConstructorBase@CJavaEventSourceBase@@IAE@PAV1@AAUJNIEnv_@@@Z @ 6 NONAME ; CJavaEventSourceBase::TConstructorBase::TConstructorBase(class CJavaEventSourceBase *, struct JNIEnv_ &) - ??1CJavaEventSourceBase@@MAE@XZ @ 7 NONAME ; CJavaEventSourceBase::~CJavaEventSourceBase(void) - ??1RJString@@QAE@XZ @ 8 NONAME ; RJString::~RJString(void) - ?CheckEvent@CJavaEventSourceBase@@MAEHPAVCJavaEventBase@@@Z @ 9 NONAME ; int CJavaEventSourceBase::CheckEvent(class CJavaEventBase *) - ?Close@CJavaEventSourceBase@@QAEXAAUJNIEnv_@@@Z @ 10 NONAME ; void CJavaEventSourceBase::Close(struct JNIEnv_ &) - ?ConstructL@CJavaEventSourceBase@@IAEXAAUJNIEnv_@@PAV_jobject@@VTJavaEventServer@@@Z @ 11 NONAME ; void CJavaEventSourceBase::ConstructL(struct JNIEnv_ &, class _jobject *, class TJavaEventServer) - ?CopyToJava@ArrayUtils@@SAHAAUJNIEnv_@@ABVTDesC8@@PAV_jbyteArray@@HH@Z @ 12 NONAME ; int ArrayUtils::CopyToJava(struct JNIEnv_ &, class TDesC8 const &, class _jbyteArray *, int, int) - ?CopyToNewJavaStringArrayL@@YAPAV_jobjectArray@@AAUJNIEnv_@@ABVCDesC16Array@@@Z @ 13 NONAME ; class _jobjectArray * CopyToNewJavaStringArrayL(struct JNIEnv_ &, class CDesC16Array const &) - ?CreateEpocTTime@JavaEpocTime@@SA?AVTTime@@_J@Z @ 14 NONAME ; class TTime JavaEpocTime::CreateEpocTTime(long long) - ?CreateJavaString@@YAPAV_jstring@@AAUJNIEnv_@@ABVTDesC16@@@Z @ 15 NONAME ; class _jstring * CreateJavaString(struct JNIEnv_ &, class TDesC16 const &) - ?CreateJavaTime@JavaEpocTime@@SA_JVTTime@@@Z @ 16 NONAME ; long long JavaEpocTime::CreateJavaTime(class TTime) - ?DoExecute@CJavaEventSourceBase@@AAAHPAXZZ @ 17 NONAME ; int CJavaEventSourceBase::DoExecute(void *, ...) - ?DoExecuteTrap@CJavaEventSourceBase@@AAAHPAXZZ @ 18 NONAME ; int CJavaEventSourceBase::DoExecuteTrap(void *, ...) - ?DoPostEvent@CJavaEventSourceBase@@IAEHPAVCJavaEventBase@@H@Z @ 19 NONAME ; int CJavaEventSourceBase::DoPostEvent(class CJavaEventBase *, int) - ?FinalizeJni@CJavaEventSourceBase@@EAEXAAUJNIEnv_@@@Z @ 20 NONAME ; void CJavaEventSourceBase::FinalizeJni(struct JNIEnv_ &) - ?FinalizeSvr@CJavaEventSourceBase@@EAEXXZ @ 21 NONAME ; void CJavaEventSourceBase::FinalizeSvr(void) - ?NewL@TJavaEventServer@@SA?AV1@ABVTDesC16@@P6AHPAX@Z1@Z @ 22 NONAME ; class TJavaEventServer TJavaEventServer::NewL(class TDesC16 const &, int (*)(void *), void *) - ?NewL@TJavaEventServer@@SA?AV1@ABVTDesC16@@P6AHPAX@Z1IPAVRAllocator@@@Z @ 23 NONAME ; class TJavaEventServer TJavaEventServer::NewL(class TDesC16 const &, int (*)(void *), void *, unsigned int, class RAllocator *) - ?Panic@CJavaEventSourceBase@@CAXH@Z @ 24 NONAME ; void CJavaEventSourceBase::Panic(int) - ?Shutdown@TJavaEventServer@@QAEXXZ @ 25 NONAME ; void TJavaEventServer::Shutdown(void) - ?NewL@CTimeOutTimer@@SAPAV1@HAAVMTimeOutNotify@@@Z @ 26 NONAME ; class CTimeOutTimer * CTimeOutTimer::NewL(int, class MTimeOutNotify &) diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/build/eabi/javalegacyutilsu.def --- a/javauis/javalegacyutils/build/eabi/javalegacyutilsu.def Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -EXPORTS - _Z10jni_lookupPKc @ 1 NONAME - _Z16CreateJavaStringR7JNIEnv_RK7TDesC16 @ 2 NONAME - _Z25CopyToNewJavaStringArrayLR7JNIEnv_RK12CDesC16Array @ 3 NONAME - _ZN10ArrayUtils10CopyToJavaER7JNIEnv_RK6TDesC8P11_jbyteArrayii @ 4 NONAME - _ZN10CJesServerC1EP12MJesShutdown @ 5 NONAME - _ZN10CJesServerC2EP12MJesShutdown @ 6 NONAME - _ZN12JavaEpocTime14CreateJavaTimeE5TTime @ 7 NONAME - _ZN12JavaEpocTime15CreateEpocTTimeEx @ 8 NONAME - _ZN13JniEnvWrapper14GetValidJniRefEv @ 9 NONAME - _ZN16TJavaEventServer4NewLERK7TDesC16PFiPvES3_ @ 10 NONAME - _ZN16TJavaEventServer4NewLERK7TDesC16PFiPvES3_jP10RAllocator @ 11 NONAME - _ZN20CJavaEventSourceBase10CheckEventEP14CJavaEventBase @ 12 NONAME - _ZN20CJavaEventSourceBase10ConstructLER7JNIEnv_P8_jobject16TJavaEventServer @ 13 NONAME - _ZN20CJavaEventSourceBase11DoPostEventEP14CJavaEventBasei @ 14 NONAME - _ZN20CJavaEventSourceBase11FinalizeJniER7JNIEnv_ @ 15 NONAME - _ZN20CJavaEventSourceBase11FinalizeSvrEv @ 16 NONAME - _ZN20CJavaEventSourceBase13DoExecuteTrapEPvz @ 17 NONAME - _ZN20CJavaEventSourceBase16TConstructorBaseC1EPS_R7JNIEnv_ @ 18 NONAME - _ZN20CJavaEventSourceBase16TConstructorBaseC2EPS_R7JNIEnv_ @ 19 NONAME - _ZN20CJavaEventSourceBase5CloseER7JNIEnv_ @ 20 NONAME - _ZN20CJavaEventSourceBase5PanicEi @ 21 NONAME - _ZN20CJavaEventSourceBase9DoExecuteEPvz @ 22 NONAME - _ZN20CJavaEventSourceBaseC1Ev @ 23 NONAME - _ZN20CJavaEventSourceBaseC2Ev @ 24 NONAME - _ZN20CJavaEventSourceBaseD0Ev @ 25 NONAME - _ZN20CJavaEventSourceBaseD1Ev @ 26 NONAME - _ZN20CJavaEventSourceBaseD2Ev @ 27 NONAME - _ZN8RJStringC1ER7JNIEnv_P8_jstring @ 28 NONAME - _ZN8RJStringC2ER7JNIEnv_P8_jstring @ 29 NONAME - _ZN8RJStringD1Ev @ 30 NONAME - _ZN8RJStringD2Ev @ 31 NONAME - _ZTI10CJesServer @ 32 NONAME ; ## - _ZTI11CEventQueue @ 33 NONAME ; ## - _ZTI11CJesSession @ 34 NONAME ; ## - _ZTI12CJesShutdown @ 35 NONAME ; ## - _ZTI13CJesScheduler @ 36 NONAME ; ## - _ZTI16CJavaEventServer @ 37 NONAME ; ## - _ZTI20CJavaEventSourceBase @ 38 NONAME ; ## - _ZTI9CIntQueue @ 39 NONAME ; ## - _ZTV10CJesServer @ 40 NONAME ; ## - _ZTV11CEventQueue @ 41 NONAME ; ## - _ZTV11CJesSession @ 42 NONAME ; ## - _ZTV12CJesShutdown @ 43 NONAME ; ## - _ZTV13CJesScheduler @ 44 NONAME ; ## - _ZTV16CJavaEventServer @ 45 NONAME ; ## - _ZTV20CJavaEventSourceBase @ 46 NONAME ; ## - _ZTV9CIntQueue @ 47 NONAME ; ## - _ZN16TJavaEventServer8ShutdownEv @ 48 NONAME - _ZN13CTimeOutTimer4NewLEiR14MTimeOutNotify @ 49 NONAME - _ZTI13CTimeOutTimer @ 50 NONAME ; ## - _ZTV13CTimeOutTimer @ 51 NONAME ; ## - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/build/exports.inf --- a/javauis/javalegacyutils/build/exports.inf Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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: -* -*/ - -PRJ_EXPORTS - -../../inc/jdebug.h |../../../inc/j2me/jdebug.h - -../inc/capabilities.mmh |../../../javauis/inc/capabilities.mmh -../inc/JniEnvWrapper.h |../../../javauis/inc/JniEnvWrapper.h -../inc/mevents.h |../../../javauis/inc/mevents.h -../inc/JesServer.h |../../../javauis/inc/JesServer.h -../inc/CJavaEventServer.h |../../../javauis/inc/CJavaEventServer.h -../inc/jutils.h |../../../javauis/inc/jutils.h -../inc/TimeOutTimer.h |../../../javauis/inc/TimeOutTimer.h diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/build/javalegacyutils.pro --- a/javauis/javalegacyutils/build/javalegacyutils.pro Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE=lib -TARGET=javalegacyutils -CONFIG += omj java staticdata stl -CONFIG -= qt -LIBS += -lhal -lcommonengine - - -include(../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/CJavaEventServer.h --- a/javauis/javalegacyutils/inc/CJavaEventServer.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 CJAVAEVENTSERVER_H -#define CJAVAEVENTSERVER_H - -#include -#include - -#include "mevents.h" - -enum {EJessExecute,EJessExecuteTrap, EJessShutdown}; - -class RJess : public RSessionBase -{ -public: - TInt Connect(RServer2& aServer); - inline TInt Execute(TAny* aParam) - { - return SendReceive(EJessExecute,TIpcArgs(aParam)); - } - inline TInt ExecuteTrap(TAny* aParam) - { - return SendReceive(EJessExecuteTrap,TIpcArgs(aParam)); - } - inline TInt Shutdown() - { - return SendReceive(EJessShutdown, TIpcArgs()); - } -}; - -class CJavaEventServer : public CBase -{ -public: - ~CJavaEventServer(); - static CJavaEventServer* NewL(const TDesC& aName,TThreadFunction aServerThread, TAny* aServerArg, - TUint aStackSize = 0, RAllocator* aHeap = 0); - - // Notify Java dispatcher thread about new event, called from C++ thread - static void NotifyJavaCall(TInt aEvent, TInt aPriority); - - // Cleanup the event server stuff, called from Java thread through JNI - static void Cleanup(RArray& aServerHandles); - - // Helper method to do tracing from the native to the Java side - static void Trace(JNIEnv& aJni, TInt aValue); - - inline RJess& Session() - { - return iSession; - } - void PostEvent(CJavaEventBase* aEvent, TInt aPriority); - static TInt ServerThread(TAny* aParam); - - void AddRef(); - void RemoveRef(); - void Shutdown(); - -private: - CJavaEventServer(); - void ConstructL(const TDesC& aUserName,TThreadFunction aServerThread, TAny* aServerArg, - TUint aStackSize, RAllocator* aHeap); - -private: - TInt iRef; - RJess iSession; - TBool iShutdown; - RCriticalSection iMutex; - -}; - -// CIntQueue helper class implements an integer FIFO queue The implementation is based on -// fixed-sized array, because we don't want any garbage to be collected here and we don't -// want to grab all the memory due to some misbehaving midlet. Synchronization is provided -// in putItem() and removeItem() functions so it's safe to call them from different threads - -class CIntQueue : public CBase -{ - -public: - virtual ~CIntQueue(); - - static CIntQueue* NewL(); // two-phased constructor - static CIntQueue* NewLC(); // two-phased constructor - - void Enqueue(TInt aValue); // add integer to the end of the queue - TInt Dequeue(); // return integer from the beginning of the queue - TBool IsEmpty(); // checks if there are any items in queue - -private: - void PutItem(TInt aItem); // put new item to the buffer - TInt RemoveItem(); // take item from the buffer - - CIntQueue(); // default C++ constructor - void ConstructL(); // by default Symbian 2nd phase constructor is private - -private: - RArray iQueue; - RMutex iMutex; // protect a critical regions of code - RSemaphore iFull; // counts full buffer slots - TInt iCompressCounter; // counts event dequeuing -}; - -// CEventLock implements queues for manipulating of event and notification handlers. - -class CEventQueue : public CBase -{ - -public: - virtual ~CEventQueue(); - - void NewEvent(TInt aEvent); - TInt GetNext(); - - static void NotifyServer(TInt aEvent, TInt aThreadNumber); - static void OnCloseThreads(); - - static void InitL(); - static void Cleanup(); - - static CEventQueue* GetQueue(TInt aThread); - static const TInt KDispatchThreads = 2; // two dispatching threads: events and notifications - -private: - CEventQueue(); - void ConstructL(); - -private: - CIntQueue* iEventQueue; // queue for storing event handles -}; - -// clean-up event server objects on vm exit -void CleanupEventServer(); -// init event server objects on vm start -void InitEventServer(); - -#endif // CJAVAEVENTSERVER_H - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/JesServer.h --- a/javauis/javalegacyutils/inc/JesServer.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 1999-2005 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 JESSERVER_H -#define JESSERVER_H - - -/** - * Event server async shutdown interface. - */ -class MJesShutdown -{ -public: - virtual void Shutdown() = 0; -}; - -/** - * Event server async shutdown handler. - */ -class CJesShutdown : public CActive -{ -public: - CJesShutdown(MJesShutdown*); - - void Start(); - -protected: - virtual void RunL(); - virtual TInt RunError(TInt aError); - virtual void DoCancel(); - -private: - MJesShutdown* iShutdown; -}; - -/** - * Java Event Server - */ -class CJesServer : public CServer2 -{ -public: - IMPORT_C CJesServer(MJesShutdown* aShutdown); - ~CJesServer(); - - void Shutdown(); - -private: - CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; - -private: - CJesShutdown iShutdown; -}; - -#endif // JESSERVER_H diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/JniEnvWrapper.h --- a/javauis/javalegacyutils/inc/JniEnvWrapper.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2006 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 JNIENVWRAPPER_H -#define JNIENVWRAPPER_H - -#include -#define JNIENV_TO_VM(aJni) JavaVM* vm;\ - aJni->GetJavaVM(&vm); /* Get pointer to VM*/\ - JNIEnv* castedJNIEnv = reinterpret_cast< JNIEnv* >(vm); /* Get pointer to VM*/ -#define JNI_PARAM castedJNIEnv -#define JNIENV_ATTACH(aJni) (reinterpret_cast< JavaVM* >(aJni))->AttachCurrentThreadAsDaemon((void**)&aJni, 0) - -class JniEnvWrapper -{ -public: - static void InitJavaVmRef(JNIEnv* aJni); - IMPORT_C static JNIEnv* GetValidJniRef(); -}; -#endif // JNIENVWRAPPER_H diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/TimeOutTimer.h --- a/javauis/javalegacyutils/inc/TimeOutTimer.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2003 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: Timer for comms time-outs -* -*/ - - -#ifndef TIMEOUTTIMER_H -#define TIMEOUTTIMER_H - -#include -#include - -// MTimeOutNotify: used in conjunction with CTimeOutTimer class -class MTimeOutNotify -{ -public: - virtual void TimerExpired() = 0; -}; - -// CTimeOutTimer: timer for comms time-outs -class CTimeOutTimer : public CTimer -{ -public: - IMPORT_C static CTimeOutTimer* NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify); - ~CTimeOutTimer(); - -protected: - CTimeOutTimer(const TInt aPriority); - void ConstructL(MTimeOutNotify& aTimeOutNotify); - virtual void RunL(); - -private: - MTimeOutNotify* iNotify; -}; - -#endif // TIMEOUTTIMER_H - -// End of File diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/capabilities.mmh --- a/javauis/javalegacyutils/inc/capabilities.mmh Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +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: -* -*/ - -#define J2ME_VMS_CAPABILITIES2 all -tcb -#define J2ME_VMS_CAPABILITIES LocalServices NetworkServices ProtServ WriteDeviceData ReadDeviceData ReadUserData WriteUserData UserEnvironment SwEvent Location MultiMediaDD NetworkControl TrustedUI - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/eventserverglobals.h --- a/javauis/javalegacyutils/inc/eventserverglobals.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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: -* -*/ - - -#ifndef EVENTSERVERGLOBALS_H -#define EVENTSERVERGLOBALS_H - -#include -#include - -#include "CJavaEventServer.h" - - -NONSHARABLE_CLASS(EventServerGlobals) -{ -public: - EventServerGlobals(); - -public: - CEventQueue* mLocks[CEventQueue::KDispatchThreads]; - JavaVM* mVm; - RArray mHandles; -}; - -EventServerGlobals* getEsStaticData(); - -#endif // EVENTSERVERGLOBALS_H - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/jutils.h --- a/javauis/javalegacyutils/inc/jutils.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -/* -* Copyright (c) 1999-2004 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 JUTILS_H -#define JUTILS_H - -#include -#include -#include "jni.h" - -//---------------------------------------------------------------------------- -// RJString takes a Java JNI string and converts it to an -// Epoc string. It retains the JNI environment and the string -// in order to release the string resources during destruction -class RJString : public TPtrC16 -{ -public: - IMPORT_C RJString(JNIEnv& aJni, jstring aString); - IMPORT_C ~RJString(); - -private: - // Prevent accidental copying because of the shared underlying Java - // string - RJString(const RJString&); - RJString& operator=(const RJString&); - -private: - JNIEnv& iJni; - jstring iString; -}; - -//---------------------------------------------------------------------------- - -IMPORT_C jstring CreateJavaString(JNIEnv& aJni, const TDesC16& aString); - -void AddToJavaStringArrayL(JNIEnv& aJni, jobjectArray& aContainer, TInt aPosition, const TDesC& aString); - -IMPORT_C jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni, const CDesCArray& aNativeArray); - - - -class RJArray -{ -public: - RJArray(JNIEnv& aJni); - ~RJArray(); - void* GetPrimitiveArrayCriticalLC(jarray aJavaArray, TBool aMutable = EFalse); - static void CleanupArrayAccess(TAny* aRJArray); - -private: - void ReleasePrimitiveArrayCritical(); - -private: - JNIEnv& iJni; - jarray iJavaArray; - TUint8* iArrayPtr; - TBool iMutable; -}; - - - -class ArrayUtils -{ -public: - static TInt CopyToNative(JNIEnv& aJni, jbyteArray aJavaBuffer, - TInt aOffset, TInt aLength, TDes8& aNativeBuffer); - IMPORT_C static TInt CopyToJava(JNIEnv& aJni, const TDesC8& aNativeBuffer, - jbyteArray aJavaBuffer, TInt aOffset, TInt aLength); - static jobjectArray CopyToNewJavaStringArray(JNIEnv& aJni, - const RPointerArray& aNativeArray); - -}; - - - -//---------------------------------------------------------------------------- -// Constants that define the date/time '00:00, 1 Jan 1970' when used to create a TTime object -const TUint JavaUpperTimeFor1970 = 14474675; -const TUint JavaLowerTimeFor1970 = 254771200; - -//---------------------------------------------------------------------------- -// Used for converting between a Java jlong value and an Epoc -// TTime and vice-versa. The jlong represents the number of -// milliseconds since 00:00 1st Jan 1970. -class JavaEpocTime -{ -public: - IMPORT_C static TTime CreateEpocTTime(jlong aJavaTime); - IMPORT_C static jlong CreateJavaTime(TTime aEpocTime); -}; - -//----------------------------------------------------------------------------- -// Creating integer 'handles' from C++ objects for referencing them inside Java -// The shift garauntees a positive integer, so object creation native methods -// can overload the return value to be a handle or an error code -// -// Unhanding the integer requires the destination type to be known, so is -// implemented as a template function, it should be invoked as -// -// CXyz* xyz=JavaUnhand(aHandle); -// -const TInt KJavaHandleShift=2; - -inline TInt JavaMakeHandle(const TAny* aObject) -{ - return reinterpret_cast(aObject)>>KJavaHandleShift; -} - -template -inline T* JavaUnhand(TInt aHandle) -{ - return reinterpret_cast(aHandle< -// {...}; -// -// The TConstructor member allows for more complex factory functions, -// providing automatic use of the cleanup stack. Supposing the derived -// class has a second phase constructor ConstructL(), the factory function -// could be: -// -// TInt CXyz::New(...) -// { -// TRAPD(h,TConstructor c;c->ConstructL(...);h=c.GetHandle();) -// return h; -// } -// -template -class CJavaPeer : public CBase -{ -protected: - class TConstructor - { - public: - inline TConstructor(T* aObject) - :iObject(aObject) - { - CleanupStack::PushL(aObject); - } - inline TConstructor() - :iObject(new(ELeave) T) - { - CleanupStack::PushL(iObject); - } - inline T* operator->() const - { - return static_cast(iObject); - } - inline TInt GetHandle() - { - CleanupStack::Pop(); - return JavaMakeHandle(iObject); - } - private: - CBase* iObject; - }; -public: - inline TInt Handle() const - { - return JavaMakeHandle(this); - } - inline static T& Unhand(TInt aHandle) - { - return *JavaUnhand(aHandle); - } - static TInt New() - { - T* self=new T; - return self ? self->Handle() : KErrNoMemory; - } -}; - -#endif // JUTILS_H diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/inc/mevents.h --- a/javauis/javalegacyutils/inc/mevents.h Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,397 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 MEVENTS_H -#define MEVENTS_H - -#include - -#include "logger.h" - -/** - * Callback interface for event server thread. - */ -class MEventServer -{ -public: - - /** - * Event server started. - */ - virtual void Started(TInt aError, RServer2 server) = 0; - - /** - * Argument for event server thread. - */ - virtual TAny* Arg() const = 0; -}; - -class CJavaEventServer; -class TJavaEventServer -{ - friend class CJavaEventServer; -public: - IMPORT_C static TJavaEventServer NewL(const TDesC& aName, TThreadFunction aServerThread=NULL, TAny* aServerArg=NULL); - IMPORT_C static TJavaEventServer NewL(const TDesC& aName, TThreadFunction aServerThread, TAny* aServerArg, TUint aStackSize, RAllocator* aHeap = 0); - - inline TJavaEventServer() - {} - inline TJavaEventServer(TInt aServer) - :iServer(JavaUnhand(aServer)) - {} - inline CJavaEventServer* operator->() const - { - return iServer; - } - static inline TInt Handle(CJavaEventServer* aServer) - { - return JavaMakeHandle(aServer); - } - inline TInt Handle() const - { - return Handle(iServer); - } - IMPORT_C void Shutdown(); -private: - inline TJavaEventServer(CJavaEventServer* aServer); -private: - CJavaEventServer* iServer; -}; - -#pragma warning(disable: 4786) // Truncated browser info for long mangled names - -class CJavaEventBase; -class CJavaEventSourceBase : public CBase -{ - enum {KMaxExecuteArgumentSize=32}; - static inline void CallCheck(TInt aSize) - { // fault at run time for invalid JpServer calls -#pragma warning(disable: 4127) - if (aSize>KMaxExecuteArgumentSize) Panic(aSize); -#pragma warning(default: 4127) - } -public: - inline TInt Handle() const - { - return JavaMakeHandle(this); - } - inline jweak Peer() const - { - return iPeer; - } - inline TJavaEventServer Server() const - { - return iServer; - } - inline void Dispose(JNIEnv& aJni) - { - iDead=ETrue; - Close(aJni); - } - inline TBool IsDisposed() const - { - return iDead; - } - TBool Open(); - IMPORT_C void Close(JNIEnv& aJni); - - - void OnVmClose(); - - template - inline R Execute(R(*aFuncL)(T1,T2,T3,T4,T5,T6,T7,T8),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6,T7 aT7,T8 aT8) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)+sizeof(T7)+sizeof(T8)); - return (R)DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6,aT7,aT8); - } - template - inline R Execute(R(*aFuncL)(T1,T2,T3,T4,T5,T6,T7),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6,T7 aT7) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)+sizeof(T7)); - return (R)DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6,aT7); - } - template - inline R Execute(R(*aFuncL)(T1,T2,T3,T4,T5,T6),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)); - return (R)DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6); - } - template - inline R Execute(R(*aFuncL)(T1,T2,T3,T4,T5),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)); - return (R)DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5); - } - template - inline R Execute(R(*aFunc)(T1,T2,T3,T4),T1 aT1,T2 aT2,T3 aT3,T4 aT4) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)); - return (R)DoExecute((TAny*)aFunc,aT1,aT2,aT3,aT4); - } - template - inline R Execute(R(*aFunc)(T1,T2,T3),T1 aT1,T2 aT2,T3 aT3) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)); - return (R)DoExecute((TAny*)aFunc,aT1,aT2,aT3); - } - template - inline R Execute(R(*aFunc)(T1,T2),T1 aT1,T2 aT2) - { - CallCheck(sizeof(T1)+sizeof(T2)); - return (R)DoExecute((TAny*)aFunc,aT1,aT2); - } - template - inline R Execute(R(*aFunc)(T1),T1 aT1) - { - CallCheck(sizeof(T1)); - return (R)DoExecute((TAny*)aFunc,aT1); - } - template - inline R Execute(R(*aFunc)()) - { - return (R)DoExecute((TAny*)aFunc); - } - - template - inline void ExecuteV(void (*aFuncL)(T1,T2,T3,T4,T5,T6,T7),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6,T7 aT7) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)+sizeof(T7)); - DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6,aT7); - } - template - inline void ExecuteV(void (*aFuncL)(T1,T2,T3,T4,T5,T6),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)); - DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6); - } - template - inline void ExecuteV(void (*aFuncL)(T1,T2,T3,T4,T5),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)); - DoExecute((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5); - } - template - inline void ExecuteV(void (*aFunc)(T1,T2,T3,T4),T1 aT1,T2 aT2,T3 aT3,T4 aT4) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)); - DoExecute((TAny*)aFunc,aT1,aT2,aT3,aT4); - } - template - inline void ExecuteV(void (*aFunc)(T1,T2,T3),T1 aT1,T2 aT2,T3 aT3) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)); - DoExecute((TAny*)aFunc,aT1,aT2,aT3); - } - template - inline void ExecuteV(void (*aFunc)(T1,T2),T1 aT1,T2 aT2) - { - CallCheck(sizeof(T1)+sizeof(T2)); - DoExecute((TAny*)aFunc,aT1,aT2); - } - template - inline void ExecuteV(void (*aFunc)(T1),T1 aT1) - { - CallCheck(sizeof(T1)); - DoExecute((TAny*)aFunc,aT1); - } - inline void ExecuteV(void (*aFunc)()) - { - DoExecute((TAny*)aFunc); - } - - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3,T4,T5,T6,T7,T8,T9),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6,T7 aT7,T8 aT8,T9 aT9) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)+sizeof(T7)+sizeof(T8)+sizeof(T9)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6,aT7,aT8,aT9); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3,T4,T5,T6,T7,T8),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6,T7 aT7,T8 aT8) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)+sizeof(T7)+sizeof(T8)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6,aT7,aT8); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3,T4,T5,T6,T7),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6,T7 aT7) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)+sizeof(T7)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6,aT7); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3,T4,T5,T6),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5,T6 aT6) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)+sizeof(T6)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5,aT6); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3,T4,T5),T1 aT1,T2 aT2,T3 aT3,T4 aT4,T5 aT5) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)+sizeof(T5)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3,aT4,aT5); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3,T4),T1 aT1,T2 aT2,T3 aT3,T4 aT4) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)+sizeof(T4)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3,aT4); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2,T3),T1 aT1,T2 aT2,T3 aT3) - { - CallCheck(sizeof(T1)+sizeof(T2)+sizeof(T3)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2,aT3); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1,T2),T1 aT1,T2 aT2) - { - CallCheck(sizeof(T1)+sizeof(T2)); - return DoExecuteTrap((TAny*)aFuncL,aT1,aT2); - } - template - inline TInt ExecuteTrap(void (*aFuncL)(T1),T1 aT1) - { - CallCheck(sizeof(T1)); - return DoExecuteTrap((TAny*)aFuncL,aT1); - } - inline int ExecuteTrap(void (*aFuncL)()) - { - return DoExecuteTrap((TAny*)aFuncL); - } -protected: - IMPORT_C CJavaEventSourceBase(); - IMPORT_C ~CJavaEventSourceBase(); - IMPORT_C void ConstructL(JNIEnv& aJni, jobject aPeer,TJavaEventServer aServer); - - IMPORT_C TBool DoPostEvent(CJavaEventBase* aEvent, TInt aPriority); - - IMPORT_C virtual TBool CheckEvent(CJavaEventBase* aEvent); -private: - IMPORT_C virtual void FinalizeSvr(); - - IMPORT_C virtual void FinalizeJni(JNIEnv& aJni); - - IMPORT_C TInt DoExecute(TAny* aFunc,...); - IMPORT_C TInt DoExecuteTrap(TAny* aFuncL,...); - static void DoFinalize(CJavaEventSourceBase* aThis); - - IMPORT_C static void Panic(TInt aPanic); -public: - class TConstructorBase - { - public: - inline TInt GetHandle() - { - CleanupStack::Pop(); - return iObject->Handle(); - } - protected: - IMPORT_C TConstructorBase(CJavaEventSourceBase* aObject, JNIEnv& aJni); - private: - static void Disposer(TAny* aThis); - protected: - CJavaEventSourceBase* iObject; - JNIEnv& iJni; - }; -private: - jweak iPeer; - TJavaEventServer iServer; - TInt iRef; - TBool iDead; -}; - -#pragma warning(default: 4786) - -class CJavaEventBase : public CBase -{ - friend class CJavaEventSourceBase; - friend class CJavaEventServer; - -public: - enum {EEventPriority = 0, ENotifyPriority = 1, ELastPriority = 1}; - enum TDisposability { EDisposableEvent, EReusableEvent }; -public: - inline TBool IsDisposable() const - { - return iDisposableState == EDisposableEvent; - } -protected: - CJavaEventBase(TDisposability aDisposable) - : iDisposableState(aDisposable) {} - -public: - inline CJavaEventSourceBase& Object() const - { - return *iObject; - } - - void Run(JNIEnv& aJni); - -private: - virtual void Dispatch(JNIEnv& aJni) =0; - TSglQueLink iLink; - CJavaEventSourceBase* iObject; - TDisposability iDisposableState; -}; - -template -class CJavaEvent : public CJavaEventBase -{ -protected: - CJavaEvent(TDisposability aDisposable = EDisposableEvent) - : CJavaEventBase(aDisposable) {} - inline T& Object() const - { - return static_cast(CJavaEventBase::Object()); - } -}; - -template -class CJavaEventSource : public CJavaEventSourceBase -{ -protected: - class TConstructor : public CJavaEventSourceBase::TConstructorBase - { - public: - inline TConstructor(T* aObject,JNIEnv& aJni) - :TConstructorBase(aObject,aJni) - {} - inline TConstructor(JNIEnv& aJni) - :TConstructorBase(new(ELeave) T,aJni) - {} - inline T* operator->() const - { - return static_cast(iObject); - } - }; -public: - inline static T& Unhand(TInt aHandle) - { - return *JavaUnhand(aHandle); - } - inline TBool PostEvent(CJavaEvent* aEvent, TInt aPriority = CJavaEventBase::EEventPriority) - { - return DoPostEvent(aEvent, aPriority); - } - static TInt New(JNIEnv& aJni,jobject aPeer,TJavaEventServer aServer) - { - TRAPD(h,TConstructor self(aJni); self->ConstructL(aJni,aPeer,aServer); h=self.GetHandle()); - return h; - } -}; - -#endif // MEVENTS_H diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javalegacyutils.pro --- a/javauis/javalegacyutils/javalegacyutils.pro Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +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: Generated file - do not edit manually -# -TEMPLATE = subdirs -SUBDIRS += build/javalegacyutils.pro -BLD_INF_RULES.prj_extensions += "prj_extensions" diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/EventProcessor.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/EventProcessor.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2001 - 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.rt.legacy; - -import com.nokia.mj.impl.rt.support.Jvm; - -/** - * A class for dispatcher thread handling. - */ -class EventProcessor extends Thread -{ - - /** - * The Event dispatcher thread. - */ - private static EventProcessor mEventProcessor; - - /** - * The Notify dispatcher thread. - */ - private static EventProcessor mNotifyProcessor; - - /** - * The thread id. 0=event dispatcher, 1= notify dispatcher. - */ - private int mThreadId; - - static - { - Jvm.loadSystemLibrary("javalegacyutils"); - } - - /** - * Create the dispatcher threads if don't exist. - */ - static synchronized void startEventProcessing() - { - if (mEventProcessor == null) - { - mEventProcessor = new EventProcessor(0); - mEventProcessor.start(); - mNotifyProcessor = new EventProcessor(1); - mNotifyProcessor.start(); - } - } - - private EventProcessor(int threadId) - { - super(null, "EventProcessor"); - mThreadId = threadId; - } - - - /** - * The dispatcher threads makes only upcalls from Java. - */ - public void run() - { - _dispatchCallbacks(mThreadId); - } - - /** - * Called to exit the dispatcher threads. Interrupts the threads - */ - static void exitThreads() - { - _exitThreads(); - } - - - // Native method to cleanup the native event server stuff - private static native void _dispatchCallbacks(int threadId); - private static native void _exitThreads(); -} -// eof diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacyRtPort.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacyRtPort.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +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: -* -*/ - -package com.nokia.mj.impl.rt.legacy; - -import javax.microedition.midlet.MIDlet; - -import com.nokia.mj.impl.rt.support.ApplicationInfo; - -/** - * A class for porting legacy JSRs to new runtime. - */ -public class LegacyRtPort -{ - - /** - * A singleton instance. - */ - private static LegacyRtPort mInstance = new LegacyRtPort(); - - /** - * The running MIDlet instance. - */ - private MIDlet mMidlet; - - /** - * The registered UI toolkit. - */ - private String mRegisteredToolkit; - - /** - * Contructor, allowed only for this class. - */ - private LegacyRtPort() - { - } - - /** - * Sets the running MIDlet. - */ - static void setMidlet(MIDlet midlet) - { - mInstance.mMidlet = midlet; - } - - /** - * Gets the running MIDlet instance. - */ - public static MIDlet getMidlet() - { - return mInstance.mMidlet; - } - - /** - * Gets the UID of the running MIDlet in int format. - */ - public static int getMidletUid() - { - int midletUid = -1; - try - { - String uidS = ApplicationInfo.getInstance().getUid().getStringValue(); - // In Symbian the UID is in format '[]' where 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) - { - } - return midletUid; - } - - - /** - * Registers active UI toolkit. There can be only one active UI toolkit at the - * same time. - */ - public static void registerToolkit(String toolkitId) - { - if (mInstance.mRegisteredToolkit != null) - { - throw new RuntimeException("Could not register toolkit: " + - toolkitId); - } - mInstance.mRegisteredToolkit = toolkitId; - } - - /** - * Unregisters the given UI toolkit. - */ - public static void unRegisterToolkit(String toolkitId) - { - if (mInstance.mRegisteredToolkit != null && - mInstance.mRegisteredToolkit.equals(toolkitId)) - { - mInstance.mRegisteredToolkit = null; - } - } - - /** - * Gets the active UI toolkit. - */ - public static String getRegisteredToolkit() - { - return mInstance.mRegisteredToolkit; - } - - /** - * Gets the ApplicationId. - */ - public static Object getApplicationId() - { - return mInstance; - } - -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacySymbian.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacySymbian.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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: -* -*/ - -package com.nokia.mj.impl.rt.legacy; - -import java.util.Hashtable; -import javax.microedition.midlet.MIDlet; - - -/** - * A class for porting legacy JSRs to new runtime. - */ -class LegacySymbian extends LegacySupport -{ - - /** - * @see com.nokia.mj.impl.rt.legacy.LegacySupport#init(java.util.Hashtable, boolean) - */ - protected void initImpl(Hashtable args, boolean startInBackGround) - { - ToolkitInvoker.getToolkitInvoker(). - createToolkit(args, startInBackGround); - EventProcessor.startEventProcessing(); - } - - /** - * @see com.nokia.mj.impl.rt.legacy.LegacySupport#setMidlet(java.lang.Object) - */ - protected void setMidletImpl(Object midlet) - { - LegacyRtPort.setMidlet((MIDlet)midlet); - } - - /** - * @see com.nokia.mj.impl.rt.legacy.LegacySupport#close(java.lang.Object) - */ - protected void closeImpl() - { - EventProcessor.exitThreads(); - } -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServer.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServer.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 1999-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.rt.legacy; - -public class MIDEventServer -{ - private static final int MAX_USER_NAME=64; - - private final int iHandle; - /** - * Construct a named EPOC event server system. - *

    - * The server and event threads manage EPOC event notification - * and propogation of those events back to Java. - * - * The native server handle should be passed through to - * native event sources to bind to this event server. - * @see getHandle - * @param aName The event server system to use - */ - public MIDEventServer(String aName) - { - super(); - iHandle = openEventServer(aName, new DefaultFactory()); - } - - protected MIDEventServer(String aName, MIDEventServerFactory aFactory) - { - super(); - iHandle = openEventServer(aName, aFactory); - } - - private int openEventServer(String aName, MIDEventServerFactory aFactory) - { - // - if (aName.length()>MAX_USER_NAME) - { - throw new IllegalArgumentException(); - } - int server = aFactory.createServer(aName); - NativeError.checkOOM(server); - return server; - } - /** - * Get the server handle for passing through to native - * event sources. - * @returns The handle of the native event server - */ - public int getHandle() - { - return iHandle; - } - - public void shutdown() - { - _shutdown(iHandle); - } - - private class DefaultFactory implements MIDEventServerFactory - { - DefaultFactory() - { - } - public int createServer(String aName) - { - return _createServer(aName); - } - } - - /** - * Native methods required to implement getServer() - */ - private native void _shutdown(int aHandle); - private native int _createServer(String aName); -}; - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServerFactory.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServerFactory.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* 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 com.nokia.mj.impl.rt.legacy; - -public interface MIDEventServerFactory -{ - public int createServer(String aName); -} \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MemoryUtil.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MemoryUtil.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* Copyright (c) 2001-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.rt.legacy; - -import com.nokia.mj.impl.rt.support.JvmInternal; -import com.nokia.mj.impl.rt.support.Jvm; - -public class MemoryUtil -{ - - static - { - Jvm.loadSystemLibrary("javalegacyutils"); - } - - - // Two independent mechanisms are available for managing native - // heap consumption. - - // The first mechanism checks available system heap, and if - // beneath a configurable limit forces a garbage collection - // followed by synchronous execution of all pending - // finalizers. This mechanism is not used by Symbian JSRs but - // is preferred by some licensees. - - private static final int FREE_KB_RAM_LIMIT_FOR_FINALIZATION = 4096; // S60 change - - public static void ensureMinFreeRAM() - { - final long freeRAM = _getFreeRAMInKB(); - if (freeRAM < FREE_KB_RAM_LIMIT_FOR_FINALIZATION) - { - // Attempt GC also if returned an error code (!= KErrNone) - freeNativeMemory(); - } - } - - // The second mechanism allows native allocation/deallocation - // to be tracked and triggers regular garbage collections - // after a configurable delta. This is the mechanism used by - // Symbian JSRs since it is proactive in keeping native heap - // allocation under control rather than allowing the - // consumption of all system memory before taking action. - - private static final int NATIVE_ALLOCATION_GC_THRESHOLD = 2048 * 1024; // S60 change - - static final Object sNativeAllocationLock = new Object(); - static long sNativeAllocationCounter = 0; - - - /** - * Native heap management memory allocated notification. - * - * Called after a native memory allocation to allow - * heap manager to track native heap usage. - */ - public static void nativeMemoryAllocated(int aNativeBytes) - { - /* - * Native heap allocation algorith: track known native allocations and - * deletions. Trigger GC when total allocation reaches a threshold. - * We zero the allocation count when this happens to avoid pathological - * cases for applications that have a stable native heap use that just - * exceeds the threshold. - */ - boolean gc = false; - synchronized (sNativeAllocationLock) - { - sNativeAllocationCounter += aNativeBytes; // S60 change - if (sNativeAllocationCounter > NATIVE_ALLOCATION_GC_THRESHOLD) // S60 change - { - sNativeAllocationCounter = 0; - gc = true; - } - } - if (gc) - { - freeNativeMemory(); // S60 change - } - } - - /** - * Native heap management memory released notification. - * - * Called after native memory freed to allow heap manager - * to track native heap usage. - */ - public static void nativeMemoryFreed(int aNativeBytes) - { - /* - * Decrement native heap counter and zero clamp. - */ - synchronized (sNativeAllocationLock) - { - sNativeAllocationCounter -= aNativeBytes; // S60 change - if (sNativeAllocationCounter < 0) - { - sNativeAllocationCounter = 0; - } - } - } - - /* - * Attempt to free native peers by forcing GC and finalization. - */ - public static void freeNativeMemory() - { - //attempt GC also if returned an error code (!= KErrNone) - if (JvmInternal.runYoungGenerationGc()) - { - JvmInternal.runFinalization(); - - if (_getFreeRAMInKB() >= FREE_KB_RAM_LIMIT_FOR_FINALIZATION) - { - return; - } - } - System.gc(); - JvmInternal.runFinalization(); - } - - private static native long _getFreeRAMInKB(); -} -// eof - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/NativeError.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/NativeError.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* -* Copyright (c) 2002-2007 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.rt.legacy; - -import java.io.IOException; - -/** - * A utility class for declaring and handling native SymbianOS error codes. - * All error codes that are used in Java from native code should be - * declared here and referenced from this class. Also if a new error code - * is added, it should be added to the list of compile-time asserts in - * NativeError.cpp. - */ -public final class NativeError -{ - public static final String NATIVE_ERROR_MESSAGE = "SymbianOS error = "; - private static final int BUFFER_SIZE = 256; - - // SymbianOS error codes - public static final int KErrNone = 0; - public static final int KErrNotFound = -1; - public static final int KErrGeneral = -2; - public static final int KErrCancel = -3; - public static final int KErrNoMemory = -4; - public static final int KErrNotSupported = -5; - public static final int KErrArgument = -6; - public static final int KErrOverflow = -9; - public static final int KErrAlreadyExists = -11; - public static final int KErrPathNotFound = -12; - public static final int KErrDied = -13; - public static final int KErrNotReady = -18; - public static final int KErrCorrupt = -20; - public static final int KErrAccessDenied = -21; - public static final int KErrWrite = -23; - public static final int KErrEof = -25; - public static final int KErrDiskFull = -26; - public static final int KErrBadName = -28; - public static final int KErrCommsLineFail = -29; - public static final int KErrTimedOut = -33; - public static final int KErrDisconnected = -36; - public static final int KErrTooBig = -40; - public static final int KErrDivideByZero = -41; - public static final int KErrHardwareNotAvailable = -44; - - - // Not intended to be constructed - private NativeError() - { - } - - - - /** - * Checks for basic native error codes that map to standard Java - * exceptions and throws the exception if the error code matches. - * Otherwise just returns the error. - * - * @param aError Possible error code. - * @return Value passed in is returned if not an error. - * @throws OutOfMemoryError If aError equals KErrNoMemory. - * @throws IllegalArgumentException If aError equals KErrArgument - * @throws ArithmeticException If aError equals KErrDivideByZero - */ - public static int checkExplicitOnly(int aError) - { - if (aError < KErrNone) - { - switch (aError) - { - case KErrNoMemory: - throw new OutOfMemoryError(); - // KErrArgument must throw IllegalArgumentException - // otherwise lcdui will break, so don't change this. - case KErrArgument: - throw new IllegalArgumentException(); - case KErrDivideByZero: - throw new ArithmeticException(); - default: - // Do nothing - } - } - return aError; - } - - - - /** - * Checks for basic native error codes that map to standard Java - * exceptions and throws the exception if the error code matches. - * Otherwise throws basic Error class. - * - * @param aError Possible error code. - * @param aThrowAlways Determines whether a default exception is thrown - * if the error code is not recognised. - * @return Value passed in is returned if not an error. - * @throws Error If the error code does not match any exception thrown - * in checkExplicitOnly, a default exception is thrown here. - */ - public static int check(int aError) - { - if (aError < KErrNone) - { - checkExplicitOnly(aError); - throw new Error(errorMessage(aError)); - } - return aError; - } - - - - /** - * Version of check that uses a long rather than an int. - */ - public static long check(long aError) - { - check((int)aError); - return aError; - } - - - - /** - * Checks for basic native error codes that map to standard Java - * exceptions and throws the exception if the error code matches. - * Otherwise throws an IOException. - * - * @param aError Possible error code. - * @return Value passed in is returned if not an error. - */ - public static int checkIO(int aError) - throws IOException - { - if (aError < KErrNone) - { - checkExplicitOnly(aError); - throw new IOException(errorMessage(aError)); - } - return aError; - } - - - - /** - * Checks if the error code represents out of memory, and throws Java Error - * if true. Otherwise throws basic Error class. - * - * @param aError Possible error code. - * @return Value passed in is returned if not an error. - */ - public static int checkOOM(int aError) - { - if (aError < KErrNone) - { - if (aError == KErrNoMemory) - { - throw new OutOfMemoryError(); - } - throw new Error(errorMessage(aError)); - } - return aError; - } - - - - /** - * Checks if the object is a null reference, and throws OutOfMemoryError - * if this is the case. Useful for checking for OOM when Java objects - * returned from a native method. - * - * @param aObject Object that may be null. - * @return Value passed in is returned if not an error. - */ - public static Object checkOOM(Object aObject) - { - if (aObject == null) - { - throw new OutOfMemoryError(); - } - return aObject; - } - - - - /** - * Checks if the error code represents out of memory, and throws Java Error - * if true. Does not throw anything otherwise. - * - * @param aError Possible error code. - * @return Value passed in is returned if not an out of memory error. - */ - public static int checkOOMOnly(int aError) - { - if (aError == KErrNoMemory) - { - throw new OutOfMemoryError(); - } - return aError; - } - - - - /** - * Returns a string formatted with generic text to indicate where the error - * code comes from and the error code given. - * - * @param A native error code. - * @return A string containing the error code and explanatory text. - */ - public static String errorMessage(int aError) - { - final String message = _getNativeErrorMessage(aError); - String result = NATIVE_ERROR_MESSAGE.concat(Integer.toString(aError)); - if (message != null && message.length() > 0) - result = result.concat(" : ").concat(message); - return result; - } - - /** - * Returns a string formatted with generic text to indicate where the error - * code comes from and the error code given. - * - * @param A native error code. - * @param An extra text message for more information. - * @return A string containing the error code and explanatory text. - */ - public static String errorMessage(int aError, String aExtraText) - { - final StringBuffer messageBuf = new StringBuffer(BUFFER_SIZE); // use native max as base - messageBuf.append(aExtraText); - messageBuf.append(", "); - messageBuf.append(errorMessage(aError)); - return messageBuf.toString(); - } - - - private static native String _getNativeErrorMessage(int aError); - -} - - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/Security.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/Security.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +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: -* -*/ -package com.nokia.mj.impl.rt.legacy; -import com.nokia.mj.impl.rt.support.ApplicationUtils; -import com.nokia.mj.impl.security.midp.common.PermissionMappingTable; -import com.nokia.mj.impl.security.midp.common.MIDPPermission; -import com.nokia.mj.impl.security.midp.authorization.ClassInstantiator; -import com.nokia.mj.impl.utils.Logger; -import java.security.Permission; - -public final class Security -{ - public static void ensurePermission(String aPermission, String aOperation, String[] aArgs) - throws - SecurityException - { - if (aPermission != null) - { - MIDPPermission internalPermission = PermissionMappingTable.get( - aPermission); - if (internalPermission != null) - { - // make an instance of the internal permission - try - { - Permission permission = (Permission)ClassInstantiator - .newInstance(internalPermission.getName(), - internalPermission.getTarget(), - internalPermission.getActionList()); - ApplicationUtils appUtils = ApplicationUtils.getInstance(); - appUtils.checkPermission(permission); - return; - } - catch (InstantiationException e) - { - // fall-through - } - } - } - throw new SecurityException("Permission " + aPermission + " not allowed"); - } - -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2002 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.rt.legacy; - -import java.util.Hashtable; - -public abstract class ToolkitInvoker -{ - private static ToolkitInvoker sInvoker; - - protected static synchronized void setInvoker(ToolkitInvoker aInvoker) - { - if (null != sInvoker) - { - throw new RuntimeException("Toolkit invoker already exists"); - } - sInvoker = aInvoker; - } - - public static synchronized ToolkitInvoker getToolkitInvoker() - { - if (sInvoker == null) - { - try - { - // It's a static initializer of this class that installs - // the concrete invoker object by calling setInvoker() - Class.forName("javax.microedition.lcdui.ToolkitInvoker"); - } - catch (ClassNotFoundException x) - { - throw new Error("Failed to load the toolkit class: " + x); - } - } - return sInvoker; - } - - public abstract void createToolkit(Hashtable args, boolean startInBackGround); - - /** - * MIDP 2.0 Game support - */ - - // - // Toolkit access - // - public abstract Object getToolkit(); - - /** - * unsafe - */ - public abstract int toolkitGetHandle(Object aToolkit); - - public abstract void toolkitDisposeObject(Object aToolkit,int aHandle); - - public abstract void toolkitSync(Object aToolkit); - - /** - * NGA specific change. - * New variant for synchronization initiated from M3G - * @param aToolkit - - * @param aObject - - * @since S60 9.2 - */ - public abstract void toolkitSync(Object aToolkit, Object aObject); - - /** - * NGA specific change. - * Checks if the NGA flag is set - * @return true if the NGA flag is set - * @since S60 9.2 - */ - public abstract boolean isNgaEnabled(); - - // - // Image access - // - public abstract int imageGetHandle(Object aImage); - public abstract boolean imageIsMutable(Object aImage); - public abstract boolean imageHasTransparency(Object aImage); - - /** - Detect pixel level collision between two Images. - @param aImage1 sprite1 raw frame image - @param aS1X1,aS1Y1,aS1X2,aS1Y2 sprite1 collision rect (clipped to frame rect) in sprite1 raw frame image co-ordinates - @param aTransform1 sprite1 transform - @param aD1X1, aD1Y1 position of sprite1 transformed collision rect (clipped to frame rect) in painter's co-ordinates - @param aImage2 sprite2\image\tiledlayer image - @param aS2X1,aS2Y1,aS2X2,aS2Y2 sprite2\image\tiledlayer collision rect in image co-ordinates - @param aTransform2 sprite2 transform. 0 if image\tiledlayer - @param aD2X1, aD2Y1 position of collision rect in painter's coordinates - */ - public abstract boolean imageCollision(Object aImage1, - int aS1X1,int aS1Y1,int aS1X2,int aS1Y2, - int aTransform1, - int aD1X1, int aD1Y1, - Object aImage2, - int aS2X1,int aS2Y1,int aS2X2,int aS2Y2, - int aTransform2, - int aD2X1, int aD2Y1 - ); - - // - // Game Canvas support - // - public abstract Object canvasInitGameCanvas(Object aCanvas, boolean aSuppressKeys); - public abstract Object canvasGetBufferGraphics(Object aCanvas); - public abstract int canvasGetKeyStates(Object aCanvas); - public abstract int canvasGetHandle(Object aCanvas); - public abstract void canvasRenderGraphics(Object aCanvas, Object aGraphics); - public abstract void canvasFlushGraphics(Object aCanvas, int aX, int aY, int aW, int aH); - - // Graphics - /** - * @return the MMIDGraphics handle for a graphics instance. - * - * WARNING: Unsupported. The validity of the return handle cannot be guaranteed. It should not be - * dereferenced on anythread other than the UI thread on which the native graphics peer was instantiated. - * - */ - public abstract int graphicsGetHandle(Object aGraphics); - - /** - * @return the MMIDImage handle for a mutable image that is the target surface of - * a graphics instance. - * - * WARNING: Unsupported. The validity of the return handle cannot be guaranteed. It should not be - * dereferenced on anythread other than the UI thread on which the native graphics peer was instantiated. - * - */ - public abstract int graphicsGetMutableImageHandle(Object aGraphics); - - /** - * JSR 135 support - */ - public abstract int getUIEventServerHandle(); - public abstract int itemGetHandle(Object aItem); - public abstract void addObserver(Object aToolkit,ToolkitObserver aObserver); - public abstract void removeObserver(Object aToolkit,ToolkitObserver aObserver); - - /** S60 AddOn for JSR135 - * Getter for Displayable's native handle. - * Object parameter is used because runtime package - * don't know Displayable class. - * @param aDisplayable Displayable which handle is returned. - * @return Native handle for displayable. - */ - public abstract int getDisplayableHandle(Object aDisplayable); - - /** - * Getter for Item's native handle. - * Object parameter is used because runtime package - * don't know Item class. - * @param aItem Item which handle is returned. - * @return Native handle for item. - */ - public abstract int getItemHandle(Object aItem); - -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserver.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserver.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2003 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.rt.legacy; - -public interface ToolkitObserver -{ - /** - Called prior to the Toolkit being destroyed. - This must not callout into the application. - NB At the point this is called Toolkit.getToolkit() will return null. - */ - void destroyNotify(); -} \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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: -* -*/ - - -package com.nokia.mj.impl.rt.legacy; - -public interface ToolkitObserverNGAExtension extends ToolkitObserver -{ - /** - * Notification that observer should free all graphics memory immediately. - */ - void freeGraphicsMemory(); -} \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/ArrayUtils.cpp --- a/javauis/javalegacyutils/src/ArrayUtils.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2002-2004 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 "jutils.h" - - - -enum TJavaArrayPanic -{ - EBadOffsetIntoJavaArray, - EWritingOverEndOfJavaArray, - EBadOffsetIntoJavaArrayForRead, - EReadingOverEndOfJavaArray, -}; - - - -/** - * Accesses the Java array and copies its data into the native descriptor. - * @param aJni The JNI environment. - * @param aJavaBuffer The Java buffer to copy data from. - * @param aOffset Start of data in Java buffer to copy. This is assumed to be valid. - * @param aLength Amount of data to copy. This is assumed to be valid. - * @param aNativeBuffer Target for data. This is assumed to be long enough. - * @returns An error code. - */ -TInt ArrayUtils::CopyToNative(JNIEnv& aJni, jbyteArray aJavaBuffer, - TInt aOffset, TInt aLength, TDes8& aNativeBuffer) -{ - __ASSERT_DEBUG(aOffset <= aJni.GetArrayLength(aJavaBuffer), - User::Panic(_L("ArrayUtils"), EBadOffsetIntoJavaArrayForRead)); - __ASSERT_DEBUG(aLength <= aJni.GetArrayLength(aJavaBuffer) - aOffset, - User::Panic(_L("ArrayUtils"), EReadingOverEndOfJavaArray)); - - aNativeBuffer.SetLength(aLength); - TUint8* nativeBufferPtr = const_cast(aNativeBuffer.Ptr()); - jbyte* jNativeBufferPtr = reinterpret_cast(nativeBufferPtr); - aJni.GetByteArrayRegion(aJavaBuffer, aOffset, aLength, jNativeBufferPtr); - return KErrNone; -} - - - -/** - * Copies data from the native to the Java array. - * @return The number of bytes copied. - */ -EXPORT_C TInt ArrayUtils::CopyToJava(JNIEnv& aJni, const TDesC8& aNativeBuffer, - jbyteArray aJavaBuffer, TInt aOffset, TInt aLength) -{ - __ASSERT_DEBUG(aOffset <= aJni.GetArrayLength(aJavaBuffer), - User::Panic(_L("ArrayUtils"), EBadOffsetIntoJavaArray)); - __ASSERT_DEBUG(aLength <= aJni.GetArrayLength(aJavaBuffer) - aOffset, - User::Panic(_L("ArrayUtils"), EWritingOverEndOfJavaArray)); - - TInt nativeBufferLength = aNativeBuffer.Length(); - TInt length = (nativeBufferLength < aLength) ? nativeBufferLength : aLength; - TUint8* nativeBufferPtr = const_cast(aNativeBuffer.Ptr()); - jbyte* jNativeBufferPtr = reinterpret_cast(nativeBufferPtr); - aJni.SetByteArrayRegion(aJavaBuffer, aOffset, length, jNativeBufferPtr); - return length; -} - - - -/** - * Creates a Java array of strings from a native array of descriptors allocated - * on the heap. - * @param aJni The JNI environment. - * @param aNativeArray The array of descriptors. - * @return The newly created Java array of String objects, or NULL on error. - */ -jobjectArray ArrayUtils::CopyToNewJavaStringArray(JNIEnv& aJni, - const RPointerArray& aNativeArray) -{ - jclass stringClass = aJni.FindClass("java/lang/String"); - if (stringClass == NULL) - { - return NULL; - } - - TInt count = aNativeArray.Count(); - jobjectArray result = aJni.NewObjectArray(count, stringClass, NULL); - if (result == NULL) - { - return NULL; - } - - for (int ii = 0; ii< count; ii++) - { - jstring javaString = CreateJavaString(aJni, *aNativeArray[ii]); - if (javaString == NULL) - { - aJni.DeleteLocalRef(result); - return NULL; - } - - aJni.SetObjectArrayElement(result, ii, javaString); - aJni.DeleteLocalRef(javaString); - } - - return result; -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/CreateEpocTTime.cpp --- a/javauis/javalegacyutils/src/CreateEpocTTime.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 1999-2000 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 "jutils.h" - -//---------------------------------------------------------------------------- -/* Takes a jlong which is the number of milliseconds from the Java epoch time -of 00:00 1st Jan 1970 and converts it into a EPOC TTime object */ -EXPORT_C TTime JavaEpocTime::CreateEpocTTime(jlong aJavaTime) -{ - // Convert jlong to a TInt64 - TInt64 timeNum = *reinterpret_cast(&aJavaTime); - // Create a TTime object that represents the Java Date 'epoch' time of 00:00, 1 Jan 1970 - TInt64 javaEpocTimeNum = MAKE_TINT64(JavaUpperTimeFor1970, JavaLowerTimeFor1970); - TTime time(javaEpocTimeNum); - TTimeIntervalMicroSeconds delta(timeNum * 1000); - return time + delta; -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/CreateJavaString.cpp --- a/javauis/javalegacyutils/src/CreateJavaString.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 1999-2000 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 "jutils.h" - - -//---------------------------------------------------------------------------- -/* Takes an EPOC string and returns a Java JNI string */ -EXPORT_C jstring CreateJavaString(JNIEnv& aJni, const TDesC16& aString) -{ - const jchar* stringPtr = aString.Ptr(); - const jsize stringLength = aString.Length(); - jstring jniString = aJni.NewString(stringPtr, stringLength); - return jniString; -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/CreateJavaTime.cpp --- a/javauis/javalegacyutils/src/CreateJavaTime.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 1999-2000 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 "jutils.h" - -//---------------------------------------------------------------------------- -/* Takes a TTime and returns the number of milliseconds since the Java epoch time -of 00:00 1st Jan 1970 */ -EXPORT_C jlong JavaEpocTime::CreateJavaTime(TTime aEpocTime) -{ - // Create a TTime object that represents the Java Date 'epoch' time of 00:00, 1 Jan 1970 - TInt64 javaEpocTimeNum = MAKE_TINT64(JavaUpperTimeFor1970, JavaLowerTimeFor1970); - TTime javaEpochTime(javaEpocTimeNum); - // Find difference in microseconds between 'epoch' and EPOC date and adjust to milliseconds - TTimeIntervalMicroSeconds microInterval = aEpocTime.MicroSecondsFrom(javaEpochTime); - TInt64 intervalNum = microInterval.Int64(); - intervalNum /= 1000; - jlong jInterval = *reinterpret_cast(&intervalNum); - return jInterval; -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/NativeError.cpp --- a/javauis/javalegacyutils/src/NativeError.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2002 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 -#include "com_nokia_mj_impl_rt_legacy_NativeError.h" -#include - -jstring getErrorL(JNIEnv* aJni, jint aError) -{ - jstring result = NULL; - CTextResolver* iTextResolver = CTextResolver::NewLC(); - TPtrC errorMsg; - errorMsg.Set(iTextResolver->ResolveErrorString(aError)); - result = CreateJavaString(*aJni, errorMsg); - CleanupStack::PopAndDestroy(); // iTextResolver - return result; -} - -JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_rt_legacy_NativeError__1getNativeErrorMessage -(JNIEnv* aJni, jclass /* aPeer */, jint aError) -{ - jstring result = NULL; - TRAP_IGNORE(result = getErrorL(aJni, aError)); - return result; -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/RJArray.cpp --- a/javauis/javalegacyutils/src/RJArray.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 1999-2000 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 "jutils.h" - -RJArray::RJArray(JNIEnv& aJni) - : iJni(aJni) -{ -} - - - -RJArray::~RJArray() -{ -} - - - -void* RJArray::GetPrimitiveArrayCriticalLC(jarray aJavaArray, TBool aMutable) -{ - iJavaArray = aJavaArray; - iArrayPtr = REINTERPRET_CAST(TUint8*, iJni.GetPrimitiveArrayCritical(aJavaArray, NULL)); - iMutable = aMutable; - User::LeaveIfNull(iArrayPtr); - CleanupStack::PushL(TCleanupItem(&CleanupArrayAccess, this)); - return iArrayPtr; -} - - - -void RJArray::CleanupArrayAccess(TAny* aRJArray) -{ - RJArray* array = STATIC_CAST(RJArray*, aRJArray); - array->ReleasePrimitiveArrayCritical(); -} - - - -void RJArray::ReleasePrimitiveArrayCritical() -{ - iJni.ReleasePrimitiveArrayCritical(iJavaArray, iArrayPtr, (iMutable ? 0 : JNI_ABORT)); -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/RJString.cpp --- a/javauis/javalegacyutils/src/RJString.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 1999-2000 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 "jutils.h" - -/** - * Constuctor taking a Java JNI string and converting it to an EPOC TPtrC. - */ -EXPORT_C RJString::RJString(JNIEnv& aJni, jstring aString) - : iJni(aJni), iString(aString) -{ - // Potential for a string to be NULL, but NULL cannot be passed into - // JNI methods, so must check. If string is NULL, will result in empty string - if (iString != NULL) - { - const jchar* ptr = aJni.GetStringChars(iString, NULL); - const jint len = aJni.GetStringLength(iString); - if (ptr) - { - Set(ptr, len); - } - } -} - - - -/** - * Frees up the JNI string resources, if they need to be freed. - */ -EXPORT_C RJString::~RJString() -{ - if (iString != NULL) - { - iJni.ReleaseStringChars(iString, this->Ptr()); - } -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/StringArrayUtils.cpp --- a/javauis/javalegacyutils/src/StringArrayUtils.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2003 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 "jutils.h" - - -void AddToJavaStringArrayL(JNIEnv& aJni, jobjectArray& aContainer, TInt aPosition, const TDesC& aString) -{ - jstring javaString = CreateJavaString(aJni, aString); - User::LeaveIfNull(javaString); - // - aJni.SetObjectArrayElement(aContainer, aPosition, javaString); - aJni.DeleteLocalRef(javaString); -} - - -EXPORT_C jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni, const CDesCArray& aNativeArray) -{ - jclass stringClass = aJni.FindClass("java/lang/String"); - User::LeaveIfNull(stringClass); - // - jobjectArray result = aJni.NewObjectArray(aNativeArray.Count(), stringClass, NULL); - if (result != NULL) - { - TPtrC item; - for (int i=0; iConstructL(aTimeOutNotify); - CleanupStack::Pop(); - return p; -} - -void CTimeOutTimer::ConstructL(MTimeOutNotify &aTimeOutNotify) -{ - iNotify=&aTimeOutNotify; - CTimer::ConstructL(); - CActiveScheduler::Add(this); -} - -void CTimeOutTimer::RunL() -// Timer request has completed, so notify the timer's owner -{ - iNotify->TimerExpired(); -} - -// End of File diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/CJavaEventServer.cpp --- a/javauis/javalegacyutils/src/eventserver/CJavaEventServer.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,481 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 -#include -#include -#include - -#include "JesServer.h" -#include "CJavaEventServer.h" - - - -const TInt KMaxUserName=64; -const TInt KMaxJesName=3+1+8+1+KMaxUserName+1+8; - - -class TJesName : public TBuf -{ -public: - TJesName(const TDesC& aUserName); - TJesName(const TDesC& aUserName,TInt aHandle); -private: - void Build(const TDesC& aUserName); -}; - -class TJesParam : public MEventServer -{ -public: - virtual void Started(TInt aError, RServer2 aServer) - { - iServerHandle = aServer; - iThread.RequestComplete(iStatus,aError); - } - virtual TAny* Arg() const - { - return iArg; - } -public: - RThread iThread; - RServer2 iServerHandle; - TRequestStatus* iStatus; - TAny* iArg; -}; - -class CJesSession : public CSession2 -{ - class TExecute - { - public: - inline TInt operator()() const; - private: - TInt(*iFunc)(TAny*,TAny*,TAny*,TAny*,TAny*,TAny*,TAny*,TAny*,TAny*); - TAny* iParam[9]; - }; -private: - void ServiceL(const RMessage2& aMessage); - static TInt ExecuteTrap(const TExecute& aExecute); -}; - -class CJesScheduler : public CActiveScheduler, public MJesShutdown -{ -public: - static TInt Create(RServer2& serverHandle); - virtual void Shutdown(); -private: - CJesScheduler(); - static void CreateL(RServer2& serverHandle); -private: - CJesServer iServer; -}; - -// Class TJesName - -// The thread name is made up of the user name, the process Id and -// the address of this object. - -_LIT(KName,"jes-"); - -TJesName::TJesName(const TDesC& aUserName) -// -// Construct the base Java Event Server name -// -{ - Build(aUserName); -} - -TJesName::TJesName(const TDesC& aUserName,TInt aHandle) -// -// Construct the full Java Event Server name -// -{ - Build(aUserName); - AppendNum(aHandle,EHex); -} - -void TJesName::Build(const TDesC& aUserName) -// -// Create the base of the server name -// -{ - Copy(KName); - TProcessId id(RProcess().Id()); - AppendNum(*reinterpret_cast(&id),EHex); - Append('-'); - Append(aUserName); - Append('@'); -} - - -// class RJess - -TInt RJess::Connect(RServer2& aServer) -// -// Establish an IPC session with the event server and share it -// -{ - TInt r=CreateSession(aServer, TVersion(), CJavaEventBase::ELastPriority + 1); - if (r==KErrNone) - { - r=ShareAuto(); - if (r!=KErrNone) - Close(); - } - return r; -} - -// class TJavaEventServer - -inline TJavaEventServer::TJavaEventServer(CJavaEventServer* aServer) - :iServer(aServer) -{} - -EXPORT_C TJavaEventServer TJavaEventServer::NewL(const TDesC& aName, TThreadFunction aServerThread, TAny* aServerArg) -{ - return CJavaEventServer::NewL(aName, aServerThread, aServerArg, 0, 0); -} - -EXPORT_C TJavaEventServer TJavaEventServer::NewL(const TDesC& aName, TThreadFunction aServerThread, TAny* aServerArg, - TUint aStackSize, RAllocator* aHeap) -{ - return CJavaEventServer::NewL(aName, aServerThread, aServerArg, aStackSize, aHeap); -} - -EXPORT_C void TJavaEventServer::Shutdown() -{ - iServer->Shutdown(); -} - -// class CJesServer - -EXPORT_C CJesServer::CJesServer(MJesShutdown* aShutdown): -// -// The Java Event Server shares the session between all thread clients -// - CServer2(0,ESharableSessions) - , iShutdown(aShutdown) -{ -} - -CJesServer::~CJesServer() -{ -} - -CSession2* CJesServer::NewSessionL(const TVersion& /*version*/, const RMessage2& /*message*/) const -{ - return new(ELeave) CJesSession(); -} - -void CJesServer::Shutdown() -{ - iShutdown.Start(); -} - - -// class CJesScheduler -CJesScheduler::CJesScheduler() - : iServer(this) -{ -} - -void CJesScheduler::Shutdown() -{ - CActiveScheduler::Stop(); -} - -void CJesScheduler::CreateL(RServer2& serverHandle) -{ - CJesScheduler* s=new(ELeave) CJesScheduler; - CActiveScheduler::Install(s); - s->iServer.StartL(KNullDesC); - serverHandle = s->iServer.Server(); -} - -TInt CJesScheduler::Create(RServer2& serverHandle) -// -// Create the Java Event thread scheduler and server -// -{ - TRAPD(r,CreateL(serverHandle)); - return r; -} - -// java-side -void CJavaEventServer::AddRef() -{ - iMutex.Wait(); - ++iRef; - iMutex.Signal(); -} - -// java-side -void CJavaEventServer::RemoveRef() -{ - iMutex.Wait(); - if ((--iRef == 0) && iShutdown) - { - iSession.Shutdown(); - } - iMutex.Signal(); -} - -// java-side - consider purging event queue. -void CJavaEventServer::Shutdown() -{ - iMutex.Wait(); - iShutdown=ETrue; - if (0 == iRef) - { - iSession.Shutdown(); - } - iMutex.Signal(); -} - -TInt CJavaEventServer::ServerThread(TAny* aParam) -// -// The thread function for the Java event server thread -// This initialises the thread environment before reporting success -// and then starting its scheduler -// -{ - MEventServer* server = static_cast(aParam); - - TInt err = KErrNoMemory; - - RServer2 serverHandle; - - CTrapCleanup* cleanup = CTrapCleanup::New(); - if (cleanup) - { - err = CJesScheduler::Create(serverHandle); - } - - server->Started(err, serverHandle); // don't touch server again - its gone. - server = NULL; - if (err==KErrNone) - { - CActiveScheduler::Start(); - } - delete CActiveScheduler::Current(); // will delete all objects - delete cleanup; - return 0; -} - -#ifndef JAVA_STACKSIZE -#define JAVA_STACKSIZE 0x2000 -#endif - -void CJavaEventServer::ConstructL(const TDesC& aUserName, TThreadFunction aServerThread, TAny* aServerArg, - TUint aStackSize, RAllocator* aHeap) -// -// Main construction of the event server -// -{ - User::LeaveIfError(iMutex.CreateLocal()); - - if (NULL == aServerThread) - { - // default thread function. - aServerThread = &ServerThread; - } - - TJesParam param; - param.iArg = aServerArg; - User::LeaveIfError(param.iThread.Duplicate(param.iThread,EOwnerProcess)); // make the thread handle process relative - CleanupClosePushL(param.iThread); - TRequestStatus s(KRequestPending); - param.iStatus=&s; - RThread js; - if (aStackSize == 0) - { - aStackSize = JAVA_STACKSIZE; - } - - TJesName name(aUserName,TJavaEventServer::Handle(this)); - User::LeaveIfError(js.Create(name,aServerThread,aStackSize,aHeap,¶m,EOwnerProcess)); -// js.SetPriority(EPriorityMore); - js.Resume(); - js.Close(); - User::WaitForRequest(s); // wait for signal from server thread - User::LeaveIfError(s.Int()); - CleanupStack::PopAndDestroy(); // param.iThread - User::LeaveIfError(iSession.Connect(param.iServerHandle)); -} - -CJavaEventServer::CJavaEventServer() -{ -} - -CJavaEventServer::~CJavaEventServer() -{ - iSession.Close(); - iMutex.Close(); -} - -CJavaEventServer* CJavaEventServer::NewL(const TDesC& aUserName,TThreadFunction aServerThread, TAny* aServerArg, - TUint aStackSize, RAllocator* aHeap) -{ - CJavaEventServer* self=new(ELeave) CJavaEventServer; - CleanupStack::PushL(self); - self->ConstructL(aUserName, aServerThread, aServerArg, aStackSize, aHeap); - CleanupStack::Pop(); - return self; -} - -// class CJavaEventBase - -void CJavaEventBase::Run(JNIEnv& aJni) -// -// Dispatch this event and destroy the event object -// -{ - CJavaEventSourceBase& source = Object(); - - // check if the event type is disposable before calling java callback - // because if it's reusable it can be destroyed during servicing process - TBool isDisposable = IsDisposable(); - - if (!source.IsDisposed() && !aJni.IsSameObject(source.Peer(),0)) - { - if (aJni.PushLocalFrame(16)==0) - { - Dispatch(aJni); - if (aJni.ExceptionCheck()) - { // Report any exceptions that were generated and clear them from the JNI environment - aJni.ExceptionDescribe(); - aJni.ExceptionClear(); - } - aJni.PopLocalFrame(0); - } - } - if (isDisposable) - { - delete this; - } - // Close must be called last, because it may result in the destruction of this - // event object if the event is a reusable event - source.Close(aJni); -} - -// class CJesSession - -inline TInt CJesSession::TExecute::operator()() const -{ - return iFunc(iParam[0],iParam[1],iParam[2],iParam[3],iParam[4],iParam[5],iParam[6],iParam[7],iParam[8]); -} - -TInt CJesSession::ExecuteTrap(const TExecute& aExecute) -// -// Execute the client function inside a trap harness -// -{ - TRAPD(r,aExecute()); - return r; -} - - -void CJesSession::ServiceL(const RMessage2& m) -// -// Invoke the requested client function -// -{ - switch (m.Function()) - { - case EJessExecute: - { - const TExecute& e = *static_cast(m.Ptr0()); - TInt result = e(); - m.Complete(result != KRequestPending ? result : KErrNotSupported); - } - break; - - case EJessExecuteTrap: - m.Complete(ExecuteTrap(*static_cast(m.Ptr0()))); - break; - - case EJessShutdown: - ((CJesServer*)Server())->Shutdown(); - m.Complete(KErrNone); - break; - } -} - -CJesShutdown::CJesShutdown(MJesShutdown* aShutdown) - : CActive(CActive::EPriorityStandard) - , iShutdown(aShutdown) -{ -} - -void CJesShutdown::Start() -{ - CActiveScheduler::Add(this); - iStatus=KRequestPending; - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); -} - -void CJesShutdown::RunL() -{ - ASSERT(iShutdown); - iShutdown->Shutdown(); - iShutdown = NULL; -} - -TInt CJesShutdown::RunError(TInt aError) -{ - if (aError == KLeaveExit) - { - return aError; - } - return KErrNone; -} - -void CJesShutdown::DoCancel() -{ - // nop -} - -// Helper method to trace output (int) to Java side, eg. System.out -void CJavaEventServer::Trace(JNIEnv& aJni, TInt value) -{ - jclass clazz = aJni.FindClass("com/symbian/lcdjava/lang/SystemExtensions"); - jmethodID method = aJni.GetStaticMethodID(clazz, "trace" , "(I)V"); - aJni.CallStaticVoidMethod(clazz, method, value); -} - -// Notify Java thread of a new event -void CJavaEventServer::NotifyJavaCall(TInt aEvent, TInt aPriority) -{ - CEventQueue::NotifyServer(aEvent, aPriority); -} - - -void CJavaEventServer::Cleanup(RArray& aServerHandles) -{ - CEventQueue::Cleanup(); - - // Loop through event server instances and remove each - for (TInt i = aServerHandles.Count() - 1; i >= 0; --i) - { - TInt handle = aServerHandles[i]; - aServerHandles.Remove(i); - delete JavaUnhand(handle); - } -} - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/CJavaEventSourceBase.cpp --- a/javauis/javalegacyutils/src/eventserver/CJavaEventSourceBase.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 -#include "CJavaEventServer.h" - -EXPORT_C CJavaEventSourceBase::CJavaEventSourceBase() -{} - -EXPORT_C CJavaEventSourceBase::~CJavaEventSourceBase() -{ - // Must never be deleted directly - ASSERT(iRef==-1); - if (iServer.Handle()) - { - iServer->RemoveRef(); - } -} - -EXPORT_C void CJavaEventSourceBase::ConstructL(JNIEnv& aJni,jobject aPeer,TJavaEventServer aServer) -// -// Create a weak global reference to the Java object for event dispatching -// -{ - iServer=aServer; - iServer->AddRef(); - iPeer=aJni.NewWeakGlobalRef(aPeer); - if (!iPeer) - User::Leave(KErrGeneral); // exception is thrown on return to Java -} - -EXPORT_C void CJavaEventSourceBase::FinalizeSvr() -// -// Default implementation for server-side finalization -// -{ -} - -EXPORT_C void CJavaEventSourceBase::FinalizeJni(JNIEnv&) -// -// Default implementation for Java-side finalization -// -{ -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/Close.cpp --- a/javauis/javalegacyutils/src/eventserver/Close.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 -#include - -void CJavaEventSourceBase::DoFinalize(CJavaEventSourceBase* aThis) -// -// Server-side invokation function for finalization -// -{ - aThis->FinalizeSvr(); -} - -EXPORT_C void CJavaEventSourceBase::Close(JNIEnv& aJni) -// -// Remove a reference to the object, this is either from Dispose(), -// or due to event dispatch. When no longer referenced, the object is -// destroyed completely. -// -{ - if (User::LockedDec(iRef)==0) - { - __ASSERT_DEBUG(IsDisposed(),User::Invariant()); // must have called Dispose() - // server side finalization - if (iServer.Handle()!=0) - { - ExecuteV(&CJavaEventSourceBase::DoFinalize,this); - } - // JNI object finalization - FinalizeJni(aJni); - // remove our own weak reference - if (iPeer) - aJni.DeleteWeakGlobalRef(iPeer); - // finally destroy the object - delete this; - } -} - -void CJavaEventSourceBase::OnVmClose() -// -// Remove a reference to the object, this is either from Dispose(), -// or due to event dispatch. When no longer referenced, the object is -// destroyed completely. -// -{ - if (User::LockedDec(iRef)==0) - { - __ASSERT_DEBUG(IsDisposed(),User::Invariant()); // must have called Dispose() - // server side finalization - if (iServer.Handle()!=0) - { - //ExecuteV(&CJavaEventSourceBase::DoFinalize,this); - } - - // finally destroy the object - delete this; - } -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/DoExecute.cpp --- a/javauis/javalegacyutils/src/eventserver/DoExecute.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 "CJavaEventServer.h" - -EXPORT_C TInt CJavaEventSourceBase::DoExecute(TAny* aFunc,...) -{ - return iServer->Session().Execute(&aFunc); -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/DoExecuteTrap.cpp --- a/javauis/javalegacyutils/src/eventserver/DoExecuteTrap.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 "CJavaEventServer.h" - -EXPORT_C TInt CJavaEventSourceBase::DoExecuteTrap(TAny* aFuncL,...) -{ - return iServer->Session().ExecuteTrap(&aFuncL); -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/J9MIDEventServer.cpp --- a/javauis/javalegacyutils/src/eventserver/J9MIDEventServer.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2006-2006 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 - -#include -#include - -#include "eventserverglobals.h" -#include "CJavaEventServer.h" -#include "com_nokia_mj_impl_rt_legacy_MemoryUtil.h" -#include "com_nokia_mj_impl_rt_legacy_EventProcessor.h" - -RArray& EventServerHandles(); //Must be consistent with implementation -//in MIDEventServer.cpp in jniutils - - -const TInt KQueueGranularity = 100; // Define iQueue default granularity -const TInt KCompressThreshold = 100; // Define number of processed events - - -void InitEventServer() -{ - TRAPD(err, CEventQueue::InitL()); - if (err != KErrNone) - { - User::Panic(_L("EventServer::can't initialize event queue"), err); - } -} - -// Cleanup the event server; called from Java event dispatch thread -void CleanupEventServer() -{ - CJavaEventServer::Cleanup(EventServerHandles()); -} - -// Dispatch event to Java, called from Java event dispatch thread -void RunJavaEventServer(JNIEnv* aJni, TInt aServer) -{ - CJavaEventBase* ev = (CJavaEventBase*) aServer; - if (aServer != KErrServerTerminated) - { - ev->Run(*aJni); - } -} - - -JNIEXPORT jlong JNICALL Java_com_nokia_mj_impl_rt_legacy_MemoryUtil__1getFreeRAMInKB(JNIEnv*, jclass) -{ - TInt mem = 0; - TInt err = HAL::Get(HALData::EMemoryRAMFree, mem); - if (err == KErrNone) - { - return mem / 1024; - } - else - { - return err; - } -} - -JNIEXPORT void JNICALL Java_com_nokia_mj_impl_rt_legacy_EventProcessor__1dispatchCallbacks(JNIEnv* aJni, jclass /*aClass*/, jint aThread) -{ - TInt eventServer; - // Loop for event dispatching - InitEventServer(); - while ((eventServer = CEventQueue::GetQueue(aThread)->GetNext()) != 0) - { - RunJavaEventServer(aJni, eventServer); - } -} - -JNIEXPORT void JNICALL Java_com_nokia_mj_impl_rt_legacy_EventProcessor__1exitThreads(JNIEnv*, jclass) -{ - CEventQueue::OnCloseThreads(); -} -// class CIntQueue -CIntQueue::CIntQueue() : iQueue(KQueueGranularity), iCompressCounter(0) -{ -} - -CIntQueue* CIntQueue::NewL() -{ - CIntQueue* self = NewLC(); - CleanupStack::Pop(self); - return self; -} - -CIntQueue* CIntQueue::NewLC() -{ - CIntQueue* self = new(ELeave) CIntQueue(); - CleanupStack::PushL(self); - self->ConstructL(); - - return self; -} - -void CIntQueue::ConstructL() -{ - iMutex.CreateLocal(); - iFull.CreateLocal(0); -} - -CIntQueue::~CIntQueue() -{ - iMutex.Close(); - iFull.Close(); - iQueue.Close(); -} - -// Add integer to the end of the queue -void CIntQueue::Enqueue(TInt aValue) -{ - iMutex.Wait(); // enter critical region - PutItem(aValue); // put new item to the buffer - iMutex.Signal(); // leave critical region - iFull.Signal(); // inform dispatcher about new event -} - -// Return integer from the beginning of the queue -TInt CIntQueue::Dequeue() -{ - iFull.Wait(); // decrement count of full slots - iMutex.Wait(); // enter critical region - TInt ret = RemoveItem(); // take item from the buffer - iMutex.Signal(); // leave critical region - - return ret; -} - -void CIntQueue::PutItem(TInt aValue) -{ - TInt err = iQueue.Append(aValue); // put new item to the buffer - __ASSERT_ALWAYS((err == KErrNone), User::Invariant()); -} - -TInt CIntQueue::RemoveItem() -{ - TInt ret = iQueue[0]; // take item from the buffer - iQueue.Remove(0); - - iCompressCounter++; - if (iCompressCounter == KCompressThreshold) - { - iQueue.GranularCompress(); - iCompressCounter = 0; - } - - return ret; -} - -TBool CIntQueue::IsEmpty() -{ - return (iQueue.Count() == 0); -} - -/* ******************************************** */ - -CEventQueue* CEventQueue::GetQueue(TInt aThread) -{ - return getEsStaticData()->mLocks[aThread]; -} - -CEventQueue::CEventQueue() -{ -} - -void CEventQueue::ConstructL() -{ - iEventQueue = CIntQueue::NewL(); -} - -CEventQueue::~CEventQueue() -{ - while (!iEventQueue->IsEmpty()) - { - TInt event = GetNext(); - if (event != KErrServerTerminated) - { - CJavaEventBase* ev = reinterpret_cast(event); - CJavaEventSourceBase& source = ev->Object(); - - if (ev->IsDisposable()) - { - delete ev; - } - source.OnVmClose(); - } - } - delete iEventQueue; -} - -// Notify that new event has been posted. Called from the native code. -// aEventServer is C++ pointer to event server object and aThreadNumber indicates the event type -// and therefore which dispatcher thread should handle it - -void CEventQueue::NotifyServer(TInt aEventServer, TInt aThreadNumber) -{ - ASSERT(aThreadNumber < KDispatchThreads); - - // Add event server of an event to the queue - GetQueue(aThreadNumber)->iEventQueue->Enqueue(aEventServer); - -} - -// Get the next event server from the queue; wait if there are no events to be dispatched -TInt CEventQueue::GetNext() -{ - return iEventQueue->Dequeue(); -} - -void CEventQueue::OnCloseThreads() -{ - //sends fake zero events to exit from native loop back to java - for (int i = 0; i < KDispatchThreads; i++) - { - GetQueue(i)->NewEvent(0); - } -} - -// Add event server of an event to the queue -void CEventQueue::NewEvent(TInt aEventServer) -{ - iEventQueue->Enqueue(aEventServer); -} - - -void CEventQueue::Cleanup() -{ - EventServerGlobals* esd = getEsStaticData(); - for (int i = 0; i < KDispatchThreads; i++) - { - delete esd->mLocks[i]; - esd->mLocks[i] = 0; - } -} - -void CEventQueue::InitL() -{ - EventServerGlobals* esd = getEsStaticData(); - for (int i = 0; i < KDispatchThreads; i++) - { - if (esd->mLocks[i] == 0) - { - CEventQueue* self = new(ELeave) CEventQueue(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - esd->mLocks[i] = self; - } - } -} - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/JniEnvWrapper.cpp --- a/javauis/javalegacyutils/src/eventserver/JniEnvWrapper.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2006-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 "eventserverglobals.h" -#include "JniEnvWrapper.h" -#include -#include - -EXPORT_C JNIEnv* JniEnvWrapper::GetValidJniRef() -{ - JNIEnv* aJni; - getEsStaticData()->mVm->AttachCurrentThreadAsDaemon((void**)&aJni, 0); - return aJni; -} - -void JniEnvWrapper::InitJavaVmRef(JNIEnv* aJni) -{ - JavaVM* vm = getEsStaticData()->mVm; - if (vm == NULL) - { - aJni->GetJavaVM(&getEsStaticData()->mVm); - } -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/MIDEventServer.cpp --- a/javauis/javalegacyutils/src/eventserver/MIDEventServer.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 -#include "eventserverglobals.h" -#include "com_nokia_mj_impl_rt_legacy_MIDEventServer.h" -#include "JniEnvWrapper.h" - -/* - * Class: com_symbian_epoc_midp_events_MIDEventServer - * Method: _createServer - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_rt_legacy_MIDEventServer__1createServer(JNIEnv* aJni, jobject, jstring aName) -{ - RJString name(*aJni,aName); - - JniEnvWrapper::InitJavaVmRef(aJni); - - TRAPD(h,h=TJavaEventServer::NewL(name).Handle()); - return h; -} - -JNIEXPORT void JNICALL Java_com_nokia_mj_impl_rt_legacy_MIDEventServer__1shutdown(JNIEnv*, jobject, jint aHandle) -{ - TJavaEventServer(aHandle).Shutdown(); -} - -// In polling builds we maintain a global record of all the event -// servers running in the system, held in a static RArray of integer -// handles. Event servers are added to the handle array by their -// Java side thread's run() method, which goes native below. -// -// Note that it is necessary for the RArray to be initialized -// by a function-scoped static in order for its constructor to -// get run reliably. - -RArray& EventServerHandles() -{ - return getEsStaticData()->mHandles; -} - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/Open.cpp --- a/javauis/javalegacyutils/src/eventserver/Open.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 -#include - -TBool CJavaEventSourceBase::Open() -// -// Add an extra reference to the object if it is not disposed -// Return true if we have gained a good reference, false if -// the object is awaiting destruction -// -{ - if (!IsDisposed()) - { - // Another thread may call Dispose() between the test for - // being disposed and the reference increment - // Thus we must check to see if the reference count before - // the increment was -1, in which case we must release the object - if (User::LockedInc(iRef)>=0) - return ETrue; - User::LockedDec(iRef); - } - return EFalse; -} - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/Panic.cpp --- a/javauis/javalegacyutils/src/eventserver/Panic.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 - -EXPORT_C void CJavaEventSourceBase::Panic(TInt aVal) -// -// Runtime check for oversized parameter lists in the Execute...() API -// -{ - _LIT(KJsClientPanic,"JES-interface"); - User::Panic(KJsClientPanic,aVal); -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/PostEvent.cpp --- a/javauis/javalegacyutils/src/eventserver/PostEvent.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 "CJavaEventServer.h" - -// class CJavaEventServer - -void CJavaEventServer::PostEvent(CJavaEventBase* aEvent, TInt aPriority) -// -// Post the event object to the event dispatcher. -// -// If the dispatcher is ready, then send it directly, otherwise -// add it to the event queue -// -{ - ASSERT(aEvent!=0); - ASSERT(aPriority >= 0 && aPriority <= CJavaEventBase::ELastPriority); - - NotifyJavaCall(reinterpret_cast(aEvent), aPriority); - -} - -// class CJavaEventSourceBase - -EXPORT_C TBool CJavaEventSourceBase::DoPostEvent(CJavaEventBase* aEvent, TInt aPriority) -// -// Post the event to the event dispatcher queue -// -// Can accept a NULL pointer, which assumes OOM has occurred -// -// If this event source has been disposed, the event is discarded -// and EFalse is returned to indicate that events should no longer -// be generated for this event source. -// -// Otherwise the event is passed to the event queue and ETrue is -// returned to indicate success. -// -{ - if (!aEvent) - return ETrue; - if (CheckEvent(aEvent) && Open()) - { - aEvent->iObject=this; - iServer->PostEvent(aEvent, aPriority); - return ETrue; - } - if (aEvent->IsDisposable()) - { - delete aEvent; - } - return EFalse; -} - -EXPORT_C TBool CJavaEventSourceBase::CheckEvent(CJavaEventBase* /*aEvent*/) -{ - return ETrue; -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/TConstructorBase.cpp --- a/javauis/javalegacyutils/src/eventserver/TConstructorBase.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 1999-2001 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 - -EXPORT_C CJavaEventSourceBase::TConstructorBase::TConstructorBase(CJavaEventSourceBase* aObject,JNIEnv& aJni) - :iObject(aObject),iJni(aJni) -{ - // This codescanner error is supressed "illegally" away. The reason is that: - // - The method is constructor, so it cannot be "L" method. - // - The possible leave is TRAPped correctly in mevents.h file in CJavaEventSource::New - // method. - CleanupStack::PushL(TCleanupItem(&TConstructorBase::Disposer,this)); // codescanner::leave -} - -void CJavaEventSourceBase::TConstructorBase::Disposer(TAny* aThis) -{ - TConstructorBase& t=*static_cast(aThis); - t.iObject->Dispose(t.iJni); -} diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/src/eventserver/eventserverglobals.cpp --- a/javauis/javalegacyutils/src/eventserver/eventserverglobals.cpp Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +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: -* -*/ - - -#include "eventserverglobals.h" - - -EventServerGlobals::EventServerGlobals() -{ - JELOG2(EUtils); - for (int i = 0; i < CEventQueue::KDispatchThreads; i++) - { - mLocks[i] = 0; - } - mVm = 0; -} - -#if defined(__WINSCW__) - -#include -EventServerGlobals* getEsStaticData() -{ - JELOG2(EUtils); - // Access the PLS of this process - EventServerGlobals* data = Pls(TUid::Uid(0x200211E0)); - return data; -} - -#else - -static EventServerGlobals* sData = 0; - -EventServerGlobals* getEsStaticData() -{ - JELOG2(EUtils); - if (sData == 0) - { - sData = new EventServerGlobals(); - } - return sData; -} -#endif - diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/subsystem.mk --- a/javauis/javalegacyutils/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/tsrc/README.txt --- a/javauis/javalegacyutils/tsrc/README.txt Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -1) Install the LegacyPrompts MIDlet found under ../data/ folder -2) Start the LegacyPrompt MIDlet and choose "Test" -> make sure a security prompt is displayed \ No newline at end of file diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/tsrc/data/LegacyPrompts.jad --- a/javauis/javalegacyutils/tsrc/data/LegacyPrompts.jad Thu Sep 02 20:20:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -MIDlet-1: LegacyPrompts, LegacyPrompts.png, LegacyPrompts -MIDlet-Jar-Size: 1443 -MIDlet-Jar-URL: LegacyPrompts.jar -MIDlet-Name: LegacyPrompts -MIDlet-Vendor: Unknown -MIDlet-Version: 1.0 -MicroEdition-Configuration: CLDC-1.1 -MicroEdition-Profile: MIDP-2.1 diff -r 773449708c84 -r 4ad59aaee882 javauis/javalegacyutils/tsrc/data/LegacyPrompts.jar Binary file javauis/javalegacyutils/tsrc/data/LegacyPrompts.jar has changed diff -r 773449708c84 -r 4ad59aaee882 javauis/javauis.pro --- a/javauis/javauis.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/javauis.pro Fri Sep 17 08:28:21 2010 +0300 @@ -22,6 +22,5 @@ SUBDIRS += mmapi_qt/build/javamobilemedia.pro SUBDIRS += amms_qt/build/javaamms.pro SUBDIRS += m3g_qt/build/javam3g.pro -SUBDIRS += javalegacyutils BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"coreui/build/bld.inf\"" BLD_INF_RULES.prj_extensions += "prj_extensions" diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/build/build.xml --- a/javauis/lcdui_qt/build/build.xml Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/build/build.xml Fri Sep 17 08:28:21 2010 +0300 @@ -71,6 +71,11 @@ javax/microedition/lcdui/TextBox.class, javax/microedition/lcdui/TextField.class, javax/microedition/lcdui/Ticker.class, + javax/microedition/lcdui/game/GameCanvas.class, + javax/microedition/lcdui/game/Layer.class, + javax/microedition/lcdui/game/LayerManager.class, + javax/microedition/lcdui/game/Sprite.class, + javax/microedition/lcdui/game/TiledLayer.class, com/nokia/mid/ui/DeviceControl.class, com/nokia/mid/ui/DirectGraphics.class, com/nokia/mid/ui/DirectGraphicsInvoker.class, diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java Fri Sep 17 08:28:21 2010 +0300 @@ -38,12 +38,12 @@ /** * Key name for paint listener. */ - private static final String PAINT_LISTENER = "paint"; + private static final String PAINT_LISTENER = "PaintListener"; /** * Key name for mouse listener. */ - private static final String MOUSE_LISTENER = "mouse"; + private static final String MOUSE_LISTENER = "MouseListener"; boolean noBackground; @@ -93,26 +93,20 @@ twips = Integer.parseInt(twipString); timeout = Integer.parseInt(timeoutString); - // Check for Negative Values - if((twips < 0) && (timeout < 0)) - { - setDefaultTapValues(); - } - + // If any one of the value is zero or Negative, set defaults. + // If both are zero disable the tapdetection. if((twips == 0) && (timeout == 0)) { disableTapDetection = true; } - - // if any one of the value is zero, set defaults - if(!((twips != 0) && (timeout != 0))) + else if((twips <= 0) || (timeout <= 0)) { setDefaultTapValues(); } } catch(NumberFormatException e) { - // Alpha Numeric Values of Timeouts and Timeout + // Alpha Numeric Values of Twips and Timeout setDefaultTapValues(); } } @@ -149,8 +143,7 @@ void eswtResizeControl(Item item, Control control, int width, int height) { super.eswtResizeControl(item, control, width, height); - CustomItem customitem = (CustomItem) item; - customitem.internalHandleSizeChanged(width, height); + ((CustomItem)item).internalHandleSizeChanged(width, height); } /** @@ -558,19 +551,25 @@ // If the rectange width falls outside the custom area if(LeftX < 0) + { LeftX = 0; + } int TopY = pointerDownY - (int) yPixelHeight; // If the rectange height falls outside the custom area if(TopY < 0) + { TopY = 0; + } int DownY = pointerDownY + (int) yPixelHeight; // If the rectange heightfalls outside the custom area. if(DownY > customItem.getContentHeight()) + { DownY = customItem.getContentHeight(); + } // Find the PointerUp is withing rectange if((x >= LeftX) && (x <= RightX)) diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java Fri Sep 17 08:28:21 2010 +0300 @@ -255,15 +255,18 @@ { // Implementation in child-classes // Logger.method(this, "handleShellActivatedEvent"); - if(ESWTUIThreadRunner.getInstance().getDisplay().getActiveShell() - != null) + if(!isShellActive) { - if(JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_BACKGROUND_EVENT, - JadAttributeUtil.VALUE_PAUSE)) - { - ApplicationUtils.getInstance().resumeApplication(); - } - isShellActive = true; + if(JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_BACKGROUND_EVENT, + JadAttributeUtil.VALUE_PAUSE)) + { + if(ESWTUIThreadRunner.getInstance().getDisplay().getActiveShell() + != null) + { + ApplicationUtils.getInstance().resumeApplication(); + } + isShellActive = true; + } } } @@ -276,11 +279,11 @@ // Logger.method(this, "handleShellDeActivatedEvent"); if(isShellActive) { - if(ESWTUIThreadRunner.getInstance().getDisplay().getActiveShell() - == null) + if(JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_BACKGROUND_EVENT, + JadAttributeUtil.VALUE_PAUSE)) { - if(JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_BACKGROUND_EVENT, - JadAttributeUtil.VALUE_PAUSE)) + if(ESWTUIThreadRunner.getInstance().getDisplay().getActiveShell() + == null) { ApplicationUtils.getInstance().pauseApplication(); isShellActive = false; diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java Fri Sep 17 08:28:21 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -110,7 +110,7 @@ private com.nokia.mj.impl.rt.support.Finalizer finalizer; - //Constructor + // Constructor Graphics(Buffer buffer, Rectangle clipRect) { finalizer = ((finalizer != null) ? finalizer @@ -123,14 +123,7 @@ finalizer = null; if(!ESWTUIThreadRunner.isDisposed()) { - ESWTUIThreadRunner.safeSyncExec(new Runnable() - { - public void run() - { - dispose(); - } - }); - + dispose(); } } } @@ -143,8 +136,6 @@ graphicsBuffer = buffer; } - - /** * Disposes objects with native counterparts */ @@ -162,14 +153,14 @@ */ 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); - } + 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() diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java Fri Sep 17 08:28:21 2010 +0300 @@ -38,20 +38,16 @@ } /** - * Creates LayoutObject for the given Item. + * Creates eSWT Control for the given Item. * - * @param item Item to layout - * @return LayoutObject + * @param item Item to create the Control + * @param parent parent to create the Control + * @return eSWT Control */ - LayoutObject getLayoutObject(Item item) - { - LayoutObject lo = formLayouter.getLayoutObject(item); - if(lo == null) - { - lo = new LayoutObject(item, eswtGetControl(formComposite, item)); - } - return lo; - } + Control createItemControl(Composite parent, Item item) + { + return eswtGetControl(parent, item); + } /** * Creates the eSWT CaptionedControl or Composite for this item. diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Fri Sep 17 08:28:21 2010 +0300 @@ -167,12 +167,27 @@ LayoutObject lo = formLayouter.getLayoutObject(item); if(lo == null) { - lo = new LayoutObject(item, eswtGetCaptionedControl(item)); + lo = new LayoutObject(item, createItemControl(formComposite, item)); } return lo; } /** + * Creates eSWT Control for the given Item. + * + * For any Item, if it is needed to create non CaptionControl based Control + * then this fucntion can be overrided in the derived Item Layouter. + * + * @param item Item to create the Control + * @param parent formComposite as parent to create the Control + * @return eSWT Control + */ + Control createItemControl(Composite parent, Item item) + { + return eswtGetCaptionedControl(parent, item); + } + + /** * Wraps this item's control in the necessary composites.
    * Based on the item, the result of this method can be: *

  • specific Control @@ -183,9 +198,9 @@ * * @param item Item to be layouted */ - final Control eswtGetCaptionedControl(Item item) + final Control eswtGetCaptionedControl(Composite parent, Item item) { - CaptionedControl captioned = new CaptionedControl(formComposite, SWT.VERTICAL); + CaptionedControl captioned = new CaptionedControl(parent, SWT.VERTICAL); if(item.hasLabel()) { captioned.setText(item.getLabel()); diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java Fri Sep 17 08:28:21 2010 +0300 @@ -37,20 +37,16 @@ } /** - * Creates LayoutObject for the given Item. + * Creates eSWT Control for the given Item. * - * @param item Item to layout - * @return LayoutObject + * @param item Item to create the Control + * @param parent parent to create the Control + * @return eSWT Control */ - LayoutObject getLayoutObject(Item item) - { - LayoutObject lo = formLayouter.getLayoutObject(item); - if(lo == null) - { - lo = new LayoutObject(item, eswtGetControl(formComposite, item)); - } - return lo; - } + Control createItemControl(Composite parent, Item item) + { + return eswtGetControl(parent, item); + } /** * eSWT specific calls to implement getControl. diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java Fri Sep 17 08:28:21 2010 +0300 @@ -164,7 +164,7 @@ // BUTTON LayoutObject lo = formLayouter.getLayoutObject(item); formLayouter.eswtAddNewLayoutObject(lo == null ? - new LayoutObject(item, eswtGetCaptionedControl(item)) : lo); + new LayoutObject(item, eswtGetCaptionedControl(formComposite, item)) : lo); } else { diff -r 773449708c84 -r 4ad59aaee882 javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/graphics/CommandBufferingTest.java --- a/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/graphics/CommandBufferingTest.java Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/graphics/CommandBufferingTest.java Fri Sep 17 08:28:21 2010 +0300 @@ -109,6 +109,7 @@ methodNames.addElement("testFillRect"); methodNames.addElement("testFillRoundRect"); methodNames.addElement("testFillTriangle"); + return methodNames; } @@ -129,7 +130,6 @@ else if(getName().equals("testFillRect")) testFillRect(); else if(getName().equals("testFillRoundRect")) testFillRoundRect(); else if(getName().equals("testFillTriangle")) testFillTriangle(); - else super.runTest(); } @@ -765,32 +765,332 @@ } } + /** + * Test drawString with two graphics + */ void testDrawString() { - + boolean pass = true; + String errorMsg = "Pixel check failed at: "; + + Graphics g1 = testImage.getGraphics(); + Graphics g2 = testImage.getGraphics(); + + // run different settings in the graphics instances + applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1); + applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2); + + final int anchor = Graphics.TOP | Graphics.LEFT; + + g1.drawString("I", 0, -9, anchor); + g2.drawString("I", -2, -3, anchor); + g1.drawString("I", 11, -9, anchor); + + // read image pixels to member array + readTestImagePixels(); + + //print(pixelData, testImageWidth); + + // Most of the points to validate are based on the values + // set by applyGraphicsSettings() -method + final int[] spotsToValidate = { + // "I" with large font 1 + 3, 1, BLUE, // top inside + 3, 19, BLUE, // bottom inside + 3, 0, WHITE, // top outside + + // "I" with small font + 10, 4, RED, // top inside + 10, 15, RED, // bottom inside + 10, 3, WHITE, // top outside + 10, 16, WHITE, // bottom outside + + // "I" with large font 2 + 15, 1, BLUE, // top inside + 15, 19, BLUE, // bottom inside + 15, 0, WHITE // top outside + }; + + // Validate test points against reference color + for(int i = 0; i < spotsToValidate.length ; i=i+3) + { + if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2])) + { + pass = false; + errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+ + ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : "; + } + } + + if(!pass) + { + fail(errorMsg); + } } + /** + * Test fillArc with two graphics + */ void testFillArc() { - + boolean pass = true; + String errorMsg = "Pixel check failed at: "; + Graphics g1 = testImage.getGraphics(); + Graphics g2 = testImage.getGraphics(); + + // run different settings in the graphics instances + applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1); + applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2); + + g1.fillArc(0, 0, 8, 8, 0, 180); + g2.fillArc(0, 0, 8, 8, 0, 180); + g1.fillArc(0, 8, 8, 8, 0, 180); + + // read image pixels to member array + readTestImagePixels(); + + // Most of the points to validate are based on the values + // set by applyGraphicsSettings() -method + final int[] spotsToValidate = { + 2, 8, BLUE, // Starting point of the first arc + 8, 8, BLUE, // end point + 5, 6, BLUE, // tip of the arc + 11, 7, RED, // start arc 2 + 17, 7, RED, // end arc 2 + 14, 5, RED, // tip of arc 2 + 2, 16, BLUE, // start arc 3 + 8, 16, BLUE, // end arc 3 + 5, 14, BLUE, // tip of arc 3 + 1, 1, WHITE // one point to validate that whole image is not filled + }; + + // Validate test points against reference color + for(int i = 0; i < spotsToValidate.length ; i=i+3) + { + if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2])) + { + pass = false; + errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+ + ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : "; + } + } + + if(!pass) + { + fail(errorMsg); + } } + /** + * Test fillRect with two graphics + */ void testFillRect() { - + boolean pass = true; + String errorMsg = "Pixel check failed at: "; + + Graphics g1 = testImage.getGraphics(); + Graphics g2 = testImage.getGraphics(); + + // run different settings in the graphics instances + applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1); + applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2); + + g1.fillRect(0, 0, 6, 6); + g2.fillRect(0, 0, 6, 6); + g1.fillRect(0, 8, 3, 3); + + // read image pixels to member array + readTestImagePixels(); + + // Most of the points to validate are based on the values + // set by applyGraphicsSettings() -method + final int[] spotsToValidate = { + // filled rectangle 1 + 1, 5, BLUE, // top-left corner of rectangle 1 + 6, 5, BLUE, // top-right corner of rectangle 1 + 1, 10, BLUE, // bottom-left corner of rectangle 1 + 6, 10, BLUE, // bottom-right corner of rectangle 1 + + 0, 7, WHITE, // Left border (outside) of rectangle 1 + 7, 7, WHITE, // Right border (outside) of rectangle 1 + 3, 4, WHITE, // Top border (outside) of rectangle 1 + 3, 11, WHITE, // Bottom border (outside) of rectangle 1 + + // filled rectangle 2 + 10, 4, RED, // top-left corner of rectangle 2 + 15, 4, RED, // top-right corner of rectangle 2 + 10, 9, RED, // bottom-left corner of rectangle 2 + 15, 9, RED, // bottom-right corner of rectangle 2 + + 9, 6, WHITE, // Left border (outside) of rectangle 2 + 16, 6, WHITE, // Right border (outside) of rectangle 2 + 12, 3, WHITE, // Top border (outside) of rectangle 2 + 14, 10, WHITE, // Bottom border (outside) of rectangle 2 + + // filled rectangle 3 + 1, 13, BLUE, // top-left corner of rectangle 3 + 3, 13, BLUE, // top-right corner of rectangle 3 + 1, 15, BLUE, // bottom-left corner of rectangle 3 + 3, 15, BLUE, // bottom-right corner of rectangle 3 + + 0, 14, WHITE, // Left border (outside) of rectangle 3 + 4, 14, WHITE, // Right border (outside) of rectangle 3 + 3, 12, WHITE, // Top border (outside) of rectangle 3 + 3, 16, WHITE, // Bottom border (outside) of rectangle 3 + }; + + // Validate test points against reference color + for(int i = 0; i < spotsToValidate.length ; i=i+3) + { + if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2])) + { + pass = false; + errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+ + ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : "; + } + } + + if(!pass) + { + fail(errorMsg); + } } + /** + * Test fillRoundRect with two graphics + */ void testFillRoundRect() { - + boolean pass = true; + String errorMsg = "Pixel check failed at: "; + + Graphics g1 = testImage.getGraphics(); + Graphics g2 = testImage.getGraphics(); + + // run different settings in the graphics instances + applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1); + applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2); + + g1.fillRoundRect(0, 0, 6, 6, 2, 2); + g2.fillRoundRect(0, 0, 6, 6, 2, 2); + g1.fillRoundRect(0, 8, 5, 5, 2, 2); + + // read image pixels to member array + readTestImagePixels(); + + // Most of the points to validate are based on the values + // set by applyGraphicsSettings() -method + final int[] spotsToValidate = { + // rectangle 1 + 1, 6, BLUE, // left side of rectangle 1 + 6, 6, BLUE, // right side of rectangle 1 + 3, 5, BLUE, // top side of rectangle 1 + 3, 10, BLUE, // bottom side of rectangle 1 + + 0, 7, WHITE, // Left border (outside) of rectangle 1 + 7, 7, WHITE, // Right border (outside) of rectangle 1 + 3, 4, WHITE, // Top border (outside) of rectangle 1 + 3, 11, WHITE, // Bottom border (outside) of rectangle 1 + + // rectangle 2 + 10, 6, RED, // left side of rectangle 2 + 15, 5, RED, // right side of rectangle 2 + 12, 4, RED, // top side of rectangle 2 + 12, 9, RED, // bottom side corner of rectangle 2 + + 9, 6, WHITE, // Left border (outside) of rectangle 2 + 16, 6, WHITE, // Right border (outside) of rectangle 2 + 12, 3, WHITE, // Top border (outside) of rectangle 2 + 14, 10, WHITE, // Bottom border (outside) of rectangle 2 + + // rectangle 3 + 1, 15, BLUE, // left side of of rectangle 3 + 5, 14, BLUE, // right side of of rectangle 3 + 2, 13, BLUE, // top side of rectangle 3 + 3, 17, BLUE, // bottom side of rectangle 3 + + 0, 14, WHITE, // Left border (outside) of rectangle 3 + 6, 14, WHITE, // Right border (outside) of rectangle 3 + 3, 12, WHITE, // Top border (outside) of rectangle 3 + 3, 18, WHITE, // Bottom border (outside) of rectangle 3 + }; + + // Validate test points against reference color + for(int i = 0; i < spotsToValidate.length ; i=i+3) + { + if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2])) + { + pass = false; + errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+ + ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : "; + } + } + + if(!pass) + { + fail(errorMsg); + } } + /** + * Test fillTriangle with two graphics + */ void testFillTriangle() { - + boolean pass = true; + String errorMsg = "Pixel check failed at: "; + + Graphics g1 = testImage.getGraphics(); + Graphics g2 = testImage.getGraphics(); + + // run different settings in the graphics instances + applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1); + applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2); + + g1.fillTriangle(0, 0, 5, 6, 5, 0); + g2.fillTriangle(0, 0, 5, 6, 5, 0); + g1.fillTriangle(0, 8, 5, 14, 5, 8); + + // read image pixels to member array + readTestImagePixels(); + + // Most of the points to validate are based on the values + // set by applyGraphicsSettings() -method + final int[] spotsToValidate = { + // triangle 1 + 1, 5, BLUE, // top-left + 6, 5, BLUE, // top-right + 4, 4, WHITE, // outside near triangle 1 + + // triangle 2 + 10, 4, RED, // top-left + 15, 4, RED, // top-right + 13, 3, WHITE, // outside near triangle 1 + + // triangle 3 + 1, 13, BLUE, // top-left + 6, 13, BLUE, // top-right + 4, 12, WHITE, // outside near triangle 1 + }; + + // Validate test points against reference color + for(int i = 0; i < spotsToValidate.length ; i=i+3) + { + if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2])) + { + pass = false; + errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+ + ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : "; + } + } + + if(!pass) + { + fail(errorMsg); + } } - private void applyGraphicsSettings(Graphics g, int settings) { @@ -801,6 +1101,7 @@ g.setColor(BLUE); g.translate(1, 5); g.setStrokeStyle(Graphics.DOTTED); + g.setFont(font); } else if(settings == GRAPHICS_SETTINGS_2) { @@ -808,6 +1109,7 @@ g.setColor(RED); g.translate(10, 4); g.setStrokeStyle(Graphics.SOLID); + g.setFont(font); } } diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/inc/cmmadisplay.h --- a/javauis/mmapi_qt/baseline/inc/cmmadisplay.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/inc/cmmadisplay.h Fri Sep 17 08:28:21 2010 +0300 @@ -25,7 +25,6 @@ #include "mmafunctionserver.h" #include "qwidget.h" #include "jni.h" -#include "jutils.h" #include "mmmaguiplayer.h" // FORWARD DECLARATIONS diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp --- a/javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -16,8 +16,6 @@ */ #include -#include - #include "com_nokia_microedition_media_protocol_EMCSourceInfo.h" #include "cmmamanager.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp --- a/javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -17,7 +17,6 @@ #include -#include #include "cmmaoutputstream.h" #include "mmmaeventposter.h" #include "cmmaoutputstreamevent.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/cmmaplayer.cpp --- a/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -18,8 +18,6 @@ // INCLUDE FILES #include -#include - #include "cmmaplayer.h" #include "mmafunctionserver.h" #include "cmmadurationupdater.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp --- a/javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -17,8 +17,6 @@ #include -#include - #include "mmafunctionserver.h" #include "cmmasourcestream.h" #include "cmmasourcestreamevent.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp --- a/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -20,8 +20,6 @@ #include //#include -#include - #include "com_nokia_microedition_media_control_VideoControl.h" #include "cmmavideocontrol.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/managerimpl.cpp --- a/javauis/mmapi_qt/baseline/src/managerimpl.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/managerimpl.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -17,8 +17,6 @@ #include -#include - #include "com_nokia_microedition_media_ManagerImpl.h" #include "cmmamanager.h" #include "cmmaplayer.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/recordcontrol.cpp --- a/javauis/mmapi_qt/baseline/src/recordcontrol.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/recordcontrol.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -18,8 +18,6 @@ #include -#include - #include "com_nokia_microedition_media_control_RecordControl.h" #include "mmafunctionserver.h" #include "cmmarecordcontrol.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/baseline/src/videocontrol.cpp --- a/javauis/mmapi_qt/baseline/src/videocontrol.cpp Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/videocontrol.cpp Fri Sep 17 08:28:21 2010 +0300 @@ -25,8 +25,6 @@ #include "cmmadeleterefevent.h" #include -#include - //#include //#include #include "s60commonutils.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/mmapi_qt/conf/mobilemedia.confml Binary file javauis/mmapi_qt/conf/mobilemedia.confml has changed diff -r 773449708c84 -r 4ad59aaee882 javauis/nokiasound/build/javanokiasound.pro --- a/javauis/nokiasound/build/javanokiasound.pro Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/nokiasound/build/javanokiasound.pro Fri Sep 17 08:28:21 2010 +0300 @@ -22,7 +22,7 @@ LIBS += -lcenrepnotifhandler \ -lcentralrepository \ -lmediaclientaudio \ - -lcommonengine \ + -lCommonEngine \ -ljavautils include(../../../build/omj.pri) diff -r 773449708c84 -r 4ad59aaee882 javauis/nokiasound/inc/CMIDSound.h --- a/javauis/nokiasound/inc/CMIDSound.h Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/nokiasound/inc/CMIDSound.h Fri Sep 17 08:28:21 2010 +0300 @@ -17,7 +17,6 @@ // INCLUDES -#include #include #include #include "MMIDEventSender.h" diff -r 773449708c84 -r 4ad59aaee882 javauis/subsystem.mk --- a/javauis/subsystem.mk Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/subsystem.mk Fri Sep 17 08:28:21 2010 +0300 @@ -28,10 +28,8 @@ # # Common legacy utilities # -SUBSYSTEMS += javalegacyutils - -SYMBIAN_ONLY += javalegacyutils nokiasound/build +SYMBIAN_ONLY += nokiasound/build diff -r 773449708c84 -r 4ad59aaee882 javauis/subsystem_akn.mk --- a/javauis/subsystem_akn.mk Thu Sep 02 20:20:40 2010 +0300 +++ b/javauis/subsystem_akn.mk Fri Sep 17 08:28:21 2010 +0300 @@ -32,13 +32,13 @@ eswt_akn/eswtphysics/group SUBSYSTEMS += \ + javalegacyutils \ lcdui_akn ifdef RD_JAVA_S60_RELEASE_5_0_IAD SUBSYSTEMS += ptivariation_akn endif - # # Additional dependencies between the components # diff -r 773449708c84 -r 4ad59aaee882 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 773449708c84 -r 4ad59aaee882 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 17 08:28:21 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 773449708c84 -r 4ad59aaee882 rom/installerodclist30 --- a/rom/installerodclist30 Thu Sep 02 20:20:40 2010 +0300 +++ b/rom/installerodclist30 Fri Sep 17 08:28:21 2010 +0300 @@ -10,7 +10,6 @@ javamidpruntime.odc javainstaller.odc javainstallerui.odc -javalegacyutils.odc javapushregistry.odc javaruntimeui.odc javasecurity.odc diff -r 773449708c84 -r 4ad59aaee882 rom/java_2_2.iby --- a/rom/java_2_2.iby Thu Sep 02 20:20:40 2010 +0300 +++ b/rom/java_2_2.iby Fri Sep 17 08:28:21 2010 +0300 @@ -345,6 +345,9 @@ 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 +// CentralRepository API +file=ABI_DIR\BUILD_DIR\javacentrep.dll SHARED_LIB_DIR\javacentrep.dll +data=JAVA_VM_RES_BLD\javacentrep.odc JAVA_VM_RES_IMG\javacentrep.odc /////////////////// // Miscellaneous // diff -r 773449708c84 -r 4ad59aaee882 rom/java_3_1.iby --- a/rom/java_3_1.iby Thu Sep 02 20:20:40 2010 +0300 +++ b/rom/java_3_1.iby Fri Sep 17 08:28:21 2010 +0300 @@ -153,10 +153,6 @@ /*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 // @@ -341,6 +337,10 @@ 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 +// CentralRepository API +file=ABI_DIR\BUILD_DIR\javacentrep.dll SHARED_LIB_DIR\javacentrep.dll +data=JAVA_VM_RES_BLD\javacentrep.odc JAVA_VM_RES_IMG\javacentrep.odc + /////////////////// // Miscellaneous // /////////////////// diff -r 773449708c84 -r 4ad59aaee882 rom/midpodclist --- a/rom/midpodclist Thu Sep 02 20:20:40 2010 +0300 +++ b/rom/midpodclist Fri Sep 17 08:28:21 2010 +0300 @@ -41,4 +41,5 @@ javawebservices.odc javawma.odc javawmamms.odc +javacentrep.odc resources.jar diff -r 773449708c84 -r 4ad59aaee882 rom/midpodclist30 --- a/rom/midpodclist30 Thu Sep 02 20:20:40 2010 +0300 +++ b/rom/midpodclist30 Fri Sep 17 08:28:21 2010 +0300 @@ -36,5 +36,6 @@ javawmamms.odc openlcdui.odc javanokiaui.odc +javacentrep.odc resources.jar