21
|
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: Memory scan engine registry scanning
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// SYSTEM INCLUDES
|
|
20 |
#include <swi/sisregistryentry.h>
|
|
21 |
#include <swi/sisregistrysession.h>
|
|
22 |
#include <AknUtils.h>
|
|
23 |
|
|
24 |
#include <SWInstApi.h>
|
|
25 |
#include <swi/sisregistrypackage.h>
|
|
26 |
#include <CUIDetailsDialog.h>
|
|
27 |
#include <SWInstDefs.h>
|
|
28 |
#include <StringLoader.h>
|
|
29 |
#include <mseng.rsg>
|
|
30 |
|
|
31 |
// USER INCLUDES
|
|
32 |
#include "msengregistryscanner.h"
|
|
33 |
#include "msengsisxinfo.h"
|
|
34 |
#include "memscanutils.h"
|
|
35 |
|
|
36 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
37 |
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
// CMsengRegistryScanner::CMsengRegistryScanner()
|
|
40 |
//
|
|
41 |
// Default C++ constructor
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
CMsengRegistryScanner::CMsengRegistryScanner(
|
|
44 |
TDriveNumber aDrive,
|
|
45 |
MMsengScannerObserver& aObserver,
|
|
46 |
CMsengInfoArray& aScanArray,
|
|
47 |
RFs& aFsSession)
|
|
48 |
: CMsengScannerBase(aObserver, aScanArray, aFsSession),
|
|
49 |
iType( ERegistrySisx ),
|
|
50 |
iDrive( aDrive )
|
|
51 |
{
|
|
52 |
}
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// CMsengRegistryScanner::NewL()
|
|
56 |
//
|
|
57 |
// Two-phased constructor
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
CMsengRegistryScanner* CMsengRegistryScanner::NewL(
|
|
60 |
TDriveNumber aDrive,
|
|
61 |
MMsengScannerObserver& aObserver,
|
|
62 |
CMsengInfoArray& aScanArray,
|
|
63 |
RFs& aFsSession)
|
|
64 |
{
|
|
65 |
CMsengRegistryScanner* self = new (ELeave) CMsengRegistryScanner(aDrive,
|
|
66 |
aObserver, aScanArray, aFsSession);
|
|
67 |
|
|
68 |
return self;
|
|
69 |
}
|
|
70 |
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// CMsengRegistryScanner::~CMsengRegistryScanner()
|
|
74 |
//
|
|
75 |
// Destructor
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
CMsengRegistryScanner::~CMsengRegistryScanner()
|
|
78 |
{
|
|
79 |
}
|
|
80 |
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
// CMsengRegistryScanner::Scan()
|
|
83 |
//
|
|
84 |
//
|
|
85 |
// ---------------------------------------------------------------------------
|
|
86 |
void CMsengRegistryScanner::Scan()
|
|
87 |
{
|
|
88 |
// Start the scan going
|
|
89 |
CompleteRequest();
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
// CMsengRegistryScanner::PerformStepL()
|
|
95 |
//
|
|
96 |
//
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
CMsengScannerBase::TStepResult CMsengRegistryScanner::PerformStepL()
|
|
99 |
{
|
|
100 |
TStepResult result = ECompleteRequest;
|
|
101 |
|
|
102 |
// Scan requested registry
|
|
103 |
switch( iType )
|
|
104 |
{
|
|
105 |
case ERegistrySisx:
|
|
106 |
{
|
|
107 |
ScanSisRegistryL( );
|
|
108 |
iType = ERegistryLast;
|
|
109 |
break;
|
|
110 |
}
|
|
111 |
case ERegistryLast:
|
|
112 |
default:
|
|
113 |
{
|
|
114 |
// That's all we had to do
|
|
115 |
result = EScanComplete;
|
|
116 |
break;
|
|
117 |
}
|
|
118 |
}
|
|
119 |
|
|
120 |
// Return the response back to the base scanner
|
|
121 |
return result;
|
|
122 |
}
|
|
123 |
|
|
124 |
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
// CMsengRegistryScanner::ScanSisRegistryL()
|
|
127 |
//
|
|
128 |
//
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
void CMsengRegistryScanner::ScanSisRegistryL()
|
|
131 |
{
|
|
132 |
Swi::RSisRegistrySession regSession;
|
|
133 |
CleanupClosePushL(regSession);
|
|
134 |
User::LeaveIfError( regSession.Connect() );
|
|
135 |
|
|
136 |
RArray<TUid> uids;
|
|
137 |
CleanupClosePushL(uids);
|
|
138 |
regSession.InstalledUidsL( uids );
|
|
139 |
|
|
140 |
RPointerArray<Swi::CSisRegistryPackage> augmentations;
|
|
141 |
|
|
142 |
TInt64 totalSize(0);
|
|
143 |
|
|
144 |
for ( TInt index(0); index < uids.Count(); index++ )
|
|
145 |
{
|
|
146 |
Swi::RSisRegistryEntry entry;
|
|
147 |
CleanupClosePushL(entry);
|
|
148 |
User::LeaveIfError( entry.Open( regSession, uids[index] ) );
|
|
149 |
|
|
150 |
//All packages are from installed packages
|
|
151 |
CMsengSisxInfo* appObj = CMsengSisxInfo::NewL( entry, iDrive );
|
|
152 |
CleanupStack::PushL( appObj );
|
|
153 |
TInt64 baseSize( 0 );
|
|
154 |
baseSize = entry.SizeL();
|
|
155 |
|
|
156 |
TRACES
|
|
157 |
(
|
|
158 |
RDebug::Print(_L("ScanSisRegistryL, IsPresent, %d"), TInt( entry.IsPresentL()));
|
|
159 |
RDebug::Print(_L("ScanSisRegistryL, IsInRom, %d"), TInt( entry.IsInRomL()));
|
|
160 |
);
|
|
161 |
|
|
162 |
// Only show if not in rom
|
|
163 |
if ( !entry.IsInRomL() && entry.IsPresentL() && appObj->RequestedLocation() )
|
|
164 |
{
|
|
165 |
// Get possible augmentations
|
|
166 |
entry.AugmentationsL( augmentations );
|
|
167 |
for ( TInt i( 0 ); i < augmentations.Count(); i++ )
|
|
168 |
{
|
|
169 |
Swi::RSisRegistryEntry augmentation;
|
|
170 |
CleanupClosePushL( augmentation );
|
|
171 |
augmentation.OpenL( regSession, *augmentations[i] );
|
|
172 |
// Only show if not in rom
|
|
173 |
if ( !augmentation.IsInRomL() && augmentation.IsPresentL() )
|
|
174 |
{
|
|
175 |
// Append the size to the total size
|
|
176 |
baseSize += augmentation.SizeL();
|
|
177 |
}
|
|
178 |
CleanupStack::PopAndDestroy( &augmentation );
|
|
179 |
}
|
|
180 |
totalSize += baseSize;
|
|
181 |
}
|
|
182 |
|
|
183 |
augmentations.ResetAndDestroy();
|
|
184 |
|
|
185 |
CleanupStack::PopAndDestroy( appObj );
|
|
186 |
CleanupStack::PopAndDestroy( &entry );
|
|
187 |
}
|
|
188 |
|
|
189 |
InfoArray().AddSizeByGroupL(EGroupNativeApps, totalSize);
|
|
190 |
|
|
191 |
CleanupStack::PopAndDestroy(&uids);
|
|
192 |
CleanupStack::PopAndDestroy(®Session);
|
|
193 |
}
|
|
194 |
|
|
195 |
// End of File
|
|
196 |
|