sysstatemgmt/systemstatemgr/dompolicy/src/domainpolicy2.cpp
changeset 76 cb32bcc88bad
parent 0 4e1aa6a622a0
child 77 8a984d260a2d
equal deleted inserted replaced
73:d38941471f1c 76:cb32bcc88bad
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include "ssmdomaindefs.h"
    16 #include "ssmdomaindefs.h"
    17 #include "ssmsubstates.hrh"
    17 #include "ssmsubstates.hrh"
       
    18 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
    19 #include "ssmstates.hrh"
       
    20 #endif //SYMBIAN_INCLUDE_APP_CENTRIC
    18 
    21 
    19 #ifdef __WINS__
    22 #ifdef __WINS__
    20 const TInt KStateTransitionTimeout = 30000000; /* 30 seconds */
    23 const TInt KStateTransitionTimeout = 30000000; /* 30 seconds */
    21 #else
    24 #else
    22 const TInt KStateTransitionTimeout = 10000000; /* 10 seconds */
    25 const TInt KStateTransitionTimeout = 10000000; /* 10 seconds */
    23 #endif
    26 #endif
    24 
    27 
       
    28 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
    29 const TInt KStateDeferredLimit = 1; /* 1 time */
       
    30 const TInt KMemberTimeout = 5; /* 5msec */
       
    31 #endif //SYMBIAN_INCLUDE_APP_CENTRIC
    25 /*
    32 /*
    26 Domain specification and policy for the startup domain hierarchy
    33 Domain specification and policy for the startup domain hierarchy
    27 */
    34 */
    28 
    35 
    29 static const TDmDomainSpec DomainHierarchy[] =
    36 static const TDmDomainSpec DomainHierarchy[] =
    36 		{ KSM2AppServicesDomain3,		KSM2GenMiddlewareDomain4,	_INIT_SECURITY_POLICY_PASS, ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    43 		{ KSM2AppServicesDomain3,		KSM2GenMiddlewareDomain4,	_INIT_SECURITY_POLICY_PASS, ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    37 		{ KSM2AppServicesDomain4,		KSM2AppServicesDomain3,	    _INIT_SECURITY_POLICY_PASS, ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    44 		{ KSM2AppServicesDomain4,		KSM2AppServicesDomain3,	    _INIT_SECURITY_POLICY_PASS, ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    38 		{ KSM2UiServicesDomain3,		KSM2AppServicesDomain4,		_INIT_SECURITY_POLICY_PASS,	ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    45 		{ KSM2UiServicesDomain3,		KSM2AppServicesDomain4,		_INIT_SECURITY_POLICY_PASS,	ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    39 		{ KSM2UiApplicationDomain3,		KSM2UiServicesDomain3,		_INIT_SECURITY_POLICY_PASS,	ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    46 		{ KSM2UiApplicationDomain3,		KSM2UiServicesDomain3,		_INIT_SECURITY_POLICY_PASS,	ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
    40 		// end of array marker
    47 		// end of array marker
    41 		{ KDmIdNone,	KDmIdNone,	_INIT_SECURITY_POLICY_PASS,				0,			0		}
    48 		TDM_DOMAIN_SPEC_END
    42 	};
    49 	};
    43 
    50 
       
    51 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
    52 /**
       
    53  * Note that the transition monitor feature is enabled for states added to StateSpecification array only.
       
    54  */
       
    55 static const SDmStateSpecV1 StateSpecification[]=
       
    56     {
       
    57         {(ESsmShutdown << 16 | ESsmShutdownSubStateCritical), KMemberTimeout, KStateDeferredLimit, ETransitionFailureUsePolicyFromOrdinal3},
       
    58         {(ESsmShutdown << 16 | ESsmShutdownSubStateNonCritical), KMemberTimeout, KStateDeferredLimit, ETransitionFailureUsePolicyFromOrdinal3}
       
    59            
       
    60     };
    44 
    61 
       
    62 
       
    63 #endif //SYMBIAN_INCLUDE_APP_CENTRIC
    45 /*
    64 /*
    46 Note that the _INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData) is not used for the root domain, since this refers to the capabilities of
    65 Note that the _INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData) is not used for the root domain, since this refers to the capabilities of
    47 the SSA components connecting to the Start-up Domain Hierarchy. No capabilities are required by SSA components to attach to the Start-up Domain Hierarchy.
    66 the SSA components connecting to the Start-up Domain Hierarchy. No capabilities are required by SSA components to attach to the Start-up Domain Hierarchy.
    48 */
    67 */
    49 
    68 
    98 	{
   117 	{
    99 	aPolicy = HierarchyPolicyStartup;
   118 	aPolicy = HierarchyPolicyStartup;
   100 	return KErrNone;
   119 	return KErrNone;
   101 	}
   120 	}
   102 
   121 
       
   122 /**
       
   123 Retrieves the state specification array.
       
   124 The domain manager retrieves the StateSpecification array to read the state for which the transition
       
   125 monitoring feature has to be enabled.
       
   126 This should be present in the oridinal4 of the domainpolicy def file.
       
   127 
       
   128 @param aPtr  Will have the state specification structure used in the array .
       
   129 @param aNumElements Will hold the number of elements in the array.
       
   130 
       
   131 @return will return the version of the domain policy if the feature is enabled or else returns KErrNotSupported.
       
   132  */
       
   133 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
   134 EXPORT_C  TInt DmPolicy::GetStateSpec(TAny*& aPtr, TUint& aNumElements)
       
   135     {
       
   136     TInt version = KErrNotSupported;
       
   137     aPtr = (TAny*) StateSpecification;
       
   138     aNumElements = sizeof(StateSpecification)/sizeof(SDmStateSpecV1);    
       
   139     version = KSDmStateSpecV1;
       
   140     return version;    
       
   141     }
       
   142 #else
       
   143 EXPORT_C  TInt DmPolicy::GetStateSpec(TAny*& aPtr, TUint& aNumElements)
       
   144     {
       
   145     aPtr = NULL;
       
   146     aNumElements = 0;
       
   147     return KErrNotSupported;  
       
   148     }
       
   149 #endif //SYMBIAN_INCLUDE_APP_CENTRIC
       
   150 
       
   151 /**
       
   152 Defines the function type for a static function that is implemented by
       
   153 a device's domain policy DLL at ordinal 5. 
       
   154 The domain manager uses this function to release the state specification returned by ordinal 4. 
       
   155 The implementation may be empty and simply return if no release action needs 
       
   156 to be taken.
       
   157  */
       
   158 EXPORT_C void DmPolicy::ReleaseStateSpec(TAny* /*aStateSpec*/)
       
   159     {
       
   160     }
       
   161