public final class AndroidSdkHandler
extends java.lang.Object
RepoManager. Ensures that the proper android sdk-specific
schemas and source providers are registered, and provides android sdk-specific package logic
(pending as adoption continues).| Modifier and Type | Field and Description |
|---|---|
static int |
LATEST_LEGACY_VERSION
The latest version of legacy remote packages we should expect to receive from a server.
|
static java.lang.String |
SDK_TEST_BASE_URL_ENV_VAR
The name of the environment variable used to override the url of the primary repository, for
testing.
|
| Constructor and Description |
|---|
AndroidSdkHandler(java.io.File localPath,
com.android.repository.io.FileOp fop)
Don't use this, use
getInstance(File), unless you're in a unit test and need to
specify a custom FileOp. |
| Modifier and Type | Method and Description |
|---|---|
static com.android.repository.api.SchemaModule |
getAddonModule() |
AndroidTargetManager |
getAndroidTargetManager(com.android.repository.api.ProgressIndicator progress)
Gets (and creates if necessary) an
AndroidTargetManager based on our local sdk
packages. |
BuildToolInfo |
getBuildToolInfo(com.android.repository.Revision revision,
com.android.repository.api.ProgressIndicator progress)
Creates a the
BuildToolInfo for the specificed build tools revision, if available. |
static com.android.repository.api.SchemaModule |
getCommonModule() |
com.android.repository.io.FileOp |
getFileOp()
Gets our
FileOp. |
static AndroidSdkHandler |
getInstance(java.io.File localPath)
Get a
AndroidSdkHandler instance. |
BuildToolInfo |
getLatestBuildTool(com.android.repository.api.ProgressIndicator progress,
boolean allowPreview)
Gets a
BuildToolInfo corresponding to the newest installed build tool
RepoPackage, or null if none are installed (or if the allowPreview
parameter is false and there was non-preview version available) |
com.android.repository.api.LocalPackage |
getLocalPackage(java.lang.String path,
com.android.repository.api.ProgressIndicator progress)
Convenience to get a package from the local repo.
|
java.io.File |
getLocation()
Gets the path of the local SDK, if set.
|
static com.android.repository.api.SchemaModule |
getRepositoryModule() |
com.android.repository.api.RepoManager |
getSdkManager(com.android.repository.api.ProgressIndicator progress)
Fetches
RepoManager set up to interact with android SDK repositories. |
static com.android.repository.api.SchemaModule |
getSysImgModule() |
SystemImageManager |
getSystemImageManager(com.android.repository.api.ProgressIndicator progress)
Gets (and creates if necessary) a
SystemImageManager based on our local sdk packages. |
com.android.repository.impl.sources.LocalSourceProvider |
getUserSourceProvider(com.android.repository.api.ProgressIndicator progress)
Gets the customizable
RepositorySourceProvider. |
public static final java.lang.String SDK_TEST_BASE_URL_ENV_VAR
public static final int LATEST_LEGACY_VERSION
public AndroidSdkHandler(@Nullable
java.io.File localPath,
@NonNull
com.android.repository.io.FileOp fop)
getInstance(File), unless you're in a unit test and need to
specify a custom FileOp.@NonNull public static AndroidSdkHandler getInstance(@Nullable java.io.File localPath)
AndroidSdkHandler instance.localPath - The path to the local SDK. If null this handler will only be used
for remote operations.@NonNull
public com.android.repository.api.RepoManager getSdkManager(@NonNull
com.android.repository.api.ProgressIndicator progress)
RepoManager set up to interact with android SDK repositories. It should not
cached by callers of this method, since any changes to the fundamental properties of the
manager (fallback loaders, local path) will cause a new instance to be created.@NonNull public SystemImageManager getSystemImageManager(@NonNull com.android.repository.api.ProgressIndicator progress)
SystemImageManager based on our local sdk packages.@NonNull public AndroidTargetManager getAndroidTargetManager(@NonNull com.android.repository.api.ProgressIndicator progress)
AndroidTargetManager based on our local sdk
packages.@Nullable public java.io.File getLocation()
@Nullable
public com.android.repository.api.LocalPackage getLocalPackage(@NonNull
java.lang.String path,
@NonNull
com.android.repository.api.ProgressIndicator progress)
@NonNull public static com.android.repository.api.SchemaModule getCommonModule()
SchemaModule containing the common sdk-specific metadata. See
sdk-common-XX.xsd.@NonNull public static com.android.repository.api.SchemaModule getAddonModule()
SchemaModule containing the metadata for addon-type Repositorys.
See sdk-addon-XX.xsd.@NonNull public static com.android.repository.api.SchemaModule getRepositoryModule()
SchemaModule containing the metadata for the primary android SDK Repository (containin platforms etc.). See sdk-repository-XX.xsd.@NonNull public static com.android.repository.api.SchemaModule getSysImgModule()
SchemaModule containing the metadata for system image-type Repositorys. See sdk-sys-img-XX.xsd.@Nullable
public com.android.repository.impl.sources.LocalSourceProvider getUserSourceProvider(@NonNull
com.android.repository.api.ProgressIndicator progress)
RepositorySourceProvider. Can be null if there's a problem
with the user's environment.@Nullable public BuildToolInfo getLatestBuildTool(@NonNull com.android.repository.api.ProgressIndicator progress, boolean allowPreview)
BuildToolInfo corresponding to the newest installed build tool
RepoPackage, or null if none are installed (or if the allowPreview
parameter is false and there was non-preview version available)progress - a progress indicatorallowPreview - ignore preview build tools version unless this parameter is true@Nullable public BuildToolInfo getBuildToolInfo(@NonNull com.android.repository.Revision revision, @NonNull com.android.repository.api.ProgressIndicator progress)
BuildToolInfo for the specificed build tools revision, if available.revision - The build tools revision requestedprogress - ProgressIndicator for logging.BuildToolInfo corresponding to the specified build tools package, or
null if that revision is not installed.@NonNull public com.android.repository.io.FileOp getFileOp()
FileOp. Useful so both the sdk handler and file op don't both have to be
injected everywhere.