Commit 59e3d9af authored by Vikas Pachdha's avatar Vikas Pachdha

Android: Enable emulator tool installation

Let Android sdk manager UI install the emulator tool. AVD needs this
tool to manage AVD's.

Task-number: QTCREATORBUG-19332
Change-Id: If836c511ca4a5673470d42c14115afa21b1b96fd
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 216e40b3
......@@ -260,6 +260,7 @@ public:
BuildToolsMarker = 0x080,
SdkToolsMarker = 0x100,
PlatformToolsMarker = 0x200,
EmulatorToolsMarker = 0x400,
SectionMarkers = InstalledPackagesMarker | AvailablePackagesMarkers | AvailableUpdatesMarker
};
......@@ -278,6 +279,7 @@ private:
BuildTools *parseBuildToolsPackage(const QStringList &data) const;
SdkTools *parseSdkToolsPackage(const QStringList &data) const;
PlatformTools *parsePlatformToolsPackage(const QStringList &data) const;
EmulatorTools *parseEmulatorToolsPackage(const QStringList &data) const;
MarkerTag parseMarkers(const QString &line);
MarkerTag m_currentSection = MarkerTag::None;
......@@ -292,7 +294,8 @@ const std::map<SdkManagerOutputParser::MarkerTag, const char *> markerTags {
{SdkManagerOutputParser::MarkerTag::SystemImageMarker, "system-images"},
{SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"},
{SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"},
{SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"}
{SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"},
{SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"}
};
AndroidSdkManager::AndroidSdkManager(const AndroidConfig &config, QObject *parent):
......@@ -543,6 +546,10 @@ void SdkManagerOutputParser::parsePackageData(MarkerTag packageMarker, const QSt
createPackage(&SdkManagerOutputParser::parsePlatformToolsPackage);
break;
case MarkerTag::EmulatorToolsMarker:
createPackage(&SdkManagerOutputParser::parseEmulatorToolsPackage);
break;
case MarkerTag::PlatformMarker:
createPackage(&SdkManagerOutputParser::parsePlatform);
break;
......@@ -705,6 +712,22 @@ PlatformTools *SdkManagerOutputParser::parsePlatformToolsPackage(const QStringLi
return platformTools;
}
EmulatorTools *SdkManagerOutputParser::parseEmulatorToolsPackage(const QStringList &data) const
{
EmulatorTools *emulatorTools = nullptr;
GenericPackageData packageData;
if (parseAbstractData(packageData, data, 1, "Emulator-tools")) {
emulatorTools = new EmulatorTools(packageData.revision, data.at(0));
emulatorTools->setDescriptionText(packageData.description);
emulatorTools->setDisplayText(packageData.description);
emulatorTools->setInstalledLocation(packageData.installedLocation);
} else {
qCDebug(sdkManagerLog) << "Emulator-tools: Parsing failed. Minimum required data "
"unavailable:" << data;
}
return emulatorTools;
}
SdkManagerOutputParser::MarkerTag SdkManagerOutputParser::parseMarkers(const QString &line)
{
if (line.isEmpty())
......
......@@ -253,4 +253,20 @@ AndroidSdkPackage::PackageType PlatformTools::type() const
return AndroidSdkPackage::PlatformToolsPackage;
}
EmulatorTools::EmulatorTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent):
AndroidSdkPackage(revision, sdkStylePathStr, parent)
{
}
bool EmulatorTools::isValid() const
{
return installedLocation().exists();
}
AndroidSdkPackage::PackageType EmulatorTools::type() const
{
return AndroidSdkPackage::EmulatorToolsPackage;
}
} // namespace Android
......@@ -52,8 +52,9 @@ public:
PlatformToolsPackage = 1 << 3,
SdkPlatformPackage = 1 << 4,
SystemImagePackage = 1 << 5,
EmulatorToolsPackage = 1 << 6,
AnyValidType = SdkToolsPackage | BuildToolsPackage | PlatformToolsPackage |
SdkPlatformPackage | SystemImagePackage
SdkPlatformPackage | SystemImagePackage | EmulatorToolsPackage
};
enum PackageState {
......@@ -169,6 +170,17 @@ public:
PackageType type() const override;
};
class EmulatorTools : public AndroidSdkPackage
{
public:
EmulatorTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr);
// AndroidSdkPackage Overrides
public:
bool isValid() const override;
PackageType type() const override;
};
class SdkTools : public AndroidSdkPackage
{
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment