|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // apgcli.h |
|
15 // |
|
16 |
|
17 #ifndef __APGCLI_H__ |
|
18 #define __APGCLI_H__ |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <apmstd.h> |
|
22 #include <apmrec.h> |
|
23 #include <apaid.h> |
|
24 #include <badesca.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 // classes referenced |
|
28 class RFile; |
|
29 class MArrayFiller; |
|
30 class CApaCommandLine; |
|
31 class CApaMaskedBitmap; |
|
32 class CApaLsSessionExtension; |
|
33 class CApaRegistrationResourceFileWriter; |
|
34 class CApaLocalisableResourceFileWriter; |
|
35 class CApaAppServiceInfoArray; |
|
36 |
|
37 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
38 /** @internalComponent |
|
39 */ |
|
40 IMPORT_C TUint MinApplicationStackSize(); |
|
41 |
|
42 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
43 |
|
44 |
|
45 /** |
|
46 This class holds the MIME-type recognition results of a recognized directory. |
|
47 @publishedAll |
|
48 @released |
|
49 */ |
|
50 class CDataRecognitionResultArray : public CBase |
|
51 { |
|
52 public: |
|
53 IMPORT_C CDataRecognitionResultArray(); |
|
54 IMPORT_C ~CDataRecognitionResultArray(); |
|
55 IMPORT_C const TFileName& Path() const; |
|
56 IMPORT_C TUint Count() const; |
|
57 IMPORT_C void GetDataRecognitionResultL(TDataRecognitionResult& aResult, const TUint aIndex) const; |
|
58 IMPORT_C void GetFileNameL(TFileName& aFileName, const TUint aIndex) const; |
|
59 public: |
|
60 TUint InternalizeL(const CBufFlat& aBuffer); |
|
61 void SetPath(const TFileName& aPath); |
|
62 private: |
|
63 NONSHARABLE_CLASS(CItem); |
|
64 TFileName iPath; |
|
65 RPointerArray<CItem> iItems; |
|
66 }; |
|
67 |
|
68 |
|
69 /** A session with the application architecture server. |
|
70 |
|
71 The server provides access to a cached list of the applications on the device. |
|
72 |
|
73 To use this class, clients first need to connect to the server. |
|
74 |
|
75 Then, one of GetAllApps(), GetEmbeddableApps() or GetFilteredApps() needs to be called. |
|
76 These functions do some initialisation of server data in preparation for returning the |
|
77 application list (which is owned by the server). |
|
78 |
|
79 Then, GetNextApp() is called in a loop. The first time around, it populates the session's |
|
80 application list and retrieves the first application in the list. Further calls to GetNextApp() |
|
81 retrieve the remaining applications in the list, until RApaLsSession::ENoMoreAppsInList is |
|
82 returned. |
|
83 |
|
84 The session should be closed when it is no longer needed, before it goes out of scope. |
|
85 |
|
86 Various functions in RApaLsSession need to access the application list, and may return |
|
87 RApaLsSession::EAppListInvalid to indicate that the function was called before the initial |
|
88 population of the list is complete. If this occurs, you could try again after a short delay. |
|
89 |
|
90 This class provides many other functions, for instance launching applications, querying |
|
91 application-specific information, recognising data. |
|
92 |
|
93 @publishedAll |
|
94 @released */ |
|
95 class RApaLsSession : public RSessionBase |
|
96 { |
|
97 public: |
|
98 enum TApaLsErrorCode { |
|
99 /** A possible return value from GetNextApp(), to indicate that there are no more |
|
100 applications in the list. */ |
|
101 ENoMoreAppsInList = 1, |
|
102 /** Indicates that an RApaLsSession member function was called before the session's |
|
103 application list is fully populated. */ |
|
104 EAppListInvalid |
|
105 }; |
|
106 |
|
107 /** Defines the way an application is launched. |
|
108 This is no longer in use. Has no effect! */ |
|
109 enum TLaunchType { |
|
110 ELaunchNewApp = 1, |
|
111 ESwitchFiles |
|
112 }; |
|
113 public: // Session management |
|
114 IMPORT_C RApaLsSession(); |
|
115 IMPORT_C TInt Connect(); |
|
116 IMPORT_C void Close(); //lint !e1511 Member hides non-virtual member |
|
117 IMPORT_C TVersion Version() const; |
|
118 IMPORT_C void RegisterListPopulationCompleteObserver(TRequestStatus& aStatus) const; |
|
119 IMPORT_C TInt CancelListPopulationCompleteObserver() const; |
|
120 public: // Utilities |
|
121 IMPORT_C TInt IsProgram(const TDesC& aFileName, TBool& aProgram) const; |
|
122 IMPORT_C TInt MatchesSecurityPolicy(TBool& aMatches, TUid aAppUid, const TSecurityPolicy& aSecurityPolicy) const; |
|
123 public: // Application list initialization |
|
124 // Set up list of all apps |
|
125 IMPORT_C TInt GetAllApps() const; |
|
126 IMPORT_C TInt GetAllApps(TInt aScreenMode) const; |
|
127 IMPORT_C TInt GetEmbeddableApps() const; |
|
128 IMPORT_C TInt GetEmbeddableApps(TInt aScreenMode) const; |
|
129 // Set up filtered list of apps |
|
130 IMPORT_C TInt GetFilteredApps(const TApaEmbeddabilityFilter& aFilter) const; |
|
131 IMPORT_C TInt GetFilteredApps(const TApaEmbeddabilityFilter& aFilter, TInt aScreenMode) const; |
|
132 IMPORT_C TInt GetFilteredApps(TUint aCapabilityAttributeMask, TUint aCapabilityAttributeValue) const; |
|
133 IMPORT_C TInt GetFilteredApps(TUint aCapabilityAttributeMask, TUint aCapabilityAttributeValue, TInt aScreenMode) const; |
|
134 // Set up list of server "service" apps |
|
135 IMPORT_C TInt GetServerApps(TUid aServiceUid) const; |
|
136 IMPORT_C TInt GetServerApps(TUid aServiceUid, TInt aScreenMode) const; |
|
137 public: // Application list access |
|
138 // Get application count |
|
139 IMPORT_C TInt AppCount(TInt& aCount) const; |
|
140 IMPORT_C TInt EmbeddableAppCount(TInt& aCount) const; |
|
141 // Get next app in list |
|
142 IMPORT_C TInt GetNextApp(TApaAppInfo& aInfo) const; // call repeatedly, returns err (inc ENoMoreAppsInList,EAppListInvalid) |
|
143 IMPORT_C TInt GetNextApp(TApaAppInfo& aInfo,TInt aScreenMode) const; // call repeatedly, returns err (inc ENoMoreAppsInList,EAppListInvalid) |
|
144 public: // Application meta-data |
|
145 IMPORT_C TInt GetAppInfo(TApaAppInfo& aInfo, TUid aAppUid) const; |
|
146 IMPORT_C TInt GetAppViews(CApaAppViewArray& aAppViews, TUid aAppUid) const; |
|
147 |
|
148 IMPORT_C TInt SetAppShortCaption(const TDesC& aShortCaption, TLanguage aLanguage, TUid aAppUid); |
|
149 IMPORT_C TInt ApplicationLanguage(TUid aAppUid, TLanguage& aLanguage) const; |
|
150 IMPORT_C TInt GetAppCapability(TDes8& aCapabilityBuf,TUid aAppUid) const; |
|
151 IMPORT_C TInt GetAppOwnedFiles(CDesCArray& aAppOwnedFiles, TUid aAppUid) const; |
|
152 IMPORT_C TInt GetDefaultScreenNumber(TInt& aDefaultScreenNumber, TUid aAppUid) const; |
|
153 // Application icons |
|
154 IMPORT_C TInt GetAppIcon(TUid aAppUid, TInt aSize, CApaMaskedBitmap& aAppBitmap) const; |
|
155 IMPORT_C TInt GetAppIconSizes(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const; |
|
156 IMPORT_C TInt GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const; |
|
157 IMPORT_C TInt GetAppIcon(TUid aAppUid, HBufC*& aFullFileName) const; |
|
158 IMPORT_C TInt GetAppIcon(TUid aAppUid, RFile& aFile) const; |
|
159 IMPORT_C TInt NumberOfOwnDefinedIcons(TUid aAppUid, TInt& aCount) const; |
|
160 // View icons |
|
161 IMPORT_C TInt GetAppViewIcon(TUid aAppUid, TUid aViewUid, const TSize& aSize, CApaMaskedBitmap& aViewBitmap) const; |
|
162 IMPORT_C TInt GetAppViewIcon(TUid aAppUid, TUid aViewUid, HBufC*& aFullFileName) const; |
|
163 public: // Application start |
|
164 IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine); // This is only recommended for non document based apps |
|
165 IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine, TThreadId& aThreadId); |
|
166 IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
167 |
|
168 IMPORT_C TInt StartDocument(const TDesC& aDocFileName, TThreadId& aThreadId, TLaunchType aUnused = ELaunchNewApp); |
|
169 IMPORT_C TInt StartDocument(const TDesC& aDocFileName, const TDataType& aDataType, TThreadId& aThreadId, TLaunchType aUnused = ELaunchNewApp); |
|
170 IMPORT_C TInt StartDocument(const TDesC& aDocFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aUnused = ELaunchNewApp); |
|
171 IMPORT_C TInt StartDocument(RFile& aDocFile, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous = NULL); |
|
172 IMPORT_C TInt StartDocument(RFile& aDocFile, const TDataType& aDataType, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous = NULL); |
|
173 IMPORT_C TInt StartDocument(RFile& aDocFile, TUid aAppUid, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous = NULL); |
|
174 IMPORT_C TInt CreateDocument(const TDesC& aDocFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aUnused = ELaunchNewApp); |
|
175 public: // Data MIME-type recognizion |
|
176 // Minimum accepted confidence by which a data may be considered recognized |
|
177 IMPORT_C TInt SetAcceptedConfidence(TInt aConfidence); |
|
178 IMPORT_C TInt GetAcceptedConfidence(TInt& aConfidence) const; |
|
179 // Get a complete list of all known (recognizable) MIME types |
|
180 IMPORT_C TInt GetSupportedDataTypesL(CDataTypeArray& aDataTypes) const; |
|
181 // Recognize data |
|
182 IMPORT_C TInt RecognizeData(const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const; |
|
183 IMPORT_C TInt RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const; |
|
184 IMPORT_C TInt RecognizeData(const RFile& aFile, TDataRecognitionResult& aDataType) const; |
|
185 IMPORT_C TInt RecognizeSpecificData(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType, TBool& aResult) const; |
|
186 IMPORT_C TInt RecognizeSpecificData(const RFile& aFile, const TDataType& aDataType, TBool& aResult) const; |
|
187 // Recognize files |
|
188 IMPORT_C TInt RecognizeFilesL(const TDesC& aPath, CDataRecognitionResultArray& aResult) const; |
|
189 IMPORT_C void RecognizeFilesL(const TDesC& aPath, CDataRecognitionResultArray& aResult, TRequestStatus& aStatus); |
|
190 IMPORT_C TInt RecognizeFilesL(const TDesC& aPath, const TDesC8& aDataType, CDataRecognitionResultArray& aResult) const; |
|
191 IMPORT_C void RecognizeFilesL(const TDesC& aPath, const TDesC8& aDataType, CDataRecognitionResultArray& aResult, TRequestStatus& aStatus); |
|
192 IMPORT_C void CancelRecognizeFiles(); |
|
193 // Get application registered as capable of handling specified MIME data type |
|
194 IMPORT_C TInt AppForDataType(const TDataType& aDataType, TUid& aAppUid) const; |
|
195 IMPORT_C TInt AppForDocument(const TDesC& aFileName, TUid& aAppUid, TDataType& aDataType) const; |
|
196 IMPORT_C TInt AppForDocument(const RFile& aFile, TUid& aAppUid, TDataType& aDataType) const; |
|
197 // Register an applicatoin as capable of handling a specified MIME data type |
|
198 IMPORT_C TInt InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid); |
|
199 IMPORT_C TInt InsertDataMappingIfHigher(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid, TBool& aInserted); |
|
200 IMPORT_C TInt DeleteDataMapping(const TDataType& aDataType); |
|
201 // Amount of data used for recognition |
|
202 IMPORT_C TInt SetMaxDataBufSize(TInt aBufSize); |
|
203 IMPORT_C TInt GetMaxDataBufSize(TInt& aBufSize) const; |
|
204 IMPORT_C TInt GetPreferredBufSize(TInt& aPreferredBufSize) const; |
|
205 public: // Support for service-applications |
|
206 IMPORT_C CApaAppServiceInfoArray* GetAppServicesLC(TUid aAppUid) const; |
|
207 IMPORT_C CApaAppServiceInfoArray* GetServiceImplementationsLC(TUid aServiceUid) const; |
|
208 IMPORT_C CApaAppServiceInfoArray* GetServiceImplementationsLC(TUid aServiceUid, const TDataType& aDataType) const; |
|
209 IMPORT_C void GetAppServicesL(TUid aAppUid, CArrayFixFlat<TUid>& aServiceUids) const; |
|
210 IMPORT_C CApaAppServiceInfoArray* GetAppServiceOpaqueDataLC(TUid aAppUid, TUid aServiceUid) const; |
|
211 IMPORT_C TInt AppForDataTypeAndService(const TDataType& aDataType, TUid aServiceUid, TUid& aAppUid) const; |
|
212 IMPORT_C TInt AppForDocumentAndService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const; |
|
213 IMPORT_C TInt AppForDocumentAndService(const RFile& aFile, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const; |
|
214 public: // for internal use only |
|
215 IMPORT_C TInt InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid, TUid aServiceUid); |
|
216 IMPORT_C TInt DeleteDataMapping(const TDataType& aDataType, TUid aServiceUid); |
|
217 IMPORT_C void NotifyOnDataMappingChange(TRequestStatus& aRequestStatus); |
|
218 IMPORT_C void CancelNotifyOnDataMappingChange(); |
|
219 IMPORT_C TInt GetAppByDataType(const TDataType& aDataType, TUid aServiceUid, TUid& aAppUid) const; |
|
220 public: // for internal use only |
|
221 IMPORT_C static void SetFsSessionL(RFs& aFsSession); |
|
222 IMPORT_C static void ClearFsSession(); |
|
223 IMPORT_C static RFs* FsSession(); |
|
224 IMPORT_C void SetNotify(TBool aCompleteImmediatelyIfNoScanImpendingOrInProgress, TRequestStatus& aStatus); |
|
225 IMPORT_C void CancelNotify(); |
|
226 public: // for internal use only |
|
227 // Support for non-native applications |
|
228 IMPORT_C void RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable); |
|
229 IMPORT_C void DeregisterNonNativeApplicationTypeL(TUid aApplicationType); |
|
230 IMPORT_C void PrepareNonNativeApplicationsUpdatesL(); |
|
231 IMPORT_C void RegisterNonNativeApplicationL(TUid aApplicationType, const TDriveUnit& aDrive, CApaRegistrationResourceFileWriter& aRegistrationResourceFile, CApaLocalisableResourceFileWriter* aLocalisableResourceFile, const RFile* aIconFile); |
|
232 IMPORT_C void DeregisterNonNativeApplicationL(TUid aApplication); |
|
233 IMPORT_C void CommitNonNativeApplicationsUpdatesL(); |
|
234 IMPORT_C TInt RollbackNonNativeApplicationsUpdates(); |
|
235 IMPORT_C TInt GetAppType(TUid& aTypeUid, TUid aAppUid) const; |
|
236 IMPORT_C TInt ForceRegistration(const RPointerArray<TDesC>& aRegFiles); |
|
237 private: // Reserved for future use |
|
238 IMPORT_C virtual void RApaLsSession_Reserved1(); |
|
239 IMPORT_C virtual void RApaLsSession_Reserved2(); |
|
240 |
|
241 public: |
|
242 /** |
|
243 @publishedPartner |
|
244 @released |
|
245 */ |
|
246 IMPORT_C void ForceCommitNonNativeApplicationsUpdatesL(); |
|
247 |
|
248 private: |
|
249 void DoGetAppOwnedFilesL(CDesCArray& aArrayToFill, TUid aAppUid) const; |
|
250 void DoGetAppViewsL(CApaAppViewArray& aArrayToFill, TUid aAppUid) const; |
|
251 void DoGetAppIconSizesL(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const; |
|
252 TInt DoAppCount(TInt& aCount,TInt aCommand) const; |
|
253 void FetchArrayL(MArrayFiller& aArrayFiller,TUid aAppUid, TInt aOpcode, TInt aInitialBufSize) const; |
|
254 CBufBase* GetServiceBufferLC(TInt aOpcode, TUid aUid1, TUid aUid2 = KNullUid) const; |
|
255 CBufBase* GetServiceBufferLC(TInt aOpcode, TUid aUid1, const TDataType& aDataType) const; |
|
256 TInt SendReceiveWithReconnect(TInt aFunction,const TIpcArgs& aIpcArgs) const; |
|
257 TInt TransferAndInternalizeDataL(const TDesC& aPath, const TInt aRequiredBufferSize, CDataRecognitionResultArray& aResult) const; |
|
258 TInt GetExecutableNameAndNewOpaqueData(TDes& aNativeExecutableName, TDes& aLogicalExecutableName, HBufC8*& aOpaqueData, TIpcArgs& aIpcArgs, TInt aOpcode) const; |
|
259 TInt GetNewOpaqueData(HBufC8*& aOpaqueData, TInt aLengthOfOpaqueData) const; |
|
260 TInt StartApplicationPassingFileHandle(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const RFile& aFile, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
261 TInt StartApplicationPassingDocumentName(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const TDesC& aDocumentName, TThreadId& aThreadId,TApaCommand aCommand, TRequestStatus* aRequestStatusForRendezvous); |
|
262 void DoStartApplicationL(const TDesC& aNativeExecutableName, const CApaCommandLine& aCommandLine, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
263 TInt DoAppForDocumentOptionallySpecifyingService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const; |
|
264 TInt DoAppForDocumentOptionallySpecifyingService(const RFile& aFile, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const; |
|
265 TInt GetNewBufferFromFile(HBufC8*& aBuffer, const TDesC& aFileName) const; |
|
266 TInt DoStartApp(const CApaCommandLine& aCommandLine, TThreadId* aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
267 void DoStartAppL(const CApaCommandLine& aCommandLine, TThreadId* aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
268 static void GetMainThreadIdL(TThreadId& aThreadId, const RProcess& aProcess); |
|
269 static void DeletePointerToPointerToTAny(TAny* aPointerToPointerToTAny); |
|
270 static CBufFlat* CreateRegFilesBufferL(const RPointerArray<TDesC>& aRegFiles); |
|
271 static void CleanupOperation(TAny* aAny); |
|
272 |
|
273 private: // data |
|
274 friend class CApaLsSessionExtension; |
|
275 CApaLsSessionExtension* iExtension; |
|
276 }; |
|
277 |
|
278 |
|
279 #endif // __APGCLI_H__ |
|
280 |