|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: window server plugin, used by transition server to control |
|
15 * framebuffers. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef SERVERDRAWERCONTROLLER_H |
|
22 #define SERVERDRAWERCONTROLLER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <apgcli.h> |
|
26 #ifdef WSSERVERDRAWER_TIME_LOG |
|
27 #include "debuglogger.h" |
|
28 #endif //WSSERVERDRAWER_TIME_LOG |
|
29 |
|
30 #include "statehandler.h" |
|
31 |
|
32 class MAlfDrawerEngine; |
|
33 class CAppInfoCache; |
|
34 class CEndCheck; |
|
35 class CPSListener; |
|
36 |
|
37 enum TAbortFlags |
|
38 { |
|
39 EAbortFullscreen = 0x1, |
|
40 EAbortControl = 0x2, |
|
41 }; |
|
42 |
|
43 const TUint KAknApplicationShellViewId= 0x101F4CD2; |
|
44 const TUint KCapServerUid = 0x10207218; |
|
45 const TUint KScreensaverUid = 0x100056CF; |
|
46 |
|
47 NONSHARABLE_CLASS(MEndChecker) |
|
48 { |
|
49 public: |
|
50 virtual void EndExpired() = 0; |
|
51 }; |
|
52 |
|
53 class CEndCheck : public CTimer |
|
54 { |
|
55 public: |
|
56 static CEndCheck* NewL(MEndChecker& aCallBack); |
|
57 void Start(/*TInt aState,*/ TInt aMul = 1); |
|
58 ~CEndCheck(); |
|
59 private: |
|
60 void RunL(); |
|
61 CEndCheck(MEndChecker& aCallBack); |
|
62 void DoCancel(); |
|
63 private: |
|
64 MEndChecker& iCallBack; |
|
65 TBool iCancelled; |
|
66 }; |
|
67 |
|
68 /** |
|
69 * Class to hold application information. |
|
70 */ |
|
71 class CAppInfoCache : public CBase |
|
72 { |
|
73 public: |
|
74 static CAppInfoCache* NewL(); |
|
75 ~CAppInfoCache(); |
|
76 TInt SetUid(const TUid& aUid); |
|
77 void SetAvkonUid(const TUid& aUid); |
|
78 void RemoveAvkonUid(const TUid& aUid); |
|
79 TBool AvkonUid(const TUid& aUid) const; |
|
80 TBool GateFound() const; |
|
81 void Reset(const TUid& aUid); |
|
82 TBool IsEmbedded(const TUid& aUid) const; |
|
83 void SetParent(const TUid& aUid, const TUid& aParentUid); |
|
84 TInt SetAction(const TUid& aUid, TInt aAction); |
|
85 TInt Action(const TUid& aUid); |
|
86 TBool IsSameParent(const TUid& aUid1, const TUid& aUid2) const; |
|
87 |
|
88 const TUid& FocusUid() const; |
|
89 TBool SetFocusUid(TInt aWgId); |
|
90 |
|
91 void ClearActions(); |
|
92 |
|
93 private: |
|
94 class TAppInfo |
|
95 { |
|
96 public: |
|
97 static TInt Order(const TAppInfo& aNodeA, const TAppInfo& aNodeB); |
|
98 TAppInfo(const TUint aUid) : |
|
99 iUid(aUid), |
|
100 iFlags(TAppInfo::ENone), |
|
101 iParent(KNullUid), |
|
102 iAction(KErrNotFound) |
|
103 {} |
|
104 enum TFlags |
|
105 { |
|
106 ENone = 0x0, |
|
107 EAvkonApp = 0x1, |
|
108 ENotOkApp = 0x4 |
|
109 }; |
|
110 TUint iUid; |
|
111 TUint iFlags; |
|
112 TUid iParent; |
|
113 TInt iRootWgId; |
|
114 TInt iAction; |
|
115 }; |
|
116 private: |
|
117 void ConstructL(); |
|
118 void ImportL(); |
|
119 void ExportL(); |
|
120 TInt Append(TUint aUid); |
|
121 TInt IndexOf(TUint aUid) const; |
|
122 void ReadArrayL(RFile& aFile); |
|
123 void WriteArrayL(RFile& aFile) const; |
|
124 void SetAppFlags(const TUid& aUid, TUint aFlag, TBool aSet); |
|
125 TBool GetAppFlags(const TUid& aUid, TUint aFlag) const; |
|
126 private: |
|
127 RApaLsSession iLs; |
|
128 RArray<TAppInfo> iAppInfo; |
|
129 TUid iFocusedUid; |
|
130 }; |
|
131 |
|
132 NONSHARABLE_CLASS(CWsServerDrawerController) : public CBase, public MEndChecker |
|
133 { |
|
134 public: |
|
135 /** errors that the wsserverdrawer can inform the controller about through |
|
136 the Error function */ |
|
137 enum TServerDrawerError |
|
138 { |
|
139 EHandleMessageError |
|
140 }; |
|
141 |
|
142 /** |
|
143 */ |
|
144 static CWsServerDrawerController* NewL(MAlfDrawerEngine* aEngine); |
|
145 |
|
146 /** |
|
147 */ |
|
148 ~CWsServerDrawerController(); |
|
149 |
|
150 /** |
|
151 */ |
|
152 void BeginFullscreen(TInt aType, const TUid aUid1, const TUid aUid2, TInt aData ); |
|
153 |
|
154 /** |
|
155 */ |
|
156 void EndFullscreen(TBool aFromGfx); |
|
157 |
|
158 /** |
|
159 */ |
|
160 void FullscreenFinished(TInt aHandle); |
|
161 |
|
162 /** |
|
163 */ |
|
164 TInt BeginControlTransition(); |
|
165 |
|
166 /** |
|
167 */ |
|
168 void EndControlTransition(TInt aHandle); |
|
169 |
|
170 /** |
|
171 */ |
|
172 void ScreenModeChange(TBool aBeforeScreenModeChange); |
|
173 |
|
174 /** |
|
175 */ |
|
176 void Error(TServerDrawerError aError); |
|
177 |
|
178 /** |
|
179 */ |
|
180 void DSABegin(); |
|
181 /** |
|
182 */ |
|
183 void DSAEnd(); |
|
184 |
|
185 |
|
186 /** |
|
187 * Stops the oncoming and current transition and sets |
|
188 * the state machine the resting state. |
|
189 */ |
|
190 void AbortTransition(TInt aToAbort = EAbortFullscreen|EAbortControl); |
|
191 |
|
192 |
|
193 const TUid& FocusUid(); |
|
194 |
|
195 TBool SetFocusUid(TInt aUid); |
|
196 |
|
197 void StartEndChecker(TInt aMultiplier = 1); |
|
198 |
|
199 void CancelEndChecker(); |
|
200 /** |
|
201 */ |
|
202 void EndExpired(); |
|
203 |
|
204 /** Saves the current Engine action and Uids */ |
|
205 void SaveLastActionAndUid(); |
|
206 |
|
207 TInt GetState( TInt aState ) const; |
|
208 |
|
209 TBool IsBlocked( const TUid& aFromUid, const TUid& aToUid ); |
|
210 |
|
211 public: |
|
212 |
|
213 CAppInfoCache& AppInfoCache() |
|
214 { |
|
215 return *iAppInfoCache; |
|
216 } |
|
217 |
|
218 private: |
|
219 |
|
220 /** |
|
221 */ |
|
222 CWsServerDrawerController(MAlfDrawerEngine* aEngine); |
|
223 |
|
224 /** |
|
225 */ |
|
226 void ConstructL(); |
|
227 |
|
228 TBool StartCheck(TInt aFlags) const; |
|
229 |
|
230 void AddStateL(const TUid& aUid, TInt aKey); |
|
231 private: |
|
232 TUid iCurrentUid; |
|
233 CAppInfoCache* iAppInfoCache; |
|
234 CEndCheck* iEndCheck; |
|
235 MAlfDrawerEngine* iEngine; //not owning |
|
236 RPointerArray<CPSListener> iPSStates; |
|
237 CStateHandler::TFullscreenType iLastTypeTried; |
|
238 TInt iLastAction; |
|
239 TUid iLastFromUid; |
|
240 TUid iLastToUid; |
|
241 TBool iLayoutChangeActive; |
|
242 TBool iExitAborted; |
|
243 TBool iDSAActive; //ETrue if dsa is currently active |
|
244 |
|
245 CStateHandler* iStates; |
|
246 |
|
247 #ifdef WSSERVERDRAWER_TIME_LOG |
|
248 CDebugLogger *iLogger; |
|
249 #endif //WSSERVERDRAWER_TIME_LOG |
|
250 }; |
|
251 |
|
252 #endif //SERVERDRAWERCONTROLLER_H |
|
253 |