javacommons/utils/javasrc/com/nokia/mj/impl/runtime/rtport/RuntimeInfoImpl.java
branchRCL_3
changeset 24 0fd27995241b
parent 20 f9bb0fca356a
child 25 9ac0a0a7da70
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.mj.impl.runtime.rtport;
       
    20 
       
    21 import com.nokia.mj.impl.rt.support.ApplicationInfo;
       
    22 import com.nokia.mj.impl.rt.support.ApplicationUtils;
       
    23 
       
    24 import com.nokia.mj.impl.utils.Logger;
       
    25 import com.nokia.mj.impl.utils.Uid;
       
    26 
       
    27 public class RuntimeInfoImpl implements RuntimeInfo
       
    28 {
       
    29 
       
    30     UiToolkitRegisterImpl tk = new UiToolkitRegisterImpl();
       
    31 
       
    32     public UiToolkitRegister getUiToolkitRegister()
       
    33     {
       
    34         return tk;
       
    35     }
       
    36 
       
    37     public Object getApplicationId()
       
    38     {
       
    39 //        return ApplicationInfo.getInstance().getName();
       
    40         return this;
       
    41     }
       
    42 
       
    43     public int getApplicationUid()
       
    44     {
       
    45         try
       
    46         {
       
    47             String u = ApplicationInfo.getInstance().getUid().getStringValue();
       
    48             return Integer.parseInt(u.substring(1,u.length()-1), 16);
       
    49         }
       
    50         catch (Throwable t)
       
    51         {
       
    52         }
       
    53         return 0x2001843A; // The JavaInstaller uid.
       
    54     }
       
    55 
       
    56     public String getApplicationDomain()
       
    57     {
       
    58         try
       
    59         {
       
    60             return ApplicationInfo.getInstance().getProtectionDomain();
       
    61         }
       
    62         catch (Throwable t)
       
    63         {
       
    64         }
       
    65         return RuntimeInfo.MANUFACTURER_DOMAIN;
       
    66     }
       
    67 
       
    68     public void notifyExitCmd(int aUid)
       
    69     {
       
    70         try
       
    71         {
       
    72             ApplicationUtils.getInstance().notifyExitCmd();
       
    73         }
       
    74         catch (Throwable t)
       
    75         {
       
    76             Logger.ELOG(Logger.EUtils,
       
    77                         "RuntimeInfoImpl.notifyExitCmd(): Failed",
       
    78                         t);
       
    79         }
       
    80     }
       
    81 }