# HG changeset patch # User hgs # Date 1283422979 -10800 # Node ID 63b81d8075427e2763819ec61267be94d0130a2f # Parent 0ea12c182930fc39b5cde194b0cd6c4808054a3d v2.2.13_1 diff -r 0ea12c182930 -r 63b81d807542 build/Makefile.defs --- a/build/Makefile.defs Mon Aug 23 14:24:31 2010 +0300 +++ b/build/Makefile.defs Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/Makefile.project --- a/build/Makefile.project Mon Aug 23 14:24:31 2010 +0300 +++ b/build/Makefile.project Thu Sep 02 13:22:59 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 @@ -174,13 +178,6 @@ ifdef RD_JAVA_USIF_ENABLED SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK = 1 PROJECT_DEFINES += SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK - # Following flag enables application registrations to USIF - # and disables application registrations to AppArc. - PROJECT_DEFINES += RD_JAVA_USIF_APP_REG - # Following flag enables application notifications to AppArc. - PROJECT_DEFINES += RD_JAVA_USIF_NOTIFY_APP_ARC - # Following flag enables installation progress notifications through USIF. - PROJECT_DEFINES += RD_JAVA_USIF_NOTIFY_PROGRESS endif # Java proximity Listener support exsist in 9.2 only(can not be used if 5.0 untill IAD dependecy mentioned) @@ -191,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 0ea12c182930 -r 63b81d807542 build/Makefile.subsystem --- a/build/Makefile.subsystem Mon Aug 23 14:24:31 2010 +0300 +++ b/build/Makefile.subsystem Thu Sep 02 13:22:59 2010 +0300 @@ -188,6 +188,11 @@ bld.inf: $(MAKE) -f subsystem.mk makestubs qmake +# Use Carbide CodeScanner to list high-level issues +codescanner: +ifneq ($(call PATHSEARCH,codescanner.exe),) + $(call CODESCANNER,.) +endif # Symbian SBS ------------------------------ ifdef USESBS diff -r 0ea12c182930 -r 63b81d807542 build/buildutils/checkwarnings.py --- a/build/buildutils/checkwarnings.py Mon Aug 23 14:24:31 2010 +0300 +++ b/build/buildutils/checkwarnings.py Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/buildutils/distribution.policy.s60.configuration.txt --- a/build/buildutils/distribution.policy.s60.configuration.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/build/buildutils/distribution.policy.s60.configuration.txt Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/buildutils/ver2binver.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/buildutils/ver2binver.py Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/makefile --- a/build/makefile Mon Aug 23 14:24:31 2010 +0300 +++ b/build/makefile Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/makefile.javaversion --- a/build/makefile.javaversion Mon Aug 23 14:24:31 2010 +0300 +++ b/build/makefile.javaversion Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/omj.pri --- a/build/omj.pri Mon Aug 23 14:24:31 2010 +0300 +++ b/build/omj.pri Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/properties.xml --- a/build/properties.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/build/properties.xml Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/sis/java_2_0.pkg --- a/build/sis/java_2_0.pkg Mon Aug 23 14:24:31 2010 +0300 +++ b/build/sis/java_2_0.pkg Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/sis/java_3_1.pkg --- a/build/sis/java_3_1.pkg Mon Aug 23 14:24:31 2010 +0300 +++ b/build/sis/java_3_1.pkg Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/symbian_uids.pri --- a/build/symbian_uids.pri Mon Aug 23 14:24:31 2010 +0300 +++ b/build/symbian_uids.pri Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 build/templates/nokia_pkgdef_template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/templates/nokia_pkgdef_template.xml Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0ea12c182930 -r 63b81d807542 build/templates/pkgdef_template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/templates/pkgdef_template.xml Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0ea12c182930 -r 63b81d807542 build/templates/pkgmap_template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/templates/pkgmap_template.xml Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 0ea12c182930 -r 63b81d807542 build/unittest.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/unittest.properties Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,23 @@ + + + +no.rommizing = true +no.collection.update = true diff -r 0ea12c182930 -r 63b81d807542 build/utilities.xml --- a/build/utilities.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/build/utilities.xml Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 inc/build_defines.hrh --- a/inc/build_defines.hrh Mon Aug 23 14:24:31 2010 +0300 +++ b/inc/build_defines.hrh Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 inc/build_defines.pri --- a/inc/build_defines.pri Mon Aug 23 14:24:31 2010 +0300 +++ b/inc/build_defines.pri Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 inc/java.txt --- a/inc/java.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/inc/java.txt Thu Sep 02 13:22:59 2010 +0300 @@ -1,1 +1,1 @@ -2.2.11 +2.2.13 diff -r 0ea12c182930 -r 63b81d807542 javacommons/fileutils/build/javafileutils.pro --- a/javacommons/fileutils/build/javafileutils.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/fileutils/build/javafileutils.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/fileutils/tsrc/fileutilstestinit/build/javafileutilstestinit.pro --- a/javacommons/fileutils/tsrc/fileutilstestinit/build/javafileutilstestinit.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/fileutils/tsrc/fileutilstestinit/build/javafileutilstestinit.pro Thu Sep 02 13:22:59 2010 +0300 @@ -21,7 +21,6 @@ symbian { TARGET.CAPABILITY = all -tcb - INCLUDEPATH += /epoc32/include/caf LIBS += -lcaf -lcafutils -lefsrv -lDrmParsers -lDRMServerInterfaces } diff -r 0ea12c182930 -r 63b81d807542 javacommons/gcfprotocols/file/build/javafile.pro --- a/javacommons/gcfprotocols/file/build/javafile.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/gcfprotocols/file/build/javafile.pro Thu Sep 02 13:22:59 2010 +0300 @@ -20,7 +20,7 @@ CONFIG -= qt symbian { - LIBS+= -leuser -lefsrv -lPlatformEnv + LIBS+= -leuser -lefsrv -lplatformenv } include(../../../../build/omj.pri) diff -r 0ea12c182930 -r 63b81d807542 javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java --- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java Thu Sep 02 13:22:59 2010 +0300 @@ -95,7 +95,17 @@ public String toString() { - return "javax.microedition.io.FileProtocolPermission"; + if (intent.equals("read")) + { + return "javax.microedition.io.Connector.file.read"; + } + + if (intent.equals("write")) + { + return "javax.microedition.io.Connector.file.write"; + } + + return null; } /** diff -r 0ea12c182930 -r 63b81d807542 javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/gcf/protocol/ssl/SSLPermissionImpl.java --- a/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/gcf/protocol/ssl/SSLPermissionImpl.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/gcfprotocols/secureconnection/javasrc/com/nokia/mj/impl/gcf/protocol/ssl/SSLPermissionImpl.java Thu Sep 02 13:22:59 2010 +0300 @@ -55,7 +55,7 @@ public String toString() { - return "javax.microedition.io.SSLProtocolPermission"; + return "javax.microedition.io.Connector.ssl"; } public boolean implies(Permission p) diff -r 0ea12c182930 -r 63b81d807542 javacommons/gcfprotocols/socket/socket/inc/apnsettings.h --- a/javacommons/gcfprotocols/socket/socket/inc/apnsettings.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/inc/apnsettings.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/gcfprotocols/socket/socket/src.s60/apnsettings.cpp --- a/javacommons/gcfprotocols/socket/socket/src.s60/apnsettings.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/src.s60/apnsettings.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp --- a/javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/javaenv/build/javaenv.pro --- a/javacommons/javaenv/build/javaenv.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/javaenv/build/javaenv.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/data/att_operatorextra.txt --- a/javacommons/security/data/att_operatorextra.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/att_operatorextra.txt Thu Sep 02 13:22:59 2010 +0300 @@ -36,5 +36,7 @@ grant assigned { permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read"; permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; permission javax.microedition.midlet.AutoStartPermission; } \ No newline at end of file diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/data/msa_manufacturer.txt --- a/javacommons/security/data/msa_manufacturer.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/msa_manufacturer.txt Thu Sep 02 13:22:59 2010 +0300 @@ -31,10 +31,18 @@ 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 { permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read"; permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; permission javax.microedition.midlet.AutoStartPermission; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/data/msa_operator.txt --- a/javacommons/security/data/msa_operator.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/msa_operator.txt Thu Sep 02 13:22:59 2010 +0300 @@ -31,10 +31,18 @@ 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 { permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read"; permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; permission javax.microedition.midlet.AutoStartPermission; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/data/msa_trustedthirdparty.txt --- a/javacommons/security/data/msa_trustedthirdparty.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/msa_trustedthirdparty.txt Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/data/msa_untrusted.txt --- a/javacommons/security/data/msa_untrusted.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/msa_untrusted.txt Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/data/s60_manufacturer.txt --- a/javacommons/security/data/s60_manufacturer.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/s60_manufacturer.txt Thu Sep 02 13:22:59 2010 +0300 @@ -31,10 +31,18 @@ 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 { permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read"; permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; permission javax.microedition.midlet.AutoStartPermission; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/data/s60_operator.txt --- a/javacommons/security/data/s60_operator.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/s60_operator.txt Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/data/s60_trustedthirdparty.txt --- a/javacommons/security/data/s60_trustedthirdparty.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/s60_trustedthirdparty.txt Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/data/s60_untrusted.txt --- a/javacommons/security/data/s60_untrusted.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/data/s60_untrusted.txt Thu Sep 02 13:22:59 2010 +0300 @@ -55,11 +55,23 @@ 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 { + +grant assigned "Location" { permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java --- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java Thu Sep 02 13:22:59 2010 +0300 @@ -52,12 +52,13 @@ String name, String target, String actionList, + int type, SecurityPolicyPermissionSettings settings) { this.name = name; this.target = target; this.actionList = actionList; - this.type = USER_TYPE; + this.type = type; this.settings = settings; } @@ -65,13 +66,18 @@ String name, String target, String actionList, + SecurityPolicyPermissionSettings settings) + { + this(name, target, actionList, USER_TYPE, settings); + } + + public SecurityPolicyPermission( + String name, + String target, + String actionList, int type) { - this.name = name; - this.target = target; - this.actionList = actionList; - // Check type - this.type = type; + this(name, target, actionList, type, null); } public int getType() @@ -145,7 +151,7 @@ return oStream.toByteArray(); } - public static SecurityPolicyPermission getFromBytes(byte[] buf) + public static SecurityPolicyPermission getFromBytes(byte[] buf, boolean activeSettings) { int type = buf[SecurityPolicy.index]; SecurityPolicy.index++; @@ -155,10 +161,12 @@ SecurityPolicy.index += nameLen; String target = readString(buf); String actionList = readString(buf); - if (type == USER_TYPE) + if (type == USER_TYPE || type == USER_ASSIGNED_TYPE) { - return new SecurityPolicyPermission(name, target, actionList, - SecurityPolicyPermissionSettings.getFromBytes(buf)); + return new SecurityPolicyPermission( + name, target, actionList, type, + SecurityPolicyPermissionSettings.getFromBytes( + buf, activeSettings)); } return new SecurityPolicyPermission(name, target, actionList, type); } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermissionSettings.java --- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermissionSettings.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermissionSettings.java Thu Sep 02 13:22:59 2010 +0300 @@ -30,15 +30,37 @@ private String name; private int currentInteractionMode; private int[] allowedInteractionModes; + private boolean active; + + public SecurityPolicyPermissionSettings( + String name) + { + this(name, UNDEFINED_INTERACTION_MODE, null, true); + } public SecurityPolicyPermissionSettings( String name, int currentInteractionMode, int[] allowedInteractionModes) { + this(name, currentInteractionMode, allowedInteractionModes, true); + } + + public SecurityPolicyPermissionSettings( + String name, + int currentInteractionMode, + int[] allowedInteractionModes, + boolean activeSettings) + { this.name = name; this.currentInteractionMode = currentInteractionMode; this.allowedInteractionModes = allowedInteractionModes; + this.active = activeSettings; + } + + public boolean isActive() + { + return active; } public String getName() @@ -166,7 +188,7 @@ return oStream.toByteArray(); } - public static SecurityPolicyPermissionSettings getFromBytes(byte[] buf) + public static SecurityPolicyPermissionSettings getFromBytes(byte[] buf, boolean activeSettings) { int nameLen = buf[SecurityPolicy.index]; SecurityPolicy.index++; @@ -181,7 +203,7 @@ allowedInteractionModes[i] = buf[SecurityPolicy.index]; SecurityPolicy.index++; } - return new SecurityPolicyPermissionSettings(name, currentInteractionMode, allowedInteractionModes); + return new SecurityPolicyPermissionSettings(name, currentInteractionMode, allowedInteractionModes, activeSettings); } } diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermission.java --- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermission.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermission.java Thu Sep 02 13:22:59 2010 +0300 @@ -26,6 +26,7 @@ public static final int USER_TYPE = 1; public static final int ALLOWED_TYPE = 2; public static final int ASSIGNED_TYPE = 3; + public static final int USER_ASSIGNED_TYPE = 4; public String getName(); public String getTarget(); diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermissionImpl.java --- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermissionImpl.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PolicyBasedPermissionImpl.java Thu Sep 02 13:22:59 2010 +0300 @@ -33,17 +33,27 @@ String name, String target, String actionList, + int type, UserSecuritySettings userSettings, PermissionBase securityPromptDetails) { super(name, target, actionList, userSettings, securityPromptDetails); + this.type = type; + } - this.type = USER_TYPE; + public PolicyBasedPermissionImpl( + String name, + String target, + String actionList, + int type, + UserSecuritySettings userSettings) + { + this(name, target, actionList, type, userSettings, null); } public PolicyBasedPermissionImpl(PolicyBasedPermission p) { - this(p.getName(), p.getTarget(), p.getActionList(), + this(p.getName(), p.getTarget(), p.getActionList(), p.getType(), (p.getUserSecuritySettings() != null ? new UserSecuritySettingsImpl(p.getUserSecuritySettings().getName(), p.getUserSecuritySettings().getCurrentInteractionMode(), @@ -57,7 +67,7 @@ String actionList, UserSecuritySettings userSettings) { - this(name, target, actionList, userSettings, null); + this(name, target, actionList, USER_TYPE, userSettings, null); } @@ -67,10 +77,7 @@ String actionList, int type) { - super(name, target, actionList, null); - - // Check type - this.type = type; + this(name, target, actionList, type, null, null); } public int getType() diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettings.java --- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettings.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/UserSecuritySettings.java Thu Sep 02 13:22:59 2010 +0300 @@ -25,6 +25,7 @@ public interface UserSecuritySettings { // interaction modes + public static final int UNDEFINED_INTERACTION_MODE = -1; public static final int ONESHOT_INTERACTION_MODE = 1; public static final int SESSION_INTERACTION_MODE = 2; public static final int BLANKET_INTERACTION_MODE = 3; @@ -55,6 +56,7 @@ public static final String SECURITY_WARNINGS_DEFAULT_MODE = "2"; public String getName(); + public boolean isActive(); public int getCurrentInteractionMode(); public int[] getAllowedInteractionModes(); public boolean isInteractionModeAllowed(int interactionMode); diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro --- a/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss --- a/javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/javaunicertstoreplugin/src.s60/200213A3.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/legacysupport/midp2userpreferences/build/midp2userpreferences.pro --- a/javacommons/security/legacysupport/midp2userpreferences/build/midp2userpreferences.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/legacysupport/midp2userpreferences/build/midp2userpreferences.pro Thu Sep 02 13:22:59 2010 +0300 @@ -19,11 +19,7 @@ CONFIG += omj stl CONFIG -= qt -INCLUDEPATH += /epoc32/include/j2me/midp2/data \ - ../../../../../inc/j2me/midp2/security \ - ../../../../../inc/j2me/midp2/runtime \ - ../../../../../inc/j2me/midp2/dbv2 \ - ../../storageutils/inc +INCLUDEPATH += ../../storageutils/inc SOURCES += ../../storageutils/src/*.cpp \ ../src/*.cpp diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/legacysupport/tsrc/src/testpermissiondb.cpp --- a/javacommons/security/legacysupport/tsrc/src/testpermissiondb.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/legacysupport/tsrc/src/testpermissiondb.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -23,7 +23,7 @@ #include "javastoragenames.h" #include "javauid.h" -#include +#include "j2me/midp2/security/midp2permissiondb.h" using namespace MIDP; using namespace java::storage; diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/legacysupport/tsrc/src/testuserpreferences.cpp --- a/javacommons/security/legacysupport/tsrc/src/testuserpreferences.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/legacysupport/tsrc/src/testuserpreferences.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -25,11 +25,11 @@ #include "javauid.h" #include "javasymbianoslayer.h" -#include -#include -#include -#include -#include +#include "j2me/midp2/data/muserpreferences.h" +#include "j2me/midp2/data/mmidletsuiteuserpreferencesiterator.h" +#include "j2me/midp2/data/mmidletsuiteuserpreferences.h" +#include "j2me/midp2/data/mmidletsuitecustomattributes.h" +#include "j2me/midp2/security/msecuritypolicyv2.h" using namespace MIDP; using namespace java::storage; diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/src/midpauthenticationmoduleimpl.cpp --- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/javasrc/invalidjars/InnerClassImplementsProtectedInterface/myClass.java --- a/javacommons/security/tsrc/data/javasrc/invalidjars/InnerClassImplementsProtectedInterface/myClass.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/javasrc/invalidjars/InnerClassImplementsProtectedInterface/myClass.java Thu Sep 02 13:22:59 2010 +0300 @@ -22,6 +22,11 @@ private class myInnerClass implements com.nokia.mj.impl.security.midp.common.UserSecuritySettings { + + public boolean isActive() + { + return true; + } public String getName() { diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/ocspresponder/CA.pem --- a/javacommons/security/tsrc/data/ocspresponder/CA.pem Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/ocspresponder/CA.pem Thu Sep 02 13:22:59 2010 +0300 @@ -1,13 +1,13 @@ ------BEGIN CERTIFICATE----- -MIICWDCCAcECBEhQwOgwDQYJKoZIhvcNAQEEBQAwczELMAkGA1UEBhMCZmkxEjAQBgNVBAgTCVBp -cmthbm1hYTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9raWExDTALBgNVBAsTBEphdmEx -HzAdBgNVBAMMFkpQX1RoaXJkX1BhcnR5X1RydXN0ZWQwHhcNMDgwNjEyMDYyMzM2WhcNMTgwNjEw -MDYyMzM2WjBzMQswCQYDVQQGEwJmaTESMBAGA1UECBMJUGlya2FubWFhMRAwDgYDVQQHEwdUYW1w -ZXJlMQ4wDAYDVQQKEwVOb2tpYTENMAsGA1UECxMESmF2YTEfMB0GA1UEAwwWSlBfVGhpcmRfUGFy -dHlfVHJ1c3RlZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArAesh03rswICRUjexWMoIH9Z -ZqUtlx+tfhZhuzuYhiL6cLdhxNlU8yuIdw4f17XP3yxVIB8rz1EEagCMd0Y5ZleNFZ992ReLcf9V -H13RxaZ88PRxBLLROm1jcwTknYSS6AxGMup77DMwwFSN8XPnOHWt4aLGUrecMeUyI2c5UbsCAwEA -ATANBgkqhkiG9w0BAQQFAAOBgQAylJ+3aSq6a7AAL7UM8V8JhGZlLneErF7A/BJGDi7Vmr5gmlGy -f6RCJJIg4qCp+J3Tv3eCRNNuphQaSRdFpaulwCmtfCzSZNtvZg0VhMOVsZqTwQgmP6NzKoIbqqzl -gm5U+yUJw8FmX17vgdeSEdJ/oL/WT4AKrWFJYl8MdQ9ZnQ== ------END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICWDCCAcECBEhQwOgwDQYJKoZIhvcNAQEEBQAwczELMAkGA1UEBhMCZmkxEjAQBgNVBAgTCVBp +cmthbm1hYTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9raWExDTALBgNVBAsTBEphdmEx +HzAdBgNVBAMMFkpQX1RoaXJkX1BhcnR5X1RydXN0ZWQwHhcNMDgwNjEyMDYyMzM2WhcNMTgwNjEw +MDYyMzM2WjBzMQswCQYDVQQGEwJmaTESMBAGA1UECBMJUGlya2FubWFhMRAwDgYDVQQHEwdUYW1w +ZXJlMQ4wDAYDVQQKEwVOb2tpYTENMAsGA1UECxMESmF2YTEfMB0GA1UEAwwWSlBfVGhpcmRfUGFy +dHlfVHJ1c3RlZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArAesh03rswICRUjexWMoIH9Z +ZqUtlx+tfhZhuzuYhiL6cLdhxNlU8yuIdw4f17XP3yxVIB8rz1EEagCMd0Y5ZleNFZ992ReLcf9V +H13RxaZ88PRxBLLROm1jcwTknYSS6AxGMup77DMwwFSN8XPnOHWt4aLGUrecMeUyI2c5UbsCAwEA +ATANBgkqhkiG9w0BAQQFAAOBgQAylJ+3aSq6a7AAL7UM8V8JhGZlLneErF7A/BJGDi7Vmr5gmlGy +f6RCJJIg4qCp+J3Tv3eCRNNuphQaSRdFpaulwCmtfCzSZNtvZg0VhMOVsZqTwQgmP6NzKoIbqqzl +gm5U+yUJw8FmX17vgdeSEdJ/oL/WT4AKrWFJYl8MdQ9ZnQ== +-----END CERTIFICATE----- diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/policies/all.txt --- a/javacommons/security/tsrc/data/policies/all.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/policies/all.txt Thu Sep 02 13:22:59 2010 +0300 @@ -3,5 +3,4 @@ grant assigned { permission java.util.PropertyPermission "microedition.*" "read"; permission javax.microedition.PropertyPermission "mobinfo.publicinfo" "read"; - permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/policies/test_manufacturer.txt --- a/javacommons/security/tsrc/data/policies/test_manufacturer.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/policies/test_manufacturer.txt Thu Sep 02 13:22:59 2010 +0300 @@ -34,5 +34,8 @@ } grant assigned { permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read"; + permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; permission javax.microedition.midlet.AutoStartPermission; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/policies/test_operator.txt --- a/javacommons/security/tsrc/data/policies/test_operator.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/policies/test_operator.txt Thu Sep 02 13:22:59 2010 +0300 @@ -34,5 +34,8 @@ } grant assigned { permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read"; + permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; permission javax.microedition.midlet.AutoStartPermission; } diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/policies/test_untrusted.txt --- a/javacommons/security/tsrc/data/policies/test_untrusted.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/policies/test_untrusted.txt Thu Sep 02 13:22:59 2010 +0300 @@ -60,3 +60,9 @@ permission javax.microedition.io.Connector.mms "mms://*" "open,receive"; permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive"; } + +grant assigned "Location" { + permission javax.microedition.PropertyPermission "mobinfo.cellid" "read"; + permission javax.microedition.PropertyPermission "mobinfo.countrycode" "read"; + permission javax.microedition.PropertyPermission "mobinfo.networkid" "read"; +} diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/validpolicies/validators/identified_thirdparty_like_policy.txt --- a/javacommons/security/tsrc/data/validpolicies/validators/identified_thirdparty_like_policy.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/validpolicies/validators/identified_thirdparty_like_policy.txt Thu Sep 02 13:22:59 2010 +0300 @@ -1,17 +1,17 @@ domain=IdentifiedThirdParty -user,NetAccess:session:blanket:oneshot:no,javax.microedition.io.HttpProtocolPermission,http://* -user,NetAccess:session:blanket:oneshot:no,javax.microedition.io.HttpsProtocolPermission,https://* -user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.DatagramProtocolPermission,datagram://* -user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.DatagramProtocolPermission,datagram:// -user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.SocketProtocolPermission,socket://* -user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.SocketProtocolPermission,socket:// -user,LowLevelNetAccess:session:blanket:oneshot:no,javax.microedition.io.SSLProtocolPermission,ssl://* -user,ApplicationAutoInvocation:oneshot:blanket:session:no,javax.microedition.io.PushRegistryPermission,* -user,LocalConnectivity:session:blanket:oneshot:no,javax.microedition.io.CommProtocolPermission,comm:* -user,MultimediaRecording:session:blanket:oneshot:no,javax.microedition.media.PlayerPermission,*,record -user,MultimediaRecording:session:blanket:oneshot:no,javax.microedition.media.PlayerPermission,*,snapshot -assigned,java.util.PropertyPermission,microedition.*,read -assigned,javax.microedition.event.EventPermission,*.*,read -assigned,javax.microedition.event.EventPermission,*.*,register -assigned,javax.microedition.event.EventPermission,*.*,post +user?NetAccess:session:blanket:oneshot:no?javax.microedition.io.HttpProtocolPermission,http://* +user?NetAccess:session:blanket:oneshot:no?javax.microedition.io.HttpsProtocolPermission,https://* +user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.DatagramProtocolPermission,datagram://* +user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.DatagramProtocolPermission,datagram:// +user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.SocketProtocolPermission,socket://* +user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.SocketProtocolPermission,socket:// +user?LowLevelNetAccess:session:blanket:oneshot:no?javax.microedition.io.SSLProtocolPermission,ssl://* +user?ApplicationAutoInvocation:oneshot:blanket:session:no?javax.microedition.io.PushRegistryPermission,* +user?LocalConnectivity:session:blanket:oneshot:no?javax.microedition.io.CommProtocolPermission,comm:* +user?MultimediaRecording:session:blanket:oneshot:no?javax.microedition.media.PlayerPermission,*,record +user?MultimediaRecording:session:blanket:oneshot:no?javax.microedition.media.PlayerPermission,*,snapshot +assigned?java.util.PropertyPermission,microedition.*,read +assigned?javax.microedition.event.EventPermission,*.*,read +assigned?javax.microedition.event.EventPermission,*.*,register +assigned?javax.microedition.event.EventPermission,*.*,post diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/validpolicies/validators/missing_end_bracket_for_permissions.txt --- a/javacommons/security/tsrc/data/validpolicies/validators/missing_end_bracket_for_permissions.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/validpolicies/validators/missing_end_bracket_for_permissions.txt Thu Sep 02 13:22:59 2010 +0300 @@ -1,3 +1,3 @@ domain=operator -allowed,javax.microedition.midlet.AutoStartPermission +allowed?javax.microedition.midlet.AutoStartPermission diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/validpolicies/validators/missing_start_bracket_for_permissions.txt --- a/javacommons/security/tsrc/data/validpolicies/validators/missing_start_bracket_for_permissions.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/validpolicies/validators/missing_start_bracket_for_permissions.txt Thu Sep 02 13:22:59 2010 +0300 @@ -1,3 +1,3 @@ domain=operator -allowed,javax.microedition.midlet.AutoStartPermission +allowed?javax.microedition.midlet.AutoStartPermission diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/validpolicies/validators/operator_like_policy.txt --- a/javacommons/security/tsrc/data/validpolicies/validators/operator_like_policy.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/validpolicies/validators/operator_like_policy.txt Thu Sep 02 13:22:59 2010 +0300 @@ -1,22 +1,22 @@ domain=Operator -allowed,javax.microedition.io.HttpProtocolPermission,http://* -allowed,javax.microedition.io.HttpsProtocolPermission,https://* -allowed,javax.microedition.io.DatagramProtocolPermission,datagram://* -allowed,javax.microedition.io.DatagramProtocolPermission,datagram:// -allowed,javax.microedition.io.SocketProtocolPermission,socket://* -allowed,javax.microedition.io.SocketProtocolPermission,socket:// -allowed,javax.microedition.io.SSLProtocolPermission,ssl://* -allowed,javax.microedition.io.PushRegistryPermission,* -allowed,javax.microedition.io.CommProtocolPermission,comm:* -allowed,javax.microedition.media.PlayerPermission,*,record -allowed,javax.microedition.media.PlayerPermission,*,snapshot -allowed,java.util.PropertyPermission,*,read -allowed,javax.microedition.event.EventPermission,*,read -allowed,javax.microedition.event.EventPermission,*,register -allowed,javax.microedition.event.EventPermission,*,post -allowed,javax.microedition.midlet.ActionsDeniedPermission -allowed,javax.microedition.midlet.AutoStartPermission -assigned,java.util.PropertyPermission,microedition.*,read -assigned,javax.microedition.event.EventPermission,*.*,read -assigned,javax.microedition.event.EventPermission,*.*,register -assigned,javax.microedition.event.EventPermission,*.*,post +allowed?javax.microedition.io.HttpProtocolPermission,http://* +allowed?javax.microedition.io.HttpsProtocolPermission,https://* +allowed?javax.microedition.io.DatagramProtocolPermission,datagram://* +allowed?javax.microedition.io.DatagramProtocolPermission,datagram:// +allowed?javax.microedition.io.SocketProtocolPermission,socket://* +allowed?javax.microedition.io.SocketProtocolPermission,socket:// +allowed?javax.microedition.io.SSLProtocolPermission,ssl://* +allowed?javax.microedition.io.PushRegistryPermission,* +allowed?javax.microedition.io.CommProtocolPermission,comm:* +allowed?javax.microedition.media.PlayerPermission,*,record +allowed?javax.microedition.media.PlayerPermission,*,snapshot +allowed?java.util.PropertyPermission,*,read +allowed?javax.microedition.event.EventPermission,*,read +allowed?javax.microedition.event.EventPermission,*,register +allowed?javax.microedition.event.EventPermission,*,post +allowed?javax.microedition.midlet.ActionsDeniedPermission +allowed?javax.microedition.midlet.AutoStartPermission +assigned?java.util.PropertyPermission,microedition.*,read +assigned?javax.microedition.event.EventPermission,*.*,read +assigned?javax.microedition.event.EventPermission,*.*,register +assigned?javax.microedition.event.EventPermission,*.*,post diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/data/validpolicies/validators/unidentified_third_party_like_policy.txt --- a/javacommons/security/tsrc/data/validpolicies/validators/unidentified_third_party_like_policy.txt Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/data/validpolicies/validators/unidentified_third_party_like_policy.txt Thu Sep 02 13:22:59 2010 +0300 @@ -1,16 +1,16 @@ domain=UnidentifiedThirdParty -user,NetAccess:oneshot:session:no,javax.microedition.io.HttpProtocolPermission,http://* -user,NetAccess:oneshot:session:no,javax.microedition.io.HttpsProtocolPermission,https://* -user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.DatagramProtocolPermission,datagram://* -user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.DatagramProtocolPermission,datagram:// -user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.SocketProtocolPermission,socket://* -user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.SocketProtocolPermission,socket:// -user,LowLevelNetAccess:oneshot:session:no,javax.microedition.io.SSLProtocolPermission,ssl://* -user,ApplicationAutoInvocation:oneshot:session:no,javax.microedition.io.PushRegistryPermission,* -user,LocalConnectivity:session:blanket:oneshot:no,javax.microedition.io.CommProtocolPermission,comm:* -user,MultimediaRecording:session:oneshot:no,javax.microedition.media.PlayerPermission,*,record -user,MultimediaRecording:session:oneshot:no,javax.microedition.media.PlayerPermission,*,snapshot -assigned,java.util.PropertyPermission,microedition.*,read -assigned,javax.microedition.event.EventPermission,*.*,read -assigned,javax.microedition.event.EventPermission,*.*,register -assigned,javax.microedition.event.EventPermission,*.*,post +user?NetAccess:oneshot:session:no?javax.microedition.io.HttpProtocolPermission,http://* +user?NetAccess:oneshot:session:no?javax.microedition.io.HttpsProtocolPermission,https://* +user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.DatagramProtocolPermission,datagram://* +user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.DatagramProtocolPermission,datagram:// +user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.SocketProtocolPermission,socket://* +user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.SocketProtocolPermission,socket:// +user?LowLevelNetAccess:oneshot:session:no?javax.microedition.io.SSLProtocolPermission,ssl://* +user?ApplicationAutoInvocation:oneshot:session:no?javax.microedition.io.PushRegistryPermission,* +user?LocalConnectivity:session:blanket:oneshot:no?javax.microedition.io.CommProtocolPermission,comm:* +user?MultimediaRecording:session:oneshot:no?javax.microedition.media.PlayerPermission,*,record +user?MultimediaRecording:session:oneshot:no?javax.microedition.media.PlayerPermission,*,snapshot +assigned?java.util.PropertyPermission,microedition.*,read +assigned?javax.microedition.event.EventPermission,*.*,read +assigned?javax.microedition.event.EventPermission,*.*,register +assigned?javax.microedition.event.EventPermission,*.*,post diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java --- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java Thu Sep 02 13:22:59 2010 +0300 @@ -39,111 +39,115 @@ static final SecurityPolicyPermission[] MANUFACTURER_PERMS = { - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", null), - new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,PolicyBasedPermission.ALLOWED_TYPE), }; static final SecurityPolicyPermission[] OPERATOR_PERMS = { - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", null), - new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpProtocolPermission"),"http://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.HttpsProtocolPermission"),"https://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.DatagramProtocolPermission"),"datagram://", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SocketProtocolPermission"),"socket://", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.SSLProtocolPermission"),"ssl://*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.CommProtocolPermission"),"comm:*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "read", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "read_events", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "read_todos", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "write_contacts", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.EventList"), "pim://*" , "write_events", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","staticregistration",PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","dynamicregistration",PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*","autoinvocation",PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.obex.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.server"),"*", "server", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.bluetooth.client"),"*", "client", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "position", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"location://*", "orientation", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "read", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "write", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "category", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"landmarks://*", "management", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.location.LocationPermission"),"proximity://*", "registerlistener", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.aid"),"apdu://*", "aid", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.apdu.sat"),"apdu://*", "sat", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.securityservice.CMSMessageSignatureService"),"pki://*", "authenticate", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.AutoStartPermission"),null,null,PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null,null,PolicyBasedPermission.ALLOWED_TYPE), }; static final SecurityPolicyPermission[] IDENTIFIED_THIRD_PARTY_PERMS = { @@ -189,18 +193,18 @@ new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", new SecurityPolicyPermissionSettings("Read User Data Access",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), @@ -219,7 +223,7 @@ new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null), + new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*", "staticregistration", new SecurityPolicyPermissionSettings("Application Auto Invocation",UserSecuritySettings.BLANKET_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE})), @@ -265,8 +269,16 @@ new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, new SecurityPolicyPermissionSettings("Net Access",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE, + new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.SESSION_INTERACTION_MODE, + new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.USER_ASSIGNED_TYPE, + new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.SESSION_INTERACTION_MODE, + new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE, + new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.SESSION_INTERACTION_MODE, + new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), new SecurityPolicyPermission(getPermissionName("javax.microedition.midlet.CmdLineArgsPermission"),null, null, new SecurityPolicyPermissionSettings("Url start",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), @@ -315,18 +327,18 @@ new SecurityPolicyPermission(getPermissionName("javax.microedition.io.FileProtocolPermission"),"*", "write", new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.ONESHOT_INTERACTION_MODE, new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "send", new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.ONESHOT_INTERACTION_MODE, new int[]{UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.sms"), "sms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "send", new SecurityPolicyPermissionSettings("Messaging",UserSecuritySettings.ONESHOT_INTERACTION_MODE, new int[]{UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.mms"), "mms://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "open", PolicyBasedPermission.ALLOWED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.cbs"), "cbs://*" , "receive", PolicyBasedPermission.ALLOWED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ContactList"), "pim://*" , "read_contacts", new SecurityPolicyPermissionSettings("Read User Data Access",UserSecuritySettings.ONESHOT_INTERACTION_MODE, new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), @@ -345,7 +357,7 @@ new SecurityPolicyPermission(getPermissionName("javax.microedition.pim.ToDoList"), "pim://*" , "write_todos", new SecurityPolicyPermissionSettings("Write User Data Access",UserSecuritySettings.ONESHOT_INTERACTION_MODE, new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",null), + new SecurityPolicyPermission(getPermissionName("java.util.PropertyPermission"),"microedition.*","read",PolicyBasedPermission.ASSIGNED_TYPE), new SecurityPolicyPermission(getPermissionName("javax.microedition.io.PushRegistryPermission"),"*", "staticregistration", new SecurityPolicyPermissionSettings("Application Auto Invocation",UserSecuritySettings.BLANKET_INTERACTION_MODE, new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE})), @@ -385,8 +397,16 @@ new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null, new SecurityPolicyPermissionSettings("Net Access",UserSecuritySettings.SESSION_INTERACTION_MODE, new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null), - new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",PolicyBasedPermission.ASSIGNED_TYPE), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE, + new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.ONESHOT_INTERACTION_MODE, + new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.countrycode","read",PolicyBasedPermission.USER_ASSIGNED_TYPE, + new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.ONESHOT_INTERACTION_MODE, + new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), + new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.networkid","read",PolicyBasedPermission.USER_ASSIGNED_TYPE, + new SecurityPolicyPermissionSettings("Location",UserSecuritySettings.ONESHOT_INTERACTION_MODE, + new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})), }; // Begin j2meunit test framework setup diff -r 0ea12c182930 -r 63b81d807542 javacommons/security/tsrc/javasrc/com/nokia/mj/tools/security/midp/PolicyEditorTests.java --- a/javacommons/security/tsrc/javasrc/com/nokia/mj/tools/security/midp/PolicyEditorTests.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/tools/security/midp/PolicyEditorTests.java Thu Sep 02 13:22:59 2010 +0300 @@ -336,7 +336,7 @@ initBoolArray(permsChecked); for (int i=0; i currentToken) + if (permDetails.length > currentToken) { - target = permTokens[currentToken]; + target = permDetails[currentToken]; currentToken++; } - if (permTokens.length > currentToken) + if (permDetails.length > currentToken) { - actionList = permTokens[currentToken]; + actionList = permDetails[currentToken]; actionList = actionList.replace(':',','); } - PolicyBasedPermissionImpl perm1 = new PolicyBasedPermissionImpl(name, target, actionList, settings); + PolicyBasedPermissionImpl perm1 = new PolicyBasedPermissionImpl(name, target, actionList, type, settings); for (int j=0; j diff -r 0ea12c182930 -r 63b81d807542 javacommons/utils/build/javautils.pro --- a/javacommons/utils/build/javautils.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/build/javautils.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_dll.hrh Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/inc.s60/java_stdcpp_support_for_exe.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_exe.hrh Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_exe.hrh Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/inc.s60/java_stdcpp_support_for_stddll.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_stddll.hrh Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_stddll.hrh Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/inc.s60/java_stdcpp_support_for_stdexe.hrh --- a/javacommons/utils/inc.s60/java_stdcpp_support_for_stdexe.hrh Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/inc.s60/java_stdcpp_support_for_stdexe.hrh Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/inc/logger.h --- a/javacommons/utils/inc/logger.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/inc/logger.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/javasrc/com/nokia/mj/impl/coreui/CoreUi.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/coreui/CoreUi.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/coreui/CoreUi.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ResourceLoader.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/javasrc/com/nokia/mj/impl/utils/Version.java --- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Version.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Version.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/src/debugutils.cpp --- a/javacommons/utils/src/debugutils.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/src/debugutils.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/src/javacommonutils.cpp --- a/javacommons/utils/src/javacommonutils.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/src/javacommonutils.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/src/javainifileutils.cpp --- a/javacommons/utils/src/javainifileutils.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/src/javainifileutils.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -157,9 +157,9 @@ } rewind(iniFile); data = new char[len+1]; - data[len] = 0; if (data != 0) { + data[len] = 0; fread(data, sizeof(char), len, iniFile); } fclose(iniFile); diff -r 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,51 @@ + + + + + + + + + + + + Running BufferedReaderTests + + + + + Running ConcurrencyTests + + + + + Running SystemPropertyTests + + + + + Running DebugUtilsTests tests + + + + + + + + diff -r 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/rt/SystemPropertyTests.java --- a/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/rt/SystemPropertyTests.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/rt/SystemPropertyTests.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/BufferedReaderTests.java --- a/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/BufferedReaderTests.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/BufferedReaderTests.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/concurrent/ConcurrentTests.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/localisation/build/build.xml --- a/javacommons/utils/tsrc/localisation/build/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javacommons/utils/tsrc/localisation/build/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -1,6 +1,6 @@ - - - - - - diff -r 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/unittestrunner/runner/build/bwins/javaunittestrunneru.def --- a/javacommons/utils/tsrc/unittestrunner/runner/build/bwins/javaunittestrunneru.def Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/unittestrunner/runner/build/eabi/javaunittestrunneru.def --- a/javacommons/utils/tsrc/unittestrunner/runner/build/eabi/javaunittestrunneru.def Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z10jni_lookupPKc @ 1 NONAME - diff -r 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/unittestrunner/runner/build/javaunittestrunner.pro --- a/javacommons/utils/tsrc/unittestrunner/runner/build/javaunittestrunner.pro Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/unittestrunner/starter/build/javauntitester.pro --- a/javacommons/utils/tsrc/unittestrunner/starter/build/javauntitester.pro Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/unittestrunner/starter/src/main.cpp --- a/javacommons/utils/tsrc/unittestrunner/starter/src/main.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javacommons/utils/tsrc/unittestrunner/subsystem.mk --- a/javacommons/utils/tsrc/unittestrunner/subsystem.mk Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60bluetoothplatformcontrol.cpp --- a/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60bluetoothplatformcontrol.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60bluetoothplatformcontrol.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -358,7 +358,7 @@ */ std::wstring *S60BluetoothPlatformControl::getBluetoothName() { - TBuf16 bluetoothName; + TBuf16 bluetoothName; JELOG2(EJavaBluetooth); TInt error = RProperty::Get(KPropertyUidBluetoothCategory, diff -r 0ea12c182930 -r 63b81d807542 javaextensions/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp --- a/javaextensions/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -148,7 +148,7 @@ TPtrC8 uuidDes(uuidBytes, uuidByteLength); TRAPD(err, uuid.SetL(uuidDes)); - delete uuidBytes; + delete[] uuidBytes; uuidBytes = NULL; if (KErrNone != err) @@ -205,7 +205,7 @@ char *fileName = java::util::JavaCommonUtils::wstringToUtf8( persistentFileName); persistentRecFd = open(fileName, O_RDONLY); - delete fileName; + delete[] fileName; } catch (ExceptionBase ex) { @@ -618,7 +618,7 @@ write(mSrvRecFd, (char *) &aDeviceServiceClasses, sizeof(aDeviceServiceClasses)); - delete fileName; + delete[] fileName; } catch (ExceptionBase ex) { @@ -1286,7 +1286,7 @@ char *fileName = java::util::JavaCommonUtils::wstringToUtf8(persistentFileName); persistentRecFd = open(fileName, O_RDONLY); - delete fileName; + delete[] fileName; } catch (ExceptionBase ex) { @@ -1310,7 +1310,10 @@ unsigned int devServClass = 0; ret = read(persistentRecFd, &devServClass, sizeof(devServClass)); if (ret <= 0) + { + delete srvRecPopulator; return; + } elementBuilder = srvRecPopulator->SetDeviceServiceClass(devServClass); diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/build/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,42 @@ + + + + + Builds Central Repository Component + + + + + + + + + + + + + + + + diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/build/bwins/javacentrepu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/bwins/javacentrepu.def Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) + diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/build/eabi/javacentrepu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/eabi/javacentrepu.def Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z10jni_lookupPKc @ 1 NONAME + _ZTI22CJavaCentralRepository @ 2 NONAME + _ZTV22CJavaCentralRepository @ 3 NONAME + diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/build/javacentrep.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/build/javacentrep.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/inc/centrepfunctionserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/inc/centrepfunctionserver.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/inc/cjavacentralrepository.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/inc/cjavacentralrepository.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/src/cjavacentralrepository.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/src/cjavacentralrepository.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/src/javacentralrepositoryjni.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/centralrepository/src/javacentralrepositoryjni.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/javaextensions.pro --- a/javaextensions/javaextensions.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/javaextensions.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java --- a/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/build/rmsintersuite.jad --- a/javaextensions/midprms_db/tsrc/build/rmsintersuite.jad Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/build/rmsintersuite.jad Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/build/rmssharedtests.jad --- a/javaextensions/midprms_db/tsrc/build/rmssharedtests.jad Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/build/rmssharedtests.jad Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/build/rmstests.jad --- a/javaextensions/midprms_db/tsrc/build/rmstests.jad Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/build/rmstests.jad Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h --- a/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp --- a/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/build/build.xml --- a/javaextensions/pim/build/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/build/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -39,6 +39,7 @@ + com.nokia.mid.calendars=:pim.DynamicPropertyHandler microedition.pim.version=1.0 diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/build/javapim.pro --- a/javaextensions/pim/build/javapim.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/build/javapim.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h --- a/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h --- a/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp --- a/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp --- a/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp --- a/javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/common/inc.s60/mpimadapteraccess.h --- a/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/inc.s60/cpimmanager.h --- a/javaextensions/pim/framework/inc.s60/cpimmanager.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/inc.s60/cpimmanager.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/inc/pimbasemanager.h --- a/javaextensions/pim/framework/inc/pimbasemanager.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/inc/pimbasemanager.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimeventlist.cpp --- a/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimlist.cpp --- a/javaextensions/pim/framework/src.s60/cpimlist.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimlist.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimmanager.cpp --- a/javaextensions/pim/framework/src.s60/cpimmanager.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimmanager.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimtodolist.cpp --- a/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/pimjnitools.cpp --- a/javaextensions/pim/framework/src.s60/pimjnitools.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/framework/src.s60/pimjnitools.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/dummy.txt diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/mpimlocalizationdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/inc.s60/mpimlocalizationdata.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/mpimlocalizationmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/inc.s60/mpimlocalizationmanager.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/pimlocalizationids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaextensions/pim/inc.s60/pimlocalizationids.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java --- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/javax/microedition/pim/PIM.java --- a/javaextensions/pim/javasrc/javax/microedition/pim/PIM.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/javasrc/javax/microedition/pim/PIM.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/jni/src/pimmanager.cpp --- a/javaextensions/pim/jni/src/pimmanager.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/jni/src/pimmanager.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp --- a/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimcardconverter.cpp --- a/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp --- a/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimversit.cpp --- a/javaextensions/pim/versit/src.s60/cpimversit.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/pim/versit/src.s60/cpimversit.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/subsystem.mk --- a/javaextensions/subsystem.mk Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/subsystem.mk Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaextensions/wma/mms/build/javawmamms.pro --- a/javaextensions/wma/mms/build/javawmamms.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/wma/mms/build/javawmamms.pro Thu Sep 02 13:22:59 2010 +0300 @@ -27,7 +27,7 @@ ../src.s60/*.cpp LIBS += -lapmime \ - -lPlatformEnv \ + -lplatformenv \ -lcharconv \ -lCommonUI \ -lefsrv \ diff -r 0ea12c182930 -r 63b81d807542 javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp --- a/javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -790,8 +790,6 @@ { // get cc length aHeaderLengths[KCcFieldIndex] = ReadIntL(aReadStream); - if (div == 0) - break; mmsMap = div; } break; diff -r 0ea12c182930 -r 63b81d807542 javamanager/javaappscheme/build/javaappscheme.pro --- a/javamanager/javaappscheme/build/javaappscheme.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javaappscheme/build/javaappscheme.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javaappscheme/build/service_conf.xml --- a/javamanager/javaappscheme/build/service_conf.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javaappscheme/build/service_conf.xml Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javaappscheme/src.s60/serviceapp.cpp --- a/javamanager/javaappscheme/src.s60/serviceapp.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javaappscheme/src.s60/serviceapp.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp --- a/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/data/10282474.rss --- a/javamanager/javabackup/midp2backup/data/10282474.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup/data/10282474.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp --- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h --- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp --- a/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp --- a/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup_usif/data/10282474.rss --- a/javamanager/javabackup/midp2backup_usif/data/10282474.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javabackup/midp2backup_usif/data/10282474.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/scrupdater/inc/scrupdater.h --- a/javamanager/javacaptain/extensionplugins/scrupdater/inc/scrupdater.h Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ScrUpdater is Java Captain Symbian plugin that updates -* presence information of Java Applications in USIF SCR -* when removable drive is added or removed to the device. -* -*/ - -#ifndef SCRUPDATER_H -#define SCRUPDATER_H - -#include -#include - -#include "javaosheaders.h" - -#include "eventconsumerinterface.h" -#include "extensionplugininterface.h" - -namespace java -{ - -namespace captain -{ - -class CoreInterface; - -OS_NONSHARABLE_CLASS(ScrUpdater) : public EventConsumerInterface, - public ExtensionPluginInterface -{ -public: - ScrUpdater(); - virtual ~ScrUpdater(); - - // PluginInterface - virtual void startPlugin(CoreInterface* aCore); - virtual void stopPlugin(); - - // EventConsumerInterface - virtual void event(const std::string& eventProvider, - java::comms::CommsMessage& aMsg); - - // ExtensionPluginInterface methods - virtual EventConsumerInterface* getEventConsumer(); - -private: - void removeScrPresencesL(driveInfo *aInfo); - void addScrPresencesL(driveInfo *aInfo); - void initializeScrPresenceInfoL(); - - Usif::RSoftwareComponentRegistry *createScrL(); - - - CoreInterface* mCore; -}; - -} // namespace captain -} // namespace java - -#endif // SCRUPDATER_H diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/scrupdater/src.s60/lookup.cpp --- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/lookup.cpp Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: lookup -* -*/ - -#include //For strcmp - -#include "javasymbianoslayer.h" -#include "logger.h" - -#include "extensionplugininterface.h" - -using namespace java::captain; - -ExtensionPluginInterface* getExtensionPlugin(); - -EXPORT_C FuncPtr findDllMethod(const char* funcName) -{ - JELOG2(EJavaCaptain); - FuncPtr ptr = 0; - if (funcName) - { - if (strcmp(funcName, "getExtensionPlugin") == 0) - { - ptr = (FuncPtr)getExtensionPlugin; - } - } - else - { - ELOG(EJavaCaptain, - "scrupdater extensionplugin findDllMethod() funcName == null"); - } - return ptr; -} diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp --- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,705 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ScrUpdater is Java Captain Symbian plugin that updates -* presence information of Java Applications in USIF SCR -* when removable drive is added or removed to the device. -* -*/ - -#include -#include -#include - -#include "javaprocessconstants.h" -#include "javasymbianoslayer.h" -#include "javauids.h" -#include "logger.h" -#include "coreinterface.h" -#include "booteventprovidermessages.h" -#include "mmceventprovidermessages.h" - -#include "scrupdater.h" - -// Enable notifying AppArc for USIF Phase 2. -//#define RD_JAVA_USIF_NOTIFY_APP_ARC - - -using namespace Usif; - -/** - * Return pointer to ExtensionPluginInterface implementation for this - * extension dll - */ -java::captain::ExtensionPluginInterface* getExtensionPlugin() -{ - return new java::captain::ScrUpdater(); -} - -namespace java -{ -namespace captain -{ - -using java::fileutils::driveInfo; -using java::fileutils::DriveListenerInterface; - -/** - * Empty contructor - */ -ScrUpdater::ScrUpdater() : mCore(0) -{ -} - -/** - * Empty destructor - */ -ScrUpdater::~ScrUpdater() -{ -} - -/** - * Implement PluginInterface method - */ -void ScrUpdater::startPlugin(CoreInterface* core) -{ - LOG(EJavaCaptain, EInfo, "ScrUpdater plugin started"); - - mCore = core; -} - -/** - * Implement PluginInterface method - */ -void ScrUpdater::stopPlugin() -{ - mCore = 0; -} - -/** - * Implement ExtensionPluginInterface method - */ -EventConsumerInterface* ScrUpdater::getEventConsumer() -{ - return this; -} - -/** - * Handle Java Captain events sent by Boot event provider or - * MMC event provider. - * - * Implement EventConsumerInterface method - */ -void ScrUpdater::event(const std::string& eventProvider, - java::comms::CommsMessage& aMsg) -{ - if (eventProvider == BOOT_EVENT_PROVIDER) - { - int bootType = NORMAL_BOOT_C; - getBootMessageParams(aMsg, bootType); - LOG1( - EJavaCaptain, - EInfo, - "ScrUpdater::event() boot event received (type=%d)", - bootType); - switch (bootType) - { - case IAD_BOOT_C: - case FIRST_DEVICE_BOOT_C: - case NORMAL_BOOT_C: - { - // Update presence information - TRAPD(err, initializeScrPresenceInfoL()) - if (KErrNone != err) - { - ELOG1(EJavaCaptain, "initializeScrPresenceInfoL: leaved (%d)", err); - } - } - break; - - default: - { - WLOG1(EJavaCaptain, - "DriveListenerInterface: event() unknown boot event (type=%d)", bootType); - } - break; - } - } - else if (eventProvider == MMC_EVENT_PROVIDER) - { - int operation = 0; - driveInfo di; - getMmcChangedMessageParams(aMsg, operation, di); - LOG1( - EJavaCaptain, - EInfo, - "ScrUpdater::event() mmc event received (operation=%d)", - operation); - - switch (operation) - { - case DriveListenerInterface::REMOVABLE_MEDIA_REMOVED_C: - { - // All Java applications in the removed drive are set - // to 'not present' state - TRAPD(err, removeScrPresencesL(&di)); - if (KErrNone != err) - { - ELOG1(EJavaCaptain, "removeScrPresencesL leaved (%d)", err); - } - } - break; - - case DriveListenerInterface::REMOVABLE_MEDIA_INSERTED_C: - { - // Those Java applications in the drive to where the media - // (e.g. memory card) was added are set to 'present' state - // IF the media id is correct (in other words if the same - // memory card that they have been installed to is added - // to the drive). - TRAPD(err, addScrPresencesL(&di)); - if (KErrNone != err) - { - ELOG1(EJavaCaptain, "addScrPresencesL leaved (%d)", err); - } - } - break; - } - } -} - -/** - * Set the presence state of all Java applications installed - * to the removable drive specified in aInfo to not present - */ -void ScrUpdater::removeScrPresencesL(driveInfo *aInfo) -{ - __UHEAP_MARK; - LOG1WSTR(EJavaCaptain, EInfo, - "removeScrPresencesL: driveInfo root path is %s", aInfo->iRootPath); - - RSoftwareComponentRegistry *pScr = createScrL(); - CleanupStack::PushL(pScr); - - // Get ids of all Java components in scr - RArray componentIdList; - CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC(); - pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava); - - pScr->GetComponentIdsL(componentIdList); - CleanupStack::PopAndDestroy(pJavaSwTypeFilter); - CleanupClosePushL(componentIdList); - - // For each component check whether it has been installed - // to the removed drive - TInt nComponents = componentIdList.Count(); - TUint removedDrive = (TUint)(aInfo->iRootPath[0]); - // Now removedDrive contains the drive letter, convert it to drive number 0-25 - if ((removedDrive > 64) && (removedDrive < 91)) - { - // 'A' - 'Z' - removedDrive -= 65; - } - else if ((removedDrive > 96) && (removedDrive < 123)) - { - // 'a' - 'z' - removedDrive -= 97; - } - else - { - ELOG1WSTR(EJavaCaptain, - "removeScrPresencesL: Unexpected root path in remove drive info %s", - aInfo->iRootPath); - CleanupStack::PopAndDestroy(pScr); - return; - } - - LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, removed drive is %d", - nComponents, removedDrive); - -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC - // TEMP TEST - TBool fPresenceChange = EFalse; - RArray removedApps; - CleanupClosePushL(removedApps); -#endif - - for (TInt nInd = 0; nInd < nComponents; nInd++) - { - CComponentEntry *pEntry = CComponentEntry::NewLC(); - if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry))) - { - ELOG1(EJavaCaptain, - "removeScrPresencesL: SCR GetComponentIdsL returned id %d " - "but GetComponentL does not find it", componentIdList[nInd]); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - - TInt nInstalledDrives = pEntry->InstalledDrives().Length(); - if (nInstalledDrives <= removedDrive) - { - // SCR InstalledDrives should be array of 26 elements (value 0 or 1) - ELOG2(EJavaCaptain, - "removeScrPresencesL: The length of InstalledDrives array (%d) " - "is smaller than removedDrive (%d)", nInstalledDrives, removedDrive); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - - LOG1(EJavaCaptain, EInfo, "Java component id %d", componentIdList[nInd]); - - if (pEntry->InstalledDrives()[removedDrive]) - { - // This component has been installed to the drive - // that has just been removed - pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse); - - LOG1(EJavaCaptain, EInfo, - "removeScrPresencesL: set component %d to not present", - componentIdList[nInd]); - -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC - fPresenceChange = ETrue; - - // Gather the Uids of all applications that are no longer present - RArray appsInComponent; - CleanupClosePushL(appsInComponent); - pScr->GetAppUidsForComponentL( - componentIdList[nInd], appsInComponent); - for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++) - { - TApaAppUpdateInfo appInfo; - appInfo.iAppUid = appsInComponent[nInd2]; - appInfo.iAction = TApaAppUpdateInfo::EAppNotPresent; - (void)removedApps.Append(appInfo); - } - CleanupStack::PopAndDestroy(&appsInComponent); -#endif - } - - CleanupStack::PopAndDestroy(pEntry); - } - -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC - // Tell AppArc which applications are no longer present - while (fPresenceChange) - { - if (removedApps.Count() == 0) - { - ELOG(EJavaCaptain, "removeScrPresencesL: Uids of the removed apps are not known"); - break; - } - - RApaLsSession apaSession; - TInt err = apaSession.Connect(); - if (KErrNone != err) - { - ELOG1(EJavaCaptain, "removeScrPresencesL: Error %d when connecting AppArc", err); - break; - } - else - { - CleanupClosePushL(apaSession); - apaSession.UpdateAppListL(removedApps); - CleanupStack::PopAndDestroy(); // closes apaSession - fPresenceChange = EFalse; - } - } - - CleanupStack::PopAndDestroy(); // Close removedApps -#endif - CleanupStack::PopAndDestroy(); // Close componentIdList - CleanupStack::PopAndDestroy(pScr); - __UHEAP_MARKEND; -} - - -/** - * Set the presence state of all Java applications installed - * to the removable drive specified in aInfo to present - */ -void ScrUpdater::addScrPresencesL(driveInfo *aInfo) -{ - __UHEAP_MARK; - LOG1WSTR(EJavaCaptain, EInfo, - "addScrPresencesL: driveInfo root path is %s", aInfo->iRootPath); - - RSoftwareComponentRegistry *pScr = createScrL(); - CleanupStack::PushL(pScr); - - // Get ids of all Java components in scr - RArray componentIdList; - CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC(); - pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava); - - pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter); - CleanupStack::PopAndDestroy(pJavaSwTypeFilter); - CleanupClosePushL(componentIdList); - - - // For each component check whether it has been installed - // to the added drive AND whether the media id is correct - // (in other words if the actual memory card where the component - // has been installed to is added to the drive). - TInt nComponents = componentIdList.Count(); - TUint addedMediaId = (TUint)(aInfo->iId); - TUint addedDrive = (TUint)(aInfo->iRootPath[0]); - // Now addedDrive contains the drive letter, convert it to drive number 0-25 - if ((addedDrive > 64) && (addedDrive < 91)) - { - // 'A' - 'Z' - addedDrive -= 65; - } - else if ((addedDrive > 96) && (addedDrive < 123)) - { - // 'a' - 'z' - addedDrive -= 97; - } - else - { - ELOG1WSTR(EJavaCaptain, - "addScrPresencesL: Unexpected root path in add drive info %s", - aInfo->iRootPath); - CleanupStack::PopAndDestroy(pScr); - return; - } - - LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, added drive is %d", - nComponents, addedDrive); - -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC - TBool fPresenceChange = EFalse; - RArray addedApps; - CleanupClosePushL(addedApps); -#endif - - for (TInt nInd = 0; nInd < nComponents; nInd++) - { - CComponentEntry *pEntry = CComponentEntry::NewLC(); - if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry))) - { - ELOG1(EJavaCaptain, - "addScrPresencesL: SCR GetComponentIdsL returned id %d " - "but GetComponentL does not find it", componentIdList[nInd]); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - - // When Java Installer registers Java app to SCR it stores also - // the media id using SetComponentPropertyL(TComponentId aComponentId, - // _L("Media-Id")), TInt64 aValue); (aValue is actually 32 bit int) - CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *) - pScr->GetComponentPropertyL(componentIdList[nInd],_L("Media-Id")); - if (NULL == pMediaIdProperty) - { - ELOG1(EJavaCaptain, - "addScrPresencesL: media_id property not found for component %d", - componentIdList[nInd]); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - CleanupStack::PushL(pMediaIdProperty); - - TInt nInstalledDrives = pEntry->InstalledDrives().Length(); - if (nInstalledDrives <= addedDrive) - { - // SCR InstalledDrives should be array of 26 elements (value 0 or 1) - ELOG2(EJavaCaptain, - "addScrPresencesL: The length of InstalledDrives array (%d) " - "is smaller than addedDrive (%d)", nInstalledDrives, addedDrive); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - - LOG1(EJavaCaptain, EInfo, "Java component id %d", componentIdList[nInd]); - - if (pEntry->InstalledDrives()[addedDrive]) - { - // This component has been installed to the drive - // that has just been added. - // Now check whether the media id of the added media - // is OK for this component. - if (addedMediaId == pMediaIdProperty->IntValue()) - { - pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue); - - LOG1(EJavaCaptain, EInfo, - "addScrPresencesL: set component %d to present", - componentIdList[nInd]); - -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC - fPresenceChange = ETrue; - - // Gather the Uids of all 'new' applications that are now present - RArray appsInComponent; - CleanupClosePushL(appsInComponent); - pScr->GetAppUidsForComponentL( - componentIdList[nInd], appsInComponent); - for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++) - { - TApaAppUpdateInfo appInfo; - appInfo.iAppUid = appsInComponent[nInd2]; - appInfo.iAction = TApaAppUpdateInfo::EAppPresent; - (void)addedApps.Append(appInfo); - } - CleanupStack::PopAndDestroy(&appsInComponent); -#endif - } - } - - CleanupStack::PopAndDestroy(pMediaIdProperty); - CleanupStack::PopAndDestroy(pEntry); - } - -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC - // Tell AppArc which 'new' applications are now present - while (fPresenceChange) - { - if (addedApps.Count() == 0) - { - ELOG(EJavaCaptain, "addScrPresencesL: Uids of the 'new' apps are not known"); - break; - } - - RApaLsSession apaSession; - TInt err = apaSession.Connect(); - if (KErrNone != err) - { - ELOG1(EJavaCaptain, "addScrPresencesL: Error %d when connecting AppArc", err); - break; - } - else - { - CleanupClosePushL(apaSession); - apaSession.UpdateAppListL(addedApps); - CleanupStack::PopAndDestroy(); // closes apaSession - fPresenceChange = EFalse; - } - } - - CleanupStack::PopAndDestroy(); // Close addedApps -#endif - CleanupStack::PopAndDestroy(); // Close componentIdList - CleanupStack::PopAndDestroy(pScr); - __UHEAP_MARKEND; -} - - -/** - * Loop through all removable drives and get the media id of - * the memory card or other removable media in the drive and update - * presence information of all Java applications installed - * to removable drives accordingly. - */ -void ScrUpdater::initializeScrPresenceInfoL() -{ - __UHEAP_MARK; - RFs fs; - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - - // Which drives are present and what is the media id of - // each removable volume - TInt err = KErrNone; - TInt err2 = KErrNone; - TBool drivePresent[EDriveZ + 1]; - TUint driveMediaId[EDriveZ + 1]; - TVolumeInfo volumeInfo; - TDriveInfo driveInfo; - - for (TInt nInd = EDriveA; nInd < EDriveZ; nInd++) - { - err = fs.Volume(volumeInfo, nInd); - if (KErrNone == err) - { - drivePresent[nInd] = ETrue; - driveMediaId[nInd] = volumeInfo.iUniqueID; - // If the media is not removable, media id is not checked - err2 = fs.Drive(driveInfo, nInd); - if (KErrNone != err2) - { - ELOG1(EJavaCaptain, - "initializeScrPresenceInfoL: error (%d) when trying to get drive info", - err2); - User::Leave(err2); - } - else - { - if (!(driveInfo.iDriveAtt & KDriveAttRemovable)) - { - driveMediaId[nInd] = 0; - } - } - } - else if (KErrNotReady == err) - { - // no volume in this drive - drivePresent[nInd] = EFalse; - driveMediaId[nInd] = 0; - } - else - { - ELOG1(EJavaCaptain, - "initializeScrPresenceInfoL: error (%d) when trying to get volume info", - err); - User::Leave(err); - } - } - CleanupStack::PopAndDestroy(); // close RFs - - - RSoftwareComponentRegistry *pScr = createScrL(); - CleanupStack::PushL(pScr); - - // Get ids of all Java components in scr - RArray componentIdList; - CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC(); - pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava); - - pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter); - CleanupStack::PopAndDestroy(pJavaSwTypeFilter); - CleanupClosePushL(componentIdList); - - // For each component check whether the drive it has been installed - // to is present AND whether the media id is correct - TInt nComponents = componentIdList.Count(); - - LOG1(EJavaCaptain, EInfo, "initializeScrPresenceInfoL: Number of Java components is %d", - nComponents); - - for (TInt nInd = 0; nInd < nComponents; nInd++) - { - CComponentEntry *pEntry = CComponentEntry::NewLC(); - if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry))) - { - ELOG1(EJavaCaptain, - "initializeScrPresenceInfoL: SCR GetComponentIdsL returned id %d " - "but GetComponentL does not find it", componentIdList[nInd]); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - - CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *) - pScr->GetComponentPropertyL(componentIdList[nInd],_L("Media-Id")); - if (NULL == pMediaIdProperty) - { - ELOG1(EJavaCaptain, - "initializeScrPresenceInfoL: media_id property not found for component %d", - componentIdList[nInd]); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - CleanupStack::PushL(pMediaIdProperty); - - TInt nInstalledDrives = pEntry->InstalledDrives().Length(); - if (nInstalledDrives > (EDriveZ + 1)) - { - WLOG2(EJavaCaptain, - "initializeScrPresenceInfoL: too big (%d) installed drives array for " - "component %d", nInstalledDrives, componentIdList[nInd]); - nInstalledDrives = EDriveZ; - } - // When Java components are installed, only one installed drive - // and corresponding media id are registered. - TInt installationDrive = -1; - - for (TInt driveNumber = EDriveA; driveNumber < nInstalledDrives; driveNumber++) - { - if (pEntry->InstalledDrives()[driveNumber]) - { - installationDrive = driveNumber; - break; - } - } - - if (installationDrive == -1) - { - ELOG1(EJavaCaptain, - "initializeScrPresenceInfoL: component (id %d) did not have installed drive info", - componentIdList[nInd]); - CleanupStack::PopAndDestroy(pMediaIdProperty); - CleanupStack::PopAndDestroy(pEntry); - continue; - } - - if (drivePresent[installationDrive]) - { - // Check also the media id - if (driveMediaId[installationDrive] == pMediaIdProperty->IntValue()) - { - LOG1(EJavaCaptain, EInfo, - "initializeScrPresenceInfoL: set component %d to present", - componentIdList[nInd]); - - pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue); - } - else - { - LOG1(EJavaCaptain, EInfo, - "initializeScrPresenceInfoL: set component %d to NOT present", - componentIdList[nInd]); - - pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse); - } - } - else - { - LOG1(EJavaCaptain, EInfo, - "initializeScrPresenceInfoL: set component %d to NOT present", - componentIdList[nInd]); - - // drive is not present -> Java component installed to that - // drive is not present - pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse); - } - - CleanupStack::PopAndDestroy(pMediaIdProperty); - CleanupStack::PopAndDestroy(pEntry); - } - - CleanupStack::PopAndDestroy(); // Close componentIdList - CleanupStack::PopAndDestroy(pScr); // Also closes RSoftwareComponentRegistry - - __UHEAP_MARKEND; -} - - -/** - * Creates an instance of RSoftwareComponentRegistry and connects to it. - */ -RSoftwareComponentRegistry *ScrUpdater::createScrL() -{ - RSoftwareComponentRegistry *pScr = new RSoftwareComponentRegistry; - if (NULL == pScr) - { - ELOG(EJavaInstaller, - "CreateScrL: Creating RSoftwareComponentRegistry failed"); - User::Leave(KErrGeneral); - } - TInt err = pScr->Connect(); - if (KErrNone != err) - { - ELOG1(EJavaInstaller, - "CreateScrL: Connecting to RSoftwareComponentRegistry failed, error %d", - err); - delete pScr; - User::Leave(err); - } - - return pScr; -} - - -} // namespace captain -} // namespace java diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro --- a/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro Thu Sep 02 13:22:59 2010 +0300 @@ -20,7 +20,7 @@ CONFIG -= qt symbian { - LIBS += -lcommonengine \ + LIBS += -lCommonEngine \ -lcentralrepository \ -lcenrepnotifhandler \ -ljavacomms diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp --- a/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp Thu Sep 02 13:22:59 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 @@ -52,8 +56,6 @@ USERINCLUDE ../inc USERINCLUDE ../../../../inc -SYSTEMINCLUDE ../../../../inc - // Libraries LIBRARY charconv.lib LIBRARY cone.lib diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/appinstuiplugin/data/101F875F.rss --- a/javamanager/javainstaller/appinstuiplugin/data/101F875F.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/appinstuiplugin/data/101F875F.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp --- a/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss --- a/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Thu Sep 02 13:22:59 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() @@ -107,19 +285,15 @@ iIconDir = aIconDir; iComponentIcon = aComponentIcon; - if (iHandle == 0) - { - InstallerException.internalError( - "SifNotifier.notifyStart: notifier has not been initialized"); - } + checkHandle(); int ret = _notifyStart( - iHandle, aGlobalComponentId, aComponentName, + iHandle, aOperation, aGlobalComponentId, aComponentName, aApplicationNames, aApplicationIcons, aComponentSize, aIconDir, aComponentIcon); if (ret < 0) { - Log.logError("Notifying SIF start failed with code " + ret + - ", " + getInfoString()); + Log.log("Notifying SIF start failed with code " + ret + + ", " + getInfoString()); InstallerException.internalError( "Notifying SIF start failed with code " + ret); } @@ -138,11 +312,7 @@ public void notifyEnd( int aErrCategory, int aErrCode, String aErrMsg, String aErrMsgDetails) { - if (iHandle == 0) - { - InstallerException.internalError( - "SifNotifier.notifyEnd: notifier has not been initialized"); - } + checkHandle(); if (aErrCategory == 0 && iLastProgressSent < MAX_PROGRESS) { // Before sending end notification, update progress to max if @@ -162,8 +332,8 @@ ", ErrMsgDetails: " + aErrMsgDetails; if (ret < 0) { - Log.logError("Notifying SIF end failed with code " + ret + - ", " + getInfoString() + ", " + logMsg); + Log.log("Notifying SIF end failed with code " + ret + + ", " + getInfoString() + ", " + logMsg); InstallerException.internalError( "Notifying SIF end failed with code " + ret); } @@ -184,11 +354,17 @@ { return; } - if (iHandle == 0) + + iSubOperation = aSubOperation; + iCurrentValue = aCurrent; + iTotalValue = aTotal; + if (iIndicatorHandle != 0) { - InstallerException.internalError( - "SifNotifier.notifyProgress: notifier has not been initialized"); + // Call activateIndicator so that indicator gets updated. + activateIndicator(); } + + checkHandle(); if (aSubOperation == SUB_OP_NO) { iLastProgressSent = aCurrent; @@ -202,8 +378,8 @@ ", Total: " + aTotal; if (ret < 0) { - Log.logError("Notifying SIF progress failed with code " + ret + - ", " + getInfoString() + ", " + logMsg); + Log.log("Notifying SIF progress failed with code " + ret + + ", " + getInfoString() + ", " + logMsg); InstallerException.internalError( "Notifying SIF progress failed with code " + ret); } @@ -221,11 +397,8 @@ */ public void destroy() { - if (iHandle == 0) - { - InstallerException.internalError( - "SifNotifier.destroy: notifier has not been initialized"); - } + deactivateIndicator(); + checkHandle(); int ret = _destroy(iHandle); if (ret < 0) { @@ -265,6 +438,19 @@ /*** ----------------------------- PRIVATE ---------------------------- */ /** + * Checks if notifier instance has been initialized. + * @throws InstallerException if notifier has not been initialized + */ + private void checkHandle() + { + if (iHandle == 0) + { + InstallerException.internalError( + "SifNotifier.destroy: notifier has not been initialized"); + } + } + + /** * Returns notification info string used in logging. */ private String getInfoString() @@ -312,6 +498,7 @@ * Notifies SIF about installation/uinstallation start. * * @param aHandle + * @param aOperation * @param aGlobalComponentId * @param aComponentName * @param aApplicationNames @@ -323,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. @@ -365,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(); @@ -379,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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp --- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp --- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -24,6 +24,7 @@ #include #include "com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator.h" +#include "com_nokia_mj_impl_utils_InstallerErrorMessage.h" #include "javacommonutils.h" #include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL #include "logger.h" @@ -33,19 +34,15 @@ #include #include -#ifdef RD_JAVA_USIF_APP_REG #include -#endif // RD_JAVA_USIF_APP_REG +#include #include // Helper macro for logging a TDesC. #define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \ - { \ - HBufC8* tdescBuf = HBufC8::NewLC(tdescParam.Length() + 1); \ - TPtr8 tdescPtr(tdescBuf->Des()); \ - tdescPtr.Append(tdescParam); \ - LOG1(compIdParam, logLevelParam, msgParam, tdescPtr.PtrZ());\ - CleanupStack::PopAndDestroy(tdescBuf); \ + { \ + std::wstring ws((wchar_t*)tdescParam.Ptr(), tdescParam.Length()); \ + LOG1(compIdParam, logLevelParam, msgParam, ws.c_str()); \ } // NAMESPACE DECLARATION @@ -55,21 +52,19 @@ IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString); // Properties registered to SCR. -_LIT(KMIDletName, "MIDlet-Name"); _LIT(KUid, "Uid"); _LIT(KMediaId, "Media-Id"); _LIT(KMIDletInfoURL, "MIDlet-Info-URL"); _LIT(KMIDletDescription, "MIDlet-Description"); _LIT(KDownloadURL, "Download-URL"); +_LIT(KUpdateURL, "Update-URL"); _LIT(KSettingsPlugin, "SettingsName"); _LIT(KSettingsPluginValue, "javaapplicationsettingsview"); -#ifdef RD_JAVA_USIF_APP_REG // Symbian file path separator. _LIT(KPathSeperator, "\\"); // Postfix for the fake application name generated for AppArc. _LIT(KAppPostfix, ".fakeapp"); -#endif // RD_JAVA_USIF_APP_REG /** * Internal helper method for checking if specified application @@ -179,7 +174,6 @@ * See JNI method __1notifyAppChange. * This method makes calls that may leave (the actual registering). */ -#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC void NotifyAppChangeL(JNIEnv *aEnv, jintArray aAppUids, jint aAppChange) { RApaLsSession apaSession; @@ -212,11 +206,6 @@ CleanupStack::PopAndDestroy(&apaSession); LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed"); } -#else -void NotifyAppChangeL(JNIEnv *, jintArray, jint) -{ -} -#endif // RD_JAVA_USIF_NOTIFY_APP_ARC /* * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator @@ -227,12 +216,6 @@ (JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange) { TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange)); - if (KErrNone != err) - { - ELOG1(EJavaInstaller, - "notifyAppChange: notifying AppArc failed, error %d", - err); - } return err; } @@ -257,14 +240,21 @@ QUrl openRecentView("appto://20022F35?activityname=AppLibRecentView"); XQApplicationManager applicationManager; XQAiwRequest *request = applicationManager.create(openRecentView); - if (request) { + if (request) + { + LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib"); bool result = request->send(); - if (!result) { + if (!result) + { int error = request->lastError(); ELOG1(EJavaInstaller, "launchAppView: launching AppLib failed, error %d", error); err = KErrGeneral; } + else + { + LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib succeeded"); + } delete request; } @@ -354,12 +344,6 @@ TRAPD(err, pScr->RollbackTransactionL()); pScr->Close(); delete pScr; - if (KErrNone != err) - { - ELOG1(EJavaInstaller, - "rollbackSession: Rolling back transaction failed, error %d", - err); - } return err; } @@ -389,9 +373,9 @@ HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue); aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf); //LOG_TDESC_L(EJavaInstaller, EInfo, - // "SetComponentPropertyL: name %s", aName); + // "SetComponentPropertyL: name %S", aName); //LOG_TDESC_L(EJavaInstaller, EInfo, - // "SetComponentPropertyL: value %s", valueBuf->Des()); + // "SetComponentPropertyL: value %S", valueBuf->Des()); CleanupStack::PopAndDestroy(valueBuf); } } @@ -402,23 +386,14 @@ */ TComponentId RegisterComponentL( JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid, - jstring aSuiteName, jstring aVendor, jstring aVersion, - jstring aName, jstring aGlobalId, + jstring aSuiteName, jstring aVendor, jstring aVersion, jstring aGlobalId, jobjectArray aComponentFiles, TInt64 aComponentSize, TBool aIsRemovable, TBool aIsDrmProtected, TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId, - jstring aMidletInfoUrl, jstring aMidletDescription, jstring aDownloadUrl) + jstring aMidletInfoUrl, jstring aMidletDescription, + jstring aDownloadUrl, jstring aUpdateUrl) { - HBufC *name = NULL; - if (NULL == aName) - { - // If name is not specified, use suite name. - name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName); - } - else - { - name = CreateHBufCFromJavaStringLC(aEnv, aName); - } + HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName); HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion); HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId); @@ -445,14 +420,10 @@ aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue()); //LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set"); - if (NULL != aName) - { - // If name is specified, store suite name as property. - SetComponentPropertyL(aEnv, aScr, componentId, KMIDletName(), aSuiteName); - } SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl); SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription); SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl); + SetComponentPropertyL(aEnv, aScr, componentId, KUpdateURL(), aUpdateUrl); CleanupStack::PopAndDestroy(globalId); CleanupStack::PopAndDestroy(version); @@ -478,21 +449,22 @@ */ JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName, - jstring aVendor, jstring aVersion, jstring aName, jstring aGlobalId, + jstring aVendor, jstring aVersion, jstring aGlobalId, jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable, jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate, jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription, - jstring aDownloadUrl, jobject aComponentId) + jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId) { __UHEAP_MARK; RSoftwareComponentRegistry *pScr = reinterpret_cast(aSessionHandle<<2); TComponentId componentId = -1; TRAPD(err, componentId = RegisterComponentL( - aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId, + aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId, aComponentFiles, aComponentSize, aIsRemovable, aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId, - aMidletInfoUrl, aMidletDescription, aDownloadUrl)); + aMidletInfoUrl, aMidletDescription, + aDownloadUrl, aUpdateUrl)); __UHEAP_MARKEND; if (KErrNone == err) { @@ -515,9 +487,7 @@ RSoftwareComponentRegistry *pScr = reinterpret_cast(aSessionHandle<<2); TInt err = KErrNone; -#ifdef RD_JAVA_USIF_APP_REG TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId)); -#endif // RD_JAVA_USIF_APP_REG if (KErrNone == err) { TRAP(err, pScr->DeleteComponentL(aComponentId)); @@ -530,7 +500,6 @@ * See JNI method __1registerApplication. * This method makes calls that may leave. */ -#ifdef RD_JAVA_USIF_APP_REG void RegisterApplicationL( JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId, jint aAppUid, @@ -598,47 +567,36 @@ RPointerArray captionsArray; CleanupResetAndDestroyPushL(captionsArray); TInt langCount = aEnv->GetArrayLength(aLanguages); - TInt captionCount = aEnv->GetArrayLength(aAppNames); - if (langCount == captionCount) + jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL); + for (TInt i = 0; i < langCount; i++) { - jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL); - for (TInt i = 0; i < langCount; i++) - { - TLanguage tmpLanguage = (TLanguage)languages[i]; - HBufC *tmpCaption = - CreateHBufCFromJavaStringLC( - aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i)); - captionsArray.AppendL(tmpCaption); - CleanupStack::Pop(tmpCaption); - //LOG1(EJavaInstaller, EInfo, - // "RegisterApplicationL: language %d", tmpLanguage); - //LOG_TDESC_L(EJavaInstaller, EInfo, - // "RegisterApplicationL: caption %s", tmpCaption->Des()); - CCaptionAndIconInfo *tmpCaptionAndIconInfo = - CCaptionAndIconInfo::NewLC( - /*aCaption=*/ *tmpCaption, - /*aIconFileName=*/ KNullDesC, - /*aNumOfAppIcons=*/ 0); - CLocalizableAppInfo *tmpLocAppInfo = - CLocalizableAppInfo::NewLC( - /*aShortCaption=*/ KNullDesC, - /*aApplicationLanguage=*/ tmpLanguage, - /*aGroupName=*/ KNullDesC, - /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo, - /*aViewDataList=*/ viewDataList); - localizableAppInfoList.AppendL(tmpLocAppInfo); - CleanupStack::Pop(tmpLocAppInfo); - CleanupStack::Pop(tmpCaptionAndIconInfo); - } - aEnv->ReleaseIntArrayElements(aLanguages, languages, 0); + TLanguage tmpLanguage = (TLanguage)languages[i]; + HBufC *tmpCaption = + CreateHBufCFromJavaStringLC( + aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i)); + captionsArray.AppendL(tmpCaption); + CleanupStack::Pop(tmpCaption); + //LOG1(EJavaInstaller, EInfo, + // "RegisterApplicationL: language %d", tmpLanguage); + //LOG_TDESC_L(EJavaInstaller, EInfo, + // "RegisterApplicationL: caption %S", tmpCaption->Des()); + CCaptionAndIconInfo *tmpCaptionAndIconInfo = + CCaptionAndIconInfo::NewLC( + /*aCaption=*/ *tmpCaption, + /*aIconFileName=*/ KNullDesC, + /*aNumOfAppIcons=*/ 0); + CLocalizableAppInfo *tmpLocAppInfo = + CLocalizableAppInfo::NewLC( + /*aShortCaption=*/ KNullDesC, + /*aApplicationLanguage=*/ tmpLanguage, + /*aGroupName=*/ KNullDesC, + /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo, + /*aViewDataList=*/ viewDataList); + localizableAppInfoList.AppendL(tmpLocAppInfo); + CleanupStack::Pop(tmpLocAppInfo); + CleanupStack::Pop(tmpCaptionAndIconInfo); } - else - { - WLOG2(EJavaInstaller, - "RegisterApplicationL: localisation not made because language " \ - "count does not match to caption count (%d != %d)", - langCount, captionCount); - } + aEnv->ReleaseIntArrayElements(aLanguages, languages, 0); // Create application registration data objects. TApplicationCharacteristics appCharacteristics; @@ -674,13 +632,6 @@ CleanupStack::PopAndDestroy(caption); __UHEAP_MARKEND; } -#else -void RegisterApplicationL( - JNIEnv *, RSoftwareComponentRegistry *, jint, jint, jstring, - jstring, jstring, jstring, jint, jintArray, jobjectArray) -{ -} -#endif // RD_JAVA_USIF_APP_REG /* * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator @@ -710,19 +661,13 @@ JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId, jstring aName, jstring aVendor, jint aLanguage) { - if (NULL != aName) - { - HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); - aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage); - CleanupStack::PopAndDestroy(name); - } + HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName); + aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage); + CleanupStack::PopAndDestroy(name); - if (NULL != aVendor) - { - HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); - aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage); - CleanupStack::PopAndDestroy(vendor); - } + HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor); + aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage); + CleanupStack::PopAndDestroy(vendor); } /* @@ -827,7 +772,6 @@ * Method: _getComponentIdForApp * Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I */ -#ifdef RD_JAVA_USIF_APP_REG JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp (JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId) { @@ -847,13 +791,6 @@ } return err; } -#else -JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp -(JNIEnv *, jclass, jint, jint, jobject) -{ - return KErrNone; -} -#endif // RD_JAVA_USIF_APP_REG /** * See JNI method __1getuid. @@ -866,20 +803,8 @@ CleanupClosePushL(*pScr); TInt uid = 0; CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid()); - if (NULL != property) - { - if (property->PropertyType() == CPropertyEntry::EIntProperty) - { - uid = ((CIntPropertyEntry*)property)->IntValue(); - } - else - { - ELOG2(EJavaInstaller, - "GetUidL: Incorrect property type %d for cid %d", - property->PropertyType(), aCid); - } - delete property; - } + uid = ((CIntPropertyEntry*)property)->IntValue(); + delete property; // Close and delete the temporary RSoftwareComponentRegistry. CleanupStack::PopAndDestroy(pScr); delete pScr; // For some reason PopAndDestroy does not delete this. @@ -916,23 +841,16 @@ HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId); CComponentEntry *componentEntry = aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage); - if (NULL == componentEntry) - { - //LOG_TDESC_L(EJavaInstaller, EInfo, - // "Component not found for GlobalId %s", globalId->Des()); - CleanupStack::PopAndDestroy(globalId); - return; - } CleanupStack::PopAndDestroy(globalId); // Log component entry. TComponentId componentId = componentEntry->ComponentId(); - LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %s", componentEntry->GlobalId()); + LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %S", componentEntry->GlobalId()); LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId); - LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %s", componentEntry->SoftwareType()); - LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %s", componentEntry->Name()); - LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %s", componentEntry->Vendor()); - LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %s", componentEntry->Version()); + LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %S", componentEntry->SoftwareType()); + LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %S", componentEntry->Name()); + LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %S", componentEntry->Vendor()); + LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %S", componentEntry->Version()); LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize()); LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState()); LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected()); @@ -960,42 +878,37 @@ switch (propertyEntry->PropertyType()) { case CPropertyEntry::EBinaryProperty: - LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %s", + LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %S", propertyEntry->PropertyName()); break; case CPropertyEntry::EIntProperty: - LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %s", + LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %S", propertyEntry->PropertyName()); LOG2(EJavaInstaller, EInfo, " = 0x%x (%d)", ((CIntPropertyEntry*)propertyEntry)->IntValue(), ((CIntPropertyEntry*)propertyEntry)->IntValue()); break; case CPropertyEntry::ELocalizedProperty: - LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %s", + LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %S", propertyEntry->PropertyName()); - LOG_TDESC_L(EJavaInstaller, EInfo, " = %s", + LOG_TDESC_L(EJavaInstaller, EInfo, " = %S", ((CLocalizablePropertyEntry*)propertyEntry)->StrValue()); break; } } CleanupStack::PopAndDestroy(&properties); -#ifdef RD_JAVA_USIF_APP_REG // Log uids of applications associated to component. RArray appUids; CleanupClosePushL(appUids); aScr->GetAppUidsForComponentL(componentId, appUids); - if (appUids.Count() == 0) - { - LOG(EJavaInstaller, EInfo, "No component appUids found from SCR"); - } + LOG1(EJavaInstaller, EInfo, "Number of AppUids found: %d", appUids.Count()); for (TInt i = 0; i < appUids.Count(); i++) { LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)", appUids[i].iUid, appUids[i].iUid); } CleanupStack::PopAndDestroy(&appUids); -#endif // RD_JAVA_USIF_APP_REG } /** @@ -1047,11 +960,51 @@ JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUsifMode (JNIEnv *, jclass) { -#ifdef RD_JAVA_USIF_APP_REG return 1; -#else - return 0; -#endif // RD_JAVA_USIF_APP_REG +} + +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator + * Method: _getErrorCategory + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory +(JNIEnv *, jclass, jint aErrorId) +{ + int errorCategory = Usif::EUnexpectedError; + switch (aErrorId) + { + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_MEM: + errorCategory = Usif::ELowDiskSpace; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_NET: + errorCategory = Usif::ENetworkUnavailable; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CORRUPT_PKG: + errorCategory = Usif::ECorruptedPackage; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_COMPAT_ERR: + errorCategory = Usif::EApplicationNotCompatible; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHORIZATION_ERR: + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHENTICATION_ERR: + errorCategory = Usif::ESecurityError; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_PUSH_REG_ERR: + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_UNEXPECTED_ERR: + case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_UNEXPECTED_ERR: + case com_nokia_mj_impl_utils_InstallerErrorMessage_OTHER_UNEXPECTED_ERR: + errorCategory = Usif::EUnexpectedError; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CANCEL: + case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_CANCEL: + errorCategory = Usif::EUserCancelled; + break; + case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_NOT_ALLOWED: + errorCategory = Usif::EUninstallationBlocked; + break; + } + return errorCategory; } #else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK @@ -1127,9 +1080,9 @@ * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I */ JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent -(JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, jstring, - jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, jstring, - jstring, jstring, jobject) +(JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, + jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, + jstring, jstring, jstring, jstring, jobject) { return KErrNone; } @@ -1233,4 +1186,15 @@ return 0; } +/* + * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator + * Method: _getErrorCategory + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory +(JNIEnv *, jclass, jint) +{ + return 0; +} + #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/build/build.xml --- a/javamanager/javainstaller/installer/tsrc/build/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/build/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -1,6 +1,6 @@ @@ -96,7 +96,7 @@ tofile="${dist.dir}/${junit.omj.jar.filename}"/> - + @@ -108,6 +108,9 @@ + + + diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/build/jiut.bat --- a/javamanager/javainstaller/installer/tsrc/build/jiut.bat Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/build/jiut.bat Thu Sep 02 13:22:59 2010 +0300 @@ -1,5 +1,5 @@ @rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. @rem This component and the accompanying materials are made available @rem under the terms of "Eclipse Public License v1.0" @@ -11,13 +11,14 @@ @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 -rem javainstaller test -mainclass=com.nokia.mj.impl.installer.downloader.NotificationPosterTest -rem javainstaller test -mainclass=com.nokia.mj.impl.installer.downloader.DownloaderTest +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 javainstaller test -mainclass=com.nokia.mj.impl.installer.integrityservice.IntegrityServiceTest javainstaller test -mainclass=com.nokia.mj.impl.installer.jadjarmatcher.JadJarMatcherTest @@ -34,4 +35,7 @@ javainstaller test -mainclass=com.nokia.mj.impl.installer.utils.AttributeReaderTest javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerResultMessageTest javainstaller test -mainclass=com.nokia.mj.impl.installer.GetComponentInfoTest -rem javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest +javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run1 +javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run2 +javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run3 +javainstaller test -mainclass=com.nokia.mj.impl.installer.InstallerEngineTest -param1=run4 diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/SifRegistratorTest.java --- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/SifRegistratorTest.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/SifRegistratorTest.java Thu Sep 02 13:22:59 2010 +0300 @@ -203,11 +203,23 @@ { SuiteInfo si = getTestSuite(); ComponentId cid = getComponentId(si.getGlobalId()); + // Check for USIF Phase 2 registration. Uid uid = sifReg.getUid(cid.getId()); assertTrue("Suite uid " + si.getUid() + " does not match" + " to uid " + uid + " from SCR", si.getUid().equals(uid)); + + Uid appUid = PlatformUid.createUid("[e0001001]"); + sifReg.startSession(false); + ComponentId cidForApp = sifReg.getComponentId(appUid); + sifReg.closeSession(); + assertTrue("Null component id from SCR for application uid " + + appUid, cidForApp != null); + assertTrue("Component id " + cid + " does not match" + + " to uid " + cidForApp + " from SCR", + cid.getId() == cidForApp.getId()); + // Check for USIF Phase 1 registration. //Vector apps = si.getApplications(); //for (int i = 0; i < apps.size(); i++) diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/DownloaderTest.java --- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/DownloaderTest.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/DownloaderTest.java Thu Sep 02 13:22:59 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" @@ -37,8 +37,8 @@ */ public class DownloaderTest extends TestCase implements InstallerMain { - private static final String TEST_URL = "http://195.134.231.83:7070/java-server/resources/DS_Snow.jar"; - private static final int TEST_URL_SIZE = 10241; // test data file size + private static final String TEST_URL = "/installertest/HelloWorld.jar"; + private static final int TEST_URL_SIZE = 1511; // test data file size // Begin j2meunit test framework setup @@ -172,10 +172,15 @@ public void testBasicDownload(Downloader downloader, TestDlListener listener) { + String server = System.getProperty( + "com.nokia.mj.impl.installer.test.server"); + assertNotNull("-server=
    : argument required.", server); + try { String filename = "test.dat"; - DownloadInfo dlInfo = new DownloadInfo(TEST_URL, filename); + DownloadInfo dlInfo = new DownloadInfo("http://" + server + + TEST_URL, filename); downloader.start(dlInfo); downloader.waitForCompletion(); assertTrue("Result DlInfo is null", diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPosterTest.java --- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPosterTest.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPosterTest.java Thu Sep 02 13:22:59 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" @@ -36,7 +36,7 @@ */ public class NotificationPosterTest extends TestCase implements InstallerMain { - private static final String TEST_URL = "http://195.134.231.83:7070/java-server/getresult.jsp?phone=CE0CBA106ADB77A9298A143E5136CD2B&tID=900_success"; + private static final String TEST_URL = "/installertest/notify?tID=900_success"; // Begin j2meunit test framework setup @@ -361,13 +361,18 @@ testNotifyPendingFailureLimit(poster); } - private static OtaStatusNotification createNotification(int aIndex) + private OtaStatusNotification createNotification(int aIndex) { + String server = System.getProperty( + "com.nokia.mj.impl.installer.test.server"); + assertNotNull("-server=
    : argument required.", server); + OtaStatusNotification notification = new OtaStatusNotification (PlatformUid.createUid(Integer.toString(aIndex)), System.currentTimeMillis(), OtaStatusNotification.TYPE_INSTALL, OtaStatusCode.SUCCESS, - TEST_URL + aIndex, System.currentTimeMillis(), 0); + "http://" + server + TEST_URL + aIndex, System.currentTimeMillis(), + 0); return notification; } diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/storagehandler/StorageHandlerTest.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/AttributeValidatorTest.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad --- a/javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.zip Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.zip has changed diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/LaunchAppQueryView.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/LaunchAppQueryView.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/LaunchAppQueryView.java Thu Sep 02 13:22:59 2010 +0300 @@ -18,12 +18,9 @@ package com.nokia.mj.impl.installer.ui.eswt2; -import com.nokia.mj.impl.installer.ui.InstallInfo; import com.nokia.mj.impl.installer.ui.LaunchAppInfo; -import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Button; /** * LaunchAppQueryView asks from the user if the installed @@ -31,9 +28,6 @@ */ public class LaunchAppQueryView extends ConfirmationViewBase { - private LaunchAppInfo iLaunchAppInfo = null; - private Button iDefaultButton = null; - /** Constructor */ protected LaunchAppQueryView() { @@ -58,7 +52,6 @@ return false; } - iLaunchAppInfo = aLaunchAppInfo; // Use confirm() from super class to display the view. boolean result = confirm(); // Return the result to the client. @@ -81,26 +74,4 @@ { // User selection data is initialized in button listeners. } - - /** - * Returns SWT style for this view. - */ - protected int getStyle() - { - return SWT.V_SCROLL; - } - - /** - * Called after view and commands have been created. Subclasses - * can overrride this method to set focus to their own default - * commands. - */ - protected void setDefaultCommand() - { - if (iDefaultButton != null) - { - iDefaultButton.setFocus(); - getShell().setDefaultButton(iDefaultButton); - } - } } diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp --- a/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/javasifplugin/data/2002BC6F.rss --- a/javamanager/javainstaller/javasifplugin/data/2002BC6F.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javainstaller/javasifplugin/data/2002BC6F.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javalauncher/src.s60/javalauncher.cpp --- a/javamanager/javalauncher/src.s60/javalauncher.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javalauncher/src.s60/javalauncher.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -92,7 +92,7 @@ JavaStorageApplicationList_t foundEntries; - // Get MIDlet-n from APPLICATION_PACKAGE_ATTRIBUTES_TABLE based on + // Get MIDlet-n from APPLICATION_PACKAGE_ATTRIBUTES_TABLE based on // PACKAGE_ID and NAME. attribute.setEntry(ID, aPackageId); findPattern.insert(attribute); @@ -107,7 +107,7 @@ return KErrNotFound; } - // Found the MIDlet-n argument. Now getting the MIDlet name and + // Found the MIDlet-n argument. Now getting the MIDlet name and // main class. Name is the first argument and main class is the last // in the comma separated list. std::wstring value = foundEntries.front().begin()->entryValue(); @@ -549,6 +549,10 @@ err = getUidFromCommandLine(cmdLineBuf, uid); if (KErrNone != err) { + ELOG1WSTR(EJavaCaptain, + "JavaLauncher: process command line was %s", + (wchar_t *)(cmdLineBuf.PtrZ())); + CleanupStack::PopAndDestroy(pBufCmdLine); CleanupStack::PopAndDestroy(commandLine); return err; @@ -773,6 +777,8 @@ "javalauncher: OMJ app launch: Exception %s caught", e.what()); } + delete pBufCmdLine; + return err; } diff -r 0ea12c182930 -r 63b81d807542 javamanager/javamanager.pro --- a/javamanager/javamanager.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javamanager.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javarecognizer/build/recjar.mmp --- a/javamanager/javarecognizer/build/recjar.mmp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javarecognizer/build/recjar.mmp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javarecognizer/data/102031FB.rss --- a/javamanager/javarecognizer/data/102031FB.rss Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javarecognizer/data/102031FB.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javarecognizer/data/102031FB_iad.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javamanager/javarecognizer/data/102031FB_iad.rss Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javaregistry/client/src/javaattribute.cpp --- a/javamanager/javaregistry/client/src/javaattribute.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javaregistry/client/src/javaattribute.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -92,7 +92,7 @@ // --------------------------------------------------------------------------- // CJavaAttribute::~MJavaAttribute // --------------------------------------------------------------------------- -CJavaAttribute::~CJavaAttribute() +EXPORT_C CJavaAttribute::~CJavaAttribute() { delete iName; delete iValue; diff -r 0ea12c182930 -r 63b81d807542 javamanager/javaregistry/client/src/javaregistryentry.cpp --- a/javamanager/javaregistry/client/src/javaregistryentry.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javaregistry/client/src/javaregistryentry.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -115,7 +115,7 @@ // CJavaRegistryEntry::~CJavaRegistryEntry // --------------------------------------------------------------------------- // -CJavaRegistryEntry::~CJavaRegistryEntry() +EXPORT_C CJavaRegistryEntry::~CJavaRegistryEntry() { if (iWritableEntry) { diff -r 0ea12c182930 -r 63b81d807542 javamanager/javasettings/javasettings.pro --- a/javamanager/javasettings/javasettings.pro Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javamanager/javasettings/subsystem.mk --- a/javamanager/javasettings/subsystem.mk Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javamanager/javasettings_qt/build/javaapplicationsettingsview.pro --- a/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp --- a/javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/javasidchecker/build/bld.inf --- a/javamanager/javasidchecker/build/bld.inf Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Java SID Checker component -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -javasidchecker.mmp diff -r 0ea12c182930 -r 63b81d807542 javamanager/javasidchecker/build/javasidchecker.mmp --- a/javamanager/javasidchecker/build/javasidchecker.mmp Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This is an ECOM plugin for Symbian AppArc (database that contains -* info on all applications installed to the device) -* This plugin tells AppArc whether Java application installed -* to a removable storage media is present and can be executed. -* -*/ - - -// INCLUDES -#include <../../../inc/project_defines.hrh> -#include <../../../inc/build_defines.hrh> -#include -#include - -#include <../../../inc/java_stdcpp_support_for_dll.hrh> - -TARGET javasidchecker.dll -CAPABILITY All -Tcb -TARGETTYPE plugin - -UID 0x10009d8d 0x10281FBE - -// Use bytepair compression to enable code paging -PAGED - -// Includes -USERINCLUDE . -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -// Sources -SOURCEPATH ../src -SOURCE javasidchecker.cpp - -start RESOURCE ../data/10281FBE.rss -target javasidchecker.rsc -end - -#ifdef RD_JAVA_OLD_SIDCHECKER_LIBRARY -LIBRARY apfile.lib -#else -LIBRARY aplist.lib -#endif - -LIBRARY ecom.lib -LIBRARY javaregistryclient.lib diff -r 0ea12c182930 -r 63b81d807542 javamanager/javasidchecker/data/10281FBE.rss --- a/javamanager/javasidchecker/data/10281FBE.rss Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Java Sid Checker is an ECOM plugin for Symbian AppArc -* (database that contains info on all applications installed -* to the device) -* It tells AppArc whether Java application installed -* to a removable storage media is present and can be executed. -* -*/ - - -// Registry file for the CApparcVerifierInterface JavaRegistry implementation - -#include -#include "javauids.h" - -RESOURCE REGISTRY_INFO r_registry -{ - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = KJavaSidCheckerDllUid; // must match the name of this file - interfaces = - { - INTERFACE_INFO - { - interface_uid = KSidCheckerEcomIfUid; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KSidCheckerEcomImplUid; - // Version number is 2 so that this implementation should override the old one in ROM - version_no = 2; - display_name = "JavaVerify"; - default_data = "[10210e26]"; - opaque_data = ""; - rom_only = 0; - } - }; - } - }; -} diff -r 0ea12c182930 -r 63b81d807542 javamanager/javasidchecker/inc/javasidchecker.h --- a/javamanager/javasidchecker/inc/javasidchecker.h Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Java Sid Checker is an ECOM plugin for Symbian AppArc - * (database that contains info on all applications installed - * to the device) - * It tells AppArc whether Java application installed - * to a removable storage media is present and can be executed. - * -*/ - - -#ifndef JAVASIDCHECKER_H -#define JAVASIDCHECKER_H - -#include -#include - -NONSHARABLE_CLASS(CJavaSidChecker) : public CAppSidChecker - /** Java Sid checker. - - This is an implementation of CAppSidChecker for checking native application Sids - - This instance of the CAppSidChecker is used to verify that a native application - installed and can be launched. - */ -{ -public: - static CJavaSidChecker* NewL(); - ~CJavaSidChecker(); - - // From CAppSidChecker - TBool AppRegisteredAt(const TUid& aSid, TDriveUnit aDrive); - - void SetRescanCallBackL(const TCallBack &aCallback); - -private: - CJavaSidChecker(); - TBool AppRegisteredAtL(const TUid& aSid, TDriveUnit aDrive); - - Java::CJavaRegistry* iJavaRegistry; -}; - -#endif // JAVASIDCHECKER_H diff -r 0ea12c182930 -r 63b81d807542 javamanager/javasidchecker/src/javasidchecker.cpp --- a/javamanager/javasidchecker/src/javasidchecker.cpp Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Java Sid Checker is an ECOM plugin for Symbian AppArc - * (database that contains info on all applications installed - * to the device) - * It tells AppArc whether Java application installed - * to a removable storage media is present and can be executed. - * -*/ - - -#include -#include -#include - -#include "javauids.h" -#include "javasidchecker.h" -#include "logger.h" - - -// DLL Entry point -TBool E32Dll() -{ - return ETrue; -} - -// ECOM Implementation Table -const TImplementationProxy ImplementationTable[] = -{ - IMPLEMENTATION_PROXY_ENTRY(KSidCheckerEcomImplUid, CJavaSidChecker::NewL) -}; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) -{ - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; -} - - -CJavaSidChecker* CJavaSidChecker::NewL() -{ - // Minimal construction (we don't want this to fail) - return new(ELeave) CJavaSidChecker; -} - -CJavaSidChecker::CJavaSidChecker() -{ - iJavaRegistry = NULL; - LOG(EUtils, EInfo, "CJavaSidChecker: Constructor called"); -} - -CJavaSidChecker::~CJavaSidChecker() -{ - if (NULL != iJavaRegistry) - { - delete iJavaRegistry; - iJavaRegistry = NULL; - } - LOG(EUtils, EInfo, "CJavaSidChecker: Destructor called"); -} - -TBool CJavaSidChecker::AppRegisteredAt(const TUid& aSid, TDriveUnit aDrive) -{ - TBool installed = EFalse; - - LOG1(EUtils, EInfo, "CJavaSidChecker: AppRegisteredAt called, %x", aSid.iUid); - - // No Java application can have Uid 0 - if (aSid.iUid == 0) - { - return installed; - } - - TRAPD(err, installed = AppRegisteredAtL(aSid, aDrive)); - if (KErrNone != err) - { - ELOG1(EUtils, "CJavaSidChecker: AppRegisteredAt error %d", err); - } - - return installed; -} - -TBool CJavaSidChecker::AppRegisteredAtL(const TUid& aSid, TDriveUnit /*aDrive*/) -{ - // Create the Java Registry if it has not been created already - if (NULL == iJavaRegistry) - { - iJavaRegistry = Java::CJavaRegistry::NewL(); - } - - // JavaRegistry does not return entries that are not present. - return iJavaRegistry->RegistryEntryExistsL(aSid); -} - -void CJavaSidChecker::SetRescanCallBackL(const TCallBack &/*aCallBack*/) -{ - // Do nothing - return; -} diff -r 0ea12c182930 -r 63b81d807542 javamanager/preinstaller/build/javapreinstaller.pro --- a/javamanager/preinstaller/build/javapreinstaller.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/preinstaller/build/javapreinstaller.pro Thu Sep 02 13:22:59 2010 +0300 @@ -24,7 +24,7 @@ SOURCES += ../src.s60/*.cpp LIBS += -lefsrv \ - -lPlatformEnv \ + -lplatformenv \ -ljavacomms \ -lcharconv \ -ljavastorage \ diff -r 0ea12c182930 -r 63b81d807542 javamanager/preinstaller/src.s60/silentmidletinstall.cpp --- a/javamanager/preinstaller/src.s60/silentmidletinstall.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/preinstaller/src.s60/silentmidletinstall.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javamanager/subsystem.mk --- a/javamanager/subsystem.mk Mon Aug 23 14:24:31 2010 +0300 +++ b/javamanager/subsystem.mk Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaruntimes/midp/runtime/build/javamidpruntime.pro --- a/javaruntimes/midp/runtime/build/javamidpruntime.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javaruntimes/midp/runtime/build/javamidpruntime.pro Thu Sep 02 13:22:59 2010 +0300 @@ -23,7 +23,7 @@ symbian { - INCLUDEPATH += /epoc32/include/ecom + INCLUDEPATH += /epoc32/include/ecom # Due to schemehandler.inl in S60 5.0 2009w18 and SPB 10.1 LIBS += -lecom -lflogger -lDrmRightsInfo -lcaf -lDrmHelper -lapgrfx -lapparc -ljavautils } diff -r 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java --- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp --- a/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaruntimes/standalone/src/javastarterimpl.cpp --- a/javaruntimes/standalone/src/javastarterimpl.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaruntimes/standalone/src/javastarterimpl.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaruntimes/starter/build/java.pro --- a/javaruntimes/starter/build/java.pro Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE=app -TARGET=javamidp -CONFIG += omj no_icon stl -CONFIG -= qt - -include(../../../inc/build_defines.pri) - -symbian { - -contains(PROJECT_DEFINES,RD_JAVA_UI_QT) { - TARGET.EPOCSTACKSIZE = 81920 -} - -!contains(PROJECT_DEFINES,RD_JAVA_UI_QT) { - TARGET.EPOCSTACKSIZE = 16384 -} - - TARGET.EPOCHEAPSIZE = 0x00001000 0x02000000 - - TARGET.UID2 = 0x102033E6 - TARGET.UID3 = 0x102033E6 - - TARGET.SID = 0x102033E6 - TARGET.VID = 0x101FB657 - - TARGET.CAPABILITY = \ - LocalServices NetworkServices ProtServ WriteDeviceData \ - ReadDeviceData ReadUserData WriteUserData UserEnvironment \ - SwEvent Location MultiMediaDD NetworkControl TrustedUI -} - -include(../../../build/omj.pri) diff -r 0ea12c182930 -r 63b81d807542 javaruntimes/starterutils/build/exports.inf --- a/javaruntimes/starterutils/build/exports.inf Mon Aug 23 14:24:31 2010 +0300 +++ b/javaruntimes/starterutils/build/exports.inf Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javaruntimes/starterutils/src.s60/j9starters60.cpp --- a/javaruntimes/starterutils/src.s60/j9starters60.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javaruntimes/starterutils/src.s60/j9starters60.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javatools/javafinishjrtinstall/build/javafinishjrtinstall.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javatools/javafinishjrtinstall/build/javafinishjrtinstall.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javatools/javafinishjrtinstall/src.s60/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javatools/javafinishjrtinstall/src.s60/main.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javatools/javatools.pro --- a/javatools/javatools.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javatools/javatools.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javatools/subsystem.mk --- a/javatools/subsystem.mk Mon Aug 23 14:24:31 2010 +0300 +++ b/javatools/subsystem.mk Thu Sep 02 13:22:59 2010 +0300 @@ -42,6 +42,11 @@ usersettingsconfigurator/build \ javarestoreconverter/build +else + +COMPONENTS += \ + javafinishjrtinstall/build + endif NONQTSUBSYSTEMS += \ diff -r 0ea12c182930 -r 63b81d807542 javauis/amms_qt/jni/src/effectcontrol.cpp --- a/javauis/amms_qt/jni/src/effectcontrol.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/amms_qt/jni/src/effectcontrol.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -25,7 +25,6 @@ #include "jstringutils.h" #include "s60commonutils.h" using namespace java::util; -#include /** * wrapper for CAMMSEffectControlGroup::PresetNamesL() diff -r 0ea12c182930 -r 63b81d807542 javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp --- a/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -25,7 +25,6 @@ #include #include #include -#include // CONSTANTS _LIT(KErrAudioOutputControlError, "AMMS AudioOutputControl error: %d"); const TInt KEventMessageSize = 64; diff -r 0ea12c182930 -r 63b81d807542 javauis/coreui/inc/javacoreui.h --- a/javauis/coreui/inc/javacoreui.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/coreui/inc/javacoreui.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/build/exports.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/build/exports.inf Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/build/testcoreui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/build/testcoreui.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/readme.txt Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/src/alltests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/src/alltests.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/src/testcoreui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/src/testcoreui.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/src/testutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/src/testutils.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/subsystem.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/subsystem.mk Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + Running CoreUiTests 1 + + + + + + Running CoreUiTests 01 + + + + + + Running CoreUiTests 001 + + + + + + + + + + diff -r 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z10jni_lookupPKc @ 1 NONAME + _Z13findDllMethodPKc @ 2 NONAME + _ZN4java2ui14CoreUiTestImpl14setTestHandlerEPNS0_17CoreUiTestHandlerE @ 3 NONAME + diff -r 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/tst.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/tst.bat Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/coreui/tsrc/tst2.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/coreui/tsrc/tst2.bat Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,1 @@ +testcoreui -nomemleaks -g NoDllCoreUiTest diff -r 0ea12c182930 -r 63b81d807542 javauis/eswt_qt/build/eswtqt/bwins/eswtqtu.def --- a/javauis/eswt_qt/build/eswtqt/bwins/eswtqtu.def Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/build/eswtqt/bwins/eswtqtu.def Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/eswt_qt/build/eswtqt/eabi/eswtqtu.def --- a/javauis/eswt_qt/build/eswtqt/eabi/eswtqtu.def Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/build/eswtqt/eabi/eswtqtu.def Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/eswt_qt/build/eswtqtwebkit/build.xml --- a/javauis/eswt_qt/build/eswtqtwebkit/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/build/eswtqtwebkit/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -26,7 +26,7 @@ - + diff -r 0ea12c182930 -r 63b81d807542 javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.me/build.xml --- a/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.me/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.me/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -263,7 +263,7 @@ - + diff -r 0ea12c182930 -r 63b81d807542 javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.se/build.xml --- a/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.se/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt.qt.linux.x86.se/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -244,7 +244,7 @@ - + diff -r 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/TextExtension.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Table.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtfontcache.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.cpp Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtlog.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/build/build.xml --- a/javauis/javalegacyutils/build/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/build/bwins/javalegacyutilsu.def --- a/javauis/javalegacyutils/build/bwins/javalegacyutilsu.def Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/build/eabi/javalegacyutilsu.def --- a/javauis/javalegacyutils/build/eabi/javalegacyutilsu.def Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/build/exports.inf --- a/javauis/javalegacyutils/build/exports.inf Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/build/javalegacyutils.pro --- a/javauis/javalegacyutils/build/javalegacyutils.pro Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/CJavaEventServer.h --- a/javauis/javalegacyutils/inc/CJavaEventServer.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/JesServer.h --- a/javauis/javalegacyutils/inc/JesServer.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/JniEnvWrapper.h --- a/javauis/javalegacyutils/inc/JniEnvWrapper.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/TimeOutTimer.h --- a/javauis/javalegacyutils/inc/TimeOutTimer.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/capabilities.mmh --- a/javauis/javalegacyutils/inc/capabilities.mmh Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/eventserverglobals.h --- a/javauis/javalegacyutils/inc/eventserverglobals.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/jutils.h --- a/javauis/javalegacyutils/inc/jutils.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/inc/mevents.h --- a/javauis/javalegacyutils/inc/mevents.h Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javalegacyutils.pro --- a/javauis/javalegacyutils/javalegacyutils.pro Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/EventProcessor.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/EventProcessor.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacyRtPort.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacyRtPort.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacySymbian.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/LegacySymbian.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServer.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServer.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServerFactory.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MIDEventServerFactory.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MemoryUtil.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/MemoryUtil.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/NativeError.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/NativeError.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/Security.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/Security.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserver.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserver.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java --- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/ArrayUtils.cpp --- a/javauis/javalegacyutils/src/ArrayUtils.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/CreateEpocTTime.cpp --- a/javauis/javalegacyutils/src/CreateEpocTTime.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/CreateJavaString.cpp --- a/javauis/javalegacyutils/src/CreateJavaString.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/CreateJavaTime.cpp --- a/javauis/javalegacyutils/src/CreateJavaTime.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/NativeError.cpp --- a/javauis/javalegacyutils/src/NativeError.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/RJArray.cpp --- a/javauis/javalegacyutils/src/RJArray.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/RJString.cpp --- a/javauis/javalegacyutils/src/RJString.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/StringArrayUtils.cpp --- a/javauis/javalegacyutils/src/StringArrayUtils.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/CJavaEventServer.cpp --- a/javauis/javalegacyutils/src/eventserver/CJavaEventServer.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/CJavaEventSourceBase.cpp --- a/javauis/javalegacyutils/src/eventserver/CJavaEventSourceBase.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/Close.cpp --- a/javauis/javalegacyutils/src/eventserver/Close.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/DoExecute.cpp --- a/javauis/javalegacyutils/src/eventserver/DoExecute.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/DoExecuteTrap.cpp --- a/javauis/javalegacyutils/src/eventserver/DoExecuteTrap.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/J9MIDEventServer.cpp --- a/javauis/javalegacyutils/src/eventserver/J9MIDEventServer.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/JniEnvWrapper.cpp --- a/javauis/javalegacyutils/src/eventserver/JniEnvWrapper.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/MIDEventServer.cpp --- a/javauis/javalegacyutils/src/eventserver/MIDEventServer.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/Open.cpp --- a/javauis/javalegacyutils/src/eventserver/Open.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/Panic.cpp --- a/javauis/javalegacyutils/src/eventserver/Panic.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/PostEvent.cpp --- a/javauis/javalegacyutils/src/eventserver/PostEvent.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/TConstructorBase.cpp --- a/javauis/javalegacyutils/src/eventserver/TConstructorBase.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/src/eventserver/eventserverglobals.cpp --- a/javauis/javalegacyutils/src/eventserver/eventserverglobals.cpp Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/subsystem.mk --- a/javauis/javalegacyutils/subsystem.mk Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/tsrc/README.txt --- a/javauis/javalegacyutils/tsrc/README.txt Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/tsrc/data/LegacyPrompts.jad --- a/javauis/javalegacyutils/tsrc/data/LegacyPrompts.jad Mon Aug 23 14:24:31 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 0ea12c182930 -r 63b81d807542 javauis/javalegacyutils/tsrc/data/LegacyPrompts.jar Binary file javauis/javalegacyutils/tsrc/data/LegacyPrompts.jar has changed diff -r 0ea12c182930 -r 63b81d807542 javauis/javauis.pro --- a/javauis/javauis.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/javauis.pro Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/build/build.xml --- a/javauis/lcdui_qt/build/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/build/build.xml Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasBufferLinux.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasBufferLinux.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasBufferLinux.java Thu Sep 02 13:22:59 2010 +0300 @@ -40,19 +40,22 @@ host = canvas; } - protected void init() - { - super.init(); - surface = Internal_PackageSupport.getWindowsurface(host.getShell()); - } - void bindToHost(GraphicsContext gc) { gc.bindTarget(surface); } + void ensureWindowSurface() + { + if(surface == null) + { + surface = Internal_PackageSupport.getWindowsurface(host.getShell()); + } + } + void beginPaint(int x, int y, int w, int h) { + ensureWindowSurface(); paintX = x; paintY = y; paintW = w; diff -r 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/ImageBuffer.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageBuffer.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageBuffer.java Thu Sep 02 13:22:59 2010 +0300 @@ -29,6 +29,7 @@ ImageBuffer(Image image) { host = image; + setImageBounds(image.getWidth(), image.getHeight()); } int getHostType() diff -r 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java --- a/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 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 Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/graphics/CommandBufferingTest.java Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/m3g_qt/src/jni/graphics3d.inl --- a/javauis/m3g_qt/src/jni/graphics3d.inl Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/m3g_qt/src/jni/graphics3d.inl Thu Sep 02 13:22:59 2010 +0300 @@ -22,7 +22,7 @@ JNIEXPORT jboolean JNICALL Java_javax_microedition_m3g_Graphics3D__1isProperRenderer (JNIEnv* /*aEnv*/, jclass) { - EGLContext ctx; +/* EGLContext ctx; EGLConfig config; EGLSurface surf; EGLint attrib[5]; @@ -78,7 +78,8 @@ eglDestroySurface(eglGetDisplay(0), surf); eglDestroyContext(eglGetDisplay(0), ctx); - return isProperRenderer; + return isProperRenderer;*/ + return false; } /* diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayerfactory.cpp --- a/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayerfactory.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayerfactory.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -19,7 +19,7 @@ // INCLUDE FILES #include #include "CMMAAudioStreamPlayerFactory.h" -#include "CMMAAudioStreamPlayer.h" +#include "cmmaaudiostreamplayer.h" #include "CMMAAudioVolumeControl.h" #include "CMMAStopTimeControl.h" #include "CMMAMMFResolver.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/inc/cmmadisplay.h --- a/javauis/mmapi_qt/baseline/inc/cmmadisplay.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/inc/cmmadisplay.h Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/inc/cmmaplayer.h --- a/javauis/mmapi_qt/baseline/inc/cmmaplayer.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/inc/cmmaplayer.h Thu Sep 02 13:22:59 2010 +0300 @@ -134,7 +134,7 @@ * @param aPlayer Player to use. * @param aIndex Control's index. */ - IMPORT_C static CMMAControl* StaticControl(CMMAPlayer* aPlayer, + static CMMAControl* StaticControl(CMMAPlayer* aPlayer, TInt aIndex); public: // New methods @@ -335,9 +335,9 @@ */ IMPORT_C void PostActionCompleted(TInt aError); - IMPORT_C void PostActionCompletedFile(); //LC work for S60 3.2 + void PostActionCompletedFile(); //LC work for S60 3.2 - IMPORT_C void PostActionCompletedStart(); + void PostActionCompletedStart(); protected: // new methods /** * @see StaticAddSourceStreamL diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h --- a/javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h Thu Sep 02 13:22:59 2010 +0300 @@ -102,6 +102,7 @@ * @param aDeleteRefEvent Event posted in the destructor. */ static void StaticInitDynamicModeL(CMMAVideoControl* aVideoControl, + JNIEnv* aJni, TInt* aContentHandle, MMAFunctionServer* aEventSource, jobject aGUIObject, @@ -171,7 +172,16 @@ private: void SetForeground(TBool aForeground, TBool aUseEventServer); - + +public: + + enum TDisplaytype + { + EDISPLAY_CANVAS=0, + EDISPLAY_VIDEOITEM=1, + EDISPLAY_ESWT=2 + }; + protected: /** * Not owned. diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoItem.java --- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoItem.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoItem.java Thu Sep 02 13:22:59 2010 +0300 @@ -23,6 +23,7 @@ import javax.microedition.media.PlayerListener; import javax.microedition.media.Player; import javax.microedition.lcdui.*; +import com.nokia.mj.impl.utils.Logger; /** * Item for VideoControl. @@ -51,9 +52,10 @@ // from PlayerListener public void playerUpdate(Player aPlayer, String aEvent, Object aEventData) { + Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"VideoItem.Playerupdate +"); if (aEvent == SIZE_CHANGED) { - invalidate(); + //invalidate(); } } diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp --- a/javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -16,8 +16,6 @@ */ #include -#include - #include "com_nokia_microedition_media_protocol_EMCSourceInfo.h" #include "cmmamanager.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/cmmaevent.cpp --- a/javauis/mmapi_qt/baseline/src/cmmaevent.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmaevent.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -45,6 +45,7 @@ void CMMAEvent::Dispatch(JNIEnv& aJni) { LOG1(EJavaMMAPI, EInfo, "MMA::CMMAEvent::Dispatch iEventData=%d", iEventData); + LOG1(EJavaMMAPI, EInfo, "MMA::CMMAEvent::Dispatch iListenerObject=%d", iEventData); aJni.CallVoidMethod(iListenerObject, iHandleEventMethod, diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp --- a/javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -17,7 +17,6 @@ #include -#include #include "cmmaoutputstream.h" #include "mmmaeventposter.h" #include "cmmaoutputstreamevent.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/cmmaplayer.cpp --- a/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -18,8 +18,6 @@ // INCLUDE FILES #include -#include - #include "cmmaplayer.h" #include "mmafunctionserver.h" #include "cmmadurationupdater.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp --- a/javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -17,8 +17,6 @@ #include -#include - #include "mmafunctionserver.h" #include "cmmasourcestream.h" #include "cmmasourcestreamevent.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp --- a/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -20,8 +20,6 @@ #include //#include -#include - #include "com_nokia_microedition_media_control_VideoControl.h" #include "cmmavideocontrol.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/managerimpl.cpp --- a/javauis/mmapi_qt/baseline/src/managerimpl.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/managerimpl.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -17,8 +17,6 @@ #include -#include - #include "com_nokia_microedition_media_ManagerImpl.h" #include "cmmamanager.h" #include "cmmaplayer.h" @@ -108,7 +106,10 @@ JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ManagerImpl__1createEventSource (JNIEnv* aJni, jobject aPeer) { - TInt eventSourceHandle = MMAFunctionServer::NewL(*aJni, aPeer); + TInt eventSourceHandle = -1; + TRAPD(err,eventSourceHandle = MMAFunctionServer::NewL(*aJni, aPeer)); + if (err != KErrNone) + eventSourceHandle = err; if (eventSourceHandle > KErrNone) { MMAFunctionServer* eventSource = diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/recordcontrol.cpp --- a/javauis/mmapi_qt/baseline/src/recordcontrol.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/recordcontrol.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -18,8 +18,6 @@ #include -#include - #include "com_nokia_microedition_media_control_RecordControl.h" #include "mmafunctionserver.h" #include "cmmarecordcontrol.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/baseline/src/videocontrol.cpp --- a/javauis/mmapi_qt/baseline/src/videocontrol.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/baseline/src/videocontrol.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -25,8 +25,6 @@ #include "cmmadeleterefevent.h" #include -#include - //#include //#include #include "s60commonutils.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/conf/mobilemedia.confml Binary file javauis/mmapi_qt/conf/mobilemedia.confml has changed diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/directcontent/inc/cmmadcdisplay.h --- a/javauis/mmapi_qt/directcontent/inc/cmmadcdisplay.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/directcontent/inc/cmmadcdisplay.h Thu Sep 02 13:22:59 2010 +0300 @@ -48,13 +48,14 @@ * @param aPlayer provides content */ static CMMADCDisplay* NewLC(MMMAGuiPlayer* aPlayer, - MMAFunctionServer* aEventSource, - jobject aGUIObject); - virtual ~CMMADCDisplay(); + MMAFunctionServer* aEventSource, + JNIEnv* aJni, + jobject aGUIObject); + virtual ~CMMADCDisplay(); public: // From MMMADisplay void DrawFrameL(const CFbsBitmap* aBitmap); - void SetDisplaySizeL(const TSize& aSize); + //void SetDisplaySizeL(const TSize& aSize); void SetDisplayLocationL(const TPoint& aPosition); TPoint DisplayLocation(); void SetFullScreenL(TBool aFullScreen); diff -r 0ea12c182930 -r 63b81d807542 javauis/mmapi_qt/volumekeys/src/cmmavolumekeyslistener.cpp --- a/javauis/mmapi_qt/volumekeys/src/cmmavolumekeyslistener.cpp Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/mmapi_qt/volumekeys/src/cmmavolumekeyslistener.cpp Thu Sep 02 13:22:59 2010 +0300 @@ -63,11 +63,12 @@ iJavaRemConManager = NULL; } */ + /* if (NULL != iTimer) { iTimer->Cancel(); delete iTimer; - } + }*/ LOG(EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::~CMMAVolumeKeysListener() -"); } @@ -83,7 +84,8 @@ iJavaRemConManager->SetObserverL(*iJavaRemConObserver); */ // Timer for implementing Pressed/Released/Clicked feature. - iTimer = CPeriodic::NewL(CActive::EPriorityStandard); + //TODO For Mediakey(Hard VolumeKey) + //iTimer = CPeriodic::NewL(CActive::EPriorityStandard); iListener = aListener; LOG(EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::ConstructL -"); diff -r 0ea12c182930 -r 63b81d807542 javauis/nokiasound/build/javanokiasound.pro --- a/javauis/nokiasound/build/javanokiasound.pro Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/nokiasound/build/javanokiasound.pro Thu Sep 02 13:22:59 2010 +0300 @@ -22,7 +22,7 @@ LIBS += -lcenrepnotifhandler \ -lcentralrepository \ -lmediaclientaudio \ - -lcommonengine \ + -lCommonEngine \ -ljavautils include(../../../build/omj.pri) diff -r 0ea12c182930 -r 63b81d807542 javauis/nokiasound/inc/CMIDSound.h --- a/javauis/nokiasound/inc/CMIDSound.h Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/nokiasound/inc/CMIDSound.h Thu Sep 02 13:22:59 2010 +0300 @@ -17,7 +17,6 @@ // INCLUDES -#include #include #include #include "MMIDEventSender.h" diff -r 0ea12c182930 -r 63b81d807542 javauis/runtimeui_qt/tsrc.s60/javasrc/com/nokia/mj/impl/rt/ui/qt/RuntimeUiQtTests.java --- a/javauis/runtimeui_qt/tsrc.s60/javasrc/com/nokia/mj/impl/rt/ui/qt/RuntimeUiQtTests.java Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/runtimeui_qt/tsrc.s60/javasrc/com/nokia/mj/impl/rt/ui/qt/RuntimeUiQtTests.java Thu Sep 02 13:22:59 2010 +0300 @@ -82,7 +82,6 @@ private void doTest(RuntimeUi runtimeUi) { - System.out.println("+doTest()"); // error message with details -> make sure both are available to the user ExceptionBase exc = new ExceptionBase( new ShortErrorMessage(), @@ -103,13 +102,6 @@ null, 0, null /* no params for detailed msg */); - System.out.println("3"); - - runtimeUi.error("MyApplication", exc); - - // Test no crash happen. - runtimeUi.error("NullException", null); - boolean answerAvailable = false; @@ -130,6 +122,5 @@ runtimeUi.confirm("Null Application", nullConf); runtimeUi.destroy(); - System.out.println("-doTest()"); } } diff -r 0ea12c182930 -r 63b81d807542 javauis/subsystem.mk --- a/javauis/subsystem.mk Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/subsystem.mk Thu Sep 02 13:22:59 2010 +0300 @@ -28,10 +28,8 @@ # # Common legacy utilities # -SUBSYSTEMS += javalegacyutils - -SYMBIAN_ONLY += javalegacyutils nokiasound/build +SYMBIAN_ONLY += nokiasound/build diff -r 0ea12c182930 -r 63b81d807542 javauis/subsystem_akn.mk --- a/javauis/subsystem_akn.mk Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/subsystem_akn.mk Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 javauis/tsrc/fute/lcdui/Midp_Alert_01/build.xml --- a/javauis/tsrc/fute/lcdui/Midp_Alert_01/build.xml Mon Aug 23 14:24:31 2010 +0300 +++ b/javauis/tsrc/fute/lcdui/Midp_Alert_01/build.xml Thu Sep 02 13:22:59 2010 +0300 @@ -28,7 +28,7 @@ - + diff -r 0ea12c182930 -r 63b81d807542 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0ea12c182930 -r 63b81d807542 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Thu Sep 02 13:22:59 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 0ea12c182930 -r 63b81d807542 rom/installerodclist30 --- a/rom/installerodclist30 Mon Aug 23 14:24:31 2010 +0300 +++ b/rom/installerodclist30 Thu Sep 02 13:22:59 2010 +0300 @@ -10,7 +10,6 @@ javamidpruntime.odc javainstaller.odc javainstallerui.odc -javalegacyutils.odc javapushregistry.odc javaruntimeui.odc javasecurity.odc diff -r 0ea12c182930 -r 63b81d807542 rom/java_2_1.iby --- a/rom/java_2_1.iby Mon Aug 23 14:24:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,362 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* -* Description: -* Image-description file of the Java package for ROFS1. -*/ - -#ifndef __JAVA_IBY__ -#define __JAVA_IBY__ - -#include - -// Helper defines -define JAVA_RES_BLD ABI_DIR\BUILD_DIR\z\resource\java -define JAVA_RES_IMG RESOURCE_FILES_DIR\java -define JAVA_VM_RES_BLD JAVA_RES_BLD\jvm\lib\jrt -define JAVA_VM_RES_IMG JAVA_RES_IMG\jvm\lib\jrt -define JAVA_POLICY_BLD ABI_DIR\BUILD_DIR\z\resource\java\security\policies -define JAVA_POLICY_IMG RESOURCE_FILES_DIR\java\security\policies - - -//////////////////////////// -// Java Manager collection// -//////////////////////////// - -// stub sis -data=ZSYSTEM\install\java.sis System\Install\java.sis - - -// AppMngr plugin -ECOM_PLUGIN( appmngr2midletplugin.dll, appmngr2midletplugin.rsc ) -data=ZRESOURCE\plugins\appmngr2midletplugin.rsc ECOM_RESOURCE_DIR\appmngr2midletplugin.rsc - -// Captain -file=ABI_DIR\BUILD_DIR\javacaptain_ext_btdeviceclassmanager.dll SHARED_LIB_DIR\javacaptain_ext_btdeviceclassmanager.dll -file=ABI_DIR\BUILD_DIR\javacaptain_ext_config.dll SHARED_LIB_DIR\javacaptain_ext_config.dll -file=ABI_DIR\BUILD_DIR\javacaptain_ext_ondemand_2.dll SHARED_LIB_DIR\javacaptain_ext_ondemand_2.dll -file=ABI_DIR\BUILD_DIR\javacaptain_ext_ondemand_7.dll SHARED_LIB_DIR\javacaptain_ext_ondemand_7.dll -file=ABI_DIR\BUILD_DIR\javacaptain_ext_preinstallerstarter.dll SHARED_LIB_DIR\javacaptain_ext_preinstallerstarter.dll -file=ABI_DIR\BUILD_DIR\javacaptain_ext_pushregistryplugin.dll SHARED_LIB_DIR\javacaptain_ext_pushregistryplugin.dll -file=ABI_DIR\BUILD_DIR\javacaptain_ext_storageserverplugin.dll SHARED_LIB_DIR\javacaptain_ext_storageserverplugin.dll -file=ABI_DIR\BUILD_DIR\javacaptain.exe PROGRAMS_DIR\javacaptain.exe - -// Registry -file=ABI_DIR\BUILD_DIR\javaregistryclient.dll SHARED_LIB_DIR\javaregistryclient.dll -file=ABI_DIR\BUILD_DIR\javasizehelperclient.dll SHARED_LIB_DIR\javasizehelperclient.dll -file=ABI_DIR\BUILD_DIR\javasizehelperserver.dll SHARED_LIB_DIR\javasizehelperserver.dll - -// Installer -ECOM_PLUGIN(ifeui.dll,ifeui.rsc) -data=ZRESOURCE\plugins\ifeui.rsc ECOM_RESOURCE_DIR\ifeui.rsc -data=ZPRIVATE\10003a3f\apps\javainstaller_reg.rsc \private\10003a3f\import\apps\javainstaller_reg.rsc -data=ZRESOURCE\apps\javainstaller_loc.rsc APP_RESOURCE_DIR\javainstaller_loc.rsc -data=ZRESOURCE\apps\javainstaller_icon.mif APP_BITMAP_DIR\javainstaller_icon.mif -file=ABI_DIR\BUILD_DIR\javainstaller.dll SHARED_LIB_DIR\javainstaller.dll -data=JAVA_VM_RES_BLD\javainstallerui.odc JAVA_VM_RES_IMG\javainstallerui.odc -file=ABI_DIR\BUILD_DIR\javainstallerui.dll SHARED_LIB_DIR\javainstallerui.dll -data=JAVA_VM_RES_BLD\javainstaller.odc JAVA_VM_RES_IMG\javainstaller.odc -file=ABI_DIR\BUILD_DIR\javainstallerstarter.dll PROGRAMS_DIR\javainstallerstarter.dll -file=ABI_DIR\BUILD_DIR\javapreinstaller.dll PROGRAMS_DIR\javapreinstaller.dll -data=ZRESOURCE\java\java_app_92.mif JAVA_RES_IMG\java_app.mif -data=ZRESOURCE\java\java_trusted.png JAVA_RES_IMG\java_trusted.png -data=ZRESOURCE\java\java_untrusted.png JAVA_RES_IMG\java_untrusted.png -data=DATAZ_\private\102033E6\installer\inst_plugins.cfg \private\102033E6\installer\inst_plugins.cfg - -// Launchers -file=ABI_DIR\BUILD_DIR\javalauncher.exe PROGRAMS_DIR\javalauncher.exe -ECOM_PLUGIN(javaappschemeplugin.dll,javaappschemeplugin.rsc) -data=ZRESOURCE\plugins\javaappschemeplugin.rsc ECOM_RESOURCE_DIR\javaappschemeplugin.rsc - -// SID Checker -ECOM_PLUGIN(javasidchecker.dll,10281FBE.rsc) -data=ZRESOURCE\plugins\javasidchecker.rsc ECOM_RESOURCE_DIR\javasidchecker.rsc - -// Recognizers -ECOM_PLUGIN(recjar.dll, 102031FB.rsc) -data=ZRESOURCE\plugins\recjar.rsc ECOM_RESOURCE_DIR\recjar.rsc - -// Backup & Restore -file=ABI_DIR\BUILD_DIR\javabackup.exe PROGRAMS_DIR\javabackup.exe -ECOM_PLUGIN(midp2backupplugin.dll,10282474.rsc) -data=ZRESOURCE\plugins\midp2backupplugin.rsc ECOM_RESOURCE_DIR\midp2backupplugin.rsc -data=DATAZ_\private\1028246F\backup_registration.xml \private\1028246F\backup_registration.xml -data=DATAZ_\private\102033E6\backup_registration.xml \private\102033E6\backup_registration.xml - - -///////////////////////// -// Java UIs collection // -///////////////////////// - -// CoreUi -file=ABI_DIR\BUILD_DIR\javacoreui.dll SHARED_LIB_DIR\javacoreui.dll -data=JAVA_VM_RES_BLD\javacoreui.odc JAVA_VM_RES_IMG\javacoreui.odc - -// eSWT -file=ABI_DIR\BUILD_DIR\eswt.dll SHARED_LIB_DIR\eswt.dll -data=JAVA_VM_RES_BLD\eswt.odc JAVA_VM_RES_IMG\eswt.odc -file=ABI_DIR\BUILD_DIR\eswtphysics.dll SHARED_LIB_DIR\eswtphysics.dll -file=ABI_DIR\BUILD_DIR\eswtapifacade.dll SHARED_LIB_DIR\eswtapifacade.dll -file=ABI_DIR\BUILD_DIR\eswtdirectcontent.dll SHARED_LIB_DIR\eswtdirectcontent.dll -data=JAVA_VM_RES_BLD\eswtdirectcontent.odc JAVA_VM_RES_IMG\eswtdirectcontent.odc -data=ZPRIVATE\10003a3f\apps\eswt_reg.rsc \private\10003a3f\import\apps\eswt_reg.rsc - -// LCDUI -file=ABI_DIR\BUILD_DIR\javalcdui.dll SHARED_LIB_DIR\javalcdui.dll -data=JAVA_VM_RES_BLD\javalcdui.odc JAVA_VM_RES_IMG\javalcdui.odc -file=ABI_DIR\BUILD_DIR\lcdui.dll SHARED_LIB_DIR\lcdui.dll -file=ABI_DIR\BUILD_DIR\lcdgr.dll SHARED_LIB_DIR\lcdgr.dll -file=ABI_DIR\BUILD_DIR\lcdgdrv.dll SHARED_LIB_DIR\lcdgdrv.dll -file=ABI_DIR\BUILD_DIR\lcdgdrvi.dll SHARED_LIB_DIR\lcdgdrvi.dll -file=ABI_DIR\BUILD_DIR\lcduiphysicswrap.dll SHARED_LIB_DIR\lcduiphysicswrap.dll -ECOM_PLUGIN(LCDC4K.dll, 10208164.rsc) -ECOM_PLUGIN(LCDC64K.dll, 10208162.rsc) -ECOM_PLUGIN(LCDC16MU.dll, 10208166.rsc) -ECOM_PLUGIN(LCDC16MA.dll, 10208168.rsc) -data=ZRESOURCE\java\lcdgr.rsc JAVA_RES_IMG\lcdgr.rsc -data=ZPRIVATE\10003a3f\apps\lcdui_reg.rsc \private\10003a3f\import\apps\lcdui_reg.rsc - -SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,lcdui) - -// AMMS API -file=ABI_DIR\BUILD_DIR\javaamms.dll SHARED_LIB_DIR\javaamms.dll -data=JAVA_VM_RES_BLD\javaamms.odc JAVA_VM_RES_IMG\javaamms.odc - -// Mobile Media API -file=ABI_DIR\BUILD_DIR\javamobilemedia.dll SHARED_LIB_DIR\javamobilemedia.dll -data=JAVA_VM_RES_BLD\javamobilemedia.odc JAVA_VM_RES_IMG\javamobilemedia.odc -data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaCapture.wav \System\Sounds\Digital\CamcorderJavaCapture.wav -data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\CamcorderJavaStart.wav \System\Sounds\Digital\CamcorderJavaStart.wav - -// MobInfo API -file=ABI_DIR\BUILD_DIR\javamobinfo.dll SHARED_LIB_DIR\javamobinfo.dll -data=JAVA_VM_RES_BLD\javamobinfo.odc JAVA_VM_RES_IMG\javamobinfo.odc - -// GlobalIndicators API -file=ABI_DIR\BUILD_DIR\javaglobalindicators.dll SHARED_LIB_DIR\javaglobalindicators.dll -data=JAVA_VM_RES_BLD\javaglobalindicators.odc JAVA_VM_RES_IMG\javaglobalindicators.odc - -// SoftNotification API -file=ABI_DIR\BUILD_DIR\javasoftnotification.dll SHARED_LIB_DIR\javasoftnotification.dll -data=JAVA_VM_RES_BLD\javasoftnotification.odc JAVA_VM_RES_IMG\javasoftnotification.odc - -// 2G API -file=ABI_DIR\BUILD_DIR\javam2g.dll SHARED_LIB_DIR\javam2g.dll -data=JAVA_VM_RES_BLD\javam2g.odc JAVA_VM_RES_IMG\javam2g.odc - -// 3G API -file=ABI_DIR\BUILD_DIR\javam3g.dll SHARED_LIB_DIR\javam3g.dll -data=JAVA_VM_RES_BLD\javam3g.odc JAVA_VM_RES_IMG\javam3g.odc - -// Nokia Sound API -file=ABI_DIR\BUILD_DIR\javanokiasound.dll SHARED_LIB_DIR\javanokiasound.dll -data=JAVA_VM_RES_BLD\javanokiasound.odc JAVA_VM_RES_IMG\javanokiasound.odc - -// Remote Connection Observer -file=ABI_DIR\BUILD_DIR\javaremconobserver.dll SHARED_LIB_DIR\javaremconobserver.dll - -// Legacy utilities -file=ABI_DIR\BUILD_DIR\javalegacyutils.dll SHARED_LIB_DIR\javalegacyutils.dll -data=JAVA_VM_RES_BLD\javalegacyutils.odc JAVA_VM_RES_IMG\javalegacyutils.odc - - -///////////////////////////// -// Java Runtimes collection // -///////////////////////////// - -// Runtime utilities -file=ABI_DIR\BUILD_DIR\javaruntimeui.dll SHARED_LIB_DIR\javaruntimeui.dll -data=JAVA_VM_RES_BLD\javaruntimeui.odc JAVA_VM_RES_IMG\javaruntimeui.odc -file=ABI_DIR\BUILD_DIR\javaruntimestarterutils.dll SHARED_LIB_DIR\javaruntimestarterutils.dll - -// MIDP runtime -file=ABI_DIR\BUILD_DIR\javamidp.exe PROGRAMS_DIR\javamidp.exe -file=ABI_DIR\BUILD_DIR\javamidpstarter.dll SHARED_LIB_DIR\javamidpstarter.dll -file=ABI_DIR\BUILD_DIR\javamidpruntime.dll SHARED_LIB_DIR\javamidpruntime.dll -data=JAVA_VM_RES_BLD\javamidpruntime.odc JAVA_VM_RES_IMG\javamidpruntime.odc - -// An empty JVM argument modifier (to prevent 3rd parties from installing a DLL with this name) -// To enable JVM argument modifier - comment 1st line below and uncomment 2nd line below -file=ABI_DIR\BUILD_DIR\javajvmargsmodifier.dll SHARED_LIB_DIR\javajvmargsmodifier.dll -//file=ABI_DIR\BUILD_DIR\javajvmargsmodifierfile.dll SHARED_LIB_DIR\javajvmargsmodifier.dll - - -///////////////////////////// -// Java Commons collection // -///////////////////////////// - -// J9 JVM -file=ABI_DIR\BUILD_DIR\j9.dll SHARED_LIB_DIR\j9.dll -file=ABI_DIR\BUILD_DIR\j9vmall23.dll SHARED_LIB_DIR\j9vmall23.dll -file=ABI_DIR\BUILD_DIR\j9mjit23.dll SHARED_LIB_DIR\j9mjit23.dll -file=ABI_DIR\BUILD_DIR\jclcldc11_23.dll SHARED_LIB_DIR\jclcldc11_23.dll -file=ABI_DIR\BUILD_DIR\jclcdc11_23.dll SHARED_LIB_DIR\jclcdc11_23.dll -file=ABI_DIR\BUILD_DIR\j9fdm23.dll SHARED_LIB_DIR\j9fdm23.dll -file=ABI_DIR\BUILD_DIR\JvmNativePort.dll SHARED_LIB_DIR\JvmNativePort.dll -data=JAVA_RES_BLD\jvm\bin\java.properties JAVA_RES_IMG\jvm\bin\java.properties -data=JAVA_RES_BLD\jvm\lib\security\java.policy JAVA_RES_IMG\jvm\lib\security\java.policy -data=JAVA_RES_BLD\jvm\lib\security\java.security JAVA_RES_IMG\jvm\lib\security\java.security - -// Utilities -file=ABI_DIR\BUILD_DIR\javautils.dll SHARED_LIB_DIR\javautils.dll -data=JAVA_VM_RES_BLD\javautils.odc JAVA_VM_RES_IMG\javautils.odc -file=ABI_DIR\BUILD_DIR\javacomms.dll SHARED_LIB_DIR\javacomms.dll -data=JAVA_VM_RES_BLD\javacomms.odc JAVA_VM_RES_IMG\javacomms.odc -file=ABI_DIR\BUILD_DIR\javaipc.dll SHARED_LIB_DIR\javaipc.dll -file=ABI_DIR\BUILD_DIR\javafileutils.dll SHARED_LIB_DIR\javafileutils.dll -data=JAVA_VM_RES_BLD\javafileutils.odc JAVA_VM_RES_IMG\javafileutils.odc -file=ABI_DIR\BUILD_DIR\javadebugapi.dll SHARED_LIB_DIR\javadebugapi.dll - -// Security dlls -file=ABI_DIR\BUILD_DIR\javasecurity.dll SHARED_LIB_DIR\javasecurity.dll -data=JAVA_VM_RES_BLD\javasecurity.odc JAVA_VM_RES_IMG\javasecurity.odc -ECOM_PLUGIN(javaunicertstoreplugin.dll,200213A3.rsc) -data=ZRESOURCE\plugins\javaunicertstoreplugin.rsc ECOM_RESOURCE_DIR\javaunicertstoreplugin.rsc - -// Security certs & policies -data=JAVA_POLICY_BLD\s60_manufacturer.ser JAVA_POLICY_IMG\s60_manufacturer.ser -data=JAVA_POLICY_BLD\s60_operator.ser JAVA_POLICY_IMG\s60_operator.ser -data=JAVA_POLICY_BLD\s60_trustedthirdparty.ser JAVA_POLICY_IMG\s60_trustedthirdparty.ser -data=JAVA_POLICY_BLD\s60_untrusted.ser JAVA_POLICY_IMG\s60_untrusted.ser -data=JAVA_POLICY_BLD\msa_manufacturer.ser JAVA_POLICY_IMG\msa_manufacturer.ser -data=JAVA_POLICY_BLD\msa_operator.ser JAVA_POLICY_IMG\msa_operator.ser -data=JAVA_POLICY_BLD\msa_trustedthirdparty.ser JAVA_POLICY_IMG\msa_trustedthirdparty.ser -data=JAVA_POLICY_BLD\msa_untrusted.ser JAVA_POLICY_IMG\msa_untrusted.ser -data=JAVA_POLICY_BLD\att_manufacturer.ser JAVA_POLICY_IMG\att_manufacturer.ser -data=JAVA_POLICY_BLD\att_operator.ser JAVA_POLICY_IMG\att_operator.ser -data=JAVA_POLICY_BLD\att_operatorextra.ser JAVA_POLICY_IMG\att_operatorextra.ser -data=JAVA_POLICY_BLD\att_trustedthirdparty.ser JAVA_POLICY_IMG\att_trustedthirdparty.ser -data=JAVA_POLICY_BLD\att_untrusted.ser JAVA_POLICY_IMG\att_untrusted.ser -data=JAVA_POLICY_BLD\all.ser JAVA_POLICY_IMG\all.ser - - -// Java environment info -file=ABI_DIR\BUILD_DIR\javaenvinfo.dll SHARED_LIB_DIR\javaenvinfo.dll -data=ABI_DIR\BUILD_DIR\Z\Resource\versions\java.txt RESOURCE_FILES_DIR\versions\java.txt - -// Storage -file=ABI_DIR\BUILD_DIR\javastorage.dll SHARED_LIB_DIR\javastorage.dll -data=JAVA_VM_RES_BLD\javastorage.odc JAVA_VM_RES_IMG\javastorage.odc - -// GCF base -file=ABI_DIR\BUILD_DIR\javagcf.dll SHARED_LIB_DIR\javagcf.dll -data=JAVA_VM_RES_BLD\javagcf.odc JAVA_VM_RES_IMG\javagcf.odc - -// Connection Manager -file=ABI_DIR\BUILD_DIR\javaconnectionmanager.dll SHARED_LIB_DIR\javaconnectionmanager.dll -data=JAVA_VM_RES_BLD\javaconnectionmanager.odc JAVA_VM_RES_IMG\javaconnectionmanager.odc - -// Http & https protocols -file=ABI_DIR\BUILD_DIR\javahttp.dll SHARED_LIB_DIR\javahttp.dll -file=ABI_DIR\BUILD_DIR\javahttps.dll SHARED_LIB_DIR\javahttps.dll -data=JAVA_VM_RES_BLD\javahttp.odc JAVA_VM_RES_IMG\javahttp.odc -data=JAVA_VM_RES_BLD\javahttps.odc JAVA_VM_RES_IMG\javahttps.odc - -// Socket protocol -file=ABI_DIR\BUILD_DIR\javasocket.dll SHARED_LIB_DIR\javasocket.dll -file=ABI_DIR\BUILD_DIR\javasocketscplugin.dll SHARED_LIB_DIR\javasocketscplugin.dll -data=JAVA_VM_RES_BLD\javasocket.odc JAVA_VM_RES_IMG\javasocket.odc - -// Secure socket protocol -file=ABI_DIR\BUILD_DIR\javassl.dll SHARED_LIB_DIR\javassl.dll -data=JAVA_VM_RES_BLD\javassl.odc JAVA_VM_RES_IMG\javassl.odc - - -//////////////////////////////// -// Java Extensions collection // -//////////////////////////////// - -// Push -file=ABI_DIR\BUILD_DIR\javapushcontroller.dll SHARED_LIB_DIR\javapushcontroller.dll -file=ABI_DIR\BUILD_DIR\javapushregistry.dll SHARED_LIB_DIR\javapushregistry.dll -data=JAVA_VM_RES_BLD\javapushregistry.odc JAVA_VM_RES_IMG\javapushregistry.odc - -// Bluetooth -file=ABI_DIR\BUILD_DIR\javabluecove.dll SHARED_LIB_DIR\javabluecove.dll -file=ABI_DIR\BUILD_DIR\javabluetooth.dll SHARED_LIB_DIR\javabluetooth.dll -file=ABI_DIR\BUILD_DIR\javabluetoothcommons.dll SHARED_LIB_DIR\javabluetoothcommons.dll -file=ABI_DIR\BUILD_DIR\javabtgoepscplugin.dll SHARED_LIB_DIR\javabtgoepscplugin.dll -file=ABI_DIR\BUILD_DIR\javabtl2capscplugin.dll SHARED_LIB_DIR\javabtl2capscplugin.dll -file=ABI_DIR\BUILD_DIR\javabtsppscplugin.dll SHARED_LIB_DIR\javabtsppscplugin.dll -data=JAVA_VM_RES_BLD\javabluecove.odc JAVA_VM_RES_IMG\javabluecove.odc -data=JAVA_VM_RES_BLD\javabluetooth.odc JAVA_VM_RES_IMG\javabluetooth.odc -data=JAVA_VM_RES_BLD\javabluetoothcommons.odc JAVA_VM_RES_IMG\javabluetoothcommons.odc - -// WMA -file=ABI_DIR\BUILD_DIR\javawma.dll SHARED_LIB_DIR\javawma.dll -file=ABI_DIR\BUILD_DIR\javawmamms.dll SHARED_LIB_DIR\javawmamms.dll -file=ABI_DIR\BUILD_DIR\javacbsscplugin.dll SHARED_LIB_DIR\javacbsscplugin.dll -file=ABI_DIR\BUILD_DIR\javammsscplugin.dll SHARED_LIB_DIR\javammsscplugin.dll -file=ABI_DIR\BUILD_DIR\javasmsscplugin.dll SHARED_LIB_DIR\javasmsscplugin.dll -data=JAVA_VM_RES_BLD\javawma.odc JAVA_VM_RES_IMG\javawma.odc -data=JAVA_VM_RES_BLD\javawmamms.odc JAVA_VM_RES_IMG\javawmamms.odc - -// Comm -file=ABI_DIR\BUILD_DIR\javacomm.dll SHARED_LIB_DIR\javacomm.dll -data=JAVA_VM_RES_BLD\javacomm.odc JAVA_VM_RES_IMG\javacomm.odc - -// Datagram -file=ABI_DIR\BUILD_DIR\javadatagram.dll SHARED_LIB_DIR\javadatagram.dll -file=ABI_DIR\BUILD_DIR\javadatagramscplugin.dll SHARED_LIB_DIR\javadatagramscplugin.dll -data=JAVA_VM_RES_BLD\javadatagram.odc JAVA_VM_RES_IMG\javadatagram.odc - -// Location API -file=ABI_DIR\BUILD_DIR\javalocation.dll SHARED_LIB_DIR\javalocation.dll -data=JAVA_VM_RES_BLD\javalocation.odc JAVA_VM_RES_IMG\javalocation.odc - -// Sensor API -file=ABI_DIR\BUILD_DIR\javasensor.dll SHARED_LIB_DIR\javasensor.dll -data=JAVA_VM_RES_BLD\javasensor.odc JAVA_VM_RES_IMG\javasensor.odc - -// Web services API -file=ABI_DIR\BUILD_DIR\javawebservices.dll SHARED_LIB_DIR\javawebservices.dll -data=JAVA_VM_RES_BLD\javawebservices.odc JAVA_VM_RES_IMG\javawebservices.odc - -// PIM API -file=ABI_DIR\BUILD_DIR\javapim.dll SHARED_LIB_DIR\javapim.dll -data=JAVA_VM_RES_BLD\javapim.odc JAVA_VM_RES_IMG\javapim.odc - -// RMS API -file=ABI_DIR\BUILD_DIR\javarms.dll SHARED_LIB_DIR\javarms.dll -data=JAVA_VM_RES_BLD\javarms.odc JAVA_VM_RES_IMG\javarms.odc - -// SATSA API -file=ABI_DIR\BUILD_DIR\javasatsa.dll SHARED_LIB_DIR\javasatsa.dll -data=JAVA_VM_RES_BLD\javasatsa.odc JAVA_VM_RES_IMG\javasatsa.odc - -// File API -file=ABI_DIR\BUILD_DIR\javafile.dll SHARED_LIB_DIR\javafile.dll -data=JAVA_VM_RES_BLD\javafile.odc JAVA_VM_RES_IMG\javafile.odc - -// IAP Info API -file=ABI_DIR\BUILD_DIR\javaiapinfo.dll SHARED_LIB_DIR\javaiapinfo.dll -data=JAVA_VM_RES_BLD\javaiapinfo.odc JAVA_VM_RES_IMG\javaiapinfo.odc - - -/////////////////// -// Miscellaneous // -/////////////////// - -// Generated localization file resources -data=JAVA_VM_RES_BLD\resources.jar JAVA_VM_RES_IMG\resources.jar - -// ODC list files -data=ZRESOURCE\java\midpOdcList JAVA_RES_IMG\midpodclist -data=ZRESOURCE\java\installerOdcList JAVA_RES_IMG\installerodclist -data=ZRESOURCE\java\tckRunnerOdcList JAVA_RES_IMG\tckrunnerodclist -data=ZRESOURCE\java\javacontrolpanelodclist JAVA_RES_IMG\javacontrolpanelodclist - -// trust roots list -data=ZRESOURCE\java\security\trustroots\midprootslist JAVA_RES_IMG\security\trustroots\midprootslist - -#endif diff -r 0ea12c182930 -r 63b81d807542 rom/java_2_2.iby --- a/rom/java_2_2.iby Mon Aug 23 14:24:31 2010 +0300 +++ b/rom/java_2_2.iby Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 rom/java_3_1.iby --- a/rom/java_3_1.iby Mon Aug 23 14:24:31 2010 +0300 +++ b/rom/java_3_1.iby Thu Sep 02 13:22:59 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 0ea12c182930 -r 63b81d807542 rom/midpodclist --- a/rom/midpodclist Mon Aug 23 14:24:31 2010 +0300 +++ b/rom/midpodclist Thu Sep 02 13:22:59 2010 +0300 @@ -41,4 +41,5 @@ javawebservices.odc javawma.odc javawmamms.odc +javacentrep.odc resources.jar diff -r 0ea12c182930 -r 63b81d807542 rom/midpodclist30 --- a/rom/midpodclist30 Mon Aug 23 14:24:31 2010 +0300 +++ b/rom/midpodclist30 Thu Sep 02 13:22:59 2010 +0300 @@ -36,5 +36,6 @@ javawmamms.odc openlcdui.odc javanokiaui.odc +javacentrep.odc resources.jar