Committed by
Gerrit Code Review
fixing bug that would not let device come back online
Change-Id: Ie2cc9c35159320d5abab0b38984baecc2928b00e
Showing
1 changed file
with
11 additions
and
9 deletions
| ... | @@ -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,17 +437,18 @@ public class GossipDeviceStore | ... | @@ -436,17 +437,18 @@ public class GossipDeviceStore |
| 436 | providerId, oldDevice, devices.get(newDevice.id()) | 437 | providerId, oldDevice, devices.get(newDevice.id()) |
| 437 | , newDevice); | 438 | , newDevice); |
| 438 | } | 439 | } |
| 439 | - if (!providerId.isAncillary()) { | ||
| 440 | - boolean wasOnline = availableDevices.contains(newDevice.id()); | ||
| 441 | - markOnline(newDevice.id(), newTimestamp); | ||
| 442 | - if (!wasOnline) { | ||
| 443 | - notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null)); | ||
| 444 | - } | ||
| 445 | - } | ||
| 446 | 440 | ||
| 447 | - return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null); | 441 | + event = new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null); |
| 448 | } | 442 | } |
| 449 | - return null; | 443 | + |
| 444 | + if (!providerId.isAncillary()) { | ||
| 445 | + boolean wasOnline = availableDevices.contains(newDevice.id()); | ||
| 446 | + markOnline(newDevice.id(), newTimestamp); | ||
| 447 | + if (!wasOnline) { | ||
| 448 | + notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null)); | ||
| 449 | + } | ||
| 450 | + } | ||
| 451 | + return event; | ||
| 450 | } | 452 | } |
| 451 | 453 | ||
| 452 | @Override | 454 | @Override | ... | ... |
-
Please register or login to post a comment