taskswitcher/taskswitcherui/taskswitcherapp/src/tsappui.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 25 137ebc85284b
child 28 d721605b30d0
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    63 // (must give time to animation)
    63 // (must give time to animation)
    64 const TInt KWaitBeforeGoingToBackground = 200000;
    64 const TInt KWaitBeforeGoingToBackground = 200000;
    65 
    65 
    66 const TUid KTsAppUid = { KTsAppUidValue };
    66 const TUid KTsAppUid = { KTsAppUidValue };
    67 
    67 
       
    68 const TUid KTsCameraUid = { 0x101F857a };
       
    69 const TUid KTsTelephoneUid = { 0x100058b3 };
       
    70 
    68 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    69 // CTsAppUi::ConstructL()
    72 // CTsAppUi::ConstructL()
    70 // ConstructL is called by the application framework
    73 // ConstructL is called by the application framework
    71 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    72 //
    75 //
   158     windowGroup.EnableGroupListChangeEvents();
   161     windowGroup.EnableGroupListChangeEvents();
   159     
   162     
   160     iIsPopUpShown = EFalse;
   163     iIsPopUpShown = EFalse;
   161     iUiStarted = EFalse;
   164     iUiStarted = EFalse;
   162     iDisableAppKeyHandling = EFalse;
   165     iDisableAppKeyHandling = EFalse;
       
   166     
       
   167     // Set process priority to high to avoid being
       
   168     // locked by heavy ui apps processing
       
   169     iEikonEnv->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled);
       
   170     RProcess().SetPriority(EPriorityHigh);
   163     
   171     
   164     TSLOG_OUT();
   172     TSLOG_OUT();
   165     }
   173     }
   166 
   174 
   167 // -----------------------------------------------------------------------------
   175 // -----------------------------------------------------------------------------
   689             }
   697             }
   690         else
   698         else
   691             {
   699             {
   692             SetOrientationL(EAppUiOrientationPortrait);
   700             SetOrientationL(EAppUiOrientationPortrait);
   693             }
   701             }
       
   702         RProcess().SetPriority(EPriorityForeground);
   694         SetFullScreenApp(EFalse);
   703         SetFullScreenApp(EFalse);
   695         iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
   704         iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
   696         }
   705         }
   697     TSLOG_OUT();
   706     TSLOG_OUT();
   698     }
   707     }
   710         {
   719         {
   711         iIsPopUpShown = EFalse;
   720         iIsPopUpShown = EFalse;
   712         iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront);
   721         iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront);
   713         SetOrientationL(EAppUiOrientationAutomatic);
   722         SetOrientationL(EAppUiOrientationAutomatic);
   714         SetFullScreenApp(EFalse);
   723         SetFullScreenApp(EFalse);
       
   724         RProcess().SetPriority(EPriorityHigh);
   715         }
   725         }
   716     TSLOG_OUT();
   726     TSLOG_OUT();
   717     }
   727     }
   718 
   728 
   719 
   729 
   750     {
   760     {
   751     CAknAppUi::HandleWsEventL(aEvent, aDestination);
   761     CAknAppUi::HandleWsEventL(aEvent, aDestination);
   752     TInt eventType = aEvent.Type();
   762     TInt eventType = aEvent.Type();
   753     if ( eventType == EEventWindowGroupListChanged )
   763     if ( eventType == EEventWindowGroupListChanged )
   754         {
   764         {
   755         TInt wgId = WgIdOfUnderlyingApp(EFalse);
   765         TInt wgId = WgIdOfUnderlyingAppL(EFalse); 
   756         if ( iForeground &&
   766         if ( iForeground &&
   757              wgId != iUnderAppWgId &&
   767              wgId != iUnderAppWgId &&
   758              !iAppView->AppCloseInProgress(iUnderAppWgId) &&
   768              !iAppView->AppCloseInProgress(iUnderAppWgId) &&
   759              !iAppView->WgOnTaskList(wgId) )
   769              !iAppView->WgOnTaskList(wgId) )
   760             {
   770             {
   761             MoveAppToBackground( ENoneTransition );
   771             MoveAppToBackground( ENoneTransition );
   762             }
   772             }
   763         if ( WgIdOfUnderlyingApp(ETrue) != iUnderAppWgId )
   773         if ( WgIdOfUnderlyingAppL(ETrue) != iUnderAppWgId )
   764             {
   774             {
   765             HandleResourceChangeL(KEikDynamicLayoutVariantSwitch);
   775             HandleResourceChangeL(KEikDynamicLayoutVariantSwitch);
   766             }
   776             }
   767         iUnderAppWgId = wgId;
   777         iUnderAppWgId = wgId;
   768         }
   778         }
   771 
   781 
   772 // -----------------------------------------------------------------------------
   782 // -----------------------------------------------------------------------------
   773 // CTsAppUi::WgIdOfUnderlyingApp
   783 // CTsAppUi::WgIdOfUnderlyingApp
   774 // -----------------------------------------------------------------------------
   784 // -----------------------------------------------------------------------------
   775 //
   785 //
   776 TInt CTsAppUi::WgIdOfUnderlyingApp( TBool aIgnoreParentChild )
   786 TInt CTsAppUi::WgIdOfUnderlyingAppL( TBool aIgnoreParentChild )
   777     {
   787     {
   778     TInt retVal(0);
   788     TInt retVal(0);
   779     TApaTaskList taskList( iEikonEnv->WsSession() );
   789     TInt underlyingWg = CheckForUnderlyingHiddenAppsL();
   780     TInt underlyingWg = taskList.FindByPos(0).WgId();
   790     if ( !underlyingWg )
       
   791         {
       
   792         TApaTaskList taskList( iEikonEnv->WsSession() );
       
   793         underlyingWg = taskList.FindByPos(0).WgId();
       
   794         }
       
   795     
   781     if ( aIgnoreParentChild )
   796     if ( aIgnoreParentChild )
   782         {
   797         {
   783         retVal = underlyingWg;
   798         retVal = underlyingWg;
   784         }
   799         }
   785     else
   800     else
   833         }
   848         }
   834     allWgIds.Close();
   849     allWgIds.Close();
   835 	return retVal;
   850 	return retVal;
   836 	}
   851 	}
   837 
   852 
   838 
       
   839 // -----------------------------------------------------------------------------
   853 // -----------------------------------------------------------------------------
   840 // CTsAppUi::IsForeground
   854 // CTsAppUi::IsForeground
   841 // -----------------------------------------------------------------------------
   855 // -----------------------------------------------------------------------------
   842 //
   856 //
   843 TBool CTsAppUi::IsForeground() const
   857 TBool CTsAppUi::IsForeground() const
   844     {
   858     {
   845     return iForeground;
   859     return iForeground;
   846     }
   860     }
   847 
   861 
       
   862 // -----------------------------------------------------------------------------
       
   863 // CTsAppUi::CheckForUnderlyingCameraL
       
   864 // -----------------------------------------------------------------------------
       
   865 //
       
   866 TInt CTsAppUi::CheckForUnderlyingHiddenAppsL()
       
   867     {
       
   868     TInt wgId(0);
       
   869     RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
       
   870     CleanupClosePushL(allWgIds);
       
   871     User::LeaveIfError(iEikonEnv->WsSession().WindowGroupList(0, &allWgIds));
       
   872     TInt underlyingWg(allWgIds[0].iId);
       
   873     CleanupStack::PopAndDestroy(&allWgIds);
       
   874     
       
   875     CApaWindowGroupName* windowName =
       
   876         CApaWindowGroupName::NewLC( iEikonEnv->WsSession(), underlyingWg );
       
   877     TUid appUid = windowName->AppUid();
       
   878     CleanupStack::PopAndDestroy( windowName );
       
   879     if( appUid == KTsCameraUid ||
       
   880         appUid == KTsTelephoneUid )
       
   881         {
       
   882         wgId = underlyingWg;
       
   883         }
       
   884     return wgId;
       
   885     }
       
   886 
   848 // End of file
   887 // End of file