forked from qt-creator/qt-creator
Android: Hide getDeviceProperty() in cpp
Use a new CommandLine's c'tor. Change-Id: I7e0809e97ae265cc83bd05a335beb4fa815e2a4e Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -168,6 +168,18 @@ static QString getAvdName(const QString &serialnumber)
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString getDeviceProperty(const QString &device, const QString &property)
|
||||||
|
{
|
||||||
|
// workaround for '????????????' serial numbers
|
||||||
|
Process adbProc;
|
||||||
|
adbProc.setCommand({androidConfig().adbToolPath(),
|
||||||
|
{AndroidDeviceInfo::adbSelector(device), "shell", "getprop", property}});
|
||||||
|
adbProc.runBlocking();
|
||||||
|
if (adbProc.result() == ProcessResult::FinishedWithSuccess)
|
||||||
|
return adbProc.allOutput();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// AndroidConfig
|
// AndroidConfig
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
@@ -699,25 +711,10 @@ bool AndroidConfig::isConnected(const QString &serialNumber) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AndroidConfig::getDeviceProperty(const QString &device, const QString &property)
|
|
||||||
{
|
|
||||||
// workaround for '????????????' serial numbers
|
|
||||||
Process adbProc;
|
|
||||||
adbProc.setCommand({androidConfig().adbToolPath(),
|
|
||||||
{AndroidDeviceInfo::adbSelector(device), "shell", "getprop", property}});
|
|
||||||
adbProc.runBlocking();
|
|
||||||
if (adbProc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return adbProc.allOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
int AndroidConfig::getSDKVersion(const QString &device)
|
int AndroidConfig::getSDKVersion(const QString &device)
|
||||||
{
|
{
|
||||||
QString tmp = getDeviceProperty(device, "ro.build.version.sdk");
|
const QString tmp = getDeviceProperty(device, "ro.build.version.sdk");
|
||||||
if (tmp.isEmpty())
|
return tmp.isEmpty() ? -1 : tmp.trimmed().toInt();
|
||||||
return -1;
|
|
||||||
return tmp.trimmed().toInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//!
|
//!
|
||||||
@@ -730,7 +727,7 @@ QString AndroidConfig::getProductModel(const QString &device) const
|
|||||||
if (m_serialNumberToDeviceName.contains(device))
|
if (m_serialNumberToDeviceName.contains(device))
|
||||||
return m_serialNumberToDeviceName.value(device);
|
return m_serialNumberToDeviceName.value(device);
|
||||||
|
|
||||||
QString model = getDeviceProperty(device, "ro.product.model").trimmed();
|
const QString model = getDeviceProperty(device, "ro.product.model").trimmed();
|
||||||
if (model.isEmpty())
|
if (model.isEmpty())
|
||||||
return device;
|
return device;
|
||||||
|
|
||||||
|
@@ -142,8 +142,6 @@ public:
|
|||||||
Utils::Environment toolsEnvironment() const;
|
Utils::Environment toolsEnvironment() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QString getDeviceProperty(const QString &device, const QString &property);
|
|
||||||
|
|
||||||
Utils::FilePath openJDKBinPath() const;
|
Utils::FilePath openJDKBinPath() const;
|
||||||
|
|
||||||
void parseDependenciesJson();
|
void parseDependenciesJson();
|
||||||
|
Reference in New Issue
Block a user