171 { |
171 { |
172 if (userPromptAllowed) |
172 if (userPromptAllowed) |
173 { |
173 { |
174 if (iSilent) |
174 if (iSilent) |
175 { |
175 { |
176 // Do not prompt the user in case of silent installation |
176 // Do not prompt the user in case of silent installation. |
177 // -> don't enforce security, just query the permission |
|
178 // to see if it is not allowed |
|
179 int permissionResult = |
177 int permissionResult = |
180 iAccessController.checkPermission(aPermission.toString()); |
178 iAccessController.checkPermission(aPermission.toString()); |
181 Log.log("ApplicationUtilsImpl.checkPermission: appUid: " + |
179 Log.log("ApplicationUtilsImpl.checkPermission: appUid: " + |
182 aAppUid + ", " + aPermission.toString() + |
180 aAppUid + ", " + aPermission.toString() + |
183 " result " + permissionResult); |
181 " result " + permissionResult); |
188 "Permission " + aPermission.toString() + " not allowed"); |
186 "Permission " + aPermission.toString() + " not allowed"); |
189 } |
187 } |
190 } |
188 } |
191 else |
189 else |
192 { |
190 { |
193 // Not a silent installation -> enforce security (an user |
191 // Not a silent installation, display user prompt. |
194 // prompt might be displayed) |
|
195 iAccessController.checkPermission(aPermission); |
192 iAccessController.checkPermission(aPermission); |
196 Log.log("ApplicationUtilsImpl.checkPermission: appUid: " + |
193 Log.log("ApplicationUtilsImpl.checkPermission: appUid: " + |
197 aAppUid + ", " + aPermission.toString() + " ok"); |
194 aAppUid + ", " + aPermission.toString() + " ok"); |
198 } |
195 } |
199 } |
196 } |
200 else |
197 else |
201 { |
198 { |
202 // No user prompt allowed for this permission -> don't enforce |
199 // No user prompt allowed for this permission. |
203 // security, just query the permission to see if it is not |
|
204 // allowed |
|
205 int permissionResult = |
200 int permissionResult = |
206 iAccessController.checkPermission(aPermission.toString()); |
201 iAccessController.checkPermission(aPermission.toString()); |
207 Log.log("ApplicationUtilsImpl.checkPermission: appUid: " + |
202 Log.log("ApplicationUtilsImpl.checkPermission: appUid: " + |
208 aAppUid + ", " + aPermission.toString() + |
203 aAppUid + ", " + aPermission.toString() + |
209 " result " + permissionResult); |
204 " result " + permissionResult); |
210 if (permissionResult == 0) |
205 if (permissionResult <= 0) |
211 { |
206 { |
212 // Permission is denied |
207 // Permission is either denied or requires user prompt. |
213 throw new AccessControlException( |
208 throw new AccessControlException( |
214 "Permission " + aPermission.toString() + " not allowed"); |
209 "Permission " + aPermission.toString() + " not allowed"); |
215 } |
210 } |
216 } |
211 } |
217 } |
212 } |