|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #ifndef __VWSERVER_H__ |
|
18 #define __VWSERVER_H__ |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <w32std.h> |
|
22 |
|
23 #include "VWSAPPST.H" |
|
24 #include "VWSDEF.H" |
|
25 #include "VWSPRIV.H" |
|
26 #include "VWSDEBUG.H" |
|
27 #include <e32property.h> |
|
28 #include <startupdomaindefs.h> |
|
29 #include <ssm/ssmsubstates.hrh> |
|
30 #include <ssm/ssmstateawaresession.h> |
|
31 // |
|
32 // Forward declarations. |
|
33 // |
|
34 |
|
35 class CVwsLog; |
|
36 class CVwsServer; |
|
37 class CVwsSession; |
|
38 class CVwsEventQueue; |
|
39 class CVwsWServSessionHandler; |
|
40 class CVwsWServEventHandler; |
|
41 class CVwsWServRedrawer; |
|
42 class MVwsViewAdditionObserver; |
|
43 class MVwsDeactivationObserver; |
|
44 class MVwsActivationObserver; |
|
45 class MVwsSessionObserver; |
|
46 class CVwsServerEvent; |
|
47 class CVwsClientMessage; |
|
48 |
|
49 |
|
50 /** |
|
51 * The CVwsServer class implements the view server. |
|
52 */ |
|
53 class CVwsServer : public CPolicyServer |
|
54 { |
|
55 public: |
|
56 IMPORT_C static CVwsServer* NewL(MVwsAppStarter& aAppStarter); |
|
57 public: |
|
58 IMPORT_C ~CVwsServer(); |
|
59 public: //from CServer2 |
|
60 virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
61 public: |
|
62 TName ClientName() const; |
|
63 void SetSystemDefaultViewL(TInt aMode,const TVwsViewId& aViewId); |
|
64 void GetSystemDefaultView(TVwsViewId& aViewId); |
|
65 void ActivateViewL(const TVwsViewId& aViewId,CVwsClientMessage* aClientMessage,const RMessage2& aMessage,const CVwsSession& aSession,TVwsCompleteRequest aCompleteRequest); |
|
66 void ActivateViewL(const TVwsViewId& aViewId,CVwsClientMessage* aClientMessage,const RMessage2& aMessage,const TThreadId& aClientThreadId,TVwsCompleteRequest aCompleteRequest); |
|
67 CVwsSession* SessionByUid(const TUid& aAppUid); |
|
68 CVwsSession* SessionByThreadId(const TThreadId& aThreadId); |
|
69 CVwsSession* SessionByThreadIdAndAppUid(const TThreadId& aThreadId,const TUid& aAppUid); |
|
70 CVwsSession* ActiveViewSession(); |
|
71 TVwsViewId ActiveView(); |
|
72 void SetActiveView(const TThreadId& aThreadId,const TVwsViewId& aViewId); |
|
73 void ClearActiveView(); |
|
74 void SetViewAdditionObserver(MVwsViewAdditionObserver* aViewAdditionObserver); |
|
75 void HandleScreenDeviceChangedL(); |
|
76 TInt StartApp(const TUid& aAppUid,TThreadId& aThreadId); |
|
77 TInt CheckViewExists(const TThreadId& aThreadId,const TVwsViewId& aViewId); |
|
78 TBool IsViewActive(const TVwsViewId& aViewId); |
|
79 void RequestDeactivateActiveViewL(const RMessage2& aMessage,const CVwsSession& aSession,TVwsCompleteRequest aCompleteRequest); |
|
80 void RequestAppStartL(const RMessage2& aMessage,const TUid& aAppToStart); |
|
81 void HandleDeactivation(const TVwsViewId& aDeactivatedViewId, const TVwsViewId& aActivatedViewId); |
|
82 void HandleActivation(const TVwsViewId& aActivatedViewId, const TVwsViewId& ViewIdToBeDeactivated); |
|
83 void MakeInterceptingWindowVisible(); |
|
84 void MakeInterceptingWindowInvisible(); |
|
85 void MakeInterceptingWindowVisibleAndUpdateScreen(); |
|
86 TInt ScreenMode(); |
|
87 void HandleSessionViewAddition(const TVwsViewId& aViewId, const TThreadId& aNewViewClientThreadId); |
|
88 TBool IsSystemDefaultView(const TVwsViewId& aViewId); |
|
89 void HandleSessionRemoval(const TThreadId& aThreadId); |
|
90 void SetClientRequestTimeOut(const TTimeIntervalMicroSeconds32& aDuration); |
|
91 void SetServerEventTimeOut(const TTimeIntervalMicroSeconds32& aDuration); |
|
92 void HandleLastServerEventOnQueue(); |
|
93 void HandleForegroundTaskChange(); |
|
94 void EnableServerEventTimeOut(TBool aEnable); |
|
95 inline TBool IsServerEventTimeOutEnabled() const; |
|
96 void PanicClient(TInt aPanic) const; |
|
97 void GetPriorityForActiveObjectL(TInt& aPriority); |
|
98 void EnableServerBlankScreen(TBool aEnable); |
|
99 void SetCrossCheckUid(const RMessage2& aMessage); |
|
100 TUid CrossCheckUid() const; |
|
101 void SendCrossCheckToLauncherL(RWsSession& aWsSession, TInt aFgAppWgId, const TVwsViewId& aActiveView); |
|
102 void KickStartEventQ(); |
|
103 void SetWindowBackgroundColor(const RMessage2& aMessage); |
|
104 void GetCurrentActiveViewId(TVwsViewId& aActiveViewId); |
|
105 TBool IsAppInForeground(); |
|
106 TBool InitializationFinished() const; |
|
107 TInt IsPriorityBoostBeforePanicEnabled() const; |
|
108 void HandleInitializationFinished(); |
|
109 void BoostPriority(CVwsSession* aClient); |
|
110 private: |
|
111 CVwsServer(TInt aPriority,MVwsAppStarter& aAppStarter); |
|
112 void ConstructL(); |
|
113 void CrossCheckForegroundTask(); |
|
114 TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing); |
|
115 private: |
|
116 MVwsAppStarter& iAppStarter; |
|
117 CVwsWServSessionHandler* iWServSessionHandler; |
|
118 CArrayFixFlat<TVwsViewId> iSystemDefaultViewIdArray; |
|
119 CVwsEventQueue* iEventQueue; |
|
120 MVwsViewAdditionObserver* iViewAdditionObserver; |
|
121 TTimeIntervalMicroSeconds32 iClientRequestTimeOut; |
|
122 TTimeIntervalMicroSeconds32 iServerEventTimeOut; |
|
123 TBool iForegroundChangeWhileEventsOutstanding; |
|
124 TInt iIsServerEventTimeOutDisabled; |
|
125 #ifdef __DO_LOGGING__ |
|
126 TInt iNoActivationRequests; |
|
127 #endif |
|
128 TInt iPrioritySet; |
|
129 TBool iEnableServerBlankScreen; |
|
130 TUid iCrossCheckUid; |
|
131 TInt iEnableBoostAppPriorityBeforePanic; |
|
132 TBool iInitializationFinished; |
|
133 }; |
|
134 |
|
135 NONSHARABLE_CLASS (CVwsStartupAware) : public CActive |
|
136 { |
|
137 public: |
|
138 CVwsStartupAware(CVwsServer& aServer); |
|
139 ~CVwsStartupAware(); |
|
140 TInt Start(); |
|
141 |
|
142 private: |
|
143 void DoCancel(); |
|
144 void RunL(); |
|
145 |
|
146 private: |
|
147 CVwsServer& iServer; |
|
148 RSsmStateAwareSession iStateAwareSession; |
|
149 }; |
|
150 |
|
151 // |
|
152 // Inlines |
|
153 // |
|
154 |
|
155 inline TBool CVwsServer::IsServerEventTimeOutEnabled() const |
|
156 { |
|
157 return (iIsServerEventTimeOutDisabled ? EFalse : ETrue); |
|
158 } |
|
159 |
|
160 #endif |