diff options
author | Xavier Ducrohet <xav@android.com> | 2010-07-20 17:25:36 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-07-26 10:55:08 -0700 |
commit | 9db3286c710abeb2c9478c2f95657d945a55d176 (patch) | |
tree | d3e5b901646d1c2ee6bd3990bb8da99c05eb78d3 /ddms/app | |
parent | f56173887a9f6430425c93203a8c260a73b1480a (diff) | |
download | sdk-9db3286c710abeb2c9478c2f95657d945a55d176.zip sdk-9db3286c710abeb2c9478c2f95657d945a55d176.tar.gz sdk-9db3286c710abeb2c9478c2f95657d945a55d176.tar.bz2 |
Update the ddmlib api for push/pull/install
The API now throws SyncException instead of returning SyncResult.
The IDevice API to install/uninstall now returns a single
InstallException that encapsulate all the other ddmlib
exception.
Also, the recently added exceptions now don't extend IOException
anymore.
Change-Id: Ib334c4157a6add1882233dfaaa032aea1910eede
Diffstat (limited to 'ddms/app')
-rw-r--r-- | ddms/app/src/com/android/ddms/DeviceCommandDialog.java | 12 | ||||
-rw-r--r-- | ddms/app/src/com/android/ddms/UIThread.java | 18 |
2 files changed, 22 insertions, 8 deletions
diff --git a/ddms/app/src/com/android/ddms/DeviceCommandDialog.java b/ddms/app/src/com/android/ddms/DeviceCommandDialog.java index 6145733..ce6865d 100644 --- a/ddms/app/src/com/android/ddms/DeviceCommandDialog.java +++ b/ddms/app/src/com/android/ddms/DeviceCommandDialog.java @@ -17,9 +17,12 @@ package com.android.ddms; +import com.android.ddmlib.AdbCommandRejectedException; import com.android.ddmlib.IDevice; import com.android.ddmlib.IShellOutputReceiver; import com.android.ddmlib.Log; +import com.android.ddmlib.ShellCommandUnresponsiveException; +import com.android.ddmlib.TimeoutException; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -256,6 +259,15 @@ public class DeviceCommandDialog extends Dialog { catch (IOException ioe) { Log.w("ddms", "Remote exec failed: " + ioe.getMessage()); mResult = RESULT_FAILURE; + } catch (TimeoutException e) { + Log.w("ddms", "Remote exec failed: " + e.getMessage()); + mResult = RESULT_FAILURE; + } catch (AdbCommandRejectedException e) { + Log.w("ddms", "Remote exec failed: " + e.getMessage()); + mResult = RESULT_FAILURE; + } catch (ShellCommandUnresponsiveException e) { + Log.w("ddms", "Remote exec failed: " + e.getMessage()); + mResult = RESULT_FAILURE; } } diff --git a/ddms/app/src/com/android/ddms/UIThread.java b/ddms/app/src/com/android/ddms/UIThread.java index 723442d..9ba1ea0 100644 --- a/ddms/app/src/com/android/ddms/UIThread.java +++ b/ddms/app/src/com/android/ddms/UIThread.java @@ -21,13 +21,13 @@ import com.android.ddmlib.Client; import com.android.ddmlib.ClientData; import com.android.ddmlib.IDevice; import com.android.ddmlib.Log; +import com.android.ddmlib.SyncException; import com.android.ddmlib.SyncService; import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener; import com.android.ddmlib.ClientData.IHprofDumpHandler; import com.android.ddmlib.ClientData.MethodProfilingStatus; import com.android.ddmlib.Log.ILogOutput; import com.android.ddmlib.Log.LogLevel; -import com.android.ddmlib.SyncService.SyncResult; import com.android.ddmuilib.AllocationPanel; import com.android.ddmuilib.DevicePanel; import com.android.ddmuilib.EmulatorControlPanel; @@ -328,18 +328,20 @@ public class UIThread implements IUiSelectionListener, IClientChangeListener { // get the sync service to pull the HPROF file final SyncService sync = client.getDevice().getSyncService(); if (sync != null) { - SyncResult result = promptAndPull(sync, + promptAndPull(sync, client.getClientData().getClientDescription() + ".hprof", remoteFilePath, "Save HPROF file"); - if (result != null && result.getCode() != SyncService.RESULT_OK) { - displayErrorFromUiThread( - "Unable to download HPROF file from device '%1$s'.\n\n%2$s", - device.getSerialNumber(), result.getMessage()); - } } else { - displayErrorFromUiThread("Unable to download HPROF file from device '%1$s'.", + displayErrorFromUiThread( + "Unable to download HPROF file from device '%1$s'.", device.getSerialNumber()); } + } catch (SyncException e) { + if (e.wasCanceled() == false) { + displayErrorFromUiThread( + "Unable to download HPROF file from device '%1$s'.\n\n%2$s", + device.getSerialNumber(), e.getMessage()); + } } catch (Exception e) { displayErrorFromUiThread("Unable to download HPROF file from device '%1$s'.", device.getSerialNumber()); |