15 |
15 |
16 #include <e32debug.h> |
16 #include <e32debug.h> |
17 #include "lbsdevloggermacros.h" |
17 #include "lbsdevloggermacros.h" |
18 #include "lbsrootapi.h" |
18 #include "lbsrootapi.h" |
19 #include "privacyshutdown.h" |
19 #include "privacyshutdown.h" |
20 |
|
21 |
|
22 // P&S Key we check how many outstanding requests there are |
|
23 const TInt EPrivacyNumberOfRequest = 0x1028720F; |
|
24 |
20 |
25 |
21 |
26 /** |
22 /** |
27 Static public constructor |
23 Static public constructor |
28 */ |
24 */ |
41 /** |
37 /** |
42 Default constructor, set the timer to standard priority by default and |
38 Default constructor, set the timer to standard priority by default and |
43 add timer to active scheduler. |
39 add timer to active scheduler. |
44 */ |
40 */ |
45 CPrivacyShutdown::CPrivacyShutdown() : CTimer(CActive::EPriorityStandard), |
41 CPrivacyShutdown::CPrivacyShutdown() : CTimer(CActive::EPriorityStandard), |
46 iState(EShutdownStateIdle), |
42 iState(EShutdownStateIdle) |
47 iTimerCount(0) |
|
48 { |
43 { |
49 LBSLOG(ELogP1, "CPrivacyShutdown::CPrivacyShutdown() Begin\n"); |
44 LBSLOG(ELogP1, "CPrivacyShutdown::CPrivacyShutdown() Begin\n"); |
50 CActiveScheduler::Add(this); |
45 CActiveScheduler::Add(this); |
51 LBSLOG(ELogP1, "CPrivacyShutdown::CPrivacyShutdown() End\n"); |
46 LBSLOG(ELogP1, "CPrivacyShutdown::CPrivacyShutdown() End\n"); |
52 } |
47 } |
82 */ |
77 */ |
83 void CPrivacyShutdown::Start(const TTimeIntervalMicroSeconds32 aDelay) |
78 void CPrivacyShutdown::Start(const TTimeIntervalMicroSeconds32 aDelay) |
84 { |
79 { |
85 LBSLOG(ELogP1, "CPrivacyShutdown::Start() Begin\n"); |
80 LBSLOG(ELogP1, "CPrivacyShutdown::Start() Begin\n"); |
86 iState = EShutdownStateTimerStarted; |
81 iState = EShutdownStateTimerStarted; |
87 iTimerCount = aDelay; |
|
88 After(aDelay); |
82 After(aDelay); |
89 LBSLOG(ELogP1, "CPrivacyShutdown::Start() End\n"); |
83 LBSLOG(ELogP1, "CPrivacyShutdown::Start() End\n"); |
90 } |
84 } |
91 |
85 |
92 /** |
86 /** |
106 */ |
100 */ |
107 void CPrivacyShutdown::RunL() |
101 void CPrivacyShutdown::RunL() |
108 { |
102 { |
109 LBSLOG(ELogP1, "CPrivacyShutdown::RunL() Begin\n"); |
103 LBSLOG(ELogP1, "CPrivacyShutdown::RunL() Begin\n"); |
110 |
104 |
111 // Check if there are any notifications outstanding |
105 iState = EShutdownStateShutdownRequested; |
112 TInt outstandingRequests = 0; |
106 |
113 RProperty::Get(KUidSystemCategory, EPrivacyNumberOfRequest, outstandingRequests); |
107 RLbsSystemController systemController; |
114 if (outstandingRequests > 0) |
108 RProcess process; |
115 { |
109 systemController.OpenL(process.SecureId()); |
116 LBSLOG(ELogP1, "CPrivacyShutdown::RunL() - Restarting Timer\n") |
110 CleanupClosePushL(systemController); |
117 Start(iTimerCount); |
111 |
118 } |
112 systemController.RequestSystemCloseDown(ETrue); |
119 else |
113 |
120 { |
114 CleanupStack::PopAndDestroy(&systemController); |
121 iState = EShutdownStateShutdownRequested; |
|
122 |
|
123 RLbsSystemController systemController; |
|
124 RProcess process; |
|
125 systemController.OpenL(process.SecureId()); |
|
126 CleanupClosePushL(systemController); |
|
127 |
|
128 systemController.RequestSystemCloseDown(ETrue); |
|
129 |
|
130 CleanupStack::PopAndDestroy(&systemController); |
|
131 } |
|
132 |
115 |
133 LBSLOG(ELogP1, "CPrivacyShutdown::RunL() End\n"); |
116 LBSLOG(ELogP1, "CPrivacyShutdown::RunL() End\n"); |
134 } |
117 } |
135 |
118 |
136 /** Return the current state of the shutdown timer. |
119 /** Return the current state of the shutdown timer. |