MSsmSwpPolicy::TResponse CRFStatusSwPPolicy ::TransitionAllowed(const TSsmSwp& aSwp, const RMessagePtr2& aMessage) { MSsmSwpPolicy::TResponse isTransitionAllowed = ENotAllowed; TBool hasCapability = aMessage.HasCapability(ECapabilityWriteDeviceData, ECapabilityPowerMgmt, __PLATSEC_DIAGNOSTIC_STRING( "Platsec violation, RF status SwP transition" )); if(hasCapability) { if (IsSsmGracefulOffline()) { //RF ON/OFF is implemented as a substate in Normal instead of SwP for graceful offline notification. //Hence the SwP RF OFF/RF ON is restricted for the request which has SSM SID. Only BtSap SwP transition is //allowed to any client with appropriate capability. if (aMessage.SecureId() == KSsmSecureId || aSwp.Value() == ESsmBtSap ) { //Allow SwP change only if request has SsmSecureId or the SwP request for BtSap isTransitionAllowed = EAllowed; } } else { isTransitionAllowed = EAllowed; } } return isTransitionAllowed; }
/** Determines if an incoming startup state transition request should be accepted or rejected. Clients calling this API should posess 'ECapabilityPowerMgmt', else the API will return ENotAllowed. @param aRequest Contains information about the new request @param aCurrent Contains NULL or the first accepted but not yet completed transition request @param aQueued Contains NULL or a second accepted but not yet started transition request @param aMessage Message sent by SSM server, used to check if the client has 'ECapabilityPowerMgmt' @return one of the TResponse value @see MSsmStatePolicy::TransitionAllowed @see MSsmStatePolicy::TResponse */ MSsmStatePolicy::TResponse CGsaStatePolicyStartup::TransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage) { TResponse response = ENotAllowed; if (!aMessage.HasCapability(ECapabilityPowerMgmt)) { DEBUGPRINT1(_L ("Startup Policy : Capability Check Failed.")); return response; } //Check if the requested transition is supported from current state if(TransitionSupported(aRequest.State())) { if((NULL == aCurrent) && (NULL == aQueued)) { // SsmServer is idle response = EDefinitelyAllowed; } else if((aRequest.State().MainState() == ESsmFail) || (aRequest.State().MainState() == ESsmShutdown)) { // Going into failed state or shutdown state will override anything currently ongoing or queued response = EReplaceCurrentClearQueue; } } #ifdef _DEBUG TSsmStateName name = aRequest.State().Name(); if(ENotAllowed == response) { DEBUGPRINT3(_L("Startup Policy : Transition (Requested State: %S) is not allowed (Response: %d)."), &name, response); } else { DEBUGPRINT3(_L("Startup Policy : Transition (Requested State %S) is allowed (Response %d)."), &name, response); } #endif return response; }