23
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2007 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
#include <coreapplicationuisdomainpskeys.h>
|
|
22 |
#include <ctsydomainpskeys.h>
|
|
23 |
#include <PSVariables.h> // Property values
|
|
24 |
#include <apgwgnam.h>
|
|
25 |
#include <coemain.h>
|
|
26 |
#include <coedef.h>
|
|
27 |
|
|
28 |
#include "vuicstate.h"
|
|
29 |
#include "vuicprecheckstate.h"
|
|
30 |
#include "vuiccontextcheckstate.h"
|
|
31 |
#include "vuicexitstate.h"
|
|
32 |
#include "vuicerrorstate.h"
|
|
33 |
|
|
34 |
#include "vuicdatastorage.h"
|
|
35 |
|
|
36 |
#include "vuicvoicerecogdialogimpl.h"
|
|
37 |
|
|
38 |
#include "rubydebug.h"
|
|
39 |
|
|
40 |
//fix for the error ECWG-7WDA9G
|
|
41 |
const TUid KAknnfysrvUid = {0x10281ef2};
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
// CPrecheckState::NewL
|
|
44 |
// Two-phased constructor.
|
|
45 |
// -----------------------------------------------------------------------------
|
|
46 |
//
|
|
47 |
CPrecheckState* CPrecheckState::NewL( CDataStorage& aDataStorage, CUiModel& aUiModel )
|
|
48 |
{
|
|
49 |
CPrecheckState* self = new (ELeave) CPrecheckState( aDataStorage, aUiModel );
|
|
50 |
CleanupStack::PushL( self );
|
|
51 |
self->ConstructL();
|
|
52 |
CleanupStack::Pop( self );
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
// Destructor
|
|
57 |
CPrecheckState::~CPrecheckState()
|
|
58 |
{
|
|
59 |
RUBY_DEBUG0( "CPrecheckState::~CPrecheckState START" );
|
|
60 |
|
|
61 |
RUBY_DEBUG0( "CPrecheckState::~CPrecheckState EXIT" );
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------
|
|
65 |
// CPrecheckState::HandleEventL
|
|
66 |
// ---------------------------------------------------------
|
|
67 |
//
|
|
68 |
void CPrecheckState::HandleEventL( TInt aEvent )
|
|
69 |
{
|
|
70 |
RUBY_DEBUG_BLOCK( "CPrecheckState::HandleEventL" );
|
|
71 |
|
|
72 |
CState* nextState = NULL;
|
|
73 |
|
|
74 |
switch( aEvent )
|
|
75 |
{
|
|
76 |
case KErrNone:
|
|
77 |
|
|
78 |
nextState = CContextCheckState::NewL( DataStorage(), UiModel() );
|
|
79 |
break;
|
|
80 |
|
|
81 |
case KErrGeneral:
|
|
82 |
|
|
83 |
nextState = CExitState::NewL( DataStorage(), UiModel() );
|
|
84 |
break;
|
|
85 |
|
|
86 |
default:
|
|
87 |
|
|
88 |
nextState = CErrorState::NewL( DataStorage(), UiModel(), aEvent );
|
|
89 |
break;
|
|
90 |
}
|
|
91 |
|
|
92 |
DataStorage().VoiceRecognitionImpl()->ChangeState( nextState );
|
|
93 |
}
|
|
94 |
|
|
95 |
// ---------------------------------------------------------
|
|
96 |
// CPrecheckState::ExecuteL
|
|
97 |
// ---------------------------------------------------------
|
|
98 |
//
|
|
99 |
void CPrecheckState::ExecuteL()
|
|
100 |
{
|
|
101 |
RUBY_DEBUG_BLOCK( "CPrecheckState::ExecuteL" );
|
|
102 |
|
|
103 |
TInt error = KErrNone;
|
|
104 |
|
|
105 |
// Check if autolock is on
|
|
106 |
if ( GetAutoLockValue() > EAutolockOff )
|
|
107 |
{
|
|
108 |
if ( !DataStorage().DeviceLockMode() )
|
|
109 |
{
|
|
110 |
error = KErrGeneral;
|
|
111 |
}
|
|
112 |
}
|
|
113 |
else
|
|
114 |
{
|
|
115 |
DataStorage().SetDeviceLockMode( EFalse );
|
|
116 |
}
|
|
117 |
|
|
118 |
// Check if lockphone dialog is active
|
|
119 |
if ( IsLockPhoneDialogL() )
|
|
120 |
{
|
|
121 |
error = KErrGeneral;
|
|
122 |
}
|
|
123 |
|
|
124 |
// Check if phone or video call is currently active
|
|
125 |
TInt state = CheckCallState();
|
|
126 |
if ( ( state != EPSCTsyCallStateNone &&
|
|
127 |
state != EPSCTsyCallStateUninitialized &&
|
|
128 |
state != KErrUnknown ) || IsVideoCall() )
|
|
129 |
{
|
|
130 |
error = KErrCallInProgress;
|
|
131 |
}
|
|
132 |
|
|
133 |
HandleEventL( error );
|
|
134 |
}
|
|
135 |
|
|
136 |
// ---------------------------------------------------------
|
|
137 |
// CPrecheckState::CPrecheckState
|
|
138 |
// ---------------------------------------------------------
|
|
139 |
//
|
|
140 |
CPrecheckState::CPrecheckState( CDataStorage& aDataStorage, CUiModel& aUiModel )
|
|
141 |
: CState( aDataStorage, aUiModel )
|
|
142 |
{
|
|
143 |
}
|
|
144 |
|
|
145 |
// ---------------------------------------------------------
|
|
146 |
// CPrecheckState::GetAutoLockValue
|
|
147 |
// ---------------------------------------------------------
|
|
148 |
//
|
|
149 |
TInt CPrecheckState::GetAutoLockValue()
|
|
150 |
{
|
|
151 |
RUBY_DEBUG0( "CPrecheckState::GetAutoLockValue START" );
|
|
152 |
|
|
153 |
TInt autoLockValue;
|
|
154 |
TInt err = RProperty::Get( KPSUidCoreApplicationUIs,
|
|
155 |
KCoreAppUIsAutolockStatus,
|
|
156 |
autoLockValue );
|
|
157 |
if ( err == KErrNotFound )
|
|
158 |
{
|
|
159 |
autoLockValue = KErrNotFound;
|
|
160 |
}
|
|
161 |
|
|
162 |
RUBY_DEBUG0( "CPrecheckState::GetAutoLockValue EXIT" );
|
|
163 |
|
|
164 |
return autoLockValue;
|
|
165 |
}
|
|
166 |
|
|
167 |
// ---------------------------------------------------------
|
|
168 |
// CPrecheckState::CheckCallState
|
|
169 |
// ---------------------------------------------------------
|
|
170 |
//
|
|
171 |
TInt CPrecheckState::CheckCallState()
|
|
172 |
{
|
|
173 |
RUBY_DEBUG0( "CPrecheckState::CheckCallState START" );
|
|
174 |
|
|
175 |
TInt callState;
|
|
176 |
TInt err = RProperty::Get( KPSUidCtsyCallInformation,
|
|
177 |
KCTsyCallState,
|
|
178 |
callState );
|
|
179 |
if ( err == KErrNotFound )
|
|
180 |
{
|
|
181 |
callState = KErrNotFound;
|
|
182 |
}
|
|
183 |
|
|
184 |
RUBY_DEBUG0( "CPrecheckState::CheckCallState EXIT" );
|
|
185 |
|
|
186 |
return callState;
|
|
187 |
}
|
|
188 |
|
|
189 |
// -----------------------------------------------------------------------------
|
|
190 |
// CPrecheckState::IsVideoCall
|
|
191 |
// -----------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
TBool CPrecheckState::IsVideoCall()
|
|
194 |
{
|
|
195 |
RUBY_DEBUG0( "CPrecheckState::IsVideoCall START" );
|
|
196 |
|
|
197 |
TInt callType;
|
|
198 |
RProperty::Get( KPSUidCtsyCallInformation,
|
|
199 |
KCTsyCallType,
|
|
200 |
callType );// Ignore errors
|
|
201 |
|
|
202 |
RUBY_DEBUG0( "CPrecheckState::IsVideoCall EXIT" );
|
|
203 |
|
|
204 |
return callType == EPSCTsyCallTypeH324Multimedia;
|
|
205 |
}
|
|
206 |
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
// CPrecheckState::IsLockPhoneDialogL
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
TBool CPrecheckState::IsLockPhoneDialogL()
|
|
212 |
{
|
|
213 |
//fix for the error ECWG-7WDA9G,if we found the first windows is "lockphone" dialog we will terminate the App.
|
|
214 |
TBool islock = EFalse;
|
|
215 |
RWsSession &ws = CCoeEnv::Static()->WsSession();
|
|
216 |
TInt wgId = ws.GetFocusWindowGroup();
|
|
217 |
CApaWindowGroupName *WindowsGroupName = CApaWindowGroupName::NewLC( ws, wgId );
|
|
218 |
if ( ( KAknnfysrvUid == WindowsGroupName->AppUid() ) &&
|
|
219 |
( ws.GetWindowGroupOrdinalPriority( wgId ) >= ECoeWinPriorityAlwaysAtFront ) )
|
|
220 |
{
|
|
221 |
islock = ETrue;
|
|
222 |
}
|
|
223 |
CleanupStack::PopAndDestroy( WindowsGroupName );
|
|
224 |
return islock;
|
|
225 |
}
|
|
226 |
|
|
227 |
// End of File
|
|
228 |
|