26
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Java Sid Checker is an ECOM plugin for Symbian AppArc
|
|
15 |
* (database that contains info on all applications installed
|
|
16 |
* to the device)
|
|
17 |
* It tells AppArc whether Java application installed
|
|
18 |
* to a removable storage media is present and can be executed.
|
|
19 |
*
|
|
20 |
*/
|
|
21 |
|
|
22 |
|
|
23 |
#include <e32std.h>
|
|
24 |
#include <ecom/implementationproxy.h>
|
|
25 |
#include <appversion.h>
|
|
26 |
|
|
27 |
#include "javauids.h"
|
|
28 |
#include "javasidchecker.h"
|
|
29 |
#include "logger.h"
|
|
30 |
|
|
31 |
|
|
32 |
// DLL Entry point
|
|
33 |
TBool E32Dll()
|
|
34 |
{
|
|
35 |
return ETrue;
|
|
36 |
}
|
|
37 |
|
|
38 |
// ECOM Implementation Table
|
|
39 |
const TImplementationProxy ImplementationTable[] =
|
|
40 |
{
|
|
41 |
IMPLEMENTATION_PROXY_ENTRY(KSidCheckerEcomImplUid, CJavaSidChecker::NewL)
|
|
42 |
};
|
|
43 |
|
|
44 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
|
|
45 |
{
|
|
46 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
|
47 |
return ImplementationTable;
|
|
48 |
}
|
|
49 |
|
|
50 |
|
|
51 |
CJavaSidChecker* CJavaSidChecker::NewL()
|
|
52 |
{
|
|
53 |
// Minimal construction (we don't want this to fail)
|
|
54 |
return new(ELeave) CJavaSidChecker;
|
|
55 |
}
|
|
56 |
|
|
57 |
CJavaSidChecker::CJavaSidChecker()
|
|
58 |
{
|
|
59 |
iJavaRegistry = NULL;
|
|
60 |
LOG(EUtils, EInfo, "CJavaSidChecker: Constructor called");
|
|
61 |
}
|
|
62 |
|
|
63 |
CJavaSidChecker::~CJavaSidChecker()
|
|
64 |
{
|
|
65 |
if (NULL != iJavaRegistry)
|
|
66 |
{
|
|
67 |
delete iJavaRegistry;
|
|
68 |
iJavaRegistry = NULL;
|
|
69 |
}
|
|
70 |
LOG(EUtils, EInfo, "CJavaSidChecker: Destructor called");
|
|
71 |
}
|
|
72 |
|
|
73 |
TBool CJavaSidChecker::AppRegisteredAt(const TUid& aSid, TDriveUnit aDrive)
|
|
74 |
{
|
|
75 |
TBool installed = EFalse;
|
|
76 |
|
|
77 |
LOG1(EUtils, EInfo, "CJavaSidChecker: AppRegisteredAt called, %x", aSid.iUid);
|
|
78 |
|
|
79 |
// No Java application can have Uid 0
|
|
80 |
if (aSid.iUid == 0)
|
|
81 |
{
|
|
82 |
return installed;
|
|
83 |
}
|
|
84 |
|
|
85 |
TRAPD(err, installed = AppRegisteredAtL(aSid, aDrive));
|
|
86 |
if (KErrNone != err)
|
|
87 |
{
|
|
88 |
ELOG1(EUtils, "CJavaSidChecker: AppRegisteredAt error %d", err);
|
|
89 |
}
|
|
90 |
|
|
91 |
return installed;
|
|
92 |
}
|
|
93 |
|
|
94 |
TBool CJavaSidChecker::AppRegisteredAtL(const TUid& aSid, TDriveUnit /*aDrive*/)
|
|
95 |
{
|
|
96 |
// Create the Java Registry if it has not been created already
|
|
97 |
if (NULL == iJavaRegistry)
|
|
98 |
{
|
|
99 |
iJavaRegistry = Java::CJavaRegistry::NewL();
|
|
100 |
}
|
|
101 |
|
|
102 |
// JavaRegistry does not return entries that are not present.
|
|
103 |
return iJavaRegistry->RegistryEntryExistsL(aSid);
|
|
104 |
}
|
|
105 |
|
|
106 |
void CJavaSidChecker::SetRescanCallBackL(const TCallBack &/*aCallBack*/)
|
|
107 |
{
|
|
108 |
// Do nothing
|
|
109 |
return;
|
|
110 |
}
|