/** @SYMTestCaseID APPFWK-APPARC-0026 @SYMPREQ PREQ1122 @SYMTestCaseDesc Rule Based Launching of Applications @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The test utilises 3 test applications that simply display the appication name. The test utilises 2 plugins. Rules from both plugins are executed. Plugin1 (Launching App4 closes App2) Plugin2 (Launching App4 closes App3) @SYMTestExpectedResults The test verifies that multiple rules can be implemented in multiple plugins and only the correct rules are executed. */ void CTRuleBasedLaunchingStep::LaunchAppTests4L(RApaLsSession& aLs) { INFO_PRINTF1(_L("Test case 4 started")); // App2 and App3 are closed if App4 is launched TEST(AppLaunchedL(aLs, KUidApp3) == KErrNone); TEST(AppLaunchedL(aLs, KUidApp2) == KErrNone); TEST(AppLaunchedL(aLs, KUidApp4) == KErrNone); TApaTaskList taskList(iWs); //Wait 2sec for App2 and App3 to be closed User::After(2 * 1000000); const TApaTask task2 = taskList.FindApp(KUidApp2); TEST(!task2.Exists()); const TApaTask task3 = taskList.FindApp(KUidApp3); TEST(!task3.Exists()); const TApaTask task4 = taskList.FindApp(KUidApp4); TEST(task4.Exists()); // Close all apps ClosedAllTestApp(); INFO_PRINTF1(_L("Test case 4 finished")); }
/** @SYMTestCaseID APPFWK-APPARC-0027 @SYMPREQ PREQ1122 @SYMTestCaseDesc Rule Based Launching of Applications @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The test cases is similar to APPFWK-APPARC-0025 but it launching applications via associated documents. @SYMTestExpectedResults The test verifies that multiple rules can be implemented in a single plugin and only the correct rule is executed. */ void CTRuleBasedLaunchingStep::LaunchAppTests5L(RApaLsSession& aLs) { INFO_PRINTF1(_L("Test case 5 started")); // App1 cannot be launched if App3 is running TEST(LaunchAppFromAssociatedDocument(aLs, KUidApp2) == KErrNone); TEST(LaunchAppFromAssociatedDocument(aLs, KUidApp3) == KErrNone); // Wait 2sec for App2 and App3 to be closed User::After(2 * 1000000); TEST(LaunchAppFromAssociatedDocument(aLs, KUidApp1) == KErrCancel); TApaTaskList taskList(iWs); const TApaTask task1 = taskList.FindApp(KUidApp1); TEST(!task1.Exists()); const TApaTask task2 = taskList.FindApp(KUidApp2); TEST(task2.Exists()); const TApaTask task3 = taskList.FindApp(KUidApp3); TEST(task3.Exists()); // Close all apps ClosedAllTestApp(); INFO_PRINTF1(_L("Test case 5 finished")); }
/** @SYMTestCaseID APPFWK-APPARC-0024 @SYMPREQ PREQ1122 @SYMTestCaseDesc Rule Based Launching of Applications @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The test utilises 3 test applications that simply display the appication name. The test utilises a single plugin that implements 2 rules. Only the first rule is executed(Launching App3 closes App1). @SYMTestExpectedResults The test verifies that that when an application is launched, the rule based mechanism is invoked and only the corresponding rule executed. */ void CTRuleBasedLaunchingStep::LaunchAppTests2L(RApaLsSession& aLs) { INFO_PRINTF1(_L("Test case 2 started")); TEST(AppLaunchedL(aLs, KUidApp1) == KErrNone); TEST(AppLaunchedL(aLs, KUidApp2) == KErrNone); TEST(AppLaunchedL(aLs, KUidApp3) == KErrNone); TApaTaskList taskList(iWs); //Wait 2sec for App1 to be closed User::After(2 * 1000000); // App1 should be closed when App3 is launched const TApaTask task1 = taskList.FindApp(KUidApp1); TEST(!task1.Exists()); const TApaTask task2 = taskList.FindApp(KUidApp2); TEST(task2.Exists()); const TApaTask task3 = taskList.FindApp(KUidApp3); TEST(task3.Exists()); // Close all apps ClosedAllTestApp(); INFO_PRINTF1(_L("Test case 2 finished")); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TInt CMgAppUi::OpenMobileWEBSiteL(TAny* /*aAny*/) { const TInt KWmlBrowserUid = 0x10008D39; TUid id( TUid::Uid( KWmlBrowserUid ) ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param = HBufC8::NewLC( KMobileJukkaLink().Length() + 2); //"4 " is to Start/Continue the browser specifying a URL param->Des().Append(_L("4 ")); param->Des().Append(KMobileJukkaLink); task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used CleanupStack::PopAndDestroy(param); } else { HBufC16* param = HBufC16::NewLC( KMobileJukkaLink().Length() + 2); //"4 " is to Start/Continue the browser specifying a URL param->Des().Append(_L("4 ")); param->Des().Append(KMobileJukkaLink); RApaLsSession appArcSession; // connect to AppArc server User::LeaveIfError(appArcSession.Connect()); TThreadId id; appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid), id ); appArcSession.Close(); CleanupStack::PopAndDestroy(param); } return KErrNone; }
void CMainControlEngine::LaunchWapBrowswerL(const TDesC& aAddr ) { RApaLsSession iApaLsSession; TUid id( KPhoneUidWmlBrowser ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param8 = HBufC8::NewLC( aAddr.Length() ); param8->Des().Append( aAddr ); task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used CleanupStack::PopAndDestroy( param8 ); } else { if ( !iApaLsSession.Handle() ) { User::LeaveIfError( iApaLsSession.Connect() ); } TThreadId thread; User::LeaveIfError( iApaLsSession.StartDocument( aAddr, KPhoneUidWmlBrowser, thread ) ); } }
static void handleOtherSchemesL(const TDesC& aUrl) { // Other schemes are at the moment passed to WEB browser HBufC* buf16 = HBufC::NewLC(aUrl.Length() + KBrowserPrefix.iTypeLength); buf16->Des().Copy(KBrowserPrefix); // Prefix used to launch correct browser view buf16->Des().Append(aUrl); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(KUidBrowser); if (task.Exists()){ // Switch to existing browser instance task.BringToForeground(); HBufC8* param8 = HBufC8::NewLC(buf16->Length()); param8->Des().Append(buf16->Des()); task.SendMessage(TUid::Uid( 0 ), *param8); // Uid is not used CleanupStack::PopAndDestroy(param8); } else { // Start a new browser instance RApaLsSession appArcSession; User::LeaveIfError(appArcSession.Connect()); CleanupClosePushL<RApaLsSession>(appArcSession); TThreadId id; appArcSession.StartDocument(*buf16, KUidBrowser, id); CleanupStack::PopAndDestroy(); // appArcSession } CleanupStack::PopAndDestroy(buf16); }
void JXApplication::PerformUrgentTasks() { if (!itsUrgentTasks->IsEmpty()) { // clear out itsUrgentTasks so new ones can safely be added JPtrArray<JXUrgentTask> taskList(*itsUrgentTasks, JPtrArrayT::kDeleteAll); itsUrgentTasks->RemoveAll(); // perform each task const JSize count = taskList.GetElementCount(); for (JIndex i=1; i<=count; i++) { (taskList.NthElement(i))->Perform(); } } JXDisplay::CheckForXErrors(); // We check in this order so CheckForSignals() can broadcast even // if the app is suspended. if (!itsHasBlockingWindowFlag && JThisProcess::CheckForSignals() && !IsSuspended()) { Quit(); } }
// ----------------------------------------------------------------------------- // CClientInstallerApplication::StartBrowser(URL) // Start up a NETFRONT browser on a given URL // ----------------------------------------------------------------------------- // void CClientInstallerApplication::StartBrowser(const TDesC& aUrl) { HBufC* param = HBufC::NewLC( 256 ); param->Des().Format( _L( "4 %S" ),&aUrl ); const TInt KWmlBrowserUid = ${browser.UID}; // NETFRONT Browser 3.3 TUid id( TUid::Uid( KWmlBrowserUid ) ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param8 = HBufC8::NewLC( param->Length() ); param8->Des().Append( *param ); task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used CleanupStack::PopAndDestroy(); // param8 } else { RApaLsSession appArcSession; User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server TThreadId id; appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid ), id ); appArcSession.Close(); } CleanupStack::PopAndDestroy(); // param }
EXPORT_C void KillApplicationL(RWsSession& aWs, TUid aUid, TInt aRetryInterval ) { TTime wait_until; wait_until.HomeTime(); wait_until+=TTimeIntervalSeconds(15); TApaTaskList taskList( aWs ); for(;;) { TApaTask task = taskList.FindApp(aUid); if(! task.Exists()) { break; } TTime now; now.HomeTime(); if (now < wait_until) { task.EndTask(); //DebugMsg(_L("waiting..."), aDebugLog); User::After(TTimeIntervalMicroSeconds32(aRetryInterval*1000) ); } else { break; } } TApaTask task = taskList.FindApp(aUid); if( task.Exists()) { #ifdef __S60V3__ task.KillTask(); #else RThread t; if (t.Open(task.ThreadId())==KErrNone) { //DebugMsg(_L("killing"), aDebugLog); t.Kill(2003); t.Close(); } #endif } }
EXPORT_C TBool IsRunningL(RWsSession& aWs, const TUid& aAppUid) { TApaTaskList taskList( aWs ); TApaTask task = taskList.FindApp(aAppUid); return task.Exists(); }
void roadmap_internet_open_browser (char *url) { RApaLsSession apaLsSession; const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed TUid id(KOSSBrowserUidValue); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(id); if(task.Exists()) { task.BringToForeground(); task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url,strlen(url))); // UID not used } else { if(!apaLsSession.Handle()) { User::LeaveIfError(apaLsSession.Connect()); } TThreadId thread; TBuf16<128> buf; buf.Copy(TPtrC8((TUint8 *)url,strlen(url))); User::LeaveIfError(apaLsSession.StartDocument(buf, KOSSBrowserUidValue, thread)); apaLsSession.Close(); } }
// From MWidgetCallbacks // ---------------------------------------------------------------------------- // CWidgetClient::launchApplicationL // // // // ---------------------------------------------------------------------------- // void CWidgetClient::launchApplicationL(const TUid& aUid, const TDesC& aParam) { RApaLsSession apaLsSession; TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(aUid); if ( task.Exists() ) { task.BringToForeground(); if ( aParam.Length() > 0 ) { HBufC8* param8 = HBufC8::NewLC( aParam.Length() ); param8->Des().Append( aParam ); task.SendMessage( TUid::Uid( 0 ), *param8 ); CleanupStack::PopAndDestroy( param8 ); } } else { TInt eConnect = KErrNone; if ( !apaLsSession.Handle() ) { eConnect = apaLsSession.Connect(); } if ( eConnect == KErrNone ) { TThreadId threadId; apaLsSession.StartDocument( aParam, aUid, threadId ); apaLsSession.Close(); } } }
/** @SYMTestCaseID APPFWK-APPARC-0028 @SYMPREQ PREQ1122 @SYMTestCaseDesc Rule Based Launching of Applications @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The test case launches an applications where file name defined whether without extension or disk drive, or as non system path. @SYMTestExpectedResults Rule based framework has to process this name correctly and apply pre-defined rules. */ void CTRuleBasedLaunchingStep::LaunchAppTests6L(RApaLsSession& aLs) { INFO_PRINTF1(_L("Test case 6 started")); TPtrC arFileName[] = { _L("tRuleBasedApp1.exe"), _L("\\sys\\bin\\tRuleBasedApp1.exe"), _L("\\nonsys\\bin\\tRuleBasedApp1.exe"), _L("\\sys\\bin\\tRuleBasedApp1"), _L("tRuleBasedApp1"), }; TInt sizeOfFileNameArray = sizeof(arFileName) / sizeof(arFileName[0]); for(TInt ii = 0; ii < sizeOfFileNameArray; ii++) { TEST(LaunchAppFromAssociatedDocument(aLs, KUidApp3) == KErrNone); TEST(AppLaunchedL(aLs, arFileName[ii]) == KErrCancel); TApaTaskList taskList(iWs); const TApaTask task1 = taskList.FindApp(KUidApp1); TEST(!task1.Exists()); const TApaTask task3 = taskList.FindApp(KUidApp3); TEST(task3.Exists()); if(task1.Exists() || !task3.Exists()) { INFO_PRINTF2(_L("The name %S is not recognized by rule based plug-ins as a valid"), &arFileName[ii]); } // Close all apps ClosedAllTestApp(); } INFO_PRINTF1(_L("Test case 6 finished")); }
TBool LaunchWapBrowserUtil::LaunchWapBrowser(const TDesC& aUrl) { #if defined NAV2_CLIENT_SERIES60_V2 || defined NAV2_CLIENT_SERIES60_V3 TInt urlLen = aUrl.Length(); HBufC* fixedUrl; if (KFourHttpString().Compare(aUrl.Left(KFourHttpString().Length()))) { /* Not 4 http:// at the beginning. */ if (KHttpString().Compare(aUrl.Left(KHttpString().Length()))) { /* Not http:// at the beginning. */ urlLen += KFourHttpString().Length() + 1; fixedUrl = HBufC::NewLC(urlLen); fixedUrl->Des().Copy(KFourHttpString); } else { urlLen += KFourString().Length() + 1; fixedUrl = HBufC::NewLC(urlLen); fixedUrl->Des().Copy(KFourString); } fixedUrl->Des().Append(aUrl); } else { fixedUrl = aUrl.AllocLC(); } RApaLsSession aApaLsSession; TUid id( KPhoneUidWmlBrowser ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param8 = HBufC8::NewLC( fixedUrl->Length() ); param8->Des().Append( *fixedUrl ); task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used CleanupStack::PopAndDestroy( param8 ); } else { if ( !aApaLsSession.Handle() ) { User::LeaveIfError( aApaLsSession.Connect() ); } TThreadId thread; User::LeaveIfError( aApaLsSession.StartDocument( *fixedUrl, KPhoneUidWmlBrowser, thread ) ); } CleanupStack::PopAndDestroy(fixedUrl); aApaLsSession.Close(); #elif defined NAV2_CLIENT_SERIES60_V1 return EFalse; #else # error This code not implemented! #endif return ETrue; }
void CDataQuotaView::OpenWebBrowserL(const TDesC& aUrl, const TBool aForceNative) { // To suppress compiler warnings (void)aUrl; (void)aForceNative; #ifdef __OVI_SIGNED__ RApaLsSession lsSession; User::LeaveIfError(lsSession.Connect()); CleanupClosePushL(lsSession); const TUid KBrowserUid = {0x10008D39}; TUid handlerUid = KBrowserUid; if (!aForceNative) { // Find the default browser, on S^1/S^3 it may be a 3rd party browser _LIT8(KMimeDataType, "application/x-web-browse"); TDataType mimeDataType(KMimeDataType); // Get the default application UID for "application/x-web-browse" lsSession.AppForDataType(mimeDataType, handlerUid); if (handlerUid.iUid == 0) { // For S60 3.x handlerUid = KBrowserUid; } } TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task(taskList.FindApp(handlerUid)); if(task.Exists()) { task.BringToForeground(); HBufC8* param8(HBufC8::NewLC(aUrl.Length())); param8->Des().Append(aUrl); task.SendMessage(TUid::Uid(0), *param8); // UID not used CleanupStack::PopAndDestroy(param8); } else { TThreadId thread; User::LeaveIfError(lsSession.StartDocument(aUrl, handlerUid, thread)); } CleanupStack::PopAndDestroy(&lsSession); #else // !__OVI_SIGNED__ if (!iBrowserLauncher) { iBrowserLauncher = CBrowserLauncher::NewL(); } iBrowserLauncher->LaunchBrowserEmbeddedL(aUrl); #endif // __OVI_SIGNED__ }
void MpFetcherTestAppView::killMP() { TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(TUid::Uid(270564450)); if (task.Exists()) { task.KillTask(); } else { qCritical("Cannot bring to forward task %08x", 270564450); } }
// ---------------------------------------------------------------------------- // // ---------------------------------------------------------------------------- // TBool CWrtHarvester::CheckTaskExistsL() { TUid widgetAppUid( TUid::Uid( KWidgetAppUid ) ); RWsSession wsSession; // Create Window server session User::LeaveIfError( wsSession.Connect() ); TApaTaskList taskList( wsSession ); TApaTask task = taskList.FindApp( widgetAppUid ); return task.Exists()?ETrue:EFalse; }
void CTestAppUi::TestForegroundChangeWhileEventsOnQueueL() { RDebug::Print(_L("TVIEW1 : Test Foreground Change While Events On Queue")); // Activate a view in TView2 first to make sure that the app is available CCoeAppUi::ActivateViewL(TVwsViewId(KUidViewAppTwo,KUidViewOne)); // Activate a view in TView1 to get into a known state so that we can do a check of the outcome of the real test CCoeAppUi::ActivateViewL(TVwsViewId(KUidViewAppOne,KUidViewOne)); // Create an activation event for TView2 and stall long enough so that the event will be waiting for the deactivation // in this app. Then immediately bring this app into the foreground. CreateActivateViewEventL(TVwsViewId(KUidViewAppTwo,KUidViewOne),KNullUid,KNullDesC8); User::After(50000); // 0.5 sec TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task=taskList.FindApp(KUidViewAppOne); task.BringToForeground(); }
void HlpLauncher::DoLaunchHelpApplicationL(RWsSession& aWsSession, const TDesC8& aCmdLine) { TApaTaskList taskList(aWsSession); TApaTask task = taskList.FindApp(KHlpAppUid); if (task.Exists()) { task.SendMessage (KHlpAppWsMsg, aCmdLine); task.BringToForeground(); } else { CApaCommandLine* cmdLine=CApaCommandLine::NewLC(); // INC057477 fix // Get and open the resource file RFs f; CleanupClosePushL(f); User::LeaveIfError(f.Connect()); RResourceFile r; r.OpenL(f, KHelpLauncherResource); CleanupClosePushL(r); // Read the path of the help application from the resource file r.ConfirmSignatureL(); TResourceReader resReader; resReader.SetBuffer(r.AllocReadLC(R_HELP_PATH)); TPtrC16 helpPath = resReader.ReadTPtrC16(); cmdLine->SetExecutableNameL(helpPath); CleanupStack::PopAndDestroy(); // AllocReadLC CleanupStack::PopAndDestroy(); // close r CleanupStack::PopAndDestroy(); // close f cmdLine->SetCommandL(EApaCommandOpen); cmdLine->SetTailEndL(aCmdLine); //EikDll::StartAppL(*cmdLine); RApaLsSession lsSession; User::LeaveIfError(lsSession.Connect()); CleanupClosePushL(lsSession); User::LeaveIfError(lsSession.StartApp(*cmdLine)); CleanupStack::PopAndDestroy(&lsSession); CleanupStack::PopAndDestroy(); //cmdLine } }
void CScummVMUi::ConstructL() { BaseConstructL(); TBuf<128> startFile; startFile = iEikonEnv->EikAppUi()->Application()->AppFullName(); TParse parser; parser.Set(startFile,NULL,NULL); startFile = parser.DriveAndPath(); #ifndef __WINS__ startFile.Append( _L("ScummVM.exe")); #else startFile.Append( _L("ScummVM.dll")); #endif CApaCommandLine *cmdLine = CApaCommandLine::NewLC(startFile); RApaLsSession lsSession; lsSession.Connect(); CleanupClosePushL(lsSession); lsSession.StartApp(*cmdLine, iThreadId); CleanupStack::PopAndDestroy();//close lsSession CleanupStack::PopAndDestroy(cmdLine); User::After(500000);// Let the application start TApaTaskList taskList(iEikonEnv->WsSession()); TApaTask myTask = taskList.FindApp(TUid::Uid(0x101f9b57)); myTask.SendToBackground(); TApaTask exeTask = taskList.FindByPos(0); iExeWgId=exeTask.WgId(); exeTask.BringToForeground(); if(iExeWgId == myTask.WgId()) { // Should n't be the same Exit(); } if(iThreadWatch.Open(iThreadId) == KErrNone) { iWatcher = new (ELeave)CScummWatcher; iWatcher->iAppUi = this; iThreadWatch.Logon(iWatcher->iStatus); } }
/** * Common implementation for test case 0001 and 0002. See INFO_PRINTs for further information. */ TApaTask CApStartTestStep::TestStartL(TRequestStatus* aRequestStatus, RWsSession& aWsSession) { INFO_PRINTF1(_L("Requesting start of KTestAppGood in foreground.")); const TDesC& cmdLineParams = KNullDesC; const TBool viewLess = EFalse; const TBool startInBackground = EFalse; TThreadId tId; if(aRequestStatus) { iAppStart->StartAppL(KTestAppGood, cmdLineParams, viewLess, startInBackground, tId, *aRequestStatus); } else { iAppStart->StartAppL(KTestAppGood, cmdLineParams, viewLess, startInBackground, tId); } RThread thread; RProcess process; INFO_PRINTF1(_L("Verifying that the process was created.")); TEST(KErrNone == thread.Open(tId)); TEST(KErrNone == thread.Process(process)); INFO_PRINTF1(_L("Waiting for KTestAppGood to resume.")); if(aRequestStatus) { User::WaitForRequest(*aRequestStatus); } else { TRequestStatus status; process.Rendezvous(status); User::WaitForRequest(status); } process.Close(); thread.Close(); INFO_PRINTF1(_L("Verifying that KTestAppGood is now up and running.")); TApaTaskList taskList(aWsSession); const TUid appUid = {KTestAppGoodUid}; TApaTask task = taskList.FindApp(appUid); TEST(task.Exists()); return task; }
/** The function is used to close an app whose UID is supplied as the input parameter. The function returns KerrNone upon success, KErrGeneral othewise. */ TInt CTRuleBasedLaunchingStep::AppClosed(TUid AppUid) { TInt result = KErrNone; TApaTaskList taskList(iWs); TApaTask task1 = taskList.FindApp(AppUid); if(task1.Exists()) { task1.EndTask(); //Wait 0.5sec for the App to close User::After(500000); const TApaTask task2 = taskList.FindApp(AppUid); if (task2.Exists()) { result = KErrGeneral; } } return result; }
// ============================================================================ // CWidgetEntry::Active() // Is widget running? 0 if not, non zero if running. // // @since 3.1 // ============================================================================ // TInt CWidgetEntry::ActiveL() { if ( iActive ) { // check that WidgetUI didn't crash, this assumes all widgets // in the registry are running under WidgetUI RWsSession wsSession; User::LeaveIfError( wsSession.Connect() ); CleanupClosePushL( wsSession ); TApaTaskList taskList( wsSession ); TApaTask task = taskList.FindApp( KUidWidgetUi ); if ( EFalse == task.Exists() ) { // widget UI crashed, reset active iActive = 0; } CleanupStack::PopAndDestroy( &wsSession ); } return iActive; }
// ----------------------------------------------------------------------------- // CTwitterLauncherAppContainer::LaunchSWF() // method to open SWF file in FlashLite player. // ----------------------------------------------------------------------------- // void CFlashLite21LauncherAppUi::LaunchSWF () { //Search for open player TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( KUidFlash21 ); if( task.Exists()) //If player is already running { TInt err = task.SwitchOpenFile( KLitSwfFileToLaunch ); if(err == KErrNone) { //everything is fine } else { //any error } task.BringToForeground(); } }
void CTestAppUi::ConstructL() { CTestVwAppUi::ConstructL(); iRichParaFormatLayer=CEikonEnv::NewDefaultParaFormatLayerL(); iRichCharFormatLayer=CEikonEnv::NewDefaultCharFormatLayerL(); iRichText=CRichText::NewL(iRichParaFormatLayer,iRichCharFormatLayer); CreateViewsL(); iViewActivationObserver=new(ELeave) CTestViewActivationObserver(*this); iViewActivationObserver->ConstructL(); iAutoTestTimer=CPeriodic::NewL(0); iIdle=CIdle::NewL(CActive::EPriorityIdle); // Set default owning window if available CEikonEnv* env=CEikonEnv::Static(); TApaTaskList taskList(env->WsSession()); TApaTask task=taskList.FindApp(KUidViewAppOne); if (task.Exists()) { env->RootWin().SetOwningWindowGroup(task.WgId()); } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TInt CExPolicy_Server::KillTasks(TUid& aUid) { TInt RetErr(KErrNone); RWsSession wsSession; RetErr= wsSession.Connect(); if(RetErr == KErrNone) { TApaTaskList taskList( wsSession ); TApaTask task = taskList.FindApp(aUid); if( task.Exists() ) { task.KillTask(); } } wsSession.Close(); return RetErr; }
void CTestView::DoDeactivate() { if (!iActivated) { RDebug::Print(_L("%x,%x deactivated when not active"),ViewId().iAppUid.iUid,ViewId().iViewUid.iUid); ASSERT(iActivated); } if (iDeactivationPanic) { RDebug::Print(_L("TVIEW1 : Deactivation Panic")); User::Panic(APP_TEXT,1); } else if (iSlowDeactivation) { RDebug::Print(_L("TVIEW1 : Slow Deactivation")); User::After(5000000); // 5 sec iSlowDeactivation=EFalse; } else if (iSluggishDeactivation) { RDebug::Print(_L("TVIEW1 : Sluggish Deactivation")); User::After(500000); // 0.5 sec iSluggishDeactivation=EFalse; } else if (iExitDeactivation) { RDebug::Print(_L("TVIEW1 : Exit During Deactivation")); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task=taskList.FindApp(KUidViewAppTwo); if (task.Exists()) { RDebug::Print(_L("TVIEW1 : ********************* KILLING TVIEW2 ********************* ")); task.KillTask(); User::After(10000); // 0.1 sec } iExitDeactivation=EFalse; } iActivated=EFalse; }
// ----------------------------------------------------------------------------- // DMFotaView::backtoMainWindow // Enables switching between views // ----------------------------------------------------------------------------- // void DMFotaView::backtoMainWindow() { qDebug("DMFotaView::backtoMainWindow >>"); QString appName = qApp->applicationName(); QString cpAppTitle("Control panel"); mMainWindow->removeView(fotaPortraitView); mMainWindow->removeView(fotaLandscapeView); fotaPortraitView->deleteLater(); fotaLandscapeView->deleteLater(); fotaPortraitView = NULL; fotaLandscapeView = NULL; if (appName == cpAppTitle) { TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(KControlPanelAppUid); if (task.Exists()) { task.BringToForeground(); } } qApp->quit(); qDebug("DMFotaView::backtoMainWindow <<"); }
/** @SYMTestCaseID APPFWK-APPARC-0025 @SYMPREQ PREQ1122 @SYMTestCaseDesc Rule Based Launching of Applications @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The test utilises 2 test applications that simply display the appication name. Only the first rule is executed(A running App3 prevents App1 launching). Only the second rule is executed(App1 cannot launch if App3 is running). @SYMTestExpectedResults The test verifies that multiple rules can be implemented in a single plugin and only the correct rule is executed. */ void CTRuleBasedLaunchingStep::LaunchAppTests3L(RApaLsSession& aLs) { INFO_PRINTF1(_L("Test case 3 started")); // App1 cannot be launched if App3 is running TEST(AppLaunchedL(aLs, KUidApp2) == KErrNone); TEST(AppLaunchedL(aLs, KUidApp3) == KErrNone); TEST(AppLaunchedL(aLs, KUidApp1) == KErrCancel); TApaTaskList taskList(iWs); const TApaTask task1 = taskList.FindApp(KUidApp1); TEST(!task1.Exists()); const TApaTask task2 = taskList.FindApp(KUidApp2); TEST(task2.Exists()); const TApaTask task3 = taskList.FindApp(KUidApp3); TEST(task3.Exists()); // Close all apps ClosedAllTestApp(); INFO_PRINTF1(_L("Test case 3 finished")); }
void OpenBrowser(const TDesC& aUrl) { TUid id(TUid::Uid(KBrowserUid)); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(id); if (task.Exists()) { HBufC8* param8 = HBufC8::NewLC(100); param8->Des().Append(aUrl); // Uid is not used task.SendMessage(TUid::Uid(0), *param8); CleanupStack::PopAndDestroy(); } else { RApaLsSession appArcSession; // connect to AppArc server User::LeaveIfError(appArcSession.Connect()); TThreadId id; TInt ret = appArcSession.StartDocument(aUrl, TUid::Uid(KBrowserUid), id); appArcSession.Close(); } }