Skip to content

Commit

Permalink
Fix OffRoute engine cleared before service shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
danesfeder committed Aug 3, 2018
1 parent 93cf745 commit 3c41a7a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public void onDestroy(boolean isChangingConfigurations) {
deactivateInstructionPlayer();
endNavigation();
}
navigation.setCameraEngine(null);
navigationViewEventDispatcher = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ public void onDestroy() {
removeProgressChangeListener(null);
removeMilestoneEventListener(null);
removeNavigationEventListener(null);
navigationEngineFactory.clearEngines();
}

// Public APIs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ void updateCameraEngine(Camera cameraEngine) {
this.cameraEngine = cameraEngine;
}

void clearEngines() {
offRouteEngine = null;
fasterRouteEngine = null;
snapEngine = null;
cameraEngine = null;
}

private void initializeDefaultEngines() {
cameraEngine = new SimpleCamera();
snapEngine = new SnapToRoute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.junit.Test;

import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;

public class NavigationEngineFactoryTest {

Expand Down Expand Up @@ -35,42 +34,6 @@ public void onInitialization_defaultFasterRouteEngineIsCreated() {
assertNotNull(provider.retrieveFasterRouteEngine());
}

@Test
public void clearEngines_cameraEngineIsRemoved() {
NavigationEngineFactory provider = new NavigationEngineFactory();

provider.clearEngines();

assertNull(provider.retrieveCameraEngine());
}

@Test
public void clearEngines_offRouteEngineIsRemoved() {
NavigationEngineFactory provider = new NavigationEngineFactory();

provider.clearEngines();

assertNull(provider.retrieveOffRouteEngine());
}

@Test
public void clearEngines_snapEngineIsRemoved() {
NavigationEngineFactory provider = new NavigationEngineFactory();

provider.clearEngines();

assertNull(provider.retrieveSnapEngine());
}

@Test
public void clearEngines_fasterRouteEngineIsRemoved() {
NavigationEngineFactory provider = new NavigationEngineFactory();

provider.clearEngines();

assertNull(provider.retrieveFasterRouteEngine());
}

@Test
public void updateFasterRouteEngine_ignoresNull() {
NavigationEngineFactory provider = new NavigationEngineFactory();
Expand Down

0 comments on commit 3c41a7a

Please sign in to comment.