forked from qt-creator/qt-creator
Android: Remove unused functions
As found by Cppcheck Change-Id: I9274fe45ed49099b52b4f8556508ec0adc676386 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
@@ -115,7 +115,6 @@ namespace {
|
||||
const QLatin1String SDKManagerToolArgsKey("SDKManagerToolArgs");
|
||||
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
|
||||
const QLatin1String OpenSslPriLocationKey("OpenSSLPriLocation");
|
||||
const QLatin1String KeystoreLocationKey("KeystoreLocation");
|
||||
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
|
||||
const QLatin1String PartitionSizeKey("PartitionSize");
|
||||
|
||||
@@ -231,7 +230,6 @@ void AndroidConfig::load(const QSettings &settings)
|
||||
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
|
||||
m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||
m_openSslLocation = FilePath::fromString(settings.value(OpenSslPriLocationKey).toString());
|
||||
m_keystoreLocation = FilePath::fromString(settings.value(KeystoreLocationKey).toString());
|
||||
m_automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
|
||||
m_sdkFullyConfigured = settings.value(SdkFullyConfiguredKey, false).toBool();
|
||||
|
||||
@@ -263,7 +261,6 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
settings.setValue(CustomNdkLocationsKey, m_customNdkList);
|
||||
settings.setValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs);
|
||||
settings.setValue(OpenJDKLocationKey, m_openJDKLocation.toString());
|
||||
settings.setValue(KeystoreLocationKey, m_keystoreLocation.toString());
|
||||
settings.setValue(OpenSslPriLocationKey, m_openSslLocation.toString());
|
||||
settings.setValue(PartitionSizeKey, m_partitionSize);
|
||||
settings.setValue(AutomaticKitCreationKey, m_automaticKitCreation);
|
||||
@@ -470,15 +467,6 @@ FilePath AndroidConfig::avdManagerToolPath() const
|
||||
return FilePath();
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::aaptToolPath() const
|
||||
{
|
||||
const FilePath aaptToolPath = m_sdkLocation / "build-tools";
|
||||
QString toolPath = QString("%1/aapt").arg(buildToolsVersion().toString());
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
toolPath += QTC_HOST_EXE_SUFFIX;
|
||||
return aaptToolPath / toolPath;
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::toolchainPathFromNdk(const Utils::FilePath &ndkLocation) const
|
||||
{
|
||||
const FilePath toolchainPath = ndkLocation / "toolchains/llvm/prebuilt/";
|
||||
@@ -646,11 +634,6 @@ QString AndroidConfig::getDeviceProperty(const FilePath &adbToolPath, const QStr
|
||||
return response.allOutput();
|
||||
}
|
||||
|
||||
int AndroidConfig::getSDKVersion(const QString &device) const
|
||||
{
|
||||
return getSDKVersion(adbToolPath(), device);
|
||||
}
|
||||
|
||||
int AndroidConfig::getSDKVersion(const FilePath &adbToolPath, const QString &device)
|
||||
{
|
||||
QString tmp = getDeviceProperty(adbToolPath, device, "ro.build.version.sdk");
|
||||
@@ -733,11 +716,6 @@ QString AndroidConfig::getProductModel(const QString &device) const
|
||||
return model;
|
||||
}
|
||||
|
||||
QStringList AndroidConfig::getAbis(const QString &device) const
|
||||
{
|
||||
return getAbis(adbToolPath(), device);
|
||||
}
|
||||
|
||||
QStringList AndroidConfig::getAbis(const FilePath &adbToolPath, const QString &device)
|
||||
{
|
||||
QStringList result;
|
||||
@@ -851,11 +829,6 @@ FilePath AndroidConfig::ndkLocation(const BaseQtVersion *qtVersion) const
|
||||
return sdkLocation().pathAppended(ndkPathFromQtVersion(*qtVersion));
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::defaultNdkLocation() const
|
||||
{
|
||||
return sdkLocation().pathAppended(m_defaultSdkDepends.ndkPath);
|
||||
}
|
||||
|
||||
QVersionNumber AndroidConfig::ndkVersion(const BaseQtVersion *qtVersion) const
|
||||
{
|
||||
return ndkVersion(ndkLocation(qtVersion));
|
||||
@@ -982,16 +955,6 @@ void AndroidConfig::setOpenJDKLocation(const FilePath &openJDKLocation)
|
||||
m_openJDKLocation = openJDKLocation;
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::keystoreLocation() const
|
||||
{
|
||||
return m_keystoreLocation;
|
||||
}
|
||||
|
||||
void AndroidConfig::setKeystoreLocation(const FilePath &keystoreLocation)
|
||||
{
|
||||
m_keystoreLocation = keystoreLocation;
|
||||
}
|
||||
|
||||
QString AndroidConfig::toolchainHost(const BaseQtVersion *qtVersion) const
|
||||
{
|
||||
return toolchainHostFromNdk(ndkLocation(qtVersion));
|
||||
|
@@ -125,7 +125,6 @@ public:
|
||||
void setSdkManagerToolArgs(const QStringList &args);
|
||||
|
||||
Utils::FilePath ndkLocation(const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
Utils::FilePath defaultNdkLocation() const;
|
||||
QVersionNumber ndkVersion(const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
QVersionNumber ndkVersion(const Utils::FilePath &ndkPath) const;
|
||||
|
||||
@@ -143,7 +142,6 @@ public:
|
||||
void setOpenJDKLocation(const Utils::FilePath &openJDKLocation);
|
||||
|
||||
Utils::FilePath keystoreLocation() const;
|
||||
void setKeystoreLocation(const Utils::FilePath &keystoreLocation);
|
||||
|
||||
QString toolchainHost(const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
QString toolchainHostFromNdk(const Utils::FilePath &ndkPath) const;
|
||||
@@ -159,7 +157,6 @@ public:
|
||||
Utils::FilePath emulatorToolPath() const;
|
||||
Utils::FilePath sdkManagerToolPath() const;
|
||||
Utils::FilePath avdManagerToolPath() const;
|
||||
Utils::FilePath aaptToolPath() const;
|
||||
|
||||
Utils::FilePath toolchainPath(const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
Utils::FilePath toolchainPathFromNdk(const Utils::FilePath &ndkLocation) const;
|
||||
@@ -205,9 +202,7 @@ private:
|
||||
const QString &device, const QString &property);
|
||||
|
||||
Utils::FilePath openJDKBinPath() const;
|
||||
int getSDKVersion(const QString &device) const;
|
||||
static int getSDKVersion(const Utils::FilePath &adbToolPath, const QString &device);
|
||||
QStringList getAbis(const QString &device) const;
|
||||
static QStringList getAbis(const Utils::FilePath &adbToolPath, const QString &device);
|
||||
static QString getAvdName(const QString &serialnumber);
|
||||
|
||||
|
@@ -608,20 +608,6 @@ void AndroidDeviceDialog::enableOkayButton()
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
|
||||
}
|
||||
|
||||
// Does not work.
|
||||
void AndroidDeviceDialog::clickedOnView(const QModelIndex &idx)
|
||||
{
|
||||
if (idx.isValid()) {
|
||||
auto node = static_cast<AndroidDeviceModelNode *>(idx.internalPointer());
|
||||
if (!node->displayName().isEmpty()) {
|
||||
if (m_ui->deviceView->isExpanded(idx))
|
||||
m_ui->deviceView->collapse(idx);
|
||||
else
|
||||
m_ui->deviceView->expand(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidDeviceDialog::showHelp()
|
||||
{
|
||||
QPoint pos = m_ui->missingLabel->pos();
|
||||
|
@@ -63,7 +63,6 @@ public:
|
||||
private:
|
||||
void refreshDeviceList();
|
||||
void createAvd();
|
||||
void clickedOnView(const QModelIndex &idx);
|
||||
void showHelp();
|
||||
void avdAdded();
|
||||
void devicesRefreshed();
|
||||
|
@@ -77,7 +77,6 @@ using namespace Android::Internal;
|
||||
namespace Android {
|
||||
|
||||
const QLatin1String AndroidManifestName("AndroidManifest.xml");
|
||||
const QLatin1String AndroidDefaultPropertiesName("project.properties");
|
||||
const QLatin1String AndroidDeviceSn("AndroidDeviceSerialNumber");
|
||||
const QLatin1String AndroidDeviceAbis("AndroidDeviceAbis");
|
||||
const QLatin1String ApiLevelKey("AndroidVersion.ApiLevel");
|
||||
@@ -89,17 +88,6 @@ const QString qtcSignature("This file is generated by QtCreator to be read by an
|
||||
|
||||
static Q_LOGGING_CATEGORY(androidManagerLog, "qtc.android.androidManager", QtWarningMsg)
|
||||
|
||||
static QString parseAaptOutput(const QString &output, const QString ®Ex)
|
||||
{
|
||||
const QRegularExpression regRx(regEx,
|
||||
QRegularExpression::CaseInsensitiveOption |
|
||||
QRegularExpression::MultilineOption);
|
||||
QRegularExpressionMatch match = regRx.match(output);
|
||||
if (match.hasMatch())
|
||||
return match.captured("target");
|
||||
return QString();
|
||||
}
|
||||
|
||||
class Library
|
||||
{
|
||||
public:
|
||||
@@ -139,69 +127,6 @@ QString AndroidManager::packageName(const FilePath &manifestFile)
|
||||
return manifestElem.attribute(QLatin1String("package"));
|
||||
}
|
||||
|
||||
bool AndroidManager::packageInstalled(const QString &deviceSerial,
|
||||
const QString &packageName)
|
||||
{
|
||||
if (deviceSerial.isEmpty() || packageName.isEmpty())
|
||||
return false;
|
||||
QStringList args = AndroidDeviceInfo::adbSelector(deviceSerial);
|
||||
args << "shell" << "pm" << "list" << "packages";
|
||||
QStringList lines = runAdbCommand(args).stdOut().split(QRegularExpression("[\\n\\r]"),
|
||||
Qt::SkipEmptyParts);
|
||||
for (const QString &line : lines) {
|
||||
// Don't want to confuse com.abc.xyz with com.abc.xyz.def so check with
|
||||
// endsWith
|
||||
if (line.endsWith(packageName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int AndroidManager::packageVersionCode(const QString &deviceSerial,
|
||||
const QString &packageName)
|
||||
{
|
||||
if (deviceSerial.isEmpty() || packageName.isEmpty())
|
||||
return -1;
|
||||
|
||||
QStringList args = AndroidDeviceInfo::adbSelector(deviceSerial);
|
||||
args << "shell" << "dumpsys" << "package" << packageName;
|
||||
const QRegularExpression regRx(versionCodeRegEx,
|
||||
QRegularExpression::CaseInsensitiveOption |
|
||||
QRegularExpression::MultilineOption);
|
||||
QRegularExpressionMatch match = regRx.match(runAdbCommand(args).stdOut());
|
||||
if (match.hasMatch())
|
||||
return match.captured("version").toInt();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void AndroidManager::apkInfo(const FilePath &apkPath,
|
||||
QString *packageName,
|
||||
int *version,
|
||||
QString *activityPath)
|
||||
{
|
||||
SdkToolResult result;
|
||||
result = runAaptCommand({"dump", "badging", apkPath.toString()});
|
||||
|
||||
QString packageStr;
|
||||
if (activityPath) {
|
||||
packageStr = parseAaptOutput(result.stdOut(), packageNameRegEx);
|
||||
QString path = parseAaptOutput(result.stdOut(), activityRegEx);
|
||||
if (!packageStr.isEmpty() && !path.isEmpty())
|
||||
*activityPath = packageStr + '/' + path;
|
||||
}
|
||||
|
||||
if (packageName) {
|
||||
*packageName = activityPath ? packageStr :
|
||||
parseAaptOutput(result.stdOut(), packageNameRegEx);
|
||||
}
|
||||
|
||||
if (version) {
|
||||
QString versionStr = parseAaptOutput(result.stdOut(), apkVersionRegEx);
|
||||
*version = versionStr.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
QString AndroidManager::activityName(const Target *target)
|
||||
{
|
||||
QDomDocument doc;
|
||||
@@ -422,11 +347,6 @@ void AndroidManager::setManifestPath(Target *target, const FilePath &path)
|
||||
target->setNamedSettings(AndroidManifestName, QVariant::fromValue(path));
|
||||
}
|
||||
|
||||
FilePath AndroidManager::defaultPropertiesPath(const Target *target)
|
||||
{
|
||||
return dirPath(target).pathAppended(AndroidDefaultPropertiesName);
|
||||
}
|
||||
|
||||
QString AndroidManager::deviceSerialNumber(const Target *target)
|
||||
{
|
||||
return target->namedSettings(AndroidDeviceSn).toString();
|
||||
@@ -767,20 +687,6 @@ bool AndroidManager::updateGradleProperties(Target *target, const QString &build
|
||||
return mergeGradleProperties(gradlePropertiesPath, gradleProperties);
|
||||
}
|
||||
|
||||
int AndroidManager::findApiLevel(const FilePath &platformPath)
|
||||
{
|
||||
int apiLevel = -1;
|
||||
const FilePath propertiesPath = platformPath / "/source.properties";
|
||||
if (propertiesPath.exists()) {
|
||||
QSettings sdkProperties(propertiesPath.toString(), QSettings::IniFormat);
|
||||
bool validInt = false;
|
||||
apiLevel = sdkProperties.value(ApiLevelKey).toInt(&validInt);
|
||||
if (!validInt)
|
||||
apiLevel = -1;
|
||||
}
|
||||
return apiLevel;
|
||||
}
|
||||
|
||||
QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString *err,
|
||||
bool deleteOnFinish)
|
||||
{
|
||||
@@ -830,10 +736,4 @@ SdkToolResult AndroidManager::runAdbCommand(const QStringList &args,
|
||||
return runCommand({AndroidConfigurations::currentConfig().adbToolPath(), args},
|
||||
writeData, timeoutS);
|
||||
}
|
||||
|
||||
SdkToolResult AndroidManager::runAaptCommand(const QStringList &args, int timeoutS)
|
||||
{
|
||||
return runCommand({AndroidConfigurations::currentConfig().aaptToolPath(), args}, {},
|
||||
timeoutS);
|
||||
}
|
||||
} // namespace Android
|
||||
|
@@ -72,12 +72,6 @@ class ANDROID_EXPORT AndroidManager : public QObject
|
||||
public:
|
||||
static QString packageName(const ProjectExplorer::Target *target);
|
||||
static QString packageName(const Utils::FilePath &manifestFile);
|
||||
static bool packageInstalled(const QString &deviceSerial, const QString &packageName);
|
||||
static int packageVersionCode(const QString &deviceSerial, const QString &packageName);
|
||||
static void apkInfo(const Utils::FilePath &apkPath,
|
||||
QString *packageName = nullptr,
|
||||
int *version = nullptr,
|
||||
QString *activityPath = nullptr);
|
||||
static QString activityName(const ProjectExplorer::Target *target);
|
||||
|
||||
static QString deviceSerialNumber(const ProjectExplorer::Target *target);
|
||||
@@ -101,7 +95,6 @@ public:
|
||||
static Utils::FilePath manifestPath(const ProjectExplorer::Target *target);
|
||||
static void setManifestPath(ProjectExplorer::Target *target, const Utils::FilePath &path);
|
||||
static Utils::FilePath manifestSourcePath(const ProjectExplorer::Target *target);
|
||||
static Utils::FilePath defaultPropertiesPath(const ProjectExplorer::Target *target);
|
||||
static Utils::FilePath apkPath(const ProjectExplorer::Target *target);
|
||||
static bool matchedAbis(const QStringList &deviceAbis, const QStringList &appAbis);
|
||||
static QString devicePreferredAbi(const QStringList &deviceAbis, const QStringList &appAbis);
|
||||
@@ -118,13 +111,11 @@ public:
|
||||
static bool checkCertificateExists(const QString &keystorePath, const QString &keystorePasswd,
|
||||
const QString &alias);
|
||||
static bool updateGradleProperties(ProjectExplorer::Target *target, const QString &buildKey);
|
||||
static int findApiLevel(const Utils::FilePath &platformPath);
|
||||
|
||||
static QProcess *runAdbCommandDetached(const QStringList &args, QString *err = nullptr,
|
||||
bool deleteOnFinish = false);
|
||||
static SdkToolResult runAdbCommand(const QStringList &args, const QByteArray &writeData = {},
|
||||
int timeoutS = 30);
|
||||
static SdkToolResult runAaptCommand(const QStringList &args, int timeoutS = 30);
|
||||
|
||||
static QJsonObject deploymentSettings(const ProjectExplorer::Target *target);
|
||||
static bool isQtCreatorGenerated(const Utils::FilePath &deploymentFile);
|
||||
|
@@ -1580,35 +1580,6 @@ QModelIndex PermissionsModel::addPermission(const QString &permission)
|
||||
return index(idx);
|
||||
}
|
||||
|
||||
bool PermissionsModel::updatePermission(const QModelIndex &index, const QString &permission)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
if (m_permissions[index.row()] == permission)
|
||||
return false;
|
||||
|
||||
auto it = std::lower_bound(m_permissions.constBegin(), m_permissions.constEnd(), permission);
|
||||
const int newIndex = it - m_permissions.constBegin();
|
||||
if (newIndex == index.row() || newIndex == index.row() + 1) {
|
||||
m_permissions[index.row()] = permission;
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
|
||||
beginMoveRows(QModelIndex(), index.row(), index.row(), QModelIndex(), newIndex);
|
||||
|
||||
if (newIndex > index.row()) {
|
||||
m_permissions.insert(newIndex, permission);
|
||||
m_permissions.removeAt(index.row());
|
||||
} else {
|
||||
m_permissions.removeAt(index.row());
|
||||
m_permissions.insert(newIndex, permission);
|
||||
}
|
||||
endMoveRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PermissionsModel::removePermission(int index)
|
||||
{
|
||||
if (index >= m_permissions.size())
|
||||
|
@@ -68,7 +68,6 @@ public:
|
||||
void setPermissions(const QStringList &permissions);
|
||||
const QStringList &permissions();
|
||||
QModelIndex addPermission(const QString &permission);
|
||||
bool updatePermission(const QModelIndex &index, const QString &permission);
|
||||
void removePermission(int index);
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
|
@@ -352,11 +352,6 @@ const AndroidSdkPackageList &AndroidSdkManager::allSdkPackages()
|
||||
return m_d->allPackages();
|
||||
}
|
||||
|
||||
AndroidSdkPackageList AndroidSdkManager::availableSdkPackages()
|
||||
{
|
||||
return m_d->filteredPackages(AndroidSdkPackage::Available, AndroidSdkPackage::AnyValidType);
|
||||
}
|
||||
|
||||
AndroidSdkPackageList AndroidSdkManager::installedSdkPackages()
|
||||
{
|
||||
return m_d->filteredPackages(AndroidSdkPackage::Installed, AndroidSdkPackage::AnyValidType);
|
||||
@@ -820,8 +815,6 @@ Ndk *SdkManagerOutputParser::parseNdkPackage(const QStringList &data) const
|
||||
ndk->setDescriptionText(packageData.description);
|
||||
ndk->setDisplayText(packageData.description);
|
||||
ndk->setInstalledLocation(packageData.installedLocation);
|
||||
if (packageData.description == "NDK")
|
||||
ndk->setAsNdkBundle(true);
|
||||
} else {
|
||||
qCDebug(sdkManagerLog) << "NDK: Parsing failed. Minimum required data unavailable:"
|
||||
<< data;
|
||||
|
@@ -67,7 +67,6 @@ public:
|
||||
|
||||
SdkPlatformList installedSdkPlatforms();
|
||||
const AndroidSdkPackageList &allSdkPackages();
|
||||
AndroidSdkPackageList availableSdkPackages();
|
||||
AndroidSdkPackageList installedSdkPackages();
|
||||
SystemImageList installedSystemImages();
|
||||
NdkList installedNdkPackages();
|
||||
|
@@ -154,15 +154,6 @@ AndroidSdkManagerWidget::~AndroidSdkManagerWidget()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void AndroidSdkManagerWidget::setSdkManagerControlsEnabled(bool enable)
|
||||
{
|
||||
m_ui->packagesTypeGroup->setEnabled(enable);
|
||||
m_ui->expandCheck->setVisible(enable);
|
||||
m_ui->packagesView->setEnabled(enable);
|
||||
m_ui->updateInstalledButton->setEnabled(enable);
|
||||
m_ui->optionsButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
void AndroidSdkManagerWidget::installEssentials()
|
||||
{
|
||||
m_sdkModel->selectMissingEssentials();
|
||||
|
@@ -80,7 +80,6 @@ public:
|
||||
QWidget *parent = nullptr);
|
||||
~AndroidSdkManagerWidget() override;
|
||||
|
||||
void setSdkManagerControlsEnabled(bool enable);
|
||||
void installEssentials();
|
||||
|
||||
signals:
|
||||
|
@@ -309,16 +309,6 @@ AndroidSdkPackage::PackageType Ndk::type() const
|
||||
return AndroidSdkPackage::NDKPackage;
|
||||
}
|
||||
|
||||
bool Ndk::isNdkBundle() const
|
||||
{
|
||||
return m_isBundle;
|
||||
}
|
||||
|
||||
void Ndk::setAsNdkBundle(const bool isBundle)
|
||||
{
|
||||
m_isBundle = isBundle;
|
||||
}
|
||||
|
||||
GenericSdkPackage::GenericSdkPackage(QVersionNumber revision, QString sdkStylePathStr, QObject *parent) :
|
||||
AndroidSdkPackage(revision, sdkStylePathStr, parent)
|
||||
{
|
||||
|
@@ -207,12 +207,6 @@ public:
|
||||
// AndroidSdkPackage Overrides
|
||||
bool isValid() const override;
|
||||
PackageType type() const override;
|
||||
|
||||
bool isNdkBundle() const;
|
||||
void setAsNdkBundle(const bool isBundle);
|
||||
|
||||
private:
|
||||
bool m_isBundle = false;
|
||||
};
|
||||
using NdkList = QList<Ndk *>;
|
||||
|
||||
|
Reference in New Issue
Block a user