diff options
author | Robert Schuster <thebohemian@gmx.net> | 2011-05-20 12:38:21 +0200 |
---|---|---|
committer | BogDan Vatra <bog_dan_ro@yahoo.com> | 2011-07-26 10:24:05 +0300 |
commit | 92996556db807995e204f2ea1f7405c6de4dfa4a (patch) | |
tree | ccae9d426c9dbaf6947aa941e206f32b76ec9acf /Ministro | |
parent | de81fab5be1a2bb17c039dce120b6c05f90a1243 (diff) |
MinistroService.java: Extracted onBind() implementation into own method.
(onBind): Moved implementation into its own method.
(checkModulesImpl): New method for dealing with the modules check.
Diffstat (limited to 'Ministro')
-rw-r--r-- | Ministro/src/eu/licentia/necessitas/ministro/MinistroService.java | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/Ministro/src/eu/licentia/necessitas/ministro/MinistroService.java b/Ministro/src/eu/licentia/necessitas/ministro/MinistroService.java index bea5f98..19585e0 100644 --- a/Ministro/src/eu/licentia/necessitas/ministro/MinistroService.java +++ b/Ministro/src/eu/licentia/necessitas/ministro/MinistroService.java @@ -301,39 +301,56 @@ public class MinistroService extends Service { @Override public void checkModules(IMinistroCallback callback, String[] modules, String appName, int ministroApiLevel, int necessitasApiLevel) throws RemoteException { + checkModules(callback, modules, appName, ministroApiLevel, necessitasApiLevel); + } + }; + } - if (ministroApiLevel<MINISTRO_MIN_API_LEVEL || ministroApiLevel>MINISTRO_MAX_API_LEVEL) - { - // panic !!! Ministro service is not compatible, user should upgrade Ministro package - return; - } + /** + * Implements the {@link IMinistro.Stub#checkModules(IMinistroCallback, String[], String, int, int)} + * service method. + * + * @param callback + * @param modules + * @param appName + * @param ministroApiLevel + * @param necessitasApiLevel + * @throws RemoteException + */ + final void checkModulesImpl(IMinistroCallback callback, + String[] modules, String appName, int ministroApiLevel, int necessitasApiLevel) throws RemoteException { - // check necessitasApiLevel !!! I'm pretty sure some people will completely ignore my warning - // and they will deploying apps to Android Market, so let's try to give them a chance. + if (ministroApiLevel<MINISTRO_MIN_API_LEVEL || ministroApiLevel>MINISTRO_MAX_API_LEVEL) + { + // panic !!! Ministro service is not compatible, user should upgrade Ministro package + return; + } - // this method is called by the activity client who needs modules. - ArrayList<String> notFoundModules = new ArrayList<String>(); - ArrayList<String> libraries = new ArrayList<String>(); - Collections.addAll(libraries, modules); - if (MinistroService.this.checkModules(libraries, notFoundModules)) - { - String[] libs = new String[libraries.size()]; - libs = libraries.toArray(libs); - callback.libs(libs, m_environmentVariables, m_applicationParams, 0, null);// if we have all modules downloaded just call back the activity client. - } - else - m_actions.add(new ActionStruct(callback, modules, notFoundModules, appName)); // if not, lets start an activity to do it. - } - }; + // check necessitasApiLevel !!! I'm pretty sure some people will completely ignore my warning + // and they will deploying apps to Android Market, so let's try to give them a chance. + + // this method is called by the activity client who needs modules. + ArrayList<String> notFoundModules = new ArrayList<String>(); + ArrayList<String> libraries = new ArrayList<String>(); + Collections.addAll(libraries, modules); + if (MinistroService.this.checkModules(libraries, notFoundModules)) + { + String[] libs = new String[libraries.size()]; + libs = libraries.toArray(libs); + callback.libs(libs, m_environmentVariables, m_applicationParams, 0, null);// if we have all modules downloaded just call back the activity client. + } + else + m_actions.add(new ActionStruct(callback, modules, notFoundModules, appName)); // if not, lets start an activity to do it. } + /** * Checks whether a given list of libraries are readily accessible (e.g. usable by a program). * * <p>If the <code>notFoundModules</code> argument is given, the method fills the list with * libraries that need to be retrieved first.</p> * - * @param requestedLibs + * @param libs * @param notFoundModules * @return */ |