From 47b344a7eee3ffbd7d218b2de36a54a6854b407a Mon Sep 17 00:00:00 2001 From: "hyunsik.noh" Date: Thu, 24 Jan 2013 17:33:48 +0900 Subject: [PATCH] [Title] revert previous merged [Module]common [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] Change-Id: Icf837edd4c1e4e8c950503ac8a4590232339de52 --- .../src/org/tizen/sdblib/DeviceMonitor.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/org.tizen.common.sdblib/src/org/tizen/sdblib/DeviceMonitor.java b/org.tizen.common.sdblib/src/org/tizen/sdblib/DeviceMonitor.java index 5f57cda..f88a007 100644 --- a/org.tizen.common.sdblib/src/org/tizen/sdblib/DeviceMonitor.java +++ b/org.tizen.common.sdblib/src/org/tizen/sdblib/DeviceMonitor.java @@ -84,7 +84,7 @@ final class DeviceMonitor { mMainSdbConnection.close(); } } catch (IOException e) { - Log.e("sdb", "close main sdb connection failed:" + e); + Log.e("sdb", "close main sdb connection failed:" + e); } // wake up the secondary loop by closing the selector. @@ -144,14 +144,13 @@ final class DeviceMonitor { Log.e("DeviceMonitor", "sdb restart attempts: " + mRestartAttemptCount); } + waitABit(); } else { Log.d("DeviceMonitor", "connected to sdb for device monitoring"); } } - waitABit(); - - if (mMainSdbConnection != null) { + if (mMainSdbConnection != null && mMonitoring == false) { mMonitoring = sendDeviceListMonitoringRequest(); } @@ -190,7 +189,7 @@ final class DeviceMonitor { mMainSdbConnection.close(); } catch (IOException ioe) { // we can safely ignore that one. - Log.e("sdb", "close main sdb connection failed:" + ioe); + Log.e("sdb", "close main sdb connection failed:" + ioe); } mMainSdbConnection = null; } @@ -298,6 +297,7 @@ final class DeviceMonitor { // array to store the devices that must be queried for information. // it's important to not do it inside the synchronized loop as this could block // the whole workspace (this lock is acquired during build too). + ArrayList devicesToQuery = new ArrayList(); synchronized (mDevices) { // For each device in the current list, we look for a matching the new list. // * if we find it, we update the current object with whatever new information @@ -307,7 +307,7 @@ final class DeviceMonitor { // * if we do not find it, we remove it from the current list. // Once this is done, the new list contains device we aren't monitoring yet, so we // add them to the list, and start monitoring them. - for (int d = 0 ; d < mDevices.size() ; ) { + for (int d = 0 ; d < mDevices.size() ;) { Device device = mDevices.get(d); // look for a similar device in the new list. int count = newList.size(); @@ -327,7 +327,7 @@ final class DeviceMonitor { { device.checkArchitecture(); device.checkDeviceType(); - Log.d("DeviceMonitor", "updateDevices: " + device.getSerialNumber() + " changed state to onlined"); + Log.d("DeviceMonitor", "updateDevices: " + device.getSerialNumber() + " onlined"); device.update(Device.CHANGE_STATE); } } @@ -343,9 +343,8 @@ final class DeviceMonitor { removeDevice(device); mServer.deviceDisconnected(device); Log.d("DeviceMonitor", "updateDevices: " + device.getSerialNumber() + " off-lined"); - } - else - { + } else { + // process the next one d++; } } @@ -364,8 +363,9 @@ final class DeviceMonitor { // look for their build info. if (newDevice.isOnline()) { + devicesToQuery.add(newDevice); mServer.deviceConnected(newDevice); - Log.d("DeviceMonitor", "[New Device]: " + newDevice.getSerialNumber() + " newly connected."); + Log.d("DeviceMonitor", "updateDevices: " + newDevice.getSerialNumber() + " newly connected."); } } } @@ -392,7 +392,7 @@ final class DeviceMonitor { return Integer.parseInt(msg, 16); } catch (NumberFormatException nfe) { // we'll throw an exception below. - Log.e("sdb", "parse integer failed:" + nfe); + Log.e("sdb", "parse integer failed:" + nfe); } } @@ -422,7 +422,7 @@ final class DeviceMonitor { try { return new String(buffer, 0, buf.position(), SdbHelper.DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { - Log.e("sdb", "read buffer failed from socket:" + e); + Log.e("sdb", "read buffer failed from socket:" + e); } return null; -- 2.7.4