From 92996556db807995e204f2ea1f7405c6de4dfa4a Mon Sep 17 00:00:00 2001 From: Robert Schuster Date: Fri, 20 May 2011 12:38:21 +0200 Subject: MinistroService.java: Extracted onBind() implementation into own method. (onBind): Moved implementation into its own method. (checkModulesImpl): New method for dealing with the modules check. --- .../necessitas/ministro/MinistroService.java | 61 ++++++++++++++-------- 1 file changed, 39 insertions(+), 22 deletions(-) (limited to 'Ministro') 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 (ministroApiLevelMINISTRO_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 (ministroApiLevelMINISTRO_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 notFoundModules = new ArrayList(); - ArrayList libraries = new ArrayList(); - 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 notFoundModules = new ArrayList(); + ArrayList libraries = new ArrayList(); + 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). * *

If the notFoundModules argument is given, the method fills the list with * libraries that need to be retrieved first.

* - * @param requestedLibs + * @param libs * @param notFoundModules * @return */ -- cgit v1.2.3