Skip to content

Commit

Permalink
sanders: Remove prebuilt GPS related commits
Browse files Browse the repository at this point in the history
Revert "sanders: Move GNSS vintf from vendor to local manifest"

This reverts commit 9d2370d2fb28e8cdffe8db11006113a395086c37.

Revert "sanders: Drop intree GPS hal since we moved fully to prebuilt"

This reverts commit 28750e5bc5e11dd4443bdb76be4753db36185b2c.

Change-Id: Ia2ed2c58c16cd0215ef053693489f251e857e5da
  • Loading branch information
Dybios authored and lucasponez committed Dec 30, 2020
1 parent 6d9c425 commit a7ad779
Show file tree
Hide file tree
Showing 137 changed files with 32,182 additions and 6 deletions.
18 changes: 12 additions & 6 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,18 @@ PRODUCT_PACKAGES += \
[email protected]

# GPS
PRODUCT_PACKAGES += \
libgnss \
libgnsspps \
[email protected]

PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/gps/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \
$(LOCAL_PATH)/configs/gps/gps.conf:$(TARGET_COPY_OUT_VENDOR)/etc/gps.conf \
$(LOCAL_PATH)/configs/gps/izat.conf:$(TARGET_COPY_OUT_VENDOR)/etc/izat.conf \
$(LOCAL_PATH)/configs/gps/lowi.conf:$(TARGET_COPY_OUT_VENDOR)/etc/lowi.conf \
$(LOCAL_PATH)/configs/gps/sap.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sap.conf \
$(LOCAL_PATH)/configs/gps/xtwifi.conf:$(TARGET_COPY_OUT_VENDOR)/etc/xtwifi.conf
$(LOCAL_PATH)/gps/etc/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \
$(LOCAL_PATH)/gps/etc/gps.conf:$(TARGET_COPY_OUT_VENDOR)/etc/gps.conf \
$(LOCAL_PATH)/gps/etc/izat.conf:$(TARGET_COPY_OUT_VENDOR)/etc/izat.conf \
$(LOCAL_PATH)/gps/etc/lowi.conf:$(TARGET_COPY_OUT_VENDOR)/etc/lowi.conf \
$(LOCAL_PATH)/gps/etc/sap.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sap.conf \
$(LOCAL_PATH)/gps/etc/xtwifi.conf:$(TARGET_COPY_OUT_VENDOR)/etc/xtwifi.conf

# health
PRODUCT_PACKAGES += \
Expand Down Expand Up @@ -458,6 +463,7 @@ PRODUCT_PACKAGES += \
wpa_supplicant.conf \
WifiOverlay \
TetheringOverlay \
libcurl \
libQWiFiSoftApCfg \
tcpdump

Expand Down
6 changes: 6 additions & 0 deletions gps/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/build/target_specific_features.mk

include $(call all-makefiles-under,$(LOCAL_PATH))
endif
50 changes: 50 additions & 0 deletions gps/CleanSpec.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libloc_api*)
10 changes: 10 additions & 0 deletions gps/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Makefile.am - Automake script for gps loc_api
#

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = gnss

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = loc-hal.pc
EXTRA_DIST = $(pkgconfig_DATA)
203 changes: 203 additions & 0 deletions gps/android/AGnss.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#define LOG_TAG "LocSvc_AGnssInterface"

#include <log_util.h>
#include "Gnss.h"
#include "AGnss.h"

namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {

static AGnss* spAGnss = nullptr;

AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
spAGnss = this;
}

AGnss::~AGnss() {
spAGnss = nullptr;
}

void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){
if (nullptr != spAGnss) {
spAGnss->statusIpV4Cb(status);
}
}

void AGnss::statusIpV4Cb(AGnssExtStatusIpV4 status) {
IAGnssCallback::AGnssStatusIpV4 st = {};

switch (status.type) {
case LOC_AGPS_TYPE_SUPL:
st.type = IAGnssCallback::AGnssType::TYPE_SUPL;
break;
case LOC_AGPS_TYPE_C2K:
st.type = IAGnssCallback::AGnssType::TYPE_C2K;
break;
default:
LOC_LOGE("invalid type: %d", status.type);
return;
}

switch (status.status) {
case LOC_GPS_REQUEST_AGPS_DATA_CONN:
st.status = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
break;
case LOC_GPS_RELEASE_AGPS_DATA_CONN:
st.status = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
break;
case LOC_GPS_AGPS_DATA_CONNECTED:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
break;
case LOC_GPS_AGPS_DATA_CONN_DONE:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
break;
case LOC_GPS_AGPS_DATA_CONN_FAILED:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
break;
default:
LOC_LOGE("invalid status: %d", status.status);
return;
}
st.ipV4Addr = status.ipV4Addr;

if (mAGnssCbIface != nullptr) {
auto r = mAGnssCbIface->agnssStatusIpV4Cb(st);
if (!r.isOk()) {
LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str());
}
} else {
LOC_LOGw("setCallback has not been called yet");
}
}

Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {

if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return Void();
}

// Save the interface
mAGnssCbIface = callback;

AgpsCbInfo cbInfo = {};
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
cbInfo.cbPriority = AGPS_CB_PRIORITY_LOW;

mGnss->getGnssInterface()->agpsInit(cbInfo);
return Void();
}

Return<bool> AGnss::dataConnClosed() {

if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}

mGnss->getGnssInterface()->agpsDataConnClosed(LOC_AGPS_TYPE_SUPL);
return true;
}

Return<bool> AGnss::dataConnFailed() {

if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}

mGnss->getGnssInterface()->agpsDataConnFailed(LOC_AGPS_TYPE_SUPL);
return true;
}

Return<bool> AGnss::dataConnOpen(const hidl_string& apn,
IAGnss::ApnIpType apnIpType) {

if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}

/* Validate */
if(apn.empty()){
LOC_LOGE("Invalid APN");
return false;
}

LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());

AGpsBearerType bearerType;
switch (apnIpType) {
case IAGnss::ApnIpType::IPV4:
bearerType = AGPS_APN_BEARER_IPV4;
break;
case IAGnss::ApnIpType::IPV6:
bearerType = AGPS_APN_BEARER_IPV6;
break;
case IAGnss::ApnIpType::IPV4V6:
bearerType = AGPS_APN_BEARER_IPV4V6;
break;
default:
bearerType = AGPS_APN_BEARER_IPV4;
break;
}

mGnss->getGnssInterface()->agpsDataConnOpen(
LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
return true;
}

Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname,
int32_t port) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}

GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
config.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
if (type == IAGnssCallback::AGnssType::TYPE_SUPL) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
} else if (type == IAGnssCallback::AGnssType::TYPE_C2K) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
} else {
LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<int>(type));
return false;
}
config.assistanceServer.hostName = strdup(hostname.c_str());
config.assistanceServer.port = port;
return mGnss->updateConfiguration(config);
}

} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
79 changes: 79 additions & 0 deletions gps/android/AGnss.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
#define ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H

#include <android/hardware/gnss/1.0/IAGnss.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>

namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {

using ::android::hardware::gnss::V1_0::IAGnss;
using ::android::hardware::gnss::V1_0::IAGnssCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;

struct Gnss;
struct AGnss : public IAGnss {

AGnss(Gnss* gnss);
~AGnss();
/*
* Methods from ::android::hardware::gnss::V1_0::IAGnss interface follow.
* These declarations were generated from IAGnss.hal.
*/
Return<void> setCallback(const sp<IAGnssCallback>& callback) override;

Return<bool> dataConnClosed() override;

Return<bool> dataConnFailed() override;

Return<bool> dataConnOpen(const hidl_string& apn,
IAGnss::ApnIpType apnIpType) override;

Return<bool> setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname, int32_t port) override;

void statusIpV4Cb(AGnssExtStatusIpV4 status);

/* Data call setup callback passed down to GNSS HAL implementation */
static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);

private:
Gnss* mGnss = nullptr;
sp<IAGnssCallback> mAGnssCbIface = nullptr;
};

} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
Loading

0 comments on commit a7ad779

Please sign in to comment.