javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java
branchRCL_3
changeset 60 6c158198356e
parent 24 0fd27995241b
child 83 26b2b12093af
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 package com.nokia.mj.impl.installer.applicationregistrator;
    19 package com.nokia.mj.impl.installer.applicationregistrator;
    20 
    20 
       
    21 import com.nokia.mj.impl.installer.storagehandler.SuiteInfo;
    21 import com.nokia.mj.impl.installer.utils.InstallerException;
    22 import com.nokia.mj.impl.installer.utils.InstallerException;
    22 import com.nokia.mj.impl.installer.utils.FileRoots;
    23 import com.nokia.mj.impl.installer.utils.FileRoots;
    23 import com.nokia.mj.impl.installer.utils.FileUtils;
    24 import com.nokia.mj.impl.installer.utils.FileUtils;
    24 import com.nokia.mj.impl.installer.utils.Log;
    25 import com.nokia.mj.impl.installer.utils.Log;
    25 import com.nokia.mj.impl.installer.utils.PlatformUid;
    26 import com.nokia.mj.impl.installer.utils.PlatformUid;
   353         String aInputIconFilename,
   354         String aInputIconFilename,
   354         String aOutputIconFilename,
   355         String aOutputIconFilename,
   355         String aJarFilename,
   356         String aJarFilename,
   356         StringBuffer aIconSuffix)
   357         StringBuffer aIconSuffix)
   357     {
   358     {
       
   359         Log.log("ApplicationRegistrator.convertIcon: " + aInputIconFilename +
       
   360                 " --> " + aOutputIconFilename + ", from jar " + aJarFilename);
   358         return _convertIcon(aInputIconFilename, aOutputIconFilename,
   361         return _convertIcon(aInputIconFilename, aOutputIconFilename,
   359                             aJarFilename, aIconSuffix);
   362                             aJarFilename, aIconSuffix);
   360     }
   363     }
   361 
   364 
   362     /**
   365     /**
   435     {
   438     {
   436         _notifyLauncherThatUiIsReady();
   439         _notifyLauncherThatUiIsReady();
   437         return;
   440         return;
   438     }
   441     }
   439 
   442 
       
   443     /**
       
   444      * Adds an entry to platform installation log.
       
   445      *
       
   446      * @param aSuite application suite information
       
   447      * @param aAction 0 - installation, 1 - uninstallation
       
   448      */
       
   449     public static void addInstallLogEntry(SuiteInfo aSuite, int aAction)
       
   450     {
       
   451         // In S60 the version number is restricted to limited range.
       
   452         // If version number is outside of this range, use version
       
   453         // number 0 instead.
       
   454         int result = _addInstallLogEntry(
       
   455             aAction, PlatformUid.getIntValue(aSuite.getUid()),
       
   456             aSuite.getName(), aSuite.getVendor(),
       
   457             getVersion(aSuite.getVersion().getMajor(), 0, 127),
       
   458             getVersion(aSuite.getVersion().getMinor(), 0, 99),
       
   459             getVersion(aSuite.getVersion().getMicro(), 0, 32767));
       
   460         if (result < 0)
       
   461         {
       
   462             Log.logError("Adding installation log entry failed, err=" + result);
       
   463         }
       
   464         else
       
   465         {
       
   466             Log.log("Added installation log entry");
       
   467         }
       
   468     }
       
   469 
   440     /*** ----------------------------- PACKAGE ---------------------------- */
   470     /*** ----------------------------- PACKAGE ---------------------------- */
   441     /*** ----------------------------- PRIVATE ---------------------------- */
   471     /*** ----------------------------- PRIVATE ---------------------------- */
       
   472 
       
   473     /**
       
   474      * Checks that given version number is between specified minimum and
       
   475      * maximum value range (inclusive) and if it is returns version number.
       
   476      * If version number is out of given range, returns 0.
       
   477      */
       
   478     private static int getVersion(int aVersion, int aMin, int aMax)
       
   479     {
       
   480         if (aVersion >= aMin && aVersion <= aMax)
       
   481         {
       
   482             return aVersion;
       
   483         }
       
   484         return 0;
       
   485     }
       
   486 
   442     /*** ----------------------------- NATIVE ----------------------------- */
   487     /*** ----------------------------- NATIVE ----------------------------- */
   443 
   488 
   444     /**
   489     /**
   445      * Starts native application registration session.
   490      * Starts native application registration session.
   446      *
   491      *
   577      * emulator environment.
   622      * emulator environment.
   578      *
   623      *
   579      * @return true if Symbian 9.2 emulator environment
   624      * @return true if Symbian 9.2 emulator environment
   580      */
   625      */
   581     private static native boolean _runningIn92Emulator();
   626     private static native boolean _runningIn92Emulator();
       
   627 
       
   628     /**
       
   629      * Adds an entry to platform installation log.
       
   630      *
       
   631      * @param aAction 0 - installation, 1 - uninstallation
       
   632      * @param aUid application suite uid
       
   633      * @param aName application suite name
       
   634      * @param aVendor application suite vendor
       
   635      * @param aMajorVersion application suite major version
       
   636      * @param aMinorVersion application suite minor version
       
   637      * @param aMicroVersion application suite micro version
       
   638      * @return Symbian error code (negative number) if fails, otherwise 0
       
   639      */
       
   640     private static native int _addInstallLogEntry(
       
   641         int aAction, int aUid, String aName, String aVendor,
       
   642         int aMajorVersion, int aMinorVersion, int aMicroVersion);
   582 }
   643 }