|
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: OMJ S60 preinstaller process |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SILENTMIDLETINSTALL_H |
|
20 #define SILENTMIDLETINSTALL_H |
|
21 |
|
22 #include <f32file.h> |
|
23 #include <e32base.h> |
|
24 #include <javasymbianoslayer.h> |
|
25 |
|
26 #include "preinstallcommsserver.h" |
|
27 |
|
28 /** |
|
29 * The main active object of java preinstaller. |
|
30 * |
|
31 * This active object is activated from the process main() after the |
|
32 * active scheduler has been created. |
|
33 */ |
|
34 OS_NONSHARABLE_CLASS(CSilentMIDletInstall) : public CActive |
|
35 { |
|
36 // This active object goes through all these states in order and |
|
37 // exits from EExit state |
|
38 enum TSilentInstallState |
|
39 { |
|
40 EFindOutDeviceDrives, |
|
41 EFindOutDirectoriesToBeScannedNow, |
|
42 EAppsInPreinstallDirectories, |
|
43 ECheckWhichAppsShouldBeInstalled, |
|
44 EExecutePreinstallServer, |
|
45 EExit |
|
46 }; |
|
47 |
|
48 public: |
|
49 // the only allowed way to create this object |
|
50 static CSilentMIDletInstall* NewLC(RFs& aFs); |
|
51 |
|
52 ~CSilentMIDletInstall(); |
|
53 |
|
54 // Start this AO after it has been constructed |
|
55 void Start(); |
|
56 // Move AO to the next state |
|
57 void CompleteRequest(); |
|
58 |
|
59 protected: |
|
60 // From CActive |
|
61 void RunL(); |
|
62 void DoCancel(); |
|
63 TInt RunError(TInt aError); |
|
64 |
|
65 private: |
|
66 // Exit whole AO |
|
67 void Exit(); |
|
68 // Private constructor. Adds this AO to active scheduler |
|
69 CSilentMIDletInstall(RFs& aFs); |
|
70 void ConstructL(); |
|
71 // Add .jad files in the directories specified in aDirs to iJadFiles. |
|
72 void GetMIDletFilesL(RPointerArray<HBufC>& aDirs); |
|
73 // Start Java Installer in poll mode and then wait until it exits. |
|
74 void RunJavaInstallerL(); |
|
75 // Start Java Installer just to do IntegrityService rollback. |
|
76 void RollbackJavaInstaller(); |
|
77 // Get the entries of the directory in alphabetical order. |
|
78 void GetDirEntriesL(const TDesC& aDirectory, const TDesC& aMask, |
|
79 RPointerArray<HBufC>& aVector); |
|
80 // Parse MIDlet-Name, MIDlet-Vendor and MIDlet-Version parameters from JAD file. |
|
81 TBool ParseJadL(const TDesC& aJadFileName); |
|
82 // Checks all local drives in the device and stores the DriveInfo API drive |
|
83 // status information for each drive to iDriveStatuses |
|
84 void GetAllDeviceDrivesL(); |
|
85 // Adds the preinstall directory of every local, non-substed drive to iDirs |
|
86 void GetDirsToBeScannedL(); |
|
87 // Check all Jad files in iJadFiles and remove those |
|
88 // that need not be preinstalled (already installed[1] or preinstalled[2] |
|
89 // or preinstalled and then uninstalled by user[3]). |
|
90 void CheckWhichAppsShouldBeInstalledL(); |
|
91 // If there is something to preinstall start preinstall comms server and |
|
92 // installer in poll mode. |
|
93 void ExecutePreinstallServerL(); |
|
94 // Reads the whole content of the Jad file and returns it in |
|
95 // buffer in UCS-2 character set. |
|
96 HBufC *GetJadContentL(const TDesC& aJadFileName); |
|
97 // Finds the java attribute specified by |
|
98 // aAttributeName from aJad and returns the value of that attribute |
|
99 // in HBufC. |
|
100 HBufC *ParseAttribute(const HBufC *aJad, const TDesC& aAttributeName); |
|
101 // Parses the application version string given in aAppVersionString |
|
102 // and returns the corresponding Symbian TAppVersion. |
|
103 TAppVersion DesToAppVersion(const HBufC *aAppVersionString); |
|
104 |
|
105 |
|
106 private: |
|
107 // File server handle passed to this AO when it was created. |
|
108 // This object does not own it. |
|
109 RFs& iFs; |
|
110 // The preinstall directories to be scanned |
|
111 RPointerArray<HBufC> iDirs; |
|
112 // The jad files to be preinstalled |
|
113 RPointerArray<HBufC> iJadFiles; |
|
114 // Current state of the state machine |
|
115 TSilentInstallState iState; |
|
116 // True if Java Installer Integrity Server rollback must be done |
|
117 TBool iISRollbackNeeded; |
|
118 // Comms server used to pass the jad file names to Java Installer |
|
119 PreinstallCommsServer* iPreinstallServer; |
|
120 // Buffer used for parsing midlet name from jad file |
|
121 HBufC* iMIDletName; |
|
122 // Buffer used for parsing midlet vendor from jad file |
|
123 HBufC* iMIDletVendor; |
|
124 // Variable used for parsing midlet version from jad file |
|
125 TAppVersion iMIDletVersion; |
|
126 |
|
127 // Drive status info for each non-remote, non-substed drive on device |
|
128 TUint iDriveStatuses[KMaxDrives]; |
|
129 // How many applications must be preinstalled |
|
130 TInt iNumberOfAppsToInstall; |
|
131 }; |
|
132 |
|
133 #endif // SILENTMIDLETINSTALL_H |