30
|
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: Active Idle <-> Phone app synchronizer implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "aiidleappregisterimpl.h"
|
|
20 |
#include <e32property.h>
|
|
21 |
#include <aisystemuids.hrh>
|
|
22 |
#include <activeidle2domainpskeys.h>
|
|
23 |
|
|
24 |
namespace
|
|
25 |
{
|
|
26 |
_LIT_SECURITY_POLICY_C1( KTelephonyInformationReadPolicy, ECapabilityReadDeviceData );
|
|
27 |
_LIT_SECURITY_POLICY_C1( KTelephonyInformationWritePolicy, ECapabilityWriteDeviceData );
|
|
28 |
_LIT_SECURITY_POLICY_PASS( KTelephonyInformationPolicyAlwaysPass );
|
|
29 |
|
|
30 |
const TInt KActOnSendKey = 1;
|
|
31 |
|
|
32 |
TInt SetIdleAppPS()
|
|
33 |
{
|
|
34 |
return RProperty::Set(
|
|
35 |
KPSUidAiInformation,
|
|
36 |
KActiveIdleUid,
|
|
37 |
AI_UID3_AIFW_EXE );
|
|
38 |
}
|
|
39 |
|
|
40 |
TInt DefineIdleAppPS()
|
|
41 |
{
|
|
42 |
return RProperty::Define(
|
|
43 |
KPSUidAiInformation,
|
|
44 |
KActiveIdleUid,
|
|
45 |
RProperty::EInt,
|
|
46 |
KTelephonyInformationReadPolicy,
|
|
47 |
KTelephonyInformationWritePolicy );
|
|
48 |
}
|
|
49 |
|
|
50 |
TInt DefineIdleStatePS()
|
|
51 |
{
|
|
52 |
RProperty::Define(
|
|
53 |
KPSUidAiInformation,
|
|
54 |
KActiveIdlePopupState,
|
|
55 |
RProperty::EInt,
|
|
56 |
KTelephonyInformationPolicyAlwaysPass,
|
|
57 |
KTelephonyInformationWritePolicy );
|
|
58 |
return RProperty::Define(
|
|
59 |
KPSUidAiInformation,
|
|
60 |
KActiveIdleState,
|
|
61 |
RProperty::EInt,
|
|
62 |
KTelephonyInformationPolicyAlwaysPass,
|
|
63 |
KTelephonyInformationWritePolicy );
|
|
64 |
}
|
|
65 |
|
|
66 |
TInt DefineIdleSendKeyPS()
|
|
67 |
{
|
|
68 |
return RProperty::Define(
|
|
69 |
KPSUidAiInformation,
|
|
70 |
KActiveIdleActOnSendKey,
|
|
71 |
RProperty::EInt,
|
|
72 |
KTelephonyInformationReadPolicy,
|
|
73 |
KTelephonyInformationWritePolicy );
|
|
74 |
}
|
|
75 |
TInt SetIdleSendKeyPS()
|
|
76 |
{
|
|
77 |
return RProperty::Set(
|
|
78 |
KPSUidAiInformation,
|
|
79 |
KActiveIdleActOnSendKey,
|
|
80 |
KActOnSendKey );
|
|
81 |
}
|
|
82 |
|
|
83 |
TInt DefineIdleSimRegFailedReceivedPS()
|
|
84 |
{
|
|
85 |
return RProperty::Define(
|
|
86 |
KPSUidAiInformation,
|
|
87 |
KActiveIdleSimRegFailedReceived,
|
|
88 |
RProperty::EInt,
|
|
89 |
KTelephonyInformationReadPolicy,
|
|
90 |
KTelephonyInformationWritePolicy );
|
|
91 |
}
|
|
92 |
|
|
93 |
TInt DefineIdleSendNumKeysToPhonePS()
|
|
94 |
{
|
|
95 |
return RProperty::Define(
|
|
96 |
KPSUidAiInformation,
|
|
97 |
KActiveIdleForwardNumericKeysToPhone,
|
|
98 |
RProperty::EInt,
|
|
99 |
ECapabilityReadDeviceData,
|
|
100 |
ECapabilityWriteDeviceData );
|
|
101 |
|
|
102 |
}
|
|
103 |
|
|
104 |
TInt SetIdleSendNumKeysToPhonePS()
|
|
105 |
{
|
|
106 |
return RProperty::Set(KPSUidAiInformation,
|
|
107 |
KActiveIdleForwardNumericKeysToPhone,
|
|
108 |
EPSAiForwardNumericKeysToPhone);
|
|
109 |
}
|
|
110 |
}
|
|
111 |
|
|
112 |
CAiIdleAppRegisterImpl* CAiIdleAppRegisterImpl::NewLC()
|
|
113 |
{
|
|
114 |
CAiIdleAppRegisterImpl* self = new(ELeave) CAiIdleAppRegisterImpl;
|
|
115 |
CleanupStack::PushL( self );
|
|
116 |
return self;
|
|
117 |
}
|
|
118 |
|
|
119 |
CAiIdleAppRegisterImpl::~CAiIdleAppRegisterImpl()
|
|
120 |
{
|
|
121 |
}
|
|
122 |
|
|
123 |
void CAiIdleAppRegisterImpl::RegisterL()
|
|
124 |
{
|
|
125 |
// Give own uid for phone.
|
|
126 |
TInt setPSResult = SetIdleAppPS();
|
|
127 |
if ( setPSResult == KErrNotFound )
|
|
128 |
{
|
|
129 |
// Key not defined yet -> try to define
|
|
130 |
const TInt err = DefineIdleAppPS();
|
|
131 |
if( err == KErrNone || err == KErrAlreadyExists )
|
|
132 |
{
|
|
133 |
// Try setting again
|
|
134 |
setPSResult = SetIdleAppPS();
|
|
135 |
}
|
|
136 |
}
|
|
137 |
|
|
138 |
DefineIdleSendKeyPS();
|
|
139 |
|
|
140 |
DefineIdleSimRegFailedReceivedPS();
|
|
141 |
|
|
142 |
// Set the default value to 1 so the send key press is reacted
|
|
143 |
SetIdleSendKeyPS();
|
|
144 |
|
|
145 |
// Failure to set the telephony P&S key is fatal
|
|
146 |
User::LeaveIfError( setPSResult );
|
|
147 |
|
|
148 |
// Define idle state key
|
|
149 |
DefineIdleStatePS();
|
|
150 |
|
|
151 |
DefineIdleSendNumKeysToPhonePS();
|
|
152 |
|
|
153 |
SetIdleSendNumKeysToPhonePS();
|
|
154 |
}
|
|
155 |
|
|
156 |
CAiIdleAppRegisterImpl::CAiIdleAppRegisterImpl()
|
|
157 |
{
|
|
158 |
}
|
|
159 |
|
|
160 |
EXPORT_C CAiIdleAppRegister* CAiIdleAppRegister::NewLC()
|
|
161 |
{
|
|
162 |
return CAiIdleAppRegisterImpl::NewLC();
|
|
163 |
}
|
|
164 |
|