void CTestAppUi::TestServerEnduranceWithKillsL() { RDebug::Print(_L("TVIEW1 : Test Server Endurance With Client Kills")); iDoKills=ETrue; DoNextEnduranceTestActivation(); ActivateViewL(TVwsViewId(KUidViewAppTwo,KUidViewOne),KUidEndurance,KNullDesC16); ActivateViewL(TVwsViewId(KUidViewAppThree,KUidViewOne),KUidEndurance,KNullDesC16); }
void CTestView::HandleCommandL(TInt aCommand) { switch (aCommand) { case ETaskToAppAViewOne: ActivateViewL(TVwsViewId(KUidViewAppOne,KUidViewOne)); break; case ETaskToAppAViewTwo: ActivateViewL(TVwsViewId(KUidViewAppOne,KUidViewTwo)); break; case EDNLViewAppC: //ActivateViewL(TVwsViewId(KUidViewAppCApp,KUidViewAppCOne)); break; default: break; } }
void CTestAppUi::DoActivationL() { if (iCustomMsg->Length()) { ActivateViewL(iViewToActivate,KUidTestCustomMesssageId,*iCustomMsg); } else { CCoeAppUi::ActivateViewL(iViewToActivate); } }
void CTestAppUi::DoActivationL() { if (iCustomMsg->Length()) { ActivateViewL(iViewToActivate,KUidTestCustomMesssageId,*iCustomMsg); } else { TVwsViewId viewId; CCoeAppUi::GetActiveViewId(viewId); CCoeAppUi::ActivateViewL(iViewToActivate); CCoeAppUi::GetActiveViewId(viewId); } }
void CTestAppUi::DoNextEnduranceTestActivation() { if (iAutoTestTimer->IsActive()) iAutoTestTimer->Cancel(); // Find a new view to activate TUid viewUid = (Math::Rand(iRandSeed)<KMaxTInt/2) ? KUidViewOne : KUidViewTwo; TUid appUid = KNullUid; TInt rand=Math::Rand(iRandSeed); if (rand<=KMaxTInt/3) // 1 in 3 chance { appUid=KUidViewAppOne; } else if (rand/2<=KMaxTInt/3) { appUid=KUidViewAppTwo; } else { appUid=KUidViewAppThree; } // Decide whether any special condition should be used with activation. // This can mean the activation will be sluggish, a deactivation will be sluggish // or the activation will leave TUid messageUid=KNullUid; rand=Math::Rand(iRandSeed); if (rand<=KMaxTInt/10) // 1 in 10 chance { messageUid=KUidActivationOOM; } else if (rand/2<=KMaxTInt/10) { messageUid=KUidSluggishActivation; } else if (rand/3<=KMaxTInt/10) { STATIC_CAST(CTestView*,View(VIEW_ONE))->iSluggishDeactivation=ETrue; } // Start the timer again with a new time delay TTimeIntervalMicroSeconds32 delay(KMinimumDelay+KMinimumDelay*Math::Rand(iRandSeed)/KMaxTInt); iAutoTestTimer->Start(delay,delay,TCallBack(EnduranceTestCallBack,this)); TRAPD(err,ActivateViewL(TVwsViewId(appUid,viewUid),messageUid,KNullDesC)); __ASSERT_ALWAYS(!err,User::Panic(_L("ActivateViewL(TVwsViewId(appUid,viewUid),messageUid,KNullDesC)"),err)); }
void CVwsSession::ServiceL(const RMessage2& aMessage) { TBool completeMessage=ETrue; switch (aMessage.Function()) { case EVwsAsynchronousMessageForServerToPanicClientWith: iPanicMessage=aMessage; completeMessage=EFalse; break; case EVwsClose: CActiveScheduler::Stop(); break; case EVwsAddView: AddViewL(aMessage); break; case EVwsSetSystemDefaultView: SetSystemDefaultViewL(aMessage); break; case EVwsGetSystemDefaultView: GetSystemDefaultViewL(aMessage); break; case EVwsRemoveView: RemoveViewL(aMessage); break; case EVwsRequestViewEvent: RequestViewEventL(aMessage); completeMessage=EFalse; break; case EVwsRequestViewEventCancel: CancelRequestViewEvent(); break; case EVwsActivateView: ActivateViewL(aMessage,ECompleteRequest); completeMessage=EFalse; break; case EVwsCreateActivateViewEvent: ActivateViewL(aMessage,EDoNotCompleteRequest); break; case EVwsRequestCustomMessage: RequestCustomMessageL(aMessage); break; case EVwsStartApp: StartAppL(aMessage); completeMessage=EFalse; break; case EVwsDeactivateActiveView: DeactivateActiveViewL(aMessage,ECompleteRequest); completeMessage=EFalse; break; case EVwsDeactivateActiveViewIfOwnerMatch: DeactivateActiveViewIfOwnerMatchL(aMessage,ECompleteRequest); completeMessage=EFalse; break; case EVwsCreateDeactivateViewEvent: DeactivateActiveViewL(aMessage,EDoNotCompleteRequest); break; case EVwsNotifyNextDeactivation: NotifyNextDeactivationL(aMessage); break; case EVwsNotifyNextActivation: NotifyNextActivationL(aMessage); break; case EVwsSetClientRequestTimeOut: SetClientRequestTimeOut(aMessage); break; case EVwsSetServerEventTimeOut: SetServerEventTimeOut(aMessage); break; case EVwsEnableServerEventTimeOut: EnableServerEventTimeOut(aMessage); break; case EVwsCheckSourceOfViewSwitch: CheckSourceOfViewSwitchL(aMessage); break; case EVwsPriority: GetPriorityForActiveObjectL(aMessage); break; case EVwsEnableServerBlankScreen: EnableServerBlankScreen(aMessage); break; case EVwsSetProtected: SetProtectedL(aMessage); break; case EVwsSetCrossCheckUid: iServer.SetCrossCheckUid(aMessage); break; case EVwsSetWindowBackgroundColor: iServer.SetWindowBackgroundColor(aMessage); break; case EVwsCurrentActiveViewId: GetCurrentActiveViewIdL(aMessage); break; default: PanicClient(aMessage,EVwsBadRequest); } if (completeMessage && !aMessage.IsNull()) { LOG3(CVwsLog::ENormal,_L("Auto completing with %d"),KErrNone); aMessage.Complete(KErrNone); } }
// --------------------------------------------------------- // CStatusView::DoActivateL(...) // ?implementation_description // --------------------------------------------------------- // void CStatusView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) { CALLSTACKITEM_N(_CL("CStatusView"), _CL("DoActivateL")); iActive=true; TRect r=ClientRect(); iContainer->SetRect( r ); iContainer->MakeVisible(ETrue); AppUi()->AddToStackL( *this, iContainer ); CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); tp->SetText(CEikonEnv::Static()->AllocReadResourceL(R_CAPTION)); if ( iNextViewId != TVwsViewId() ) { TVwsViewId v = iNextViewId; iNextViewId= TVwsViewId(); { // it tends not to be safe to try to re-activate // the media capture apps if they've been shut down RWsSession& ws=CEikonEnv::Static()->WsSession(); TApaTaskList tl(ws); TApaTask app_task=tl.FindApp(v.iAppUid); if (! app_task.Exists() ) { // so activate the phone app instead TApaTask app_task=tl.FindApp(KUidPhone); if (app_task.Exists()) app_task.BringToForeground(); goto done_activate; } } if (v.iAppUid == KCameraUid) { CC_TRAPD(err, ActivateViewL(TVwsViewId(KCameraUid, KCameraViewUid))); #ifndef __S60V3__ //FIXME3RD } else if (v.iAppUid == KCamera2Uid) { /* the camera on 6630 will be stuck in showing the photo on reactivation */ auto_ptr<CApaCommandLine> cmd(CApaCommandLine::NewL(_L("z:\\system\\apps\\camcorder\\camcorder.app"))); cmd->SetCommandL(EApaCommandRun); CC_TRAPD(err, EikDll::StartAppL(*cmd)); } else if (v.iAppUid == KCamera3Uid) { // the camera on N70 will hang if the slider's been closed and we // try to reactivate it //Reporting().UserErrorLog(_L("starting camera3")); auto_ptr<CApaCommandLine> cmd(CApaCommandLine::NewL(_L("z:\\system\\apps\\cammojave\\cammojave.app"))); cmd->SetCommandL(EApaCommandRun); CC_TRAPD(err, EikDll::StartAppL(*cmd)); } else if (v.iAppUid == KVideoUid) { CC_TRAPD(err, ActivateViewL(TVwsViewId(KVideoUid, KVideoViewUid))); } else if (v.iAppUid == KRecorderUid) { auto_ptr<CApaCommandLine> cmd(CApaCommandLine::NewL(_L("z:\\system\\apps\\voicerecorder\\voicerecorder.app"))); cmd->SetCommandL(EApaCommandRun); CC_TRAPD(err, EikDll::StartAppL(*cmd)); #endif } else { //Reporting().UserErrorLog(_L("activating previous")); CC_TRAPD(err, ActivateViewL(v)); } done_activate: ; } }
void CTestAppUi::TestSlowActivationL() { RDebug::Print(_L("TVIEW2 : Test Slow Activation")); ActivateViewL(TVwsViewId(KUidViewAppTwo,KUidViewOne),KUidSlowActivation,KNullDesC16); }
void CTestAppUi::TestWaitingActivationL() { RDebug::Print(_L("TVIEW2 : Test Waiting Activation")); ActivateViewL(TVwsViewId(KUidViewAppTwo,KUidViewOne),KUidStartScheduler,KNullDesC16); }
void CTestAppUi::DoNextEnduranceTestActivation() { if (iAutoTestTimer->IsActive()) iAutoTestTimer->Cancel(); TInt rand=0; if (iDoKills) { // Occasionally we kill another TVIEW TUid killAppUid=KNullUid; rand=Math::Rand(iRandSeed); if (rand<=KMaxTInt/8) // 1 in 8 chance { killAppUid=KUidViewAppTwo; } else if (rand/2<=KMaxTInt/8) { killAppUid=KUidViewAppThree; } if (killAppUid!=KNullUid) { TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task=taskList.FindApp(killAppUid); if (task.Exists()) { RDebug::Print(_L("TVIEW1 : ********************* KILLING %x ********************* "),killAppUid.iUid); task.KillTask(); User::After(10000); // 0.1 sec } // Start the timer again with a new time delay TTimeIntervalMicroSeconds32 delay(KMinimumDelay+KMinimumDelay*Math::Rand(iRandSeed)/KMaxTInt); iAutoTestTimer->Start(delay,delay,TCallBack(EnduranceTestCallBack,this)); TRAPD(err,ActivateViewL(TVwsViewId(killAppUid,KUidViewOne),KUidEndurance,KNullDesC16)); __ASSERT_ALWAYS(!err,User::Panic(_L("ActivateViewL(TVwsViewId(killAppUid,KUidViewOne),KUidEndurance,KNullDesC16)"),err)); return; } } // Otherwise we do another random activation // Find a new view to activate TUid viewUid = (Math::Rand(iRandSeed)>KMaxTInt/2) ? KUidViewOne : KUidViewTwo; TUid appUid = KNullUid; rand=Math::Rand(iRandSeed); if (rand<=KMaxTInt/3) // 1 in 3 chance { appUid=KUidViewAppOne; } else if (rand/2<=KMaxTInt/3) { appUid=KUidViewAppTwo; } else { appUid=KUidViewAppThree; } // Decide whether any special condition should be used with activation. // This can mean the activation will be sluggish, a deactivation will be sluggish // or the activation will leave or exit TUid messageUid=KNullUid; rand=Math::Rand(iRandSeed); if (rand<KMaxTInt/10) // 1 in 10 chance { messageUid=KUidActivationOOM; } else if (rand/2<KMaxTInt/10) { messageUid=KUidSluggishActivation; } else if (rand/3<KMaxTInt/10) { STATIC_CAST(CTestView*,View(VIEW_ONE))->iSluggishDeactivation=ETrue; } else if (rand/4<=KMaxTInt/10 && iDoKills) { STATIC_CAST(CTestView*,View(VIEW_ONE))->iExitDeactivation=ETrue; } else if (rand<=KMaxTInt && iDoKills && appUid==KUidViewAppTwo) { messageUid=KUidActivationExit; } // Start the timer again with a new time delay TTimeIntervalMicroSeconds32 delay(KMinimumDelay+KMinimumDelay*Math::Rand(iRandSeed)/KMaxTInt); iAutoTestTimer->Start(delay,delay,TCallBack(EnduranceTestCallBack,this)); TRAPD(err,ActivateViewL(TVwsViewId(appUid,viewUid),messageUid,KNullDesC)); __ASSERT_ALWAYS(!err,User::Panic(_L("ActivateViewL(TVwsViewId(appUid,viewUid),messageUid,KNullDesC)"),err)); }
void CTestAppUi::TestActivateInsideViewActivatedL() { RDebug::Print(_L("TVIEW1 : Test Activate Inside ViewActivated")); ActivateViewL(TVwsViewId(KUidViewAppTwo,KUidViewOne),KUidActivateAgain,KNullDesC16); }
void CTestAppUi::TestPanicedActivationL() { RDebug::Print(_L("TVIEW1 : Test Paniced Activation")); ActivateViewL(TVwsViewId(KUidViewAppTwo,KUidViewOne),KUidActivationPanic,KNullDesC16); }