com.android.sdklib.internal.repository
Class LocalSdkParser

java.lang.Object
  extended by com.android.sdklib.internal.repository.LocalSdkParser

public class LocalSdkParser
extends java.lang.Object

Scans a local SDK to find which packages are currently installed.


Field Summary
static int PARSE_ADDONS
          Equivalent to parsing the SDK/addons folder but does so by using the valid targets loaded by the SdkManager.
static int PARSE_ALL
          Parse all SDK folders.
static int PARSE_BUILD_TOOLS
          Parse the SDK/build-tools folder.
static int PARSE_DOCS
          Parse the SDK/docs folder.
static int PARSE_EXTRAS
          Parse the SDK/extras folder.
static int PARSE_PLATFORM_TOOLS
          Parse the SDK/platform-tools folder
static int PARSE_PLATFORMS
          Equivalent to parsing the SDK/platforms folder but does so by using the valid targets loaded by the SdkManager.
static int PARSE_SAMPLES
          Parse the SDK/samples folder.
static int PARSE_SOURCES
          Parse the SDK/sources folder.
static int PARSE_TOOLS
          Parse the SDK/tools folder.
 
Constructor Summary
LocalSdkParser()
           
 
Method Summary
 void clearPackages()
          Clear the internal packages list.
 Package[] getPackages()
          Returns the packages found by the last call to parseSdk(java.lang.String, com.android.sdklib.SdkManager, com.android.sdklib.internal.repository.ITaskMonitor).
 Package[] parseSdk(java.lang.String osSdkRoot, SdkManager sdkManager, int parseFilter, ITaskMonitor monitor)
          Scan the give SDK to find all the packages already installed at this location.
 Package[] parseSdk(java.lang.String osSdkRoot, SdkManager sdkManager, ITaskMonitor monitor)
          Scan the give SDK to find all the packages already installed at this location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSE_ALL

public static final int PARSE_ALL
Parse all SDK folders.

See Also:
Constant Field Values

PARSE_TOOLS

public static final int PARSE_TOOLS
Parse the SDK/tools folder.

See Also:
Constant Field Values

PARSE_PLATFORM_TOOLS

public static final int PARSE_PLATFORM_TOOLS
Parse the SDK/platform-tools folder

See Also:
Constant Field Values

PARSE_DOCS

public static final int PARSE_DOCS
Parse the SDK/docs folder.

See Also:
Constant Field Values

PARSE_PLATFORMS

public static final int PARSE_PLATFORMS
Equivalent to parsing the SDK/platforms folder but does so by using the valid targets loaded by the SdkManager. Parsing the platforms also parses the SDK/system-images folder.

See Also:
Constant Field Values

PARSE_ADDONS

public static final int PARSE_ADDONS
Equivalent to parsing the SDK/addons folder but does so by using the valid targets loaded by the SdkManager.

See Also:
Constant Field Values

PARSE_SAMPLES

public static final int PARSE_SAMPLES
Parse the SDK/samples folder. Note: this will not detect samples located in the SDK/extras packages.

See Also:
Constant Field Values

PARSE_SOURCES

public static final int PARSE_SOURCES
Parse the SDK/sources folder.

See Also:
Constant Field Values

PARSE_EXTRAS

public static final int PARSE_EXTRAS
Parse the SDK/extras folder.

See Also:
Constant Field Values

PARSE_BUILD_TOOLS

public static final int PARSE_BUILD_TOOLS
Parse the SDK/build-tools folder.

See Also:
Constant Field Values
Constructor Detail

LocalSdkParser

public LocalSdkParser()
Method Detail

getPackages

public Package[] getPackages()
Returns the packages found by the last call to parseSdk(java.lang.String, com.android.sdklib.SdkManager, com.android.sdklib.internal.repository.ITaskMonitor).

This returns initially returns null. Once the parseSdk() method has been called, this returns a possibly empty but non-null array.


clearPackages

public void clearPackages()
Clear the internal packages list. After this call, getPackages() will return null till parseSdk(java.lang.String, com.android.sdklib.SdkManager, com.android.sdklib.internal.repository.ITaskMonitor) is called.


parseSdk

@NonNull
public Package[] parseSdk(@NonNull
                                  java.lang.String osSdkRoot,
                                  @NonNull
                                  SdkManager sdkManager,
                                  @NonNull
                                  ITaskMonitor monitor)
Scan the give SDK to find all the packages already installed at this location.

Store the packages internally. You can use getPackages() to retrieve them at any time later.

Equivalent to calling parseSdk(..., PARSE_ALL, ...);

Parameters:
osSdkRoot - The path to the SDK folder, typically sdkManager.getLocation().
sdkManager - An existing SDK manager to list current platforms and addons.
monitor - A monitor to track progress. Cannot be null.
Returns:
The packages found. Can be retrieved later using getPackages().

parseSdk

@NonNull
public Package[] parseSdk(@NonNull
                                  java.lang.String osSdkRoot,
                                  @NonNull
                                  SdkManager sdkManager,
                                  int parseFilter,
                                  @NonNull
                                  ITaskMonitor monitor)
Scan the give SDK to find all the packages already installed at this location.

Store the packages internally. You can use getPackages() to retrieve them at any time later.

Parameters:
osSdkRoot - The path to the SDK folder, typically sdkManager.getLocation().
sdkManager - An existing SDK manager to list current platforms and addons.
parseFilter - Either PARSE_ALL or an ORed combination of the other PARSE_ constants to indicate what should be parsed.
monitor - A monitor to track progress. Cannot be null.
Returns:
The packages found. Can be retrieved later using getPackages().