2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-07-03 16:57:44 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-07-03 16:57:44 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-07-03 16:57:44 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-07-03 16:57:44 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-07-03 16:57:44 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-07-03 16:57:44 +03:00
|
|
|
|
|
|
|
#include "androiddevice.h"
|
|
|
|
#include "androidconstants.h"
|
2013-09-30 13:20:02 +02:00
|
|
|
#include "androidsignaloperation.h"
|
2018-02-09 17:20:22 +01:00
|
|
|
#include "androidconfigurations.h"
|
2018-06-18 13:40:02 +02:00
|
|
|
#include "androidmanager.h"
|
2012-07-03 16:57:44 +03:00
|
|
|
|
2016-06-03 19:11:29 +02:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
|
|
|
|
2017-10-25 16:18:58 +02:00
|
|
|
#include <utils/url.h>
|
|
|
|
|
2012-07-03 16:57:44 +03:00
|
|
|
#include <QCoreApplication>
|
2018-07-17 13:58:50 +02:00
|
|
|
#include <QLoggingCategory>
|
2012-07-03 16:57:44 +03:00
|
|
|
|
2012-07-26 17:41:52 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
2018-07-17 13:58:50 +02:00
|
|
|
namespace {
|
2018-10-12 09:33:30 +03:00
|
|
|
Q_LOGGING_CATEGORY(androidDeviceLog, "qtc.android.build.androiddevice", QtWarningMsg)
|
2018-07-17 13:58:50 +02:00
|
|
|
}
|
|
|
|
|
2012-07-03 16:57:44 +03:00
|
|
|
namespace Android {
|
|
|
|
namespace Internal {
|
|
|
|
|
2012-07-26 17:41:52 +02:00
|
|
|
AndroidDevice::AndroidDevice()
|
2012-07-03 16:57:44 +03:00
|
|
|
{
|
2019-01-14 16:57:51 +01:00
|
|
|
setupId(IDevice::AutoDetected, Constants::ANDROID_DEVICE_ID);
|
2019-01-14 16:11:27 +01:00
|
|
|
setType(Constants::ANDROID_DEVICE_TYPE);
|
2019-08-01 14:30:10 +02:00
|
|
|
setDefaultDisplayName(QCoreApplication::translate("Android::Internal::AndroidDevice",
|
|
|
|
"Run on Android"));
|
2019-06-19 13:28:14 +02:00
|
|
|
setDisplayType(QCoreApplication::translate("Android::Internal::AndroidDevice", "Android"));
|
2019-01-14 15:27:52 +01:00
|
|
|
setMachineType(IDevice::Hardware);
|
2012-07-03 16:57:44 +03:00
|
|
|
setDeviceState(DeviceReadyToUse);
|
2018-06-18 13:40:02 +02:00
|
|
|
QString activityPath;
|
|
|
|
const AndroidConfig &config = AndroidConfigurations::currentConfig();
|
|
|
|
AndroidManager::apkInfo(config.qtLiveApkPath(), nullptr, nullptr, &activityPath);
|
2018-07-17 13:58:50 +02:00
|
|
|
qCDebug(androidDeviceLog) << "Using Qt live apk from: " << config.qtLiveApkPath()
|
|
|
|
<< "Activity Path:" << activityPath;
|
2018-06-18 13:40:02 +02:00
|
|
|
setQmlsceneCommand(activityPath);
|
2012-07-03 16:57:44 +03:00
|
|
|
}
|
|
|
|
|
2012-07-26 17:41:52 +02:00
|
|
|
IDevice::DeviceInfo AndroidDevice::deviceInformation() const
|
2012-07-03 16:57:44 +03:00
|
|
|
{
|
2012-07-26 17:41:52 +02:00
|
|
|
return IDevice::DeviceInfo();
|
2012-07-03 16:57:44 +03:00
|
|
|
}
|
|
|
|
|
2012-07-26 17:41:52 +02:00
|
|
|
IDeviceWidget *AndroidDevice::createWidget()
|
2012-07-03 16:57:44 +03:00
|
|
|
{
|
2018-07-25 12:19:15 +02:00
|
|
|
return nullptr;
|
2012-07-03 16:57:44 +03:00
|
|
|
}
|
|
|
|
|
2013-04-18 10:01:05 +02:00
|
|
|
bool AndroidDevice::canAutoDetectPorts() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-09-16 15:30:30 +02:00
|
|
|
DeviceProcessSignalOperation::Ptr AndroidDevice::signalOperation() const
|
|
|
|
{
|
2013-09-30 13:20:02 +02:00
|
|
|
return DeviceProcessSignalOperation::Ptr(new AndroidSignalOperation());
|
2013-09-16 15:30:30 +02:00
|
|
|
}
|
|
|
|
|
2017-06-28 17:16:07 +02:00
|
|
|
Utils::OsType AndroidDevice::osType() const
|
|
|
|
{
|
|
|
|
return Utils::OsTypeOtherUnix;
|
|
|
|
}
|
|
|
|
|
2017-06-29 18:32:01 +02:00
|
|
|
QUrl AndroidDevice::toolControlChannel(const ControlChannelHint &) const
|
2013-10-11 12:58:24 +02:00
|
|
|
{
|
2017-06-29 18:32:01 +02:00
|
|
|
QUrl url;
|
2017-10-25 16:18:58 +02:00
|
|
|
url.setScheme(Utils::urlTcpScheme());
|
2017-06-29 18:32:01 +02:00
|
|
|
url.setHost("localhost");
|
|
|
|
return url;
|
2013-10-11 12:58:24 +02:00
|
|
|
}
|
|
|
|
|
2019-02-20 19:13:28 +01:00
|
|
|
|
|
|
|
// Factory
|
|
|
|
|
|
|
|
AndroidDeviceFactory::AndroidDeviceFactory()
|
|
|
|
: ProjectExplorer::IDeviceFactory(Constants::ANDROID_DEVICE_TYPE)
|
|
|
|
{
|
|
|
|
setObjectName(QLatin1String("AndroidDeviceFactory"));
|
|
|
|
setDisplayName(tr("Android Device"));
|
|
|
|
setCombinedIcon(":/android/images/androiddevicesmall.png",
|
|
|
|
":/android/images/androiddevice.png");
|
|
|
|
setConstructionFunction(&AndroidDevice::create);
|
|
|
|
}
|
|
|
|
|
2012-07-03 16:57:44 +03:00
|
|
|
} // namespace Internal
|
|
|
|
} // namespace Android
|