From: gyeongseok.seo Date: Wed, 12 Jun 2013 06:48:52 +0000 (+0900) Subject: [Title] Fixed - SDB check first time device connection logic X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6917a63a36628720311dc402b51c20e048777b3c;p=sdk%2Fide%2Fcommon-eplugin.git [Title] Fixed - SDB check first time device connection logic [Desc.] [Issue] Change-Id: I628113ea92a96361550743cb3873e4e493768469 --- 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 e44d608..33664d9 100644 --- a/org.tizen.common.sdblib/src/org/tizen/sdblib/DeviceMonitor.java +++ b/org.tizen.common.sdblib/src/org/tizen/sdblib/DeviceMonitor.java @@ -61,7 +61,7 @@ extends AbstractServer /** * Devices to be monitored */ - protected final ArrayList devices = new ArrayList(); + protected ArrayList devices = null; private byte[] mLengthBuffer = new byte[4]; @@ -109,6 +109,13 @@ extends AbstractServer Device[] getDevices() { + while ( null == devices ) + { + try { + this.wait(); + } catch (InterruptedException e) { + } + } return devices.toArray( new Device[devices.size()] ); } @@ -249,6 +256,10 @@ extends AbstractServer // 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). final ArrayList devicesToQuery = new ArrayList(); + if (null == this.devices ) + { + this.devices = new ArrayList(); + } synchronized ( this ) { @@ -316,7 +327,9 @@ extends AbstractServer Log.d("DeviceMonitor", "updateDevices: " + newDevice.getSerialNumber() + " newly connected."); } } + this.notifyAll(); } + } newList.clear(); } diff --git a/org.tizen.common.sdblib/src/org/tizen/sdblib/SmartDevelopmentBridge.java b/org.tizen.common.sdblib/src/org/tizen/sdblib/SmartDevelopmentBridge.java index 4ef06b4..02771ce 100644 --- a/org.tizen.common.sdblib/src/org/tizen/sdblib/SmartDevelopmentBridge.java +++ b/org.tizen.common.sdblib/src/org/tizen/sdblib/SmartDevelopmentBridge.java @@ -345,13 +345,11 @@ SmartDevelopmentBridge * @see #hasInitialDeviceList() */ public IDevice[] getDevices() { - synchronized (sLock) { - if (deviceMonitor != null) { - return deviceMonitor.getDevices(); - } - } + if (deviceMonitor != null) { + return deviceMonitor.getDevices(); + } - return new IDevice[0]; + return new IDevice[0]; } /**