|
1 /* |
|
2 * Copyright (c) 2008 - 2009 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 platform 2.0 javaapppreconverter process |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <f32file.h> |
|
22 |
|
23 #include "javauids.h" |
|
24 #include "preconverter.h" |
|
25 #include "noarmlogs.h" |
|
26 |
|
27 _LIT_SECURE_ID(KAppInstUiSecureID, KAppInstUiUid); |
|
28 _LIT_SECURE_ID(KAppSisLauncherSecureID, KAppSisLauncherUid); |
|
29 |
|
30 /** |
|
31 * Create file server connection. |
|
32 * If data storage already exists, exit |
|
33 * Create active scheduler and start it. |
|
34 */ |
|
35 static void ExecutePreConverterL() |
|
36 { |
|
37 JELOG2(EJavaConverters); |
|
38 |
|
39 // Do not check the starter in emulator environment to make |
|
40 // testing possible. |
|
41 #ifndef __WINSCW__ |
|
42 // The only time that this application should be executed |
|
43 // is when native installer starts it |
|
44 if ((User::CreatorSecureId() != KAppInstUiSecureID) && |
|
45 (User::CreatorSecureId() != KAppSisLauncherSecureID)) |
|
46 { |
|
47 ELOG(EJavaConverters, |
|
48 "javaapppreconverter: ExecutePreConverterL: Mismatch in secure " |
|
49 "ID, only AppInstUi or SisLauncher can launch this exe."); |
|
50 ELOG1(EJavaConverters, |
|
51 "javaapppreconverter: ExecutePreConverterL: Starter has SID %x ", |
|
52 User::CreatorSecureId().iId); |
|
53 User::Leave(KErrPermissionDenied); |
|
54 } |
|
55 #endif |
|
56 |
|
57 CActiveScheduler* as = new(ELeave) CActiveScheduler(); |
|
58 |
|
59 // Install active scheduler |
|
60 CActiveScheduler::Install(as); |
|
61 CleanupStack::PushL(as); |
|
62 |
|
63 RFs fs; |
|
64 User::LeaveIfError(fs.Connect()); |
|
65 CleanupClosePushL(fs); |
|
66 |
|
67 // Setup and start the preconversion |
|
68 CPreConverter* pre = CPreConverter::NewLC(fs); |
|
69 |
|
70 LOG(EJavaConverters, |
|
71 EInfo, "javaapppreconverter: ExecutePreConverterL: Call CPreConverter::Start()"); |
|
72 |
|
73 pre->Start(); |
|
74 |
|
75 // Start active scheduler |
|
76 LOG(EJavaConverters, |
|
77 EInfo, "javaapppreconverter: ExecutePreConverterL: Starting CActiveScheduler"); |
|
78 CActiveScheduler::Start(); |
|
79 |
|
80 LOG(EJavaConverters, EInfo, "javaapppreconverter: ExecutePreConverterL: Cleaning up"); |
|
81 |
|
82 CleanupStack::PopAndDestroy(pre); |
|
83 CleanupStack::PopAndDestroy(&fs); // close connection to file server |
|
84 CleanupStack::PopAndDestroy(as); |
|
85 } |
|
86 |
|
87 /** |
|
88 * Create cleanup stack and run the javaapppreconverter code inside TRAP |
|
89 * harness to log unexpected leaves. |
|
90 */ |
|
91 TInt E32Main() |
|
92 { |
|
93 CTrapCleanup* cleanupStack = CTrapCleanup::New(); |
|
94 |
|
95 TInt error = KErrNone; |
|
96 TRAP(error,ExecutePreConverterL()); |
|
97 if (error != KErrNone) |
|
98 { |
|
99 ELOG1(EJavaConverters, "javaapppreconverter: ExecutePreConverterL:Main error %d", error); |
|
100 } |
|
101 |
|
102 delete cleanupStack; |
|
103 return error; |
|
104 } |