alshabib
Committed by Gerrit Code Review

fixing bug that would not let device come back online

Change-Id: Ie2cc9c35159320d5abab0b38984baecc2928b00e
...@@ -427,6 +427,7 @@ public class GossipDeviceStore ...@@ -427,6 +427,7 @@ public class GossipDeviceStore
427 427
428 // Primary providers can respond to all changes, but ancillary ones 428 // Primary providers can respond to all changes, but ancillary ones
429 // should respond only to annotation changes. 429 // should respond only to annotation changes.
430 + DeviceEvent event = null;
430 if ((providerId.isAncillary() && annotationsChanged) || 431 if ((providerId.isAncillary() && annotationsChanged) ||
431 (!providerId.isAncillary() && (propertiesChanged || annotationsChanged))) { 432 (!providerId.isAncillary() && (propertiesChanged || annotationsChanged))) {
432 boolean replaced = devices.replace(newDevice.id(), oldDevice, newDevice); 433 boolean replaced = devices.replace(newDevice.id(), oldDevice, newDevice);
...@@ -436,6 +437,10 @@ public class GossipDeviceStore ...@@ -436,6 +437,10 @@ public class GossipDeviceStore
436 providerId, oldDevice, devices.get(newDevice.id()) 437 providerId, oldDevice, devices.get(newDevice.id())
437 , newDevice); 438 , newDevice);
438 } 439 }
440 +
441 + event = new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
442 + }
443 +
439 if (!providerId.isAncillary()) { 444 if (!providerId.isAncillary()) {
440 boolean wasOnline = availableDevices.contains(newDevice.id()); 445 boolean wasOnline = availableDevices.contains(newDevice.id());
441 markOnline(newDevice.id(), newTimestamp); 446 markOnline(newDevice.id(), newTimestamp);
...@@ -443,10 +448,7 @@ public class GossipDeviceStore ...@@ -443,10 +448,7 @@ public class GossipDeviceStore
443 notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null)); 448 notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null));
444 } 449 }
445 } 450 }
446 - 451 + return event;
447 - return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
448 - }
449 - return null;
450 } 452 }
451 453
452 @Override 454 @Override
......