62 return KErrInUse; |
63 return KErrInUse; |
63 iStatus = KRequestPending; |
64 iStatus = KRequestPending; |
64 iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState); |
65 iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState); |
65 iProperty.Subscribe(iStatus); |
66 iProperty.Subscribe(iStatus); |
66 SetActive(); |
67 SetActive(); |
|
68 #if defined(_DEBUG) |
|
69 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
70 #endif |
67 return KErrNone; |
71 return KErrNone; |
68 } |
72 } |
69 // |
73 // |
70 // ---------------------------------------------------------- |
74 // ---------------------------------------------------------- |
71 // CValueObserver::Stop() |
75 // CValueObserver::Stop() |
72 // Stops listening KUidCurrentCall event |
76 // Stops listening KUidCurrentCall event |
73 // ---------------------------------------------------------- |
77 // ---------------------------------------------------------- |
74 // |
78 // |
75 void CValueObserver::Stop() |
79 void CValueObserver::Stop() |
76 { |
80 { |
|
81 #if defined(_DEBUG) |
|
82 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
83 #endif |
77 Cancel(); |
84 Cancel(); |
78 } |
85 } |
79 // |
86 // |
80 // ---------------------------------------------------------- |
87 // ---------------------------------------------------------- |
81 // CLockObserver::CLockObserver() |
88 // CLockObserver::CLockObserver() |
82 // C++ constructor |
89 // C++ constructor |
83 // ---------------------------------------------------------- |
90 // ---------------------------------------------------------- |
84 // |
91 // |
85 CValueObserver::CValueObserver(CAutolockAppUi* aAppUi) : CActive(0), iAppUi(aAppUi) |
92 CValueObserver::CValueObserver(CAutolockAppUi* aAppUi) : CActive(0), iAppUi(aAppUi) |
86 { |
93 { |
|
94 #if defined(_DEBUG) |
|
95 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
96 #endif |
87 } |
97 } |
88 // |
98 // |
89 // ---------------------------------------------------------- |
99 // ---------------------------------------------------------- |
90 // CLockObserver::ConstructL() |
100 // CLockObserver::ConstructL() |
91 // Symbian OS default constructor |
101 // Symbian OS default constructor |
92 // ---------------------------------------------------------- |
102 // ---------------------------------------------------------- |
93 // |
103 // |
94 void CValueObserver::ConstructL() |
104 void CValueObserver::ConstructL() |
95 { |
105 { |
96 // Add this active object to the scheduler. |
106 // Add this active object to the scheduler. |
|
107 #if defined(_DEBUG) |
|
108 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
109 #endif |
97 CActiveScheduler::Add(this); |
110 CActiveScheduler::Add(this); |
98 } |
111 } |
99 // |
112 // |
100 // ---------------------------------------------------------- |
113 // ---------------------------------------------------------- |
101 // CValueObserver::RunL() |
114 // CValueObserver::RunL() |
102 // |
115 // |
103 // ---------------------------------------------------------- |
116 // ---------------------------------------------------------- |
104 // |
117 // |
105 void CValueObserver::RunL() |
118 void CValueObserver::RunL() |
106 { |
119 { |
|
120 #if defined(_DEBUG) |
|
121 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
122 #endif |
|
123 TInt atForeground = iAppUi->IsForeground(); |
|
124 TInt value(EStartupUiPhaseUninitialized); |
|
125 RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); |
107 TInt callState; |
126 TInt callState; |
108 iProperty.Get( callState ); |
127 iProperty.Get( callState ); |
109 if (callState == EPSCTsyCallStateNone && !iAppUi->IsForeground()) |
128 #if defined(_DEBUG) |
|
129 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
|
130 RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone ); |
|
131 RDebug::Printf( "%s %s (%u) EPSCTsyCallStateUninitialized=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateUninitialized ); |
|
132 RDebug::Printf( "%s %s (%u) atForeground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, atForeground ); |
|
133 RDebug::Printf( "%s %s (%u) KPSStartupUiPhase value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); |
|
134 RDebug::Printf( "%s %s (%u) EStartupUiPhaseSystemWelcomeDone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStartupUiPhaseSystemWelcomeDone ); |
|
135 #endif |
|
136 |
|
137 |
|
138 if (callState == EPSCTsyCallStateNone && !atForeground) |
110 { |
139 { |
111 // app back to foreground |
140 if( value<EStartupUiPhaseSystemWelcomeDone ) |
112 iAppUi->BringAppToForegroundL(); |
141 { |
|
142 #if defined(_DEBUG) |
|
143 RDebug::Printf( "%s %s (%u) re-start=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
144 #endif |
|
145 Start(); |
|
146 } |
|
147 else |
|
148 { |
|
149 // app back to foreground |
|
150 TInt iAppUi_Locked = iAppUi->Locked(); |
|
151 TInt alocked = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value); |
|
152 #if defined(_DEBUG) |
|
153 RDebug::Printf( "%s %s (%u) alocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, alocked ); |
|
154 RDebug::Printf( "%s %s (%u) iAppUi_Locked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iAppUi_Locked ); |
|
155 #endif |
|
156 if(iAppUi_Locked) |
|
157 { |
|
158 #if defined(_DEBUG) |
|
159 RDebug::Printf( "%s %s (%u) BringAppToForegroundL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
160 #endif |
|
161 iAppUi->BringAppToForegroundL(); |
|
162 } |
|
163 } |
113 } |
164 } |
114 else |
165 else |
115 { |
166 { |
|
167 { |
|
168 if( value<EStartupUiPhaseSystemWelcomeDone ) |
|
169 { |
|
170 #if defined(_DEBUG) |
|
171 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
172 #endif |
|
173 if( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized && !atForeground) |
|
174 { |
|
175 #if defined(_DEBUG) |
|
176 RDebug::Printf( "%s %s (%u) 2=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 2 ); |
|
177 #endif |
|
178 iAppUi->BringAppToForegroundL(); |
|
179 } |
|
180 else if( (callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized) && atForeground) |
|
181 { |
|
182 #if defined(_DEBUG) |
|
183 RDebug::Printf( "%s %s (%u) calling BringAppToForegroundL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
184 #endif |
|
185 iAppUi->BringAppToForegroundL(); |
|
186 #if defined(_DEBUG) |
|
187 RDebug::Printf( "%s %s (%u) calling SwitchToPreviousAppL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 2 ); |
|
188 #endif |
|
189 iAppUi->SwitchToPreviousAppL(); |
|
190 #if defined(_DEBUG) |
|
191 RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 3 ); |
|
192 #endif |
|
193 } |
|
194 } |
|
195 } |
116 Start(); |
196 Start(); |
117 } |
197 } |
118 |
198 |
119 } |
199 } |
120 // |
200 // |