コード例 #1
0
TUid GetAppUidByWndGroupIdL( RWsSession &aWs, TInt aWndGroupId )
    {
    CApaWindowGroupName* wg = CApaWindowGroupName::NewLC(aWs,aWndGroupId);
    TUid id = wg->AppUid();
    CleanupStack::PopAndDestroy(wg);    	
    return id;
    }
コード例 #2
0
void CWindowGroupListBoxData::DoInfoForDialogL(RBuf& aTitle, RBuf& inf, TDes* name)
	{
	SWgInfo& info = *reinterpret_cast<SWgInfo*>(iInfo);
	_LIT(KInfo, "Window group info");
	aTitle.Copy(KInfo);
	CApaWindowGroupName* wg = info.iName;
	*name = wg->WindowGroupName();
	PrettyName(EListWindowGroups, *name);

	inf.Append(*name);
	TThreadId tid;
	TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid);
	inf.AppendFormat(_L("\n\nOwner thread: %i"), res == KErrNone ? (TInt)tid : res);
	RThread thread;
	if (res == KErrNone)
		{
		res = thread.Open(tid);
		}
	if (res == KErrNone)
		{
		*name = thread.FullName();
		PrettyName(EListThread, *name);
		inf.AppendFormat(_L(" (%S)"), name);
		}
	inf.AppendFormat(_L("\nBusy=%i System=%i Hidden=%i"), wg->IsBusy(), wg->IsSystem(), wg->Hidden());
	}
コード例 #3
0
TUid CGSPenInputModel::AppUidFromWndGroupIdL( TInt aWndGrpId )
    {
    RWsSession &ws = CCoeEnv::Static()->WsSession();    
    CApaWindowGroupName* wg = CApaWindowGroupName::NewLC(ws,aWndGrpId);
    TUid id = wg->AppUid();
    CleanupStack::PopAndDestroy(wg);    
    return id;    
    }
/*!
* Get the uid of application in foreground.
* @return Application uid for the foreground application.
*/
unsigned int CxuiApplicationFrameworkMonitorPrivate::focusedApplicationUid()
{
    unsigned int uid(0);
    int focusWgId(mWsSession.GetFocusWindowGroup());

    TRAP_IGNORE({
        CApaWindowGroupName* wgn = CApaWindowGroupName::NewLC(mWsSession, focusWgId);
        uid = wgn->AppUid().iUid;
        CleanupStack::PopAndDestroy(wgn);
    });
コード例 #5
0
TUid AppUidFromWndGroupIdL(TInt aWndGrpId)
    {
    RWsSession &ws = CCoeEnv::Static()->WsSession();
    //TInt wgId =ws.GetFocusWindowGroup();
    CApaWindowGroupName* wg = CApaWindowGroupName::NewLC(ws,aWndGrpId);

    TUid id = wg->AppUid();
    CleanupStack::PopAndDestroy(wg);    	
    return id;
    
    }
コード例 #6
0
void  CWindowChangeMonitor::SetWgL(TInt aFirstWg)
    {
    if(iCurrentWg != aFirstWg)
        {
        iCurrentWg = aFirstWg; 
        CApaWindowGroupName* name = CApaWindowGroupName::NewLC(iSession, aFirstWg);
        iNxtUid = name->AppUid();
        CleanupStack::PopAndDestroy();
        }
    iCurrentUid = iNxtUid;
    iAborted = 0;
    }
コード例 #7
0
void CWindowGroupListBoxData::DoFormatL(TObjectKernelInfo* aInfo, RBuf& name, RBuf& more, TInt& /*itemId*/)
	{
	SWgInfo& info = *reinterpret_cast<SWgInfo*>(aInfo);
	CApaWindowGroupName* wgName = info.iName;
	name.Copy(wgName->Caption());
	_LIT(KUnnamed, "<Untitled window group>");
	if (name.Length() == 0) name.Copy(KUnnamed);

	TThreadId tid;
	TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid);
	if (res == KErrNone)
		{
		res = tid;
		}
	more.Format(_L("Busy=%i System=%i Tid=%i"), wgName->IsBusy(), wgName->IsSystem(), res);
	}
コード例 #8
0
// -----------------------------------------------------------------------------
// CPodcastAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// -----------------------------------------------------------------------------
//
void CPodcastAppUi::HandleCommandL( TInt aCommand )
    {
    switch ( aCommand )
        {
        case EAknSoftkeyExit:
            {
            Exit();
            break;
            }
        case EEikCmdExit:
        	{
        	// we want to prevent red button from closing podcatcher, and
        	// instead we send it to background
        	// however, we want to respect the task manager (fast swap) close
        	// command, so we check if task manager is the focussed window group
        	
        	RWsSession& ws = iEikonEnv->WsSession();
			TInt wgid = ws.GetFocusWindowGroup();
			CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(ws, wgid);
			TUid activeAppUid = gn->AppUid();
			CleanupStack::PopAndDestroy(gn);
        	
			const TUid KUidFastSwap = { 0x10207218 };
			if (activeAppUid == KUidFastSwap)
				{
				// closed by task manager
				Exit();
				}
			else
        		{
        		// red button pressed
				TApaTask task(iEikonEnv->WsSession());
				task.SetWgId(iEikonEnv->RootWin().Identifier());
				task.SendToBackground(); 
        		}   		
			break;
        	}
	case EPodcastHelp:
        	{	
        	HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), HelpContextL());
        	}
        	break;      	
        default:
            break;      
        }
    }
コード例 #9
0
void CWindowChangeMonitor::WgChangeL(TInt aFirstWg)
    {
    CApaWindowGroupName* name = CApaWindowGroupName::NewLC(iSession, aFirstWg);
    iNxtUid = name->AppUid();
    iCurrentWg = aFirstWg; 
    
    if(iNxtUid != iCurrentUid)
        {
        const TInt flags = AknTransEffect::TParameter::EFlagNone;
        GfxTransEffect::BeginFullScreen(
            AknTransEffect::EApplicationActivate, 
            TRect(0,0,0,0),
            AknTransEffect::EParameterType, 
            AknTransEffect::GfxTransParam(iNxtUid, iCurrentUid, flags)); 
        }
    CleanupStack::PopAndDestroy();  
    iAborted = 0;
    }
コード例 #10
0
ファイル: ImageCapture.cpp プロジェクト: fedor4ever/testfw
// ------------------------------------------------------------------------------
// CImageCapture::RunL
// Issues request to save Images and notifies the observer after saving the image
// ------------------------------------------------------------------------------
//
void CImageCapture::RunL()
{
	switch (iScreenShotStatus)
	{
		case EIdle:
		break;
			
		case EWaiting:
			{
			RWsSession& wsSession = iEEnv->WsSession();
			TInt id = wsSession.GetFocusWindowGroup();
			CApaWindowGroupName* lApaWGName;
			lApaWGName = CApaWindowGroupName::NewLC(wsSession,id);
			
			TUid uid = lApaWGName->AppUid();
			
			if(uid.operator ==(iAppUid) )
   			   Fire(ECapturing);
			else
				FireCapture(1000000);
			
			CleanupStack::PopAndDestroy(); // lApaWGName
			
			}
			break;
			
		case ECapturing:
			DoCaptureL();
			break;
			
	
		case ESaveComplete:
		default:
			iObserver.PerformNextAction(1);
			delete this;		
			
	}          
}
コード例 #11
0
ファイル: server.cpp プロジェクト: Seikareikou/symbian
void CMyServer::GetWgEvent()
    {
    #ifdef __DEBUG
    __LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
    #endif
   if(iStatus == KErrNone)
	{
    TWsEvent e;
    iWs.GetEvent(e);
    #ifdef __DEBUG
    __LOGSTR1("event: %d",e.Type());
    #endif
	}
    TInt WgId = iWs.GetFocusWindowGroup();
    CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(iWs, WgId);
    #ifdef __DEBUG
    __LOGSTR2("focused app with uid: 0x%x,config uid: 0x%x",gn->AppUid(),iConfig.iUid);
    #endif
    if(gn->AppUid() == iConfig.iUid)
	{

    	Show();
	//Draw();
    //iWindow.SetVisible(ETrue);
    //iWs.Flush();
    #ifdef __DEBUG
	__LOGSTR("UIDs ==");
    #endif
	}else{
	//iWindow.SetVisible(EFalse);
		Hide();
	iWs.Flush();
    #ifdef __DEBUG
	__LOGSTR("UIDs !=");
    #endif
	}
    WaitWgEvent();
    }
コード例 #12
0
void CWindowGroupListBoxData::DumpToCloggerL(RClogger& clogger, TInt i, TInt /*count*/)
	{
	_LIT(KWgDesc,"WindowGroup;RawName;OwnerThreadId;System;Busy;Hidden");
	_LIT(KWgFmt,"WindowGroup;%S;%i;%i;%i;%i");

	if (i == 0) clogger.Log(KWgDesc);
	SWgInfo& info = *reinterpret_cast<SWgInfo*>(iInfo);
	CApaWindowGroupName* wg = info.iName;
	TPtrC name = wg->WindowGroupName();
	TBuf<256> temp = name;
	PrettyName(EListWindowGroups, temp);
	RBuf val;
	val.CreateL(256);
	TThreadId tid;
	TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid);
	if (res == KErrNone)
		{
		res = tid;
		}

	clogger.Log(KWgFmt, &temp, res, wg->IsSystem(), wg->IsBusy(), wg->Hidden());
	val.Close();
	}
コード例 #13
0
TVerdict CShutdownApp::doTestStepL()
	{
	TInt uidValue;
	_LIT(KUidKey, "uid");
	if (!GetHexFromConfig(ConfigSection(), KUidKey, uidValue))
		{
		ERR_PRINTF1(_L("Missing uid"));
		SetTestStepResult(EFail);
		return EFail;
		}
	TInt connectErr = KErrNotFound;
#ifndef SWI_TEXTSHELL_ROM
	TUid appUid;
	appUid.iUid = uidValue;

	TInt wgId=0;
	RWsSession wsSession;
	connectErr = wsSession.Connect();
	if (connectErr != KErrNotFound)
		{
		User::LeaveIfError(connectErr);
		CleanupClosePushL(wsSession);
		
		CApaWindowGroupName* wgName = CApaWindowGroupName::NewL(wsSession);
		CleanupStack::PushL(wgName);
		CApaWindowGroupName::FindByAppUid(appUid, wsSession, wgId);
		
		if (wgId == KErrNotFound)
			{
			ERR_PRINTF2(_L("Running app with UID 0x%x not found."), appUid.iUid);		
			User::Leave(KErrNotFound);
			}
		
		wgName->ConstructFromWgIdL(wgId);
		
		if(wgName->RespondsToShutdownEvent())
			{
			TApaTask task(wsSession);
			task.SetWgId(wgId);
			RThread thread;
			TInt err=thread.Open(task.ThreadId());
			CleanupClosePushL(thread);
			if (!err)
				{
				RProcess process;
				thread.Process(process);
				CleanupClosePushL(process);
				
				TRequestStatus processStatus;
				process.Rendezvous(processStatus);
					
				task.SendSystemEvent(EApaSystemEventShutdown);

				RTimer timer;
				CleanupClosePushL(timer);
				TRequestStatus timerStatus;
				
				User::LeaveIfError(timer.CreateLocal());
				timer.After(timerStatus, KAppShutdownTimeout);

				User::WaitForRequest(processStatus,timerStatus);

				if (processStatus==KRequestPending)
					{
					// timer completed so give up
					process.RendezvousCancel(processStatus);
					User::WaitForRequest(processStatus);
					ERR_PRINTF2(_L("App with UID 0x%x timed out on shutdown."), appUid.iUid);		
					User::Leave(KErrTimedOut);
					}
				else if (timerStatus==KRequestPending)
					{
					// Rendezvous completed so cancel timer
					timer.Cancel();
					User::WaitForRequest(timerStatus);
					}
				else
					{
					 // Both have completed, so prevent stray request
					User::WaitForRequest(processStatus,timerStatus);
					}
					
				CleanupStack::PopAndDestroy(2, &process);
				INFO_PRINTF2(_L("App with UID 0x%x shut down."), appUid.iUid);
				SetTestStepResult(EPass);

				}
			CleanupStack::PopAndDestroy(&thread);
			}
		else 
			{
			ERR_PRINTF2(_L("App with UID %x does not handle shutdown events."), appUid.iUid);
			SetTestStepResult(EFail);
			}
		CleanupStack::PopAndDestroy(2, &wsSession);
	}
#endif
	if (connectErr == KErrNotFound)
		{
		// emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM)
		ERR_PRINTF1(_L("Ignoring shutdown checks in Textshell Rom"));
		}
	return TestStepResult();
	}
コード例 #14
0
// Each test step must supply a implementation for doTestStepL
enum TVerdict CTestAppLoaderEndTask::doTestStepL( void )
	{
	// Printing to the console and log file
	INFO_PRINTF1(_L("TEST-> END TASK"));

	TPtrC	program;
	if ( !GetStringFromConfig(ConfigSection(), KProgram, program) )
		{
		ERR_PRINTF2(KErrMissingParameter, &KProgram());
		SetTestStepResult(EFail);
		}
	else
		{
		RApaLsSession	apaLsSession;
		User::LeaveIfError(apaLsSession.Connect());
		CleanupClosePushL(apaLsSession);
	    User::LeaveIfError(apaLsSession.GetAllApps());

		RWsSession	ws;
		User::LeaveIfError(ws.Connect());
		CleanupClosePushL(ws);
		
	    TInt					numWindowGroups = ws.NumWindowGroups();
	    CArrayFixFlat<TInt>*	windowGroupList = new(ELeave) CArrayFixFlat<TInt>(numWindowGroups);
	    CleanupStack::PushL(windowGroupList);

	    // Populate array with current group list ids
	    User::LeaveIfError(ws.WindowGroupList(windowGroupList));

	    CApaWindowGroupName*	windowGroupName = CApaWindowGroupName::NewLC(ws);

	    /* Note: we use windowGroupList->Count() instead of numWindowGroups, as in the middle of the
	     * update the list could change in length (or worse, be reduced) thus producing an out of bounds
	     * error if numWindowGroups were used
	     */
	    TBool	searching=ETrue;
	    for ( TInt i=0; (i<windowGroupList->Count()) && searching; ++i )
	    	{
	        TInt	wgId = windowGroupList->At(i);
	        windowGroupName->ConstructFromWgIdL(wgId);

	        TUid	appUid = windowGroupName->AppUid();

	        TApaAppInfo	appInfo;
	        HBufC* 		appCaption = NULL;
	        // Some applications, like midlets, may not provide any info
	        if (apaLsSession.GetAppInfo(appInfo, appUid) == KErrNone)
	        	{
	            appCaption = appInfo.iCaption.AllocL();
	        	}
	        else
	        	{
	            appCaption = windowGroupName->Caption().AllocL();
	        	}
            CleanupStack::PushL(appCaption);

	        // Only list 'visible' applications
	        if ( appCaption->Length() )
	        	{
	            TPtrC	caption=*appCaption;
		        INFO_PRINTF2(KLogTask, &caption);

		        if ( program.CompareC(caption)==0 )
		        	{
					searching=EFalse;
					TApaTask	task(ws);
					task.SetWgId(wgId);
					if (task.Exists())
						{
						task.EndTask();
						}
					else
						{
						ERR_PRINTF2(KErrTaskNotFound, &program);
						SetTestStepResult(EFail);
						}
		        	}
				}
            CleanupStack::Pop(1, appCaption); // taskEntry, appCaption
	    	}

	    if ( searching )
	    	{
			ERR_PRINTF2(KErrTaskNotFound, &program);
			SetTestStepResult(EFail);
	    	}
	    CleanupStack::PopAndDestroy(4, &apaLsSession);    // windowGroupName, windowGroupList
		}

	// test steps return a result
	return TestStepResult();
	}