use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class LaunchCompatibilityTest method createMockDevice.
private static AndroidDevice createMockDevice(int api, @Nullable String codeName, boolean supportsFeature, List<Abi> abis) {
AndroidDevice device = mock(AndroidDevice.class);
try {
when(device.getVersion()).thenReturn(new AndroidVersion(api, codeName));
when(device.supportsFeature(any(IDevice.HardwareFeature.class))).thenReturn(supportsFeature);
when(device.getAbis()).thenReturn(abis);
} catch (Exception ignored) {
}
return device;
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class LaunchCompatibilityTest method testIncompatibleAbiFilter.
public void testIncompatibleAbiFilter() {
AndroidVersion minSdkVersion = new AndroidVersion(8, null);
MockPlatformTarget projectTarget = new MockPlatformTarget(14, 0);
EnumSet<IDevice.HardwareFeature> requiredFeatures = EnumSet.noneOf(IDevice.HardwareFeature.class);
Set<String> supportedAbis = ImmutableSet.of(Abi.X86_64.toString());
List<Abi> deviceAbis = ImmutableList.of(Abi.ARMEABI, Abi.ARMEABI_V7A, Abi.ARM64_V8A);
LaunchCompatibility compatibility = LaunchCompatibility.canRunOnDevice(minSdkVersion, projectTarget, requiredFeatures, supportedAbis, createMockDevice(8, null, false, deviceAbis));
assertEquals(new LaunchCompatibility(ThreeState.NO, "Device supports armeabi, armeabi-v7a, arm64-v8a, but APK only supports x86_64"), compatibility);
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class SearchItemHandlerTest method onCreateApiLevelIs10.
@Test
public void onCreateApiLevelIs10() {
Mockito.when(myEditor.getMinSdkVersion()).thenReturn(new AndroidVersion(10, null));
myHandler.onCreate(myEditor, null, newChild, InsertType.CREATE);
Mockito.verify(newChild).setAndroidAttribute("actionViewClass", "android.support.v7.widget.SearchView");
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class SearchItemHandlerTest method onCreateApiLevelIs11.
@Test
public void onCreateApiLevelIs11() {
Mockito.when(myEditor.getMinSdkVersion()).thenReturn(new AndroidVersion(11, null));
myHandler.onCreate(myEditor, null, newChild, InsertType.CREATE);
Mockito.verify(newChild).setAndroidAttribute("actionViewClass", "android.widget.SearchView");
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class SdkUpdaterConfigPanel method loadPackages.
private void loadPackages(RepositoryPackages packages) {
Multimap<AndroidVersion, UpdatablePackage> platformPackages = TreeMultimap.create();
Set<UpdatablePackage> toolsPackages = Sets.newTreeSet();
for (UpdatablePackage info : packages.getConsolidatedPkgs().values()) {
RepoPackage p = info.getRepresentative();
TypeDetails details = p.getTypeDetails();
if (details instanceof DetailsTypes.ApiDetailsType) {
platformPackages.put(((DetailsTypes.ApiDetailsType) details).getAndroidVersion(), info);
} else {
toolsPackages.add(info);
}
}
// TODO: when should we show this?
//myChannelLink.setVisible(myHasPreview && !myIncludePreview);
myPlatformComponentsPanel.setPackages(platformPackages);
myToolComponentsPanel.setPackages(toolsPackages);
}
Aggregations