Search in sources :

Example 6 with AndroidVersion

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;
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion)

Example 7 with AndroidVersion

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);
}
Also used : MockPlatformTarget(com.android.sdklib.internal.androidTarget.MockPlatformTarget) IDevice(com.android.ddmlib.IDevice) Abi(com.android.sdklib.devices.Abi) AndroidVersion(com.android.sdklib.AndroidVersion)

Example 8 with AndroidVersion

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");
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Example 9 with AndroidVersion

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");
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Example 10 with AndroidVersion

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);
}
Also used : TypeDetails(com.android.repository.impl.meta.TypeDetails) DetailsTypes(com.android.sdklib.repository.meta.DetailsTypes) AndroidVersion(com.android.sdklib.AndroidVersion)

Aggregations

AndroidVersion (com.android.sdklib.AndroidVersion)89 Test (org.junit.Test)21 NotNull (org.jetbrains.annotations.NotNull)14 IAndroidTarget (com.android.sdklib.IAndroidTarget)12 IDevice (com.android.ddmlib.IDevice)11 Nullable (org.jetbrains.annotations.Nullable)9 MockPlatformTarget (com.android.sdklib.internal.androidTarget.MockPlatformTarget)8 Module (com.intellij.openapi.module.Module)8 File (java.io.File)8 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)8 AndroidPlatform (org.jetbrains.android.sdk.AndroidPlatform)8 DetailsTypes (com.android.sdklib.repository.meta.DetailsTypes)6 Project (com.intellij.openapi.project.Project)5 Abi (com.android.sdklib.devices.Abi)4 InstantRunGradleSupport (com.android.tools.idea.fd.gradle.InstantRunGradleSupport)4 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)4 OutputFile (com.android.build.OutputFile)3 TypeDetails (com.android.repository.impl.meta.TypeDetails)3 AvdInfo (com.android.sdklib.internal.avd.AvdInfo)3 ModelWizardDialog (com.android.tools.idea.wizard.model.ModelWizardDialog)3