aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/app/src
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2009-05-21 17:46:12 -0700
committerXavier Ducrohet <xav@android.com>2009-05-21 18:11:36 -0700
commit55294ff87b58bb42ed65d762f873deb2956be1a2 (patch)
tree7dc62388fab087ac6eb86f343d5e8635b4ac48ac /sdkmanager/app/src
parent15ad13f6d499949256e3163f92bdbe4ce718055f (diff)
downloadsdk-55294ff87b58bb42ed65d762f873deb2956be1a2.zip
sdk-55294ff87b58bb42ed65d762f873deb2956be1a2.tar.gz
sdk-55294ff87b58bb42ed65d762f873deb2956be1a2.tar.bz2
Moved updateAdb into SdkManager and updated with new adb_usb.ini format.
New format is: 1 number per line. First number is vendor ID count, followed by the vendor IDs themselves. Comment lines starting with # accepted.
Diffstat (limited to 'sdkmanager/app/src')
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java33
1 files changed, 1 insertions, 32 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index 8c9ad26..94f3062 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -32,10 +32,8 @@ import com.android.sdklib.internal.project.ProjectCreator.OutputLevel;
import com.android.sdkuilib.repository.UpdaterWindow;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -53,9 +51,6 @@ class Main {
private final static String[] BOOLEAN_YES_REPLIES = new String[] { "yes", "y" };
private final static String[] BOOLEAN_NO_REPLIES = new String[] { "no", "n" };
- /** Preference file containing the usb ids for adb */
- private final static String ADB_INI = "adb_usb.ini";
-
/** Path to the SDK folder. This is the parent of {@link #TOOLSDIR}. */
private String mOsSdkFolder;
/** Logger object. Use this to print normal output, warnings or errors. */
@@ -758,26 +753,8 @@ class Main {
* Updates adb with the USB devices declared in the SDK add-ons.
*/
private void updateAdb() {
- FileWriter writer = null;
try {
- // get the android prefs location to know where to write the file.
- File adbIni = new File(AndroidLocation.getFolder(), ADB_INI);
- writer = new FileWriter(adbIni);
-
- // first, put all the vendor id in an HashSet to remove duplicate.
- HashSet<Integer> set = new HashSet<Integer>();
- IAndroidTarget[] targets = mSdkManager.getTargets();
- for (IAndroidTarget target : targets) {
- if (target.getUsbVendorId() != IAndroidTarget.NO_USB_ID) {
- set.add(target.getUsbVendorId());
- }
- }
-
- // now write the Id in a text file, one per line.
- for (Integer i : set) {
- writer.write(i.toString());
- writer.write("\n");
- }
+ mSdkManager.updateAdb();
mSdkLog.printf(
"adb has been updated. You must restart adb with the following commands\n" +
@@ -787,14 +764,6 @@ class Main {
errorAndExit(e.getMessage());
} catch (IOException e) {
errorAndExit(e.getMessage());
- } finally {
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- // ignore
- }
- }
}
}