|
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: Main classes for Out of Memory Monitor. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <akneiksrvc.h> |
|
19 #include <apgwgnam.h> |
|
20 #include "oomwserveventreceiver.h" |
|
21 #include "oommemorymonitor.h" |
|
22 #include "oomtraces.h" |
|
23 #include "oomconstants.hrh" |
|
24 |
|
25 #include "apgwgnam.h" |
|
26 |
|
27 CWservEventReceiver::CWservEventReceiver(CMemoryMonitor& aMonitor, RWsSession& aWs) |
|
28 : CActive(CActive::EPriorityStandard), iMonitor(aMonitor), iWs(aWs), iWg(aWs) |
|
29 { |
|
30 FUNC_LOG; |
|
31 |
|
32 CActiveScheduler::Add(this); |
|
33 } |
|
34 |
|
35 CWservEventReceiver::~CWservEventReceiver() |
|
36 { |
|
37 FUNC_LOG; |
|
38 |
|
39 Cancel(); |
|
40 iWg.Close(); |
|
41 } |
|
42 |
|
43 void CWservEventReceiver::ConstructL() |
|
44 { |
|
45 FUNC_LOG; |
|
46 |
|
47 User::LeaveIfError(iWg.Construct((TUint32)this, EFalse)); |
|
48 iWg.SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront); |
|
49 iWg.EnableFocusChangeEvents(); |
|
50 Queue(); |
|
51 } |
|
52 |
|
53 void CWservEventReceiver::Queue() |
|
54 { |
|
55 FUNC_LOG; |
|
56 |
|
57 iWs.EventReady(&iStatus); |
|
58 SetActive(); |
|
59 } |
|
60 |
|
61 void CWservEventReceiver::DoCancel() |
|
62 { |
|
63 FUNC_LOG; |
|
64 |
|
65 iWs.EventReadyCancel(); |
|
66 } |
|
67 |
|
68 void CWservEventReceiver::RunL() |
|
69 { |
|
70 FUNC_LOG; |
|
71 |
|
72 TWsEvent event; |
|
73 iWs.GetEvent(event); |
|
74 if (event.Type() == EEventFocusGroupChanged) |
|
75 { |
|
76 // The following is done in order to avoid changing application threshholds when fastswap is activated |
|
77 // 1) get the new focused app's details |
|
78 // 2) we check to see if the fastswap uid caused the change |
|
79 // 3a) If it didn't we proceed as normal: handleFocusedWgChangeL is called |
|
80 // 3b) If not, we skip handleFocusedWgChangeL |
|
81 CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(iWs, iWs.GetFocusWindowGroup()); |
|
82 if(wgName->AppUid() != KUidFastSwap) |
|
83 { |
|
84 iMonitor.HandleFocusedWgChangeL(); |
|
85 } |
|
86 CleanupStack::PopAndDestroy(wgName); |
|
87 } |
|
88 |
|
89 Queue(); |
|
90 } |