Program: 94736
Project: 94736
Buggy source:
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,MavLinkDrone drone){
  Bundle extrasBundle=null;
  String droneEvent=null;
  final List<Pair<String,Bundle>> attributesInfo=new ArrayList<>();
switch (event) {
case DISCONNECTED:
    context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_DISCONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId));
  droneEvent=AttributeEvent.STATE_DISCONNECTED;
break;
case GUIDEDPOINT:
droneEvent=AttributeEvent.GUIDED_POINT_UPDATED;
break;
case RADIO:
droneEvent=AttributeEvent.SIGNAL_UPDATED;
break;
case RC_IN:
break;
case RC_OUT:
break;
case ARMING_STARTED:
case ARMING:
droneEvent=AttributeEvent.STATE_ARMING;
break;
case AUTOPILOT_WARNING:
extrasBundle=new Bundle(1);
extrasBundle.putString(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID,drone.getState().getErrorId());
droneEvent=AttributeEvent.AUTOPILOT_ERROR;
break;
case MODE:
droneEvent=AttributeEvent.STATE_VEHICLE_MODE;
break;
case ATTITUDE:
case ORIENTATION:
droneEvent=AttributeEvent.ATTITUDE_UPDATED;
break;
case SPEED:
droneEvent=AttributeEvent.SPEED_UPDATED;
break;
case BATTERY:
droneEvent=AttributeEvent.BATTERY_UPDATED;
break;
case STATE:
droneEvent=AttributeEvent.STATE_UPDATED;
break;
case MISSION_UPDATE:
droneEvent=AttributeEvent.MISSION_UPDATED;
break;
case MISSION_RECEIVED:
droneEvent=AttributeEvent.MISSION_RECEIVED;
break;
case FIRMWARE:
case TYPE:
droneEvent=AttributeEvent.TYPE_UPDATED;
break;
case HOME:
droneEvent=AttributeEvent.HOME_UPDATED;
break;
case GPS:
droneEvent=AttributeEvent.GPS_POSITION;
break;
case GPS_FIX:
droneEvent=AttributeEvent.GPS_FIX;
break;
case GPS_COUNT:
droneEvent=AttributeEvent.GPS_COUNT;
break;
case CALIBRATION_IMU:
final String calIMUMessage=drone.getCalibrationSetup().getMessage();
extrasBundle=new Bundle(1);
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,calIMUMessage);
droneEvent=AttributeEvent.CALIBRATION_IMU;
break;
case CALIBRATION_TIMEOUT:
final AccelCalibration accelCalibration=drone.getCalibrationSetup();
final String message=accelCalibration.getMessage();
if (accelCalibration.isCalibrating() && TextUtils.isEmpty(message)) {
accelCalibration.cancelCalibration();
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
}
 else {
extrasBundle=new Bundle(1);
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,message);
droneEvent=AttributeEvent.CALIBRATION_IMU_TIMEOUT;
}
break;
case HEARTBEAT_TIMEOUT:
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
break;
case CONNECTING:
droneEvent=AttributeEvent.STATE_CONNECTING;
break;
case CONNECTION_FAILED:
disconnect();
onConnectionFailed("String_Node_Str");
break;
case HEARTBEAT_FIRST:
final Bundle heartBeatExtras=new Bundle(1);
heartBeatExtras.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,drone.getMavlinkVersion());
attributesInfo.add(Pair.create(AttributeEvent.HEARTBEAT_FIRST,heartBeatExtras));
case CONNECTED:
final ConnectionParameter sanitizedParameter=new ConnectionParameter(connectionParams.getConnectionType(),connectionParams.getParamsBundle(),null);
context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_CONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId).putExtra(GCSEvent.EXTRA_VEHICLE_CONNECTION_PARAMETER,sanitizedParameter));
attributesInfo.add(Pair.<String,Bundle>create(AttributeEvent.STATE_CONNECTED,null));
break;
case HEARTBEAT_RESTORED:
extrasBundle=new Bundle(1);
extrasBundle.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,drone.getMavlinkVersion());
droneEvent=AttributeEvent.HEARTBEAT_RESTORED;
break;
case MISSION_SENT:
droneEvent=AttributeEvent.MISSION_SENT;
break;
case INVALID_POLYGON:
break;
case MISSION_WP_UPDATE:
final int currentWaypoint=drone.getMissionStats().getCurrentWP();
extrasBundle=new Bundle(1);
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_CURRENT_WAYPOINT,currentWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_UPDATED;
break;
case MISSION_WP_REACHED:
final int lastReachedWaypoint=drone.getMissionStats().getLastReachedWP();
extrasBundle=new Bundle(1);
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_LAST_REACHED_WAYPOINT,lastReachedWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_REACHED;
break;
case ALTITUDE:
droneEvent=AttributeEvent.ALTITUDE_UPDATED;
break;
case WARNING_SIGNAL_WEAK:
droneEvent=AttributeEvent.SIGNAL_WEAK;
break;
case WARNING_NO_GPS:
droneEvent=AttributeEvent.WARNING_NO_GPS;
break;
case MAGNETOMETER:
break;
case FOOTPRINT:
droneEvent=AttributeEvent.CAMERA_FOOTPRINTS_UPDATED;
break;
case EKF_STATUS_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_REPORT;
break;
case EKF_POSITION_STATE_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_POSITION;
break;
}
if (droneEvent != null) {
notifyAttributeUpdate(droneEvent,extrasBundle);
}
if (!attributesInfo.isEmpty()) {
notifyAttributeUpdate(attributesInfo);
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,MavLinkDrone drone){
  Bundle extrasBundle=null;
  String droneEvent=null;
  final List<Pair<String,Bundle>> attributesInfo=new ArrayList<>();
switch (event) {
case DISCONNECTED:
    context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_DISCONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId));
  droneEvent=AttributeEvent.STATE_DISCONNECTED;
break;
case GUIDEDPOINT:
droneEvent=AttributeEvent.GUIDED_POINT_UPDATED;
break;
case RADIO:
droneEvent=AttributeEvent.SIGNAL_UPDATED;
break;
case RC_IN:
break;
case RC_OUT:
break;
case ARMING_STARTED:
case ARMING:
droneEvent=AttributeEvent.STATE_ARMING;
break;
case AUTOPILOT_WARNING:
extrasBundle=new Bundle(1);
extrasBundle.putString(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID,drone.getState().getErrorId());
droneEvent=AttributeEvent.AUTOPILOT_ERROR;
break;
case MODE:
droneEvent=AttributeEvent.STATE_VEHICLE_MODE;
break;
case ATTITUDE:
case ORIENTATION:
droneEvent=AttributeEvent.ATTITUDE_UPDATED;
break;
case SPEED:
droneEvent=AttributeEvent.SPEED_UPDATED;
break;
case BATTERY:
droneEvent=AttributeEvent.BATTERY_UPDATED;
break;
case STATE:
droneEvent=AttributeEvent.STATE_UPDATED;
break;
case MISSION_UPDATE:
droneEvent=AttributeEvent.MISSION_UPDATED;
break;
case MISSION_RECEIVED:
droneEvent=AttributeEvent.MISSION_RECEIVED;
break;
case FIRMWARE:
case TYPE:
droneEvent=AttributeEvent.TYPE_UPDATED;
break;
case HOME:
droneEvent=AttributeEvent.HOME_UPDATED;
break;
case CALIBRATION_IMU:
final String calIMUMessage=drone.getCalibrationSetup().getMessage();
extrasBundle=new Bundle(1);
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,calIMUMessage);
droneEvent=AttributeEvent.CALIBRATION_IMU;
break;
case CALIBRATION_TIMEOUT:
final AccelCalibration accelCalibration=drone.getCalibrationSetup();
final String message=accelCalibration.getMessage();
if (accelCalibration.isCalibrating() && TextUtils.isEmpty(message)) {
accelCalibration.cancelCalibration();
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
}
 else {
extrasBundle=new Bundle(1);
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,message);
droneEvent=AttributeEvent.CALIBRATION_IMU_TIMEOUT;
}
break;
case HEARTBEAT_TIMEOUT:
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
break;
case CONNECTING:
droneEvent=AttributeEvent.STATE_CONNECTING;
break;
case CONNECTION_FAILED:
disconnect();
onConnectionFailed("String_Node_Str");
break;
case HEARTBEAT_FIRST:
final Bundle heartBeatExtras=new Bundle(1);
heartBeatExtras.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,drone.getMavlinkVersion());
attributesInfo.add(Pair.create(AttributeEvent.HEARTBEAT_FIRST,heartBeatExtras));
case CONNECTED:
final ConnectionParameter sanitizedParameter=new ConnectionParameter(connectionParams.getConnectionType(),connectionParams.getParamsBundle(),null);
context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_CONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId).putExtra(GCSEvent.EXTRA_VEHICLE_CONNECTION_PARAMETER,sanitizedParameter));
attributesInfo.add(Pair.<String,Bundle>create(AttributeEvent.STATE_CONNECTED,null));
break;
case HEARTBEAT_RESTORED:
extrasBundle=new Bundle(1);
extrasBundle.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,drone.getMavlinkVersion());
droneEvent=AttributeEvent.HEARTBEAT_RESTORED;
break;
case MISSION_SENT:
droneEvent=AttributeEvent.MISSION_SENT;
break;
case INVALID_POLYGON:
break;
case MISSION_WP_UPDATE:
final int currentWaypoint=drone.getMissionStats().getCurrentWP();
extrasBundle=new Bundle(1);
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_CURRENT_WAYPOINT,currentWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_UPDATED;
break;
case MISSION_WP_REACHED:
final int lastReachedWaypoint=drone.getMissionStats().getLastReachedWP();
extrasBundle=new Bundle(1);
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_LAST_REACHED_WAYPOINT,lastReachedWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_REACHED;
break;
case ALTITUDE:
droneEvent=AttributeEvent.ALTITUDE_UPDATED;
break;
case WARNING_SIGNAL_WEAK:
droneEvent=AttributeEvent.SIGNAL_WEAK;
break;
case WARNING_NO_GPS:
droneEvent=AttributeEvent.WARNING_NO_GPS;
break;
case MAGNETOMETER:
break;
case FOOTPRINT:
droneEvent=AttributeEvent.CAMERA_FOOTPRINTS_UPDATED;
break;
case EKF_STATUS_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_REPORT;
break;
case EKF_POSITION_STATE_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_POSITION;
break;
}
if (droneEvent != null) {
notifyAttributeUpdate(droneEvent,extrasBundle);
}
if (!attributesInfo.isEmpty()) {
notifyAttributeUpdate(attributesInfo);
}
}