aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-08-06 10:03:15 -0700
committerSiva Velusamy <vsiva@google.com>2012-08-06 10:03:15 -0700
commit6785c1889071e6bdc2e72a5a843af45abbc069f6 (patch)
tree9ec268f1e9e3eae398664ee4ad1c8e222dce4874
parente68867b12b200d82c80d8e2f77bbe11478027152 (diff)
downloadsdk-6785c1889071e6bdc2e72a5a843af45abbc069f6.zip
sdk-6785c1889071e6bdc2e72a5a843af45abbc069f6.tar.gz
sdk-6785c1889071e6bdc2e72a5a843af45abbc069f6.tar.bz2
ndk: Remove redundant implementation of IShellOutputReceiver
Change-Id: I43add9790edf1418cd821f3486035f495fe45ad2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ndk/src/com/android/ide/eclipse/ndk/internal/launch/NdkGdbLaunchDelegate.java36
1 files changed, 3 insertions, 33 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.ndk/src/com/android/ide/eclipse/ndk/internal/launch/NdkGdbLaunchDelegate.java b/eclipse/plugins/com.android.ide.eclipse.ndk/src/com/android/ide/eclipse/ndk/internal/launch/NdkGdbLaunchDelegate.java
index 57d96d7..818a5c1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ndk/src/com/android/ide/eclipse/ndk/internal/launch/NdkGdbLaunchDelegate.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ndk/src/com/android/ide/eclipse/ndk/internal/launch/NdkGdbLaunchDelegate.java
@@ -19,9 +19,9 @@ package com.android.ide.eclipse.ndk.internal.launch;
import com.android.ddmlib.AdbCommandRejectedException;
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.Client;
+import com.android.ddmlib.CollectingOutputReceiver;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.IDevice.DeviceUnixSocketNamespace;
-import com.android.ddmlib.IShellOutputReceiver;
import com.android.ddmlib.InstallException;
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.SyncException;
@@ -233,7 +233,7 @@ public class NdkGdbLaunchDelegate extends GdbLaunchDelegate {
activityName);
try {
CountDownLatch launchedLatch = new CountDownLatch(1);
- ShellOutputReceiver receiver = new ShellOutputReceiver(launchedLatch);
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver(launchedLatch);
device.executeShellCommand(command, receiver);
launchedLatch.await(5, TimeUnit.SECONDS);
String shellOutput = receiver.getOutput();
@@ -479,39 +479,9 @@ public class NdkGdbLaunchDelegate extends GdbLaunchDelegate {
String command = String.format("run-as %s /system/bin/sh -c pwd", app); //$NON-NLS-1$
CountDownLatch commandCompleteLatch = new CountDownLatch(1);
- ShellOutputReceiver receiver = new ShellOutputReceiver(commandCompleteLatch);
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver(commandCompleteLatch);
device.executeShellCommand(command, receiver);
commandCompleteLatch.await(timeout, timeoutUnit);
return receiver.getOutput().trim();
}
-
- private static class ShellOutputReceiver implements IShellOutputReceiver {
- private StringBuffer sb = new StringBuffer();
- private CountDownLatch mCompleteLatch;
-
- public ShellOutputReceiver(CountDownLatch commandCompleteLatch) {
- mCompleteLatch = commandCompleteLatch;
- }
-
- @Override
- public void addOutput(byte[] data, int offset, int length) {
- sb.append(new String(data, offset, length));
- }
-
- @Override
- public void flush() {
- if (mCompleteLatch != null) {
- mCompleteLatch.countDown();
- }
- }
-
- @Override
- public boolean isCancelled() {
- return false;
- }
-
- public String getOutput() {
- return sb.toString();
- }
- }
}