59
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Secui dialog notifier server session
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "secuidialognotifiersession.h" // CSecuiDialogNotifierSession
|
|
19 |
#include "secuidialognotifierserver.h" // CSecuiDialogNotifierServer
|
|
20 |
#include "secuidialognotifierservername.h" // KSecuiDialogsCancelOperation
|
|
21 |
#include "secuidialogoperbasicpinquery.h" // CBasicPinQueryOperation
|
|
22 |
#include "secuidialogstrace.h" // TRACE macro
|
|
23 |
#include <keyguardaccessapi.h>
|
|
24 |
|
|
25 |
const TInt KInputParam = 0;
|
|
26 |
const TInt KOutputParam = 1;
|
|
27 |
|
|
28 |
|
|
29 |
// ======== MEMBER FUNCTIONS ========
|
|
30 |
|
|
31 |
// ---------------------------------------------------------------------------
|
|
32 |
// CSecuiDialogNotifierSession::NewL()
|
|
33 |
// ---------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
CSecuiDialogNotifierSession* CSecuiDialogNotifierSession::NewL()
|
|
36 |
{
|
63
|
37 |
RDEBUG("0", 0);
|
59
|
38 |
CSecuiDialogNotifierSession* self = new( ELeave ) CSecuiDialogNotifierSession;
|
|
39 |
CleanupStack::PushL( self );
|
|
40 |
self->ConstructL();
|
|
41 |
CleanupStack::Pop( self );
|
|
42 |
return self;
|
|
43 |
}
|
|
44 |
|
|
45 |
// ---------------------------------------------------------------------------
|
|
46 |
// CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession()
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession()
|
|
50 |
{
|
63
|
51 |
RDEBUG("0", 0);
|
59
|
52 |
Server().RemoveSession();
|
|
53 |
delete iOperationHandler;
|
|
54 |
iOperationHandler = NULL;
|
|
55 |
delete iInputBuffer;
|
|
56 |
iInputBuffer = NULL;
|
63
|
57 |
RDEBUG("0x99", 0x99);
|
59
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
// CSecuiDialogNotifierSession::CreateL()
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
void CSecuiDialogNotifierSession::CreateL()
|
|
65 |
{
|
63
|
66 |
RDEBUG("0", 0);
|
59
|
67 |
Server().AddSession();
|
|
68 |
}
|
|
69 |
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
// CSecuiDialogNotifierSession::ServiceL()
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
void CSecuiDialogNotifierSession::ServiceL( const RMessage2& aMessage )
|
|
75 |
{
|
63
|
76 |
RDEBUG("aMessage.Handle()", aMessage.Handle());
|
59
|
77 |
TRAPD( error, DispatchMessageL( aMessage ) );
|
63
|
78 |
RDEBUG("error", error);
|
59
|
79 |
if( error && !aMessage.IsNull() )
|
|
80 |
{
|
63
|
81 |
RDEBUG("Complete aMessage.Handle()", aMessage.Handle());
|
59
|
82 |
aMessage.Complete( error );
|
|
83 |
}
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// CSecuiDialogNotifierSession::OperationComplete()
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void CSecuiDialogNotifierSession::OperationComplete()
|
|
91 |
{
|
63
|
92 |
RDEBUG("0", 0);
|
59
|
93 |
delete iOperationHandler;
|
|
94 |
iOperationHandler = NULL;
|
63
|
95 |
RDEBUG("0x99", 0x99);
|
59
|
96 |
}
|
|
97 |
|
|
98 |
// ---------------------------------------------------------------------------
|
|
99 |
// CSecuiDialogNotifierSession::CSecuiDialogNotifierSession()
|
|
100 |
// ---------------------------------------------------------------------------
|
|
101 |
//
|
|
102 |
CSecuiDialogNotifierSession::CSecuiDialogNotifierSession()
|
|
103 |
{
|
63
|
104 |
RDEBUG("0", 0);
|
59
|
105 |
}
|
|
106 |
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
// CSecuiDialogNotifierSession::ConstructL()
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
void CSecuiDialogNotifierSession::ConstructL()
|
|
112 |
{
|
63
|
113 |
RDEBUG("0", 0);
|
59
|
114 |
}
|
|
115 |
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
// CSecuiDialogNotifierSession::Server()
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
CSecuiDialogNotifierServer& CSecuiDialogNotifierSession::Server()
|
|
121 |
{
|
|
122 |
return *static_cast< CSecuiDialogNotifierServer* >(
|
|
123 |
const_cast< CServer2* >( CSession2::Server() ) );
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
// CSecuiDialogNotifierSession::DispatchMessageL()
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
void CSecuiDialogNotifierSession::DispatchMessageL( const RMessage2& aMessage )
|
|
131 |
{
|
63
|
132 |
RDEBUG("0", 0);
|
59
|
133 |
if( !IsOperationCancelled( aMessage ) )
|
|
134 |
{
|
|
135 |
TInt lOperation = aMessage.Function();
|
|
136 |
|
|
137 |
// from AskSecCodeInAutoLockL
|
|
138 |
if(lOperation==0x100+6 /*RMobilePhone::EPhonePasswordRequired*/)
|
|
139 |
{
|
63
|
140 |
RDEBUG("query from AskSecCodeInAutoLockL . No need to start Autolock.exe", 0);
|
59
|
141 |
}
|
|
142 |
else
|
|
143 |
{
|
|
144 |
CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL( );
|
63
|
145 |
RDEBUG("0", 0);
|
59
|
146 |
TInt err = iKeyguardAccess->ShowKeysLockedNote( );
|
63
|
147 |
RDEBUG("err", err);
|
59
|
148 |
delete iKeyguardAccess;
|
|
149 |
}
|
63
|
150 |
RDEBUG("lOperation", lOperation);
|
59
|
151 |
if( lOperation >= 0x1000 ) // flag for iStartup
|
|
152 |
lOperation -= 0x1000;
|
63
|
153 |
RDEBUG("new lOperation", lOperation);
|
59
|
154 |
if( lOperation < 0x200 )
|
|
155 |
{
|
|
156 |
BasicPinOperationL( aMessage );
|
|
157 |
}
|
|
158 |
else
|
|
159 |
{
|
63
|
160 |
RDEBUG("KErrNotSupported", KErrNotSupported);
|
59
|
161 |
User::Leave( KErrNotSupported );
|
|
162 |
}
|
|
163 |
}
|
63
|
164 |
RDEBUG("0x99", 0x99);
|
59
|
165 |
}
|
|
166 |
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
// CSecuiDialogNotifierSession::IsOperationCancelled()
|
|
169 |
// ---------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
TBool CSecuiDialogNotifierSession::IsOperationCancelled( const RMessage2& aMessage )
|
|
172 |
{
|
|
173 |
TBool isCancelled = EFalse;
|
|
174 |
if( aMessage.Function() == KSecuiDialogCancelOperation )
|
|
175 |
{
|
|
176 |
if( iOperationHandler )
|
|
177 |
{
|
63
|
178 |
RDEBUG("0", 0);
|
59
|
179 |
iOperationHandler->CancelOperation();
|
|
180 |
}
|
63
|
181 |
RDEBUG("completing aMessage.Handle()", aMessage.Handle());
|
59
|
182 |
aMessage.Complete( KErrNone );
|
|
183 |
isCancelled = ETrue;
|
|
184 |
}
|
|
185 |
return isCancelled;
|
|
186 |
}
|
|
187 |
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
// CSecuiDialogNotifierSession::GetInputBufferL()
|
|
190 |
// ---------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
void CSecuiDialogNotifierSession::GetInputBufferL( const RMessage2& aMessage )
|
|
193 |
{
|
|
194 |
TInt inputLength = aMessage.GetDesLength( KInputParam );
|
63
|
195 |
RDEBUG("inputLength", inputLength);
|
59
|
196 |
__ASSERT_ALWAYS( inputLength > 0, User::Leave( KErrCorrupt ) );
|
|
197 |
if( iInputBuffer )
|
|
198 |
{
|
|
199 |
delete iInputBuffer;
|
|
200 |
iInputBuffer = NULL;
|
|
201 |
}
|
|
202 |
iInputBuffer = HBufC8::NewL( inputLength );
|
|
203 |
TPtr8 inputBufferPtr( iInputBuffer->Des() );
|
|
204 |
aMessage.ReadL( KInputParam, inputBufferPtr );
|
63
|
205 |
RDEBUG("0x99", 0x99);
|
59
|
206 |
}
|
|
207 |
|
|
208 |
// ---------------------------------------------------------------------------
|
|
209 |
// CSecuiDialogNotifierSession::ServerAuthenticationFailureL()
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
//
|
63
|
212 |
void CSecuiDialogNotifierSession::ServerAuthenticationFailureL( const RMessage2& /* aMessage */ )
|
59
|
213 |
{
|
63
|
214 |
RDEBUG("not used 0x99", 0x99);
|
59
|
215 |
}
|
|
216 |
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
// CSecuiDialogNotifierSession::BasicPinOperationL()
|
|
219 |
// ---------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
void CSecuiDialogNotifierSession::BasicPinOperationL( const RMessage2& aMessage )
|
|
222 |
{
|
63
|
223 |
RDEBUG("0", 0);
|
59
|
224 |
GetInputBufferL( aMessage );
|
|
225 |
|
|
226 |
ASSERT( iOperationHandler == NULL );
|
|
227 |
iOperationHandler = CBasicPinQueryOperation::NewL( *this, aMessage, KOutputParam );
|
|
228 |
iOperationHandler->StartL( *iInputBuffer );
|
|
229 |
|
63
|
230 |
RDEBUG("0x99", 0x99);
|
59
|
231 |
}
|
|
232 |
|