use of com.android.sdklib.repository.IdDisplay in project android by JetBrains.
the class FormFactorUtils method getTag.
/**
* Return the tag for the specified repository package.
* We are only interested in 2 package types.
*/
@Nullable
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;
}
use of com.android.sdklib.repository.IdDisplay in project android by JetBrains.
the class AvdDeviceData method updateValuesFromDevice.
public void updateValuesFromDevice(@NotNull Device device, @Nullable SystemImageDescription systemImage) {
myName.set(device.getDisplayName());
String tagId = device.getTagId();
if (myTagId.get().isEmpty()) {
myTagId.set(SystemImage.DEFAULT_TAG.getId());
myDeviceType.setValue(SystemImage.DEFAULT_TAG);
} else {
for (IdDisplay tag : AvdWizardUtils.ALL_DEVICE_TAGS) {
if (tag.getId().equals(tagId)) {
myDeviceType.setValue(tag);
break;
}
}
}
Hardware defaultHardware = device.getDefaultHardware();
Screen screen = defaultHardware.getScreen();
myDiagonalScreenSize.set(screen.getDiagonalLength());
myScreenResolutionWidth.set(screen.getXDimension());
myScreenResolutionHeight.set(screen.getYDimension());
/**
* This is maxed out at {@link AvdWizardUtils.MAX_RAM_MB}, for more information read
* {@link AvdWizardUtils#getDefaultRam(Hardware)}
*/
myRamStorage.set(AvdWizardUtils.getDefaultRam(defaultHardware));
myHasHardwareButtons.set(defaultHardware.getButtonType() == ButtonType.HARD);
myHasHardwareKeyboard.set(defaultHardware.getKeyboard() != Keyboard.NOKEY);
myNavigation.setValue(defaultHardware.getNav());
myDensity.set(defaultHardware.getScreen().getPixelDensity());
List<State> states = device.getAllStates();
mySupportsPortrait.set(false);
mySupportsLandscape.set(false);
for (State state : states) {
if (state.isDefaultState()) {
myDefaultState = state;
}
if (state.getOrientation().equals(ScreenOrientation.PORTRAIT)) {
mySupportsPortrait.set(true);
}
if (state.getOrientation().equals(ScreenOrientation.LANDSCAPE)) {
mySupportsLandscape.set(true);
}
if (state.getHardware().getScreen().getRatio().equals(ScreenRatio.NOTLONG)) {
myNotLong.set(true);
}
}
myHasFrontCamera.set(defaultHardware.getCamera(CameraLocation.FRONT) != null);
myHasBackCamera.set(defaultHardware.getCamera(CameraLocation.BACK) != null);
myHasAccelerometer.set(defaultHardware.getSensors().contains(Sensor.ACCELEROMETER));
myHasGyroscope.set(defaultHardware.getSensors().contains(Sensor.GYROSCOPE));
myHasGps.set(defaultHardware.getSensors().contains(Sensor.GPS));
myHasProximitySensor.set(defaultHardware.getSensors().contains(Sensor.PROXIMITY_SENSOR));
myIsTv.set(HardwareConfigHelper.isTv(device));
myIsWear.set(HardwareConfigHelper.isWear(device));
myIsScreenRound.set(device.isScreenRound());
myScreenChinSize.set(device.getChinSize());
updateSkinFromDeviceAndSystemImage(device, systemImage);
}
use of com.android.sdklib.repository.IdDisplay in project android by JetBrains.
the class ChooseSystemImagePanel method systemImageMatchesDevice.
public static boolean systemImageMatchesDevice(@Nullable SystemImageDescription image, @Nullable Device device) {
if (device == null || image == null) {
return false;
}
String deviceTagId = device.getTagId();
IdDisplay imageTag = image.getTag();
// Unknown/generic device?
if (deviceTagId == null || deviceTagId.equals(SystemImage.DEFAULT_TAG.getId())) {
// system images (see issue #78947), we instead deliberately skip the other form factor images
return imageTag.equals(SystemImage.DEFAULT_TAG) || !imageTag.equals(SystemImage.TV_TAG) && !imageTag.equals(SystemImage.WEAR_TAG);
}
return deviceTagId.equals(imageTag.getId());
}
use of com.android.sdklib.repository.IdDisplay in project android by JetBrains.
the class EmulatorTargetConfigurable method getAvdCompatibilityWarning.
@Nullable
private String getAvdCompatibilityWarning() {
IdDisplay selectedItem = (IdDisplay) myAvdCombo.getComboBox().getSelectedItem();
if (selectedItem != null) {
final String selectedAvdName = selectedItem.getId();
final Module module = myContext.getModule();
if (module == null) {
return null;
}
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
return null;
}
final AvdManager avdManager = facet.getAvdManagerSilently();
if (avdManager == null) {
return null;
}
final AvdInfo avd = avdManager.getAvd(selectedAvdName, false);
if (avd == null || avd.getSystemImage() == null) {
return null;
}
AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
if (platform == null) {
return null;
}
AndroidVersion minSdk = AndroidModuleInfo.get(facet).getRuntimeMinSdkVersion();
LaunchCompatibility compatibility = LaunchCompatibility.canRunOnAvd(minSdk, platform.getTarget(), avd.getSystemImage());
if (compatibility.isCompatible() == ThreeState.NO) {
// todo: provide info about current module configuration
return String.format("'%1$s' may be incompatible with your configuration (%2$s)", selectedAvdName, StringUtil.notNullize(compatibility.getReason()));
}
}
return null;
}
use of com.android.sdklib.repository.IdDisplay in project android by JetBrains.
the class EmulatorTargetConfigurable method applyTo.
@Override
public void applyTo(@NotNull EmulatorTargetProvider.State state, int uniqueID) {
state.PREFERRED_AVD = "";
JComboBox combo = myAvdCombo.getComboBox();
IdDisplay preferredAvd = (IdDisplay) combo.getSelectedItem();
if (preferredAvd == null) {
state.PREFERRED_AVD = myIncorrectPreferredAvd != null ? myIncorrectPreferredAvd : "";
} else {
state.PREFERRED_AVD = preferredAvd.getId();
}
}
Aggregations