Program: 94716
Project: 94716
Buggy source:
@Override public void onLocationUpdate(Location location){
  if (location.isAccurate()) {
    final Home home=getHome();
    if (!home.isValid()) {
      updateCurrentState(ReturnToMeState.STATE_WAITING_FOR_VEHICLE_GPS);
      return;
    }
    final LatLongAlt homePosition=home.getCoordinate();
    final LatLongAlt locationCoord=location.getCoord();
    final float[] results=new float[3];
    android.location.Location.distanceBetween(homePosition.getLatitude(),homePosition.getLongitude(),locationCoord.getLatitude(),locationCoord.getLongitude(),results);
    final float displacement=results[0];
    if (displacement >= UPDATE_MINIMAL_DISPLACEMENT) {
      MavLinkDoCmds.setVehicleHome(droneMgr.getDrone(),new LatLongAlt(locationCoord.getLatitude(),locationCoord.getLongitude(),homePosition.getAltitude()),new AbstractCommandListener(){
        @Override public void onSuccess(){
          Timber.i("String_Node_Str",locationCoord.toString());
          droneMgr.executeAsyncAction(requestHomeUpdateAction,null);
          CommonApiUtils.postSuccessEvent(commandListener);
          updateCurrentState(ReturnToMeState.STATE_UPDATING_HOME);
        }
        @Override public void onError(        int executionError){
          Timber.e("String_Node_Str",executionError);
          CommonApiUtils.postErrorEvent(executionError,commandListener);
          updateCurrentState(ReturnToMeState.STATE_ERROR_UPDATING_HOME);
        }
        @Override public void onTimeout(){
          Timber.w("String_Node_Str");
          CommonApiUtils.postTimeoutEvent(commandListener);
          updateCurrentState(ReturnToMeState.STATE_ERROR_UPDATING_HOME);
        }
      }
);
    }
  }
 else {
    updateCurrentState(ReturnToMeState.STATE_USER_LOCATION_INACCURATE);
  }
}

Fixed version (ground truth):
@Override public void onLocationUpdate(Location location){
  if (location.isAccurate()) {
    final Home home=getHome();
    if (!home.isValid()) {
      updateCurrentState(ReturnToMeState.STATE_WAITING_FOR_VEHICLE_GPS);
      return;
    }
    final LatLongAlt homePosition=home.getCoordinate();
    final LatLongAlt locationCoord=location.getCoord();
    final float[] results=new float[3];
    android.location.Location.distanceBetween(homePosition.getLatitude(),homePosition.getLongitude(),locationCoord.getLatitude(),locationCoord.getLongitude(),results);
    final float displacement=results[0];
    if (displacement >= UPDATE_MINIMAL_DISPLACEMENT) {
      MavLinkDoCmds.setVehicleHome(droneMgr.getDrone(),new LatLongAlt(locationCoord.getLatitude(),locationCoord.getLongitude(),homePosition.getAltitude()),new AbstractCommandListener(){
        @Override public void onSuccess(){
          Timber.i("String_Node_Str",locationCoord.toString());
          droneMgr.getDrone().executeAsyncAction(requestHomeUpdateAction,null);
          CommonApiUtils.postSuccessEvent(commandListener);
          updateCurrentState(ReturnToMeState.STATE_UPDATING_HOME);
        }
        @Override public void onError(        int executionError){
          Timber.e("String_Node_Str",executionError);
          CommonApiUtils.postErrorEvent(executionError,commandListener);
          updateCurrentState(ReturnToMeState.STATE_ERROR_UPDATING_HOME);
        }
        @Override public void onTimeout(){
          Timber.w("String_Node_Str");
          CommonApiUtils.postTimeoutEvent(commandListener);
          updateCurrentState(ReturnToMeState.STATE_ERROR_UPDATING_HOME);
        }
      }
);
    }
  }
 else {
    updateCurrentState(ReturnToMeState.STATE_USER_LOCATION_INACCURATE);
  }
}