Search in sources :

Example 6 with TypeDetails

use of com.android.repository.impl.meta.TypeDetails in project android by JetBrains.

the class AndroidVersionsInfo method getTag.

/**
   * Return the tag for the specified repository package.
   * We are only interested in 2 package types.
   */
@Nullable
private static IdDisplay getTag(@NotNull RepoPackage repoPackage) {
    TypeDetails details = repoPackage.getTypeDetails();
    IdDisplay tag = NO_MATCH;
    if (details instanceof DetailsTypes.AddonDetailsType) {
        tag = ((DetailsTypes.AddonDetailsType) details).getTag();
    }
    if (details instanceof DetailsTypes.SysImgDetailsType) {
        DetailsTypes.SysImgDetailsType imgDetailsType = (DetailsTypes.SysImgDetailsType) details;
        if (imgDetailsType.getAbi().equals(SdkConstants.CPU_ARCH_INTEL_ATOM)) {
            tag = imgDetailsType.getTag();
        }
    }
    return tag;
}
Also used : TypeDetails(com.android.repository.impl.meta.TypeDetails) IdDisplay(com.android.sdklib.repository.IdDisplay) DetailsTypes(com.android.sdklib.repository.meta.DetailsTypes) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with TypeDetails

use of com.android.repository.impl.meta.TypeDetails in project android by JetBrains.

the class InstantRunPositionManager method createSourcesByApiLevel.

private static Map<AndroidVersion, VirtualFile> createSourcesByApiLevel() {
    Collection<? extends LocalPackage> sourcePackages = getAllPlatformSourcePackages();
    Map<AndroidVersion, VirtualFile> sourcesByApi = Maps.newHashMap();
    for (LocalPackage sourcePackage : sourcePackages) {
        TypeDetails typeDetails = sourcePackage.getTypeDetails();
        if (!(typeDetails instanceof DetailsTypes.ApiDetailsType)) {
            Logger.getInstance(InstantRunPositionManager.class).warn("Unable to get type details for source package @ " + sourcePackage.getLocation().getPath());
            continue;
        }
        DetailsTypes.ApiDetailsType details = (DetailsTypes.ApiDetailsType) typeDetails;
        AndroidVersion version = details.getAndroidVersion();
        VirtualFile sourceFolder = VfsUtil.findFileByIoFile(sourcePackage.getLocation(), true);
        if (sourceFolder != null && sourceFolder.isValid()) {
            sourcesByApi.put(version, sourceFolder);
        }
    }
    return ImmutableMap.copyOf(sourcesByApi);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TypeDetails(com.android.repository.impl.meta.TypeDetails) LocalPackage(com.android.repository.api.LocalPackage) DetailsTypes(com.android.sdklib.repository.meta.DetailsTypes) AndroidVersion(com.android.sdklib.AndroidVersion)

Aggregations

TypeDetails (com.android.repository.impl.meta.TypeDetails)7 DetailsTypes (com.android.sdklib.repository.meta.DetailsTypes)7 AndroidVersion (com.android.sdklib.AndroidVersion)3 Nullable (org.jetbrains.annotations.Nullable)3 IdDisplay (com.android.sdklib.repository.IdDisplay)2 LocalPackage (com.android.repository.api.LocalPackage)1 RemotePackage (com.android.repository.api.RemotePackage)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1