SDK Manager: reuse complete downloads, retry Windows locks.

This resolves 2 main issues with the SDK updater:
- Completed downloads are not cleared till the install is successful
- They are also stored in SDK/temp rather than the real Windows TEMP
  folder, making them more discoverable for savvy users.
- There's a retry loop on failed install when due to a directory
  being locked.
- The retry loop comes with the a Big Fat Warning[tm] in a modal
  dialog box. You can't miss it. And it explicitly mentions the
  antivirus software can be the root cause.

SDK BUG 2235058

Change-Id: Id49751ebd67e7291a0e7005136b22576335729c1
This commit is contained in:
Raphael
2009-11-06 18:55:04 -08:00
parent ca4603db2f
commit 28f6fda581
3 changed files with 267 additions and 118 deletions

View File

@@ -19,6 +19,8 @@ package com.android.sdkuilib.internal.tasks;
import com.android.sdklib.internal.repository.ITask;
import com.android.sdklib.internal.repository.ITaskMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
@@ -142,6 +144,30 @@ public final class ProgressTask implements ITaskMonitor {
return null;
}
/**
* Display a yes/no question dialog box.
*
* This implementation allow this to be called from any thread, it
* makes sure the dialog is opened synchronously in the ui thread.
*
* @param title The title of the dialog box
* @param message The error message
* @return true if YES was clicked.
*/
public boolean displayPrompt(final String title, final String message) {
final Shell shell = mDialog.getParent();
Display display = shell.getDisplay();
// we need to ask the user what he wants to do.
final boolean[] result = new boolean[] { false };
display.syncExec(new Runnable() {
public void run() {
result[0] = MessageDialog.openQuestion(shell, title, message);
}
});
return result[0];
}
/**
* Creates a sub-monitor that will use up to tickCount on the progress bar.
* tickCount must be 1 or more.
@@ -222,6 +248,10 @@ public final class ProgressTask implements ITaskMonitor {
}
}
public boolean displayPrompt(String title, String message) {
return mRoot.displayPrompt(title, message);
}
public ITaskMonitor createSubMonitor(int tickCount) {
assert mSubCoef > 0;
assert tickCount > 0;