aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2009-07-02 21:41:20 -0700
committerRaphael <raphael@google.com>2009-07-02 21:41:20 -0700
commit9d21b86db6330a01a17b633f657525f0f1fc6dd3 (patch)
treed88ecb65861d5cb8942181746139d92e7fa40f7c /sdkmanager
parentcd103a01c710938e1e5ec613be421e09c861bb37 (diff)
downloadsdk-9d21b86db6330a01a17b633f657525f0f1fc6dd3.zip
sdk-9d21b86db6330a01a17b633f657525f0f1fc6dd3.tar.gz
sdk-9d21b86db6330a01a17b633f657525f0f1fc6dd3.tar.bz2
SDK Updater: detect when install addon or tools to deal with
updating or restarting adb.
Diffstat (limited to 'sdkmanager')
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java
index 5a0c14c..09f9632 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java
@@ -20,6 +20,7 @@ import com.android.prefs.AndroidLocation.AndroidLocationException;
import com.android.sdklib.ISdkLog;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.avd.AvdManager;
+import com.android.sdklib.internal.repository.AddonPackage;
import com.android.sdklib.internal.repository.Archive;
import com.android.sdklib.internal.repository.ITask;
import com.android.sdklib.internal.repository.ITaskFactory;
@@ -28,6 +29,7 @@ import com.android.sdklib.internal.repository.LocalSdkParser;
import com.android.sdklib.internal.repository.Package;
import com.android.sdklib.internal.repository.RepoSource;
import com.android.sdklib.internal.repository.RepoSources;
+import com.android.sdklib.internal.repository.ToolPackage;
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
import org.eclipse.swt.widgets.Shell;
@@ -264,6 +266,9 @@ class UpdaterData {
monitor.setProgressMax(archives.size() * progressPerArchive);
monitor.setDescription("Preparing to install archives");
+ boolean installedAddon = false;
+ boolean installedTools = false;
+
int numInstalled = 0;
for (Archive archive : archives) {
@@ -273,6 +278,12 @@ class UpdaterData {
break;
}
+ if (archive.getParentPackage() instanceof AddonPackage) {
+ installedAddon = true;
+ } else if (archive.getParentPackage() instanceof ToolPackage) {
+ installedTools = true;
+ }
+
if (archive.install(mOsSdkRoot, forceHttp, mSdkManager, monitor)) {
numInstalled++;
}
@@ -290,6 +301,26 @@ class UpdaterData {
}
}
+ if (installedAddon) {
+ // Update the USB vendor ids for adb
+ try {
+ mSdkManager.updateAdb();
+ } catch (Exception e) {
+ mSdkLog.error(e, "Update ADB failed");
+ }
+ }
+
+ if (installedAddon || installedTools) {
+ // We need to restart ADB. Actually since we don't know if it's even
+ // running, maybe we should just kill it and not start it.
+ // Note: it turns out even under Windows we don't need to kill adb
+ // before updating the tools folder, as adb.exe is (surprisingly) not
+ // locked.
+
+ // TODO either bring in ddmlib and use its existing methods to stop adb
+ // or use a shell exec to tools/adb.
+ }
+
if (numInstalled == 0) {
monitor.setDescription("Done. Nothing was installed.");
} else {