105 iApplicationIcons = aApplicationIcons; |
105 iApplicationIcons = aApplicationIcons; |
106 iComponentSize = aComponentSize; |
106 iComponentSize = aComponentSize; |
107 iIconDir = aIconDir; |
107 iIconDir = aIconDir; |
108 iComponentIcon = aComponentIcon; |
108 iComponentIcon = aComponentIcon; |
109 |
109 |
110 if (iHandle == 0) |
110 checkHandle(); |
111 { |
|
112 InstallerException.internalError( |
|
113 "SifNotifier.notifyStart: notifier has not been initialized"); |
|
114 } |
|
115 int ret = _notifyStart( |
111 int ret = _notifyStart( |
116 iHandle, aGlobalComponentId, aComponentName, |
112 iHandle, aGlobalComponentId, aComponentName, |
117 aApplicationNames, aApplicationIcons, |
113 aApplicationNames, aApplicationIcons, |
118 aComponentSize, aIconDir, aComponentIcon); |
114 aComponentSize, aIconDir, aComponentIcon); |
119 if (ret < 0) |
115 if (ret < 0) |
120 { |
116 { |
121 Log.logError("Notifying SIF start failed with code " + ret + |
117 Log.log("Notifying SIF start failed with code " + ret + |
122 ", " + getInfoString()); |
118 ", " + getInfoString()); |
123 InstallerException.internalError( |
119 InstallerException.internalError( |
124 "Notifying SIF start failed with code " + ret); |
120 "Notifying SIF start failed with code " + ret); |
125 } |
121 } |
126 else |
122 else |
127 { |
123 { |
136 * @throws InstallerException in case an error occurs |
132 * @throws InstallerException in case an error occurs |
137 */ |
133 */ |
138 public void notifyEnd( |
134 public void notifyEnd( |
139 int aErrCategory, int aErrCode, String aErrMsg, String aErrMsgDetails) |
135 int aErrCategory, int aErrCode, String aErrMsg, String aErrMsgDetails) |
140 { |
136 { |
141 if (iHandle == 0) |
137 checkHandle(); |
142 { |
|
143 InstallerException.internalError( |
|
144 "SifNotifier.notifyEnd: notifier has not been initialized"); |
|
145 } |
|
146 if (aErrCategory == 0 && iLastProgressSent < MAX_PROGRESS) |
138 if (aErrCategory == 0 && iLastProgressSent < MAX_PROGRESS) |
147 { |
139 { |
148 // Before sending end notification, update progress to max if |
140 // Before sending end notification, update progress to max if |
149 // operation was successful and max progress notification has |
141 // operation was successful and max progress notification has |
150 // not yet been sent. |
142 // not yet been sent. |
160 ", ErrCode: " + aErrCode + |
152 ", ErrCode: " + aErrCode + |
161 ", ErrMsg: " + aErrMsg + |
153 ", ErrMsg: " + aErrMsg + |
162 ", ErrMsgDetails: " + aErrMsgDetails; |
154 ", ErrMsgDetails: " + aErrMsgDetails; |
163 if (ret < 0) |
155 if (ret < 0) |
164 { |
156 { |
165 Log.logError("Notifying SIF end failed with code " + ret + |
157 Log.log("Notifying SIF end failed with code " + ret + |
166 ", " + getInfoString() + ", " + logMsg); |
158 ", " + getInfoString() + ", " + logMsg); |
167 InstallerException.internalError( |
159 InstallerException.internalError( |
168 "Notifying SIF end failed with code " + ret); |
160 "Notifying SIF end failed with code " + ret); |
169 } |
161 } |
170 else |
162 else |
171 { |
163 { |
182 { |
174 { |
183 if (!iNotifyProgressAllowed) |
175 if (!iNotifyProgressAllowed) |
184 { |
176 { |
185 return; |
177 return; |
186 } |
178 } |
187 if (iHandle == 0) |
179 checkHandle(); |
188 { |
|
189 InstallerException.internalError( |
|
190 "SifNotifier.notifyProgress: notifier has not been initialized"); |
|
191 } |
|
192 if (aSubOperation == SUB_OP_NO) |
180 if (aSubOperation == SUB_OP_NO) |
193 { |
181 { |
194 iLastProgressSent = aCurrent; |
182 iLastProgressSent = aCurrent; |
195 } |
183 } |
196 int ret = _notifyProgress( |
184 int ret = _notifyProgress( |
200 "SubOp: " + aSubOperation + |
188 "SubOp: " + aSubOperation + |
201 ", Current: " + aCurrent + |
189 ", Current: " + aCurrent + |
202 ", Total: " + aTotal; |
190 ", Total: " + aTotal; |
203 if (ret < 0) |
191 if (ret < 0) |
204 { |
192 { |
205 Log.logError("Notifying SIF progress failed with code " + ret + |
193 Log.log("Notifying SIF progress failed with code " + ret + |
206 ", " + getInfoString() + ", " + logMsg); |
194 ", " + getInfoString() + ", " + logMsg); |
207 InstallerException.internalError( |
195 InstallerException.internalError( |
208 "Notifying SIF progress failed with code " + ret); |
196 "Notifying SIF progress failed with code " + ret); |
209 } |
197 } |
210 else |
198 else |
211 { |
199 { |
219 * |
207 * |
220 * @throws InstallerException in case an error occurs |
208 * @throws InstallerException in case an error occurs |
221 */ |
209 */ |
222 public void destroy() |
210 public void destroy() |
223 { |
211 { |
224 if (iHandle == 0) |
212 checkHandle(); |
225 { |
|
226 InstallerException.internalError( |
|
227 "SifNotifier.destroy: notifier has not been initialized"); |
|
228 } |
|
229 int ret = _destroy(iHandle); |
213 int ret = _destroy(iHandle); |
230 if (ret < 0) |
214 if (ret < 0) |
231 { |
215 { |
232 InstallerException.internalError( |
216 InstallerException.internalError( |
233 "Destroying SIF notifier failed with code " + ret); |
217 "Destroying SIF notifier failed with code " + ret); |
261 } |
245 } |
262 iHandle = ret; |
246 iHandle = ret; |
263 } |
247 } |
264 |
248 |
265 /*** ----------------------------- PRIVATE ---------------------------- */ |
249 /*** ----------------------------- PRIVATE ---------------------------- */ |
|
250 |
|
251 /** |
|
252 * Checks if notifier instance has been initialized. |
|
253 * @throws InstallerException if notifier has not been initialized |
|
254 */ |
|
255 private void checkHandle() |
|
256 { |
|
257 if (iHandle == 0) |
|
258 { |
|
259 InstallerException.internalError( |
|
260 "SifNotifier.destroy: notifier has not been initialized"); |
|
261 } |
|
262 } |
266 |
263 |
267 /** |
264 /** |
268 * Returns notification info string used in logging. |
265 * Returns notification info string used in logging. |
269 */ |
266 */ |
270 private String getInfoString() |
267 private String getInfoString() |