From 55294ff87b58bb42ed65d762f873deb2956be1a2 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Thu, 21 May 2009 17:46:12 -0700 Subject: 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. --- .../app/src/com/android/sdkmanager/Main.java | 33 +--------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'sdkmanager/app/src') 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 set = new HashSet(); - 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 - } - } } } -- cgit v1.1