Display machines as they are being refreshed

This commit is contained in:
Cameron Gutman
2014-11-08 13:14:35 -08:00
parent 2df2f850d5
commit 21e46a5c3b
5 changed files with 27 additions and 7 deletions

View File

@@ -99,15 +99,17 @@ public class ComputerDatabaseManager {
details.macAddress = c.getString(4);
// This signifies we don't have dynamic state (like pair state)
details.state = ComputerDetails.State.UNKNOWN;
details.state = ComputerDetails.State.UNKNOWN;
details.reachability = ComputerDetails.Reachability.UNKNOWN;
// If a field is corrupt or missing, skip the database entry
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
details.macAddress == null) {
continue;
}
computerList.add(details);
computerList.add(details);
}
c.close();
@@ -151,6 +153,9 @@ public class ComputerDatabaseManager {
details.macAddress = c.getString(4);
c.close();
details.state = ComputerDetails.State.UNKNOWN;
details.reachability = ComputerDetails.Reachability.UNKNOWN;
// If a field is corrupt or missing, delete the database entry
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||

View File

@@ -151,6 +151,9 @@ public class ComputerManagerService extends Service {
for (ComputerDetails computer : computerList) {
// This polling thread might already be there
if (!pollingThreads.containsKey(computer)) {
// Report this computer initially
listener.notifyComputerUpdated(computer);
Thread t = createPollingThread(computer);
pollingThreads.put(computer, t);
t.start();