use of com.android.repository.api.LocalPackage in project android by JetBrains.
the class PatchInstallerFactoryTest method canHandleWindowsUninstallWithPatcher.
@Test
public void canHandleWindowsUninstallWithPatcher() {
myFileOp.setIsWindows(true);
LocalPackage p = new FakeLocalPackage("foo");
myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(p, PATCHER_4));
assertTrue(myInstallerFactory.canHandlePackage(p, myRepoManager, myFileOp));
}
use of com.android.repository.api.LocalPackage in project android by JetBrains.
the class AvdWizardUtils method emulatorSupportsWebp.
@VisibleForTesting
static boolean emulatorSupportsWebp(@NotNull AndroidSdkHandler sdkHandler) {
ProgressIndicator log = new StudioLoggerProgressIndicator(AvdWizardUtils.class);
LocalPackage sdkPackage = sdkHandler.getLocalPackage(FD_EMULATOR, log);
if (sdkPackage == null) {
sdkPackage = sdkHandler.getLocalPackage(FD_TOOLS, log);
}
if (sdkPackage != null) {
Revision version = sdkPackage.getVersion();
// >= 25.2.3?
if (version.getMajor() > 25 || version.getMajor() == 25 && (version.getMinor() > 2 || version.getMinor() == 2 && version.getMicro() >= 3)) {
return true;
}
}
return false;
}
use of com.android.repository.api.LocalPackage in project android by JetBrains.
the class SdkMerger method compareSdks.
@NotNull
private static Collection<MergeablePackage> compareSdks(@NotNull File srcDir, @NotNull File destDir, @Nullable ProgressIndicator progress) {
com.android.repository.api.ProgressIndicator repoProgress = getRepoProgress(progress);
Collection<MergeablePackage> results = Lists.newArrayList();
AndroidSdkHandler srcHandler = AndroidSdkHandler.getInstance(srcDir);
AndroidSdkHandler destHandler = AndroidSdkHandler.getInstance(destDir);
Map<String, ? extends LocalPackage> srcPackages = srcHandler.getSdkManager(repoProgress).getPackages().getLocalPackages();
Map<String, ? extends LocalPackage> destPackages = destHandler.getSdkManager(repoProgress).getPackages().getLocalPackages();
for (LocalPackage srcPkg : srcPackages.values()) {
LocalPackage destPkg = destPackages.get(srcPkg.getPath());
if (destPkg != null) {
if (srcPkg.getVersion().compareTo(destPkg.getVersion()) > 0) {
// Package exists in destination but is old; replace it.
results.add(new MergeablePackage(srcPkg, destPkg, destDir));
}
} else {
// Package doesn't exist in destination; copy it over.
results.add(new MergeablePackage(srcPkg, null, destDir));
}
}
return results;
}
use of com.android.repository.api.LocalPackage in project android by JetBrains.
the class IdeSdks method isJdk7Supported.
public boolean isJdk7Supported(@Nullable AndroidSdkData sdkData) {
if (sdkData != null) {
ProgressIndicator progress = new StudioLoggerProgressIndicator(Jdks.class);
LocalPackage info = sdkData.getSdkHandler().getLocalPackage(SdkConstants.FD_PLATFORM_TOOLS, progress);
if (info != null) {
Revision revision = info.getVersion();
if (revision.getMajor() >= 19) {
JavaSdk jdk = JavaSdk.getInstance();
Sdk sdk = ProjectJdkTable.getInstance().findMostRecentSdkOfType(jdk);
if (sdk != null) {
JavaSdkVersion version = jdk.getVersion(sdk);
if (version != null && version.isAtLeast(JavaSdkVersion.JDK_1_7)) {
return true;
}
}
}
}
}
return false;
}
use of com.android.repository.api.LocalPackage 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);
}
Aggregations