public class LocalSdk
extends java.lang.Object
getPkgInfo(int, com.android.sdklib.AndroidVersion) which depend on the
query attribute.
| Type | Query parameter | Getter |
|---|---|---|
| Tools | Unique instance | getPkgInfo(PKG_TOOLS) => LocalPkgInfo |
| Platform-Tools | Unique instance | getPkgInfo(PKG_PLATFORM_TOOLS) => LocalPkgInfo |
| Docs | Unique instance | getPkgInfo(PKG_DOCS) => LocalPkgInfo |
| Build-Tools | FullRevision |
getLatestBuildTool() => BuildToolInfo, or getBuildTool(FullRevision) => BuildToolInfo, or getPkgInfo(PKG_BUILD_TOOLS, FullRevision) => LocalPkgInfo, or getPkgsInfos(PKG_BUILD_TOOLS) => LocalPkgInfo[] |
| Extras | String vendor/path | getExtra(String) => LocalExtraPkgInfo, or getPkgInfo(PKG_EXTRAS, String) => LocalPkgInfo, or getPkgsInfos(PKG_EXTRAS) => LocalPkgInfo[] |
| Sources | AndroidVersion |
getPkgInfo(PKG_SOURCES, AndroidVersion) => LocalPkgInfo, or getPkgsInfos(PKG_SOURCES) => LocalPkgInfo[] |
| Samples | AndroidVersion |
getPkgInfo(PKG_SAMPLES, AndroidVersion) => LocalPkgInfo, or getPkgsInfos(PKG_SAMPLES) => LocalPkgInfo[] |
| Platforms | AndroidVersion |
getPkgInfo(PKG_PLATFORMS, AndroidVersion) => LocalPkgInfo, or getPkgInfo(PKG_ADDONS, String) => LocalPkgInfo, or getPkgsInfos(PKG_PLATFORMS) => LocalPkgInfo[], or getTargetFromHashString(String) => IAndroidTarget |
| Add-ons | AndroidVersion x String vendor/path |
getPkgInfo(PKG_ADDONS, String) => LocalPkgInfo, or getPkgsInfos(PKG_ADDONS) => LocalPkgInfo[], or getTargetFromHashString(String) => IAndroidTarget |
| System images | AndroidVersion x String ABI |
getPkgsInfos(PKG_SYS_IMAGES) => LocalPkgInfo[] |
| Modifier and Type | Field and Description |
|---|---|
static int |
PKG_ADDONS
Filter the SDK/addons.
|
static int |
PKG_ALL
Filter all SDK folders.
|
static int |
PKG_BUILD_TOOLS
Filter the SDK/build-tools folder.
|
static int |
PKG_DOCS
Filter the SDK/docs folder.
|
static int |
PKG_EXTRAS
Filter the SDK/extras folder.
|
static int |
PKG_PLATFORM_TOOLS
Filter the SDK/platform-tools folder.
|
static int |
PKG_PLATFORMS
Filter the SDK/platforms.
|
static int |
PKG_SAMPLES
Filter the SDK/samples folder.
|
static int |
PKG_SOURCES
Filter the SDK/sources folder.
|
static int |
PKG_SYS_IMAGES
Filter the SDK/sys-images.
|
static int |
PKG_TOOLS
Filter the SDK/tools folder.
|
| Modifier | Constructor and Description |
|---|---|
|
LocalSdk()
Creates an initial LocalSdk instance with an unknown location.
|
|
LocalSdk(java.io.File sdkRoot)
Creates an initial LocalSdk instance for a known SDK location.
|
protected |
LocalSdk(IFileOp fileOp)
Creates an initial LocalSdk instance with an unknown location.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearLocalPkg(int filters)
Clear the tracked visited folders & the cached
LocalPkgInfo for the
given filter types. |
BuildToolInfo |
getBuildTool(FullRevision revision)
Returns the
BuildToolInfo for the given revision. |
LocalExtraPkgInfo |
getExtra(java.lang.String vendorPath)
Retrieves information on an extra package identified by its
String vendor/path. |
IFileOp |
getFileOp() |
BuildToolInfo |
getLatestBuildTool()
Returns the highest build-tool revision known, or null if there are are no build-tools.
|
java.io.File |
getLocation()
Location of the SDK.
|
LocalPkgInfo |
getPkgInfo(int filter)
For unique local packages.
|
LocalPkgInfo |
getPkgInfo(int filter,
AndroidVersion version)
Retrieves information on a package identified by an
AndroidVersion. |
LocalPkgInfo |
getPkgInfo(int filter,
FullRevision revision)
Retrieves information on a package identified by its
FullRevision. |
LocalPkgInfo |
getPkgInfo(int filter,
java.lang.String vendorPath)
Retrieves information on a package identified by its
String vendor/path. |
LocalPkgInfo[] |
getPkgsInfos(int filters)
Retrieve all the info about the requested package type.
|
IAndroidTarget |
getTargetFromHashString(java.lang.String hash)
Returns a target from a hash that was generated by
IAndroidTarget.hashString(). |
boolean |
hasChanged(int filters)
Check the tracked visited folders to see if anything has changed for the
requested filter types.
|
void |
setLocation(java.io.File sdkRoot)
Sets or changes the SDK root location.
|
public static final int PKG_ALL
public static final int PKG_TOOLS
FullRevision.public static final int PKG_PLATFORM_TOOLS
FullRevision.public static final int PKG_BUILD_TOOLS
FullRevision.public static final int PKG_DOCS
MajorRevision.public static final int PKG_EXTRAS
Path. Has MajorRevision.public static final int PKG_PLATFORMS
AndroidVersion. Has MajorRevision.public static final int PKG_SYS_IMAGES
AndroidVersion. Has MajorRevision.public static final int PKG_ADDONS
AndroidVersion. Has MajorRevision.public static final int PKG_SAMPLES
AndroidVersion. Has MajorRevision.public static final int PKG_SOURCES
AndroidVersion. Has MajorRevision.public LocalSdk()
public LocalSdk(@NonNull
java.io.File sdkRoot)
sdkRoot - The location of the SDK root folder.public IFileOp getFileOp()
public void setLocation(@NonNull
java.io.File sdkRoot)
sdkRoot - The location of the SDK root folder.@Nullable public java.io.File getLocation()
public void clearLocalPkg(int filters)
LocalPkgInfo for the
given filter types.filters - An OR of the PKG_ constants or PKG_ALL to clear everything.public boolean hasChanged(int filters)
filters - An OR of the PKG_ constants or PKG_ALL to clear everything.public LocalPkgInfo getPkgInfo(int filter, AndroidVersion version)
AndroidVersion.
Note: don't use this for PKG_SYS_IMAGES since there can be more than
one ABI and this method only returns a single package per filter type.filter - PKG_PLATFORMS, PKG_SAMPLES or PKG_SOURCES.version - The AndroidVersion specific for this package type.public LocalPkgInfo getPkgInfo(int filter, FullRevision revision)
FullRevision.
Note that PKG_TOOLS and PKG_PLATFORM_TOOLS are unique in a local SDK
so you'll want to use getPkgInfo(int) to retrieve them instead.filter - PKG_BUILD_TOOLS.revision - The FullRevision uniquely identifying this package.public LocalPkgInfo getPkgInfo(int filter, java.lang.String vendorPath)
String vendor/path.filter - PKG_EXTRAS, PKG_ADDONS, PKG_PLATFORMS.vendorPath - The vendor/path uniquely identifying this package.public LocalExtraPkgInfo getExtra(java.lang.String vendorPath)
String vendor/path.vendorPath - The vendor/path uniquely identifying this package.public LocalPkgInfo getPkgInfo(int filter)
filter - PKG_TOOLS or PKG_PLATFORM_TOOLS or PKG_DOCS.public LocalPkgInfo[] getPkgsInfos(int filters)
PKG_ALL argument to load all the known package types.
Note: you can use this with PKG_TOOLS, PKG_PLATFORM_TOOLS and
PKG_DOCS but since there can only be one package of these types, it is
more efficient to use getPkgInfo(int) to query them.filters - One or more of PKG_ADDONS, PKG_PLATFORMS,
PKG_BUILD_TOOLS, PKG_EXTRAS,
PKG_SOURCES, PKG_SYS_IMAGES@Nullable public BuildToolInfo getBuildTool(@Nullable FullRevision revision)
BuildToolInfo for the given revision.revision - The requested revision.BuildToolInfo. Can be null if revision is null or is
not part of the known set returned by getPkgsInfos(PKG_BUILD_TOOLS).@Nullable public BuildToolInfo getLatestBuildTool()
@Nullable public IAndroidTarget getTargetFromHashString(@Nullable java.lang.String hash)
IAndroidTarget.hashString().hash - the IAndroidTarget hash string.IAndroidTarget or null.