[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris-binder.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/geoclue-providers-hybris.git</param>
<param name="branch">master</param>
- <param name="revision">0.2.22</param>
+ <param name="revision">HEAD</param>
<param name="token"></param>
<param name="debian"></param>
<param name="dumb"></param>
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/binder/binderlocationbackend.cpp
^
|
@@ -148,7 +148,7 @@
return HYBRIS_APN_IP_INVALID;
}
-static const void *geoclue_binder_gnss_decode_struct1(
+const void *geoclue_binder_gnss_decode_struct1(
GBinderReader *in,
guint size)
{
@@ -226,7 +226,7 @@
const double MpsToKnots = 1.943844;
-static GBinderLocalReply *geoclue_binder_gnss_callback(
+GBinderLocalReply *geoclue_binder_gnss_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -364,19 +364,19 @@
qCDebug(lcGeoclueHybris) << "GNSS set system info";
break;
default:
- qWarning("Failed to decode callback %u\n", code);
+ qWarning("Failed to decode callback %u", code);
break;
}
*status = GBINDER_STATUS_OK;
return gbinder_local_reply_append_int32(gbinder_local_object_new_reply(obj), 0);
} else {
- qWarning("Unknown interface %s and code %u\n", iface, code);
+ qWarning("Unknown interface %s and code %u", iface, code);
*status = GBINDER_STATUS_FAILED;
}
return Q_NULLPTR;
}
-static GBinderLocalReply *geoclue_binder_gnss_xtra_callback(
+GBinderLocalReply *geoclue_binder_gnss_xtra_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -397,19 +397,19 @@
QMetaObject::invokeMethod(staticProvider, "xtraDownloadRequest", Qt::QueuedConnection);
break;
default:
- qWarning("Failed to decode callback %u\n", code);
+ qWarning("Failed to decode callback %u", code);
break;
}
*status = GBINDER_STATUS_OK;
return gbinder_local_reply_append_int32(gbinder_local_object_new_reply(obj), 0);
} else {
- qWarning("Unknown interface %s and code %u\n", iface, code);
+ qWarning("Unknown interface %s and code %u", iface, code);
*status = GBINDER_STATUS_FAILED;
}
return Q_NULLPTR;
}
-static GBinderLocalReply *geoclue_binder_agnss_callback(
+GBinderLocalReply *geoclue_binder_agnss_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -463,20 +463,20 @@
}
break;
default:
- qWarning("Failed to decode callback %u\n", code);
+ qWarning("Failed to decode callback %u", code);
break;
}
*status = GBINDER_STATUS_OK;
return gbinder_local_reply_append_int32(gbinder_local_object_new_reply(obj), 0);
} else {
- qWarning("Unknown interface %s and code %u\n", iface, code);
+ qWarning("Unknown interface %s and code %u", iface, code);
*status = GBINDER_STATUS_FAILED;
}
return Q_NULLPTR;
}
-static GBinderLocalReply *geoclue_binder_agnss_ril_callback(
+GBinderLocalReply *geoclue_binder_agnss_ril_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -500,20 +500,20 @@
qCDebug(lcGeoclueHybris) << "AGNSS RIL request ref location";
break;
default:
- qWarning("Failed to decode callback %u\n", code);
+ qWarning("Failed to decode callback %u", code);
break;
}
*status = GBINDER_STATUS_OK;
return gbinder_local_reply_append_int32(gbinder_local_object_new_reply(obj), 0);
} else {
- qWarning("Unknown interface %s and code %u\n", iface, code);
+ qWarning("Unknown interface %s and code %u", iface, code);
*status = GBINDER_STATUS_FAILED;
}
return Q_NULLPTR;
}
-static GBinderLocalReply *geoclue_binder_gnss_ni_callback(
+GBinderLocalReply *geoclue_binder_gnss_ni_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -534,19 +534,19 @@
qCDebug(lcGeoclueHybris) << "GNSS NI notify";
break;
default:
- qWarning("Failed to decode callback %u\n", code);
+ qWarning("Failed to decode callback %u", code);
break;
}
*status = GBINDER_STATUS_OK;
return gbinder_local_reply_append_int32(gbinder_local_object_new_reply(obj), 0);
} else {
- qWarning("Unknown interface %s and code %u\n", iface, code);
+ qWarning("Unknown interface %s and code %u", iface, code);
*status = GBINDER_STATUS_FAILED;
}
return Q_NULLPTR;
}
-static void geoclue_binder_gnss_gnss_died(
+void geoclue_binder_gnss_gnss_died(
GBinderRemoteObject */*obj*/,
void *user_data)
{
@@ -652,10 +652,9 @@
gbinder_servicemanager_unref(m_sm);
m_sm = Q_NULLPTR;
}
- if (m_fqname) {
- g_free(m_fqname);
- m_fqname = Q_NULLPTR;
- }
+
+ g_free(m_fqname);
+ m_fqname = Q_NULLPTR;
}
bool BinderLocationBackend::isReplySuccess(GBinderRemoteReply *reply)
@@ -682,7 +681,7 @@
gbinder_remote_reply_init_reader(reply, &reader);
if (!gbinder_reader_read_int32(&reader, &status) || status != 0) {
- qWarning("Failed to get extension object %d\n", status);
+ qWarning("Failed to get extension object %d", status);
return Q_NULLPTR;
}
@@ -694,7 +693,7 @@
{
bool ret = false;
- qWarning("Initialising GNSS interface\n");
+ qWarning("Initialising GNSS interface");
m_sm = gbinder_servicemanager_new(GNSS_BINDER_DEFAULT_DEV);
if (m_sm) {
@@ -734,7 +733,7 @@
}
if (!ret) {
- qWarning("Failed to initialise GNSS interface\n");
+ qWarning("Failed to initialise GNSS interface");
}
return ret;
}
@@ -758,7 +757,7 @@
}
if (!ret) {
- qWarning("Failed to start positioning\n");
+ qWarning("Failed to start positioning");
}
return ret;
}
@@ -782,7 +781,7 @@
}
if (!ret) {
- qWarning("Failed to stop positioning\n");
+ qWarning("Failed to stop positioning");
}
return ret;
}
@@ -790,12 +789,7 @@
void BinderLocationBackend::gnssCleanup()
{
if (m_clientGnss) {
- const int status = gbinder_client_transact_sync_oneway(m_clientGnss,
- GNSS_CLEANUP, Q_NULLPTR);
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/binder/binderlocationbackend.h
^
|
@@ -66,6 +66,7 @@
bool aGnssDataConnClosed();
bool aGnssDataConnFailed();
bool aGnssDataConnOpen(const QByteArray &apn, const QString &protocol);
+ int aGnssSetServer(HybrisAGnssType type, const char* hostname, int port);
// AGnssRil
void aGnssRilInit();
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/geoclue-providers-hybris.pri
^
|
@@ -33,6 +33,12 @@
system_dbus_conf.files = com.jollamobile.gps.conf
system_dbus_conf.path = /etc/dbus-1/system.d
+systemd_dbus_service.files = geoclue-providers-hybris.service
+systemd_dbus_service.path = /usr/lib/systemd/user
+
+systemd_dbus_service_symlink.path = .
+systemd_dbus_service_symlink.commands = ln -s geoclue-providers-hybris.service ${INSTALL_ROOT}/usr/lib/systemd/user/dbus-org.freedesktop.Geoclue.Providers.Hybris.service
+
geoclue_provider.files = geoclue-hybris.provider
geoclue_provider.path = /usr/share/geoclue-providers
@@ -49,7 +55,8 @@
$${session_dbus_service.files} \
$${system_dbus_service.files} \
$${system_dbus_conf.files} \
+ $${systemd_dbus_service.files} \
$${geoclue_provider.files} \
rpm/geoclue-providers-hybris.spec
-INSTALLS += target session_dbus_service system_dbus_conf geoclue_provider
+INSTALLS += target session_dbus_service system_dbus_conf geoclue_provider systemd_dbus_service systemd_dbus_service_symlink
|
[-]
[+]
|
Added |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/geoclue-providers-hybris.service
^
|
@@ -0,0 +1,16 @@
+[Unit]
+Description=Geoinformation Service Hybris Provider
+
+[Service]
+Type=dbus
+ExecStart=/usr/libexec/geoclue-hybris
+BusName=org.freedesktop.Geoclue.Providers.Hybris
+#Sandboxing
+Capabilities=
+PrivateTmp=yes
+ProtectHome=yes
+ProtectSystem=full
+
+[Install]
+Alias=dbus-org.freedesktop.Geoclue.Providers.Hybris.service
+
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/hal/hallocationbackend.cpp
^
|
@@ -18,8 +18,12 @@
#include <android-config.h>
+#include <errno.h>
+#include <grp.h>
#include <strings.h>
#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
// Define versions of the Android GPS interface supported.
#if ANDROID_VERSION_MAJOR >= 7
@@ -254,7 +258,7 @@
void requestUtcTimeCallback()
{
- qCDebug(lcGeoclueHybris);
+ qCDebug(lcGeoclueHybris) << "GNSS request UTC time";
QMetaObject::invokeMethod(staticProvider, "injectUtcTime", Qt::QueuedConnection);
}
@@ -263,7 +267,7 @@
void gnssSetSystemInfoCallback(const GnssSystemInfo *info)
{
Q_UNUSED(info)
- qCDebug(lcGeoclueHybris);
+ qCDebug(lcGeoclueHybris) << "GNSS set system info";
}
#endif
@@ -299,19 +303,19 @@
void gpsNiNotifyCallback(GpsNiNotification *notification)
{
Q_UNUSED(notification)
- qCDebug(lcGeoclueHybris);
+ qCDebug(lcGeoclueHybris) << "GNSS NI notify";
}
void agpsRilRequestSetId(uint32_t flags)
{
Q_UNUSED(flags)
- qCDebug(lcGeoclueHybris) << "flags" << showbase << hex << flags;
+ qCDebug(lcGeoclueHybris) << "AGNSS RIL request set ID flags" << showbase << hex << flags;
}
void agpsRilRequestRefLoc(uint32_t flags)
{
Q_UNUSED(flags)
- qCDebug(lcGeoclueHybris) << "flags" << showbase << hex << flags;
+ qCDebug(lcGeoclueHybris) << "AGNSS RIL request ref location flags" << showbase << hex << flags;
}
void gnssXtraDownloadRequest()
@@ -398,6 +402,65 @@
HalLocationBackend::HalLocationBackend(QObject *parent)
: HybrisLocationBackend(parent), m_gps(Q_NULLPTR), m_agps(Q_NULLPTR), m_agpsril(Q_NULLPTR), m_gpsni(Q_NULLPTR), m_xtra(Q_NULLPTR), m_debug(Q_NULLPTR)
{
+ uid_t realUid;
+ uid_t effectiveUid;
+ uid_t savedUid;
+
+ int result = getresuid(&realUid, &effectiveUid, &savedUid);
+ if (result == -1)
+ qFatal("Failed to get process uids, %s", strerror(errno));
+
+ gid_t supplementaryGroups[NGROUPS_MAX];
+ int numberGroups = getgroups(NGROUPS_MAX, supplementaryGroups);
+ if (numberGroups == -1)
+ qFatal("Failed to get supplementary groups, %s", strerror(errno));
+
+ if (numberGroups + 1 > NGROUPS_MAX)
+ qFatal("Too many supplementary groups");
+
+ group *group = getgrnam("gps");
+ if (!group)
+ qFatal("Failed to get id of gps group, %s", strerror(errno));
+
+ supplementaryGroups[numberGroups++] = group->gr_gid;
+
+ // remove nfc, audio, radio and bluetooth groups to avoid confusion in BSP
+ const char *groups_to_remove[] = {"bluetooth", "radio", "audio", "nfc", NULL};
+
+ for (int idx = 0; idx < numberGroups; idx++) {
+ for (int j = 0; groups_to_remove[j]; j++) {
+ group = getgrnam(groups_to_remove[j]);
+ if (group) {
+ if (supplementaryGroups[idx] == group->gr_gid) {
+ // remove it
+ qCDebug(lcGeoclueHybris, "Removing supplementary group %s (%i)", groups_to_remove[j], supplementaryGroups[idx]);
+ memmove((void*)&supplementaryGroups[idx], (void*)&supplementaryGroups[idx + 1], (numberGroups - idx) * sizeof(gid_t));
+ numberGroups--;
+ }
+ }
+ }
+ }
+
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
+ group = getgrnam("net_raw");
+ if (group) {
+ if (numberGroups + 1 > NGROUPS_MAX)
+ qWarning("Too many supplementary groups, can't add net_raw");
+ else
+ supplementaryGroups[numberGroups++] = group->gr_gid;
+ }
+#endif
+
+ numberGroups = setgroups(numberGroups, supplementaryGroups);
+ if (numberGroups == -1)
+ qFatal("Failed to set supplementary groups, %s", strerror(errno));
+
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 1
+ // Drop privileges.
+ result = setuid(realUid);
+ if (result == -1)
+ qFatal("Failed to set process uid to %d, %s", realUid, strerror(errno));
+#endif
}
HalLocationBackend::~HalLocationBackend()
@@ -411,17 +474,17 @@
int error = hw_get_module(GPS_HARDWARE_MODULE_ID, &hwModule);
if (error) {
- qWarning("Android GPS interface not found, error %d\n", error);
+ qWarning("Android GPS interface not found, error %d", error);
return false;
}
- qWarning("Android GPS hardware module \"%s\" \"%s\" %u.%u\n", hwModule->id, hwModule->name,
+ qWarning("Android GPS hardware module \"%s\" \"%s\" %u.%u", hwModule->id, hwModule->name,
hwModule->module_api_version, hwModule->hal_api_version);
error = hwModule->methods->open(hwModule, GPS_HARDWARE_MODULE_ID,
reinterpret_cast<hw_device_t **>(&m_gpsDevice));
if (error) {
- qWarning("Failed to open GPS device, error %d\n", error);
+ qWarning("Failed to open GPS device, error %d", error);
return false;
}
@@ -429,11 +492,11 @@
if (!m_gps)
return false;
- qWarning("Initialising GPS interface\n");
+ qWarning("Initialising GPS interface");
error = m_gps->init(&gpsCallbacks);
if (error) {
- qWarning("Failed to initialise GPS interface, error %d\n", error);
+ qWarning("Failed to initialise GPS interface, error %d", error);
return false;
}
@@ -445,7 +508,7 @@
if (m_gps) {
int error = m_gps->start();
if (error) {
- qWarning("Failed to start positioning, error %d\n", error);
+ qWarning("Failed to start positioning, error %d", error);
return false;
}
return true;
@@ -458,7 +521,7 @@
if (m_gps) {
int error = m_gps->stop();
if (error) {
- qWarning("Failed to stop positioning, error %d\n", error);
+ qWarning("Failed to stop positioning, error %d", error);
return false;
}
return true;
@@ -480,7 +543,7 @@
if (m_gps) {
int error = m_gps->inject_location(latitudeDegrees, longitudeDegrees, accuracyMeters);
if (error) {
- qWarning("Failed to inject location, error %d\n", error);
+ qWarning("Failed to inject location, error %d", error);
return false;
}
return true;
@@ -493,7 +556,7 @@
if (m_gps) {
int error = m_gps->inject_time(timeMs, timeReferenceMs, uncertaintyMs);
if (error) {
- qWarning("Failed to inject time, error %d\n", error);
+ qWarning("Failed to inject time, error %d", error);
return false;
}
return true;
@@ -503,7 +566,9 @@
void HalLocationBackend::gnssDeleteAidingData(HybrisGnssAidingData aidingDataFlags)
{
- Q_UNUSED(aidingDataFlags)
+ if (m_gps) {
+ m_gps->delete_aiding_data(aidingDataFlags);
+ }
}
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/hal/hallocationbackend.h
^
|
@@ -64,6 +64,7 @@
bool aGnssDataConnClosed();
bool aGnssDataConnFailed();
bool aGnssDataConnOpen(const QByteArray &apn, const QString &protocol);
+ int aGnssSetServer(HybrisAGnssType type, const char* hostname, int port);
// AGnssRil
void aGnssRilInit();
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/hybrislocationbackend.h
^
|
@@ -136,6 +136,7 @@
virtual bool aGnssDataConnClosed() = 0;
virtual bool aGnssDataConnFailed() = 0;
virtual bool aGnssDataConnOpen(const QByteArray &apn, const QString &protocol) = 0;
+ virtual int aGnssSetServer(HybrisAGnssType type, const char* hostname, int port) = 0;
// AGnssRil
virtual void aGnssRilInit() = 0;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/hybrisprovider.cpp
^
|
@@ -48,6 +48,12 @@
HybrisProvider *staticProvider = Q_NULLPTR;
+// Some older devices have the GPS week number rollover bug
+// which breaks timestamps so workaround it using a constant offset
+// of 1024 weeks if timestamp is too small
+const HybrisGnssUtcTime GnssWeekRolloverTimestamp = 1554595200000;
+const HybrisGnssUtcTime GnssWeekRolloverTimestampOffset = 619315200000;
+
namespace
{
@@ -56,20 +62,6 @@
const quint32 MinimumInterval = 1000;
const quint32 PreferredAccuracy = 0;
const quint32 PreferredInitialFixTime = 0;
-const double KnotsToMps = 0.514444;
-
-const QString LocationSettingsDir = QStringLiteral("/etc/location/");
-const QString LocationSettingsFile = QStringLiteral("/etc/location/location.conf");
-const QString LocationSettingsEnabledKey = QStringLiteral("location/enabled");
-const QString LocationSettingsAllowedDataSourcesGpsKey = QStringLiteral("allowed_data_sources/gps");
-const QString LocationSettingsGpsEnabledKey = QStringLiteral("location/gps/enabled");
-const QString LocationSettingsAgpsEnabledKey = QStringLiteral("location/%1/enabled");
-const QString LocationSettingsAgpsOnlineEnabledKey = QStringLiteral("location/%1/online_enabled");
-const QString LocationSettingsAgpsAgreementAcceptedKey = QStringLiteral("location/%1/agreement_accepted");
-const QString LocationSettingsAgpsProvidersKey = QStringLiteral("location/agps_providers");
-// deprecated keys
-const QString LocationSettingsOldAgpsEnabledKey = QStringLiteral("location/agreement_accepted");
-const QString LocationSettingsOldAgpsAgreementAcceptedKey = QStringLiteral("location/here_agreement_accepted");
const int MaxXtraServers = 3;
const QString XtraConfigFile = QStringLiteral("/etc/gps_xtra.ini");
@@ -162,7 +154,8 @@
m_networkManager(new NetworkManager(this)), m_cellularTechnology(Q_NULLPTR),
m_ofonoExtModemManager(new QOfonoExtModemManager(this)),
m_connectionManager(new QOfonoConnectionManager(this)), m_connectionContext(Q_NULLPTR), m_ntpSocket(Q_NULLPTR),
- m_agpsEnabled(false), m_agpsOnlineEnabled(false), m_useForcedXtraInject(false), m_xtraUserAgent("")
+ m_agpsEnabled(false), m_agpsOnlineEnabled(false), m_useForcedNtpInject(false), m_useForcedXtraInject(false),
+ m_suplPort(0)
{
if (staticProvider)
qFatal("Only a single instance of HybrisProvider is supported.");
@@ -213,46 +206,42 @@
m_idleTimer.start(QuitIdleTime, this);
}
- QString xtraUserAgentFileName;
QSettings settings(XtraConfigFile, QSettings::IniFormat);
- QString xtraServer;
for (int i = 0; i < MaxXtraServers; i++) {
QString key = QString("xtra/XTRA_SERVER_%1").arg(i);
- xtraServer = settings.value(key, "").toString();
- if (xtraServer != "") {
+ QString xtraServer = settings.value(key, QString()).toString();
+ if (!xtraServer.isEmpty()) {
m_xtraServers.enqueue(xtraServer);
}
}
+ if (!m_xtraServers.isEmpty())
+ qCDebug(lcGeoclueHybris) << "Overriding XTRA servers with" << m_xtraServers;
m_useForcedXtraInject = settings.value("xtra/XTRA_FORCE_INJECT", "").toBool();
+ if (m_useForcedXtraInject)
+ qCDebug(lcGeoclueHybris) << "Forcing XTRA data injection";
- xtraUserAgentFileName = settings.value("xtra/XTRA_USERAGENT_FILE", "").toString();
- if (xtraUserAgentFileName != "") {
+ QString xtraUserAgentFileName = settings.value("xtra/XTRA_USERAGENT_FILE", QString()).toString();
+ if (!xtraUserAgentFileName.isEmpty()) {
QFile xtraUserAgentFile(xtraUserAgentFileName);
if (xtraUserAgentFile.open(QIODevice::ReadOnly)) {
m_xtraUserAgent = xtraUserAgentFile.readLine();
+ qCDebug(lcGeoclueHybris) << "Overriding XTRA user agent with" << m_xtraUserAgent;
}
}
- if (m_xtraServers.isEmpty()) {
- QFile gpsConf(QStringLiteral("/system/etc/gps.conf"));
- if (gpsConf.open(QIODevice::ReadOnly)) {
+ m_useForcedNtpInject = settings.value("ntp/NTP_FORCE_INJECT", "").toBool();
+ if (m_useForcedNtpInject)
+ qCDebug(lcGeoclueHybris) << "Forcing NTP injection";
+
+ m_suplHost = settings.value("supl/SUPL_HOST").toString();
+ m_suplPort = settings.value("supl/SUPL_PORT").toInt();
+ if (!m_suplHost.isEmpty() && m_suplPort > 0)
+ qCDebug(lcGeoclueHybris) << "Overriding SUPL server with" << m_suplHost << "port" << m_suplPort;
- while (!gpsConf.atEnd()) {
- const QByteArray line = gpsConf.readLine().trimmed();
- if (line.startsWith('#'))
- continue;
-
- const QList<QByteArray> split = line.split('=');
- if (split.length() != 2)
- continue;
-
- const QByteArray key = split.at(0).trimmed();
- if (key == "XTRA_SERVER_1" || key == "XTRA_SERVER_2" || key == "XTRA_SERVER_3")
- m_xtraServers.enqueue(QUrl::fromEncoded(split.at(1).trimmed()));
- }
- }
+ if (m_xtraServers.isEmpty() || m_suplHost.isEmpty() || m_suplPort == 0) {
+ loadDefaultsFromConfigurationFile();
}
m_backend = getLocationBackend();
@@ -267,6 +256,12 @@
m_backend->aGnssRilInit();
m_backend->gnssXtraInit();
m_backend->gnssDebugInit();
+
+ // Set SUPL server if provided
+ if (!m_suplHost.isEmpty() && m_suplPort > 0) {
+ if (!m_backend->aGnssSetServer(HYBRIS_AGNSS_TYPE_SUPL, m_suplHost.toLatin1().constData(), m_suplPort))
+ qWarning("Setting SUPL server to %s (%i) failed", m_suplHost.toLatin1().constData(), m_suplPort);
+ }
}
HybrisProvider::~HybrisProvider()
@@ -280,6 +275,49 @@
staticProvider = 0;
}
+void HybrisProvider::loadDefaultsFromConfigurationFile()
+{
+ QFile gpsConf;
+ bool parseXtraServers = false;
+ const char *paths[] = {"/vendor/etc/gps.conf", "/system/etc/gps.conf", NULL};
+ int i = 0;
+ while (paths[i] != NULL) {
+ gpsConf.setFileName(paths[i]);
+ if (gpsConf.open(QIODevice::ReadOnly)) {
+ break;
+ }
+ ++i;
+ }
+ if (!gpsConf.isOpen()) {
+ return;
+ }
+ if (m_xtraServers.isEmpty()) {
+ parseXtraServers = true;
+ }
+
+ while (!gpsConf.atEnd()) {
+ const QByteArray line = gpsConf.readLine().trimmed();
+ if (line.startsWith('#'))
+ continue;
+
+ const QList<QByteArray> split = line.split('=');
+ if (split.length() != 2)
+ continue;
+
+ const QByteArray key = split.at(0).trimmed();
+ if (parseXtraServers) {
+ if (key == "XTRA_SERVER_1" || key == "XTRA_SERVER_2" || key == "XTRA_SERVER_3")
+ m_xtraServers.enqueue(QUrl::fromEncoded(split.at(1).trimmed()));
+ }
+ if (m_suplHost.isEmpty() && key == "SUPL_HOST") {
+ m_suplHost = split.at(1).trimmed();
+ }
+ if (m_suplPort == 0 && key == "SUPL_PORT") {
+ m_suplPort = split.at(1).trimmed().toInt();
+ }
+ }
+}
+
void HybrisProvider::setLocationSettings(LocationSettings *settings)
{
if (!m_locationSettings) {
@@ -374,6 +412,13 @@
HYBRIS_GNSS_POSITION_RECURRENCE_PERIODIC, updateInterval,
PreferredAccuracy, PreferredInitialFixTime);
}
+
+ if (options.contains(QStringLiteral("NoCachedAidingData"))
+ && options.value(QStringLiteral("NoCachedAidingData")).toBool()
+ && m_backend) {
+ //GPS_DELETE_ALL = 0xFFFF (almanac, ephemeris, position, time and other cache data)
+ m_backend->gnssDeleteAidingData(0xFFFF);
+ }
}
int HybrisProvider::GetPosition(int ×tamp, double &latitude, double &longitude,
@@ -454,12 +499,14 @@
void HybrisProvider::setLocation(const Location &location)
{
- qCDebug(lcGeoclueHybrisPosition) << location.timestamp() << location.latitude()
+ qCDebug(lcGeoclueHybrisPosition) << "Set location"
+ << location.timestamp() << location.latitude()
<< location.longitude() << location.altitude();
// Stop listening to all PositionChanged signals from org.freedesktop.Geoclue.Position
// interfaces.
if (m_positionInjectionConnected) {
+ qCDebug(lcGeoclueHybrisPosition) << "Stop listening to all PositionChanged signals";
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/hybrisprovider.h
^
|
@@ -156,6 +156,8 @@
void cellularConnected(bool connected);
private:
+ void loadDefaultsFromConfigurationFile();
+
void emitLocationChanged();
void emitSatelliteChanged();
void startPositioningIfNeeded();
@@ -236,9 +238,13 @@
bool m_agpsEnabled;
bool m_agpsOnlineEnabled;
+ bool m_useForcedNtpInject;
bool m_useForcedXtraInject;
QString m_xtraUserAgent;
double m_magneticVariation;
+
+ QString m_suplHost;
+ int m_suplPort;
};
extern HybrisProvider *staticProvider;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/main.cpp
^
|
@@ -18,17 +18,8 @@
#include <locationsettings.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <grp.h>
-#include <errno.h>
-
int main(int argc, char *argv[])
{
- uid_t realUid;
- uid_t effectiveUid;
- uid_t savedUid;
-
#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
QCoreApplication::setSetuidAllowed(true);
#endif
@@ -37,60 +28,6 @@
"geoclue.provider.hybris.position.debug=false"));
QCoreApplication a(argc, argv);
- int result = getresuid(&realUid, &effectiveUid, &savedUid);
- if (result == -1)
- qFatal("Failed to get process uids, %s", strerror(errno));
-
- gid_t supplementaryGroups[NGROUPS_MAX];
- int numberGroups = getgroups(NGROUPS_MAX, supplementaryGroups);
- if (numberGroups == -1)
- qFatal("Failed to get supplementary groups, %s", strerror(errno));
-
- if (numberGroups + 1 > NGROUPS_MAX)
- qFatal("Too many supplementary groups");
-
- group *group = getgrnam("gps");
- if (!group)
- qFatal("Failed to get id of gps group, %s", strerror(errno));
-
- supplementaryGroups[numberGroups++] = group->gr_gid;
-
- // remove audio, radio and bluetooth groups to avoid confusion in BSP
- char *groups_to_remove[] = {"bluetooth", "radio", "audio", NULL};
-
- int idx = 0;
- while (groups_to_remove[idx]) {
- group = getgrnam(groups_to_remove[idx]);
- idx++;
-
- if (idx + 1 < numberGroups) {
- memmove((void*)&supplementaryGroups[idx], (void*)&supplementaryGroups[idx + 1], (numberGroups - idx - 1) * sizeof(gid_t));
- }
-
- numberGroups--;
- }
-
-#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
- group = getgrnam("net_raw");
- if (group) {
- if (numberGroups + 1 > NGROUPS_MAX)
- qWarning("Too many supplementary groups, can't add net_raw");
- else
- supplementaryGroups[numberGroups++] = group->gr_gid;
- }
-#endif
-
- numberGroups = setgroups(numberGroups, supplementaryGroups);
- if (numberGroups == -1)
- qFatal("Failed to set supplementary groups, %s", strerror(errno));
-
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 1
- // Drop privileges.
- result = setuid(realUid);
- if (result == -1)
- qFatal("Failed to set process uid to %d, %s", realUid, strerror(errno));
-#endif
-
QDBusConnection session = QDBusConnection::sessionBus();
LocationSettings settings;
HybrisProvider provider;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.32.tar.gz/org.freedesktop.Geoclue.Providers.Hybris.service
^
|
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=org.freedesktop.Geoclue.Providers.Hybris
-Exec=/usr/libexec/geoclue-hybris
+Exec=/bin/false
+SystemdService=dbus-org.freedesktop.Geoclue.Providers.Hybris.service
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.inc
^
|
@@ -1,7 +1,6 @@
Summary: Geoinformation Service Hybris Provider
-Group: System/Libraries
-URL: https://bitbucket.org/jolla/base-geoclue-providers-hybris
-License: LGPLv2.1
+URL: https://github.com/mer-hybris/geoclue-providers-hybris
+License: LGPLv2
Source: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5DBus)
@@ -10,6 +9,7 @@
BuildRequires: pkgconfig(qofono-qt5)
BuildRequires: pkgconfig(qofonoext)
BuildRequires: pkgconfig(systemsettings) >= 0.5.5
+BuildRequires: systemd
Requires: connectionagent-qt5 >= 0.9.20
Source100: geoclue-providers-hybris.inc
@@ -17,24 +17,26 @@
%description
%{summary}.
-
%prep
-%setup -q -n %{name}-%{version}
-
+%autosetup -n %{name}-%{version}
%build
%{qmake_command}
-make %{?_smp_mflags}
-
+%make_build
%install
-make INSTALL_ROOT=%{buildroot} install
+%make_install
%files
+%if 0%{?with_suid}
%defattr(04755,root,root,-)
+%else
+%defattr(-,root,root,-)
+%endif
%{_libexecdir}/geoclue-hybris
%defattr(-,root,root,-)
%{_sysconfdir}/dbus-1
%{_datadir}/dbus-1
%{_datadir}/geoclue-providers/geoclue-hybris.provider
-
+%{_userunitdir}/geoclue-providers-hybris.service
+%{_userunitdir}/dbus-org.freedesktop.Geoclue.Providers.Hybris.service
|