diff options
-rw-r--r-- | sdl_android/src/main/java/com/smartdevicelink/api/BaseSubManager.java | 12 | ||||
-rw-r--r-- | sdl_android/src/main/java/com/smartdevicelink/api/SdlManager.java | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/sdl_android/src/main/java/com/smartdevicelink/api/BaseSubManager.java b/sdl_android/src/main/java/com/smartdevicelink/api/BaseSubManager.java index 8a6bf9459..66c7f309a 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/api/BaseSubManager.java +++ b/sdl_android/src/main/java/com/smartdevicelink/api/BaseSubManager.java @@ -18,7 +18,7 @@ public abstract class BaseSubManager { // states - if this gets more complicated we can move elsewhere private int state; private final Object STATE_LOCK = new Object(); - public static final int SETTING_UP = 0x00, READY = 0x30, SHUTDOWN = 0x60; + public static final int SETTING_UP = 0x00, READY = 0x30, SHUTDOWN = 0x60, ERROR = 0x90; protected final ISdl internalInterface; private CompletionListener completionListener; @@ -28,13 +28,13 @@ public abstract class BaseSubManager { } /** - * Called to start - * @param listener + * Starts up a BaseSubManager, and calls provided callback once BaseSubManager is done setting up or failed setup. + * @param listener CompletionListener that is called once the BaseSubManager's state is READY or ERROR */ public void start(CompletionListener listener){ this.completionListener = listener; - if(state == READY && completionListener != null){ - completionListener.onComplete(true); + if((state == READY || state == ERROR) && completionListener != null){ + completionListener.onComplete(state == READY); completionListener = null; } } @@ -53,7 +53,7 @@ public abstract class BaseSubManager { if(state == READY && completionListener != null){ completionListener.onComplete(true); completionListener = null; - }else if(state == SHUTDOWN && completionListener != null){ + }else if(state == ERROR && completionListener != null){ completionListener.onComplete(false); completionListener = null; } diff --git a/sdl_android/src/main/java/com/smartdevicelink/api/SdlManager.java b/sdl_android/src/main/java/com/smartdevicelink/api/SdlManager.java index a34a2819b..8a51eb6b6 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/api/SdlManager.java +++ b/sdl_android/src/main/java/com/smartdevicelink/api/SdlManager.java @@ -451,14 +451,15 @@ public class SdlManager{ // STARTUP /** - * Starts up a SdlManager, and calls provided callback once all sub managers are no longer SETTING_UP - * @param listener CompletionListener that is called once the SdlManager is READY or SHUTDOWN + * Starts up a SdlManager, and calls provided callback called once all BaseSubManagers are done setting up + * @param listener CompletionListener that is called once the SdlManager state transitions + * from SETTING_UP to READY or ERROR */ public void start(CompletionListener listener){ if(listener == null){ return; } - if(state != BaseSubManager.SETTING_UP && state != -1){ + if(state == BaseSubManager.READY || state == BaseSubManager.ERROR){ listener.onComplete(state == BaseSubManager.READY); initListener = null; }else{ |