Add boilerplate default implementation for Gnss Hal v1.1
Bug: 73845705
Test: gce_x86 device builds and runs. Debug logging shows default
implementation is called by GnssLocationProvider.
Change-Id: I58db6b11ad8b67d0364d8945801165cf6e499e55
diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp
new file mode 100644
index 0000000..977a22f
--- /dev/null
+++ b/gnss/1.1/default/Android.bp
@@ -0,0 +1,20 @@
+cc_binary {
+ name: "android.hardware.gnss@1.1-service",
+ init_rc: ["android.hardware.gnss@1.1-service.rc"],
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: [
+ "Gnss.cpp",
+ "GnssConfiguration.cpp",
+ "GnssMeasurement.cpp",
+ "service.cpp",
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "liblog",
+ "android.hardware.gnss@1.1",
+ "android.hardware.gnss@1.0",
+ ],
+}
diff --git a/gnss/1.1/default/Gnss.cpp b/gnss/1.1/default/Gnss.cpp
new file mode 100644
index 0000000..308ba70
--- /dev/null
+++ b/gnss/1.1/default/Gnss.cpp
@@ -0,0 +1,147 @@
+#define LOG_TAG "Gnss"
+
+#include "Gnss.h"
+#include <log/log.h>
+#include "GnssConfiguration.h"
+#include "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+// Methods from ::android::hardware::gnss::V1_0::IGnss follow.
+Return<bool> Gnss::setCallback(const sp<::android::hardware::gnss::V1_0::IGnssCallback>&) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::start() {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::stop() {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::cleanup() {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::injectTime(int64_t, int64_t, int32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::injectLocation(double, double, float) {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::deleteAidingData(::android::hardware::gnss::V1_0::IGnss::GnssAidingData) {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(::android::hardware::gnss::V1_0::IGnss::GnssPositionMode,
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionRecurrence,
+ uint32_t, uint32_t, uint32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IAGnssRil>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IGnssGeofencing>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IAGnss>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IGnssNi>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ // TODO implement
+ return new GnssMeasurement();
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssNavigationMessage>>
+Gnss::getExtensionGnssNavigationMessage() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IGnssNavigationMessage>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssXtra>> Gnss::getExtensionXtra() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IGnssXtra>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssConfiguration>>
+Gnss::getExtensionGnssConfiguration() {
+ // TODO implement
+ return new GnssConfiguration();
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IGnssDebug>{};
+}
+
+Return<sp<::android::hardware::gnss::V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ // TODO implement
+ return ::android::sp<::android::hardware::gnss::V1_0::IGnssBatching>{};
+}
+
+// Methods from ::android::hardware::gnss::V1_1::IGnss follow.
+Return<bool> Gnss::setCallback_1_1(const sp<::android::hardware::gnss::V1_1::IGnssCallback>&) {
+ ALOGI("Gnss::setCallback_1_1");
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::setPositionMode_1_1(
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionMode,
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t, uint32_t,
+ bool) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<::android::hardware::gnss::V1_1::IGnssConfiguration>>
+Gnss::getExtensionGnssConfiguration_1_1() {
+ // TODO implement
+ return new GnssConfiguration();
+}
+
+Return<sp<::android::hardware::gnss::V1_1::IGnssMeasurement>>
+Gnss::getExtensionGnssMeasurement_1_1() {
+ // TODO implement
+ return new GnssMeasurement();
+}
+
+Return<bool> Gnss::injectBestLocation(const ::android::hardware::gnss::V1_0::GnssLocation&) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/1.1/default/Gnss.h b/gnss/1.1/default/Gnss.h
new file mode 100644
index 0000000..e9ad34b
--- /dev/null
+++ b/gnss/1.1/default/Gnss.h
@@ -0,0 +1,79 @@
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
+
+#include <android/hardware/gnss/1.1/IGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct Gnss : public IGnss {
+ // Methods from ::android::hardware::gnss::V1_0::IGnss follow.
+ Return<bool> setCallback(
+ const sp<::android::hardware::gnss::V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ Return<bool> injectLocation(double latitudeDegrees, double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<void> deleteAidingData(
+ ::android::hardware::gnss::V1_0::IGnss::GnssAidingData aidingDataFlags) override;
+ Return<bool> setPositionMode(
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionMode mode,
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) override;
+ Return<sp<::android::hardware::gnss::V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssGeofencing>> getExtensionGnssGeofencing()
+ override;
+ Return<sp<::android::hardware::gnss::V1_0::IAGnss>> getExtensionAGnss() override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssNi>> getExtensionGnssNi() override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssMeasurement>> getExtensionGnssMeasurement()
+ override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssNavigationMessage>>
+ getExtensionGnssNavigationMessage() override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssXtra>> getExtensionXtra() override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssConfiguration>> getExtensionGnssConfiguration()
+ override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssDebug>> getExtensionGnssDebug() override;
+ Return<sp<::android::hardware::gnss::V1_0::IGnssBatching>> getExtensionGnssBatching() override;
+
+ // Methods from ::android::hardware::gnss::V1_1::IGnss follow.
+ Return<bool> setCallback_1_1(
+ const sp<::android::hardware::gnss::V1_1::IGnssCallback>& callback) override;
+ Return<bool> setPositionMode_1_1(
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionMode mode,
+ ::android::hardware::gnss::V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs,
+ bool lowPowerMode) override;
+ Return<sp<::android::hardware::gnss::V1_1::IGnssConfiguration>>
+ getExtensionGnssConfiguration_1_1() override;
+ Return<sp<::android::hardware::gnss::V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1()
+ override;
+ Return<bool> injectBestLocation(
+ const ::android::hardware::gnss::V1_0::GnssLocation& location) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
diff --git a/gnss/1.1/default/GnssConfiguration.cpp b/gnss/1.1/default/GnssConfiguration.cpp
new file mode 100644
index 0000000..d05f317
--- /dev/null
+++ b/gnss/1.1/default/GnssConfiguration.cpp
@@ -0,0 +1,58 @@
+#include "GnssConfiguration.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setSuplEs(bool) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setSuplVersion(uint32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setSuplMode(hidl_bitfield<SuplMode>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setGpsLock(hidl_bitfield<GpsLock>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setLppProfile(hidl_bitfield<LppProfile>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setEmergencySuplPdn(bool) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setBlacklist(
+ const hidl_vec<::android::hardware::gnss::V1_1::IGnssConfiguration::BlacklistedSource>&) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/1.1/default/GnssConfiguration.h b/gnss/1.1/default/GnssConfiguration.h
new file mode 100644
index 0000000..4f7ed2b
--- /dev/null
+++ b/gnss/1.1/default/GnssConfiguration.h
@@ -0,0 +1,46 @@
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
+
+#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct GnssConfiguration : public IGnssConfiguration {
+ // Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+ Return<bool> setSuplEs(bool enabled) override;
+ Return<bool> setSuplVersion(uint32_t version) override;
+ Return<bool> setSuplMode(hidl_bitfield<SuplMode> mode) override;
+ Return<bool> setGpsLock(hidl_bitfield<GpsLock> lock) override;
+ Return<bool> setLppProfile(hidl_bitfield<LppProfile> lppProfile) override;
+ Return<bool> setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol> protocol) override;
+ Return<bool> setEmergencySuplPdn(bool enable) override;
+
+ // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+ Return<bool> setBlacklist(
+ const hidl_vec<::android::hardware::gnss::V1_1::IGnssConfiguration::BlacklistedSource>&
+ blacklist) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
diff --git a/gnss/1.1/default/GnssMeasurement.cpp b/gnss/1.1/default/GnssMeasurement.cpp
new file mode 100644
index 0000000..e88badd
--- /dev/null
+++ b/gnss/1.1/default/GnssMeasurement.cpp
@@ -0,0 +1,35 @@
+#include "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+Return<::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus>
+GnssMeasurement::setCallback(const sp<::android::hardware::gnss::V1_0::IGnssMeasurementCallback>&) {
+ // TODO implement
+ return ::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+Return<void> GnssMeasurement::close() {
+ // TODO implement
+ return Void();
+}
+
+// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
+Return<::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus>
+GnssMeasurement::setCallback_1_1(
+ const sp<::android::hardware::gnss::V1_1::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return ::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/1.1/default/GnssMeasurement.h b/gnss/1.1/default/GnssMeasurement.h
new file mode 100644
index 0000000..650cb27
--- /dev/null
+++ b/gnss/1.1/default/GnssMeasurement.h
@@ -0,0 +1,42 @@
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
+
+#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct GnssMeasurement : public IGnssMeasurement {
+ // Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+ Return<::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<::android::hardware::gnss::V1_0::IGnssMeasurementCallback>& callback) override;
+ Return<void> close() override;
+
+ // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
+ Return<::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus>
+ setCallback_1_1(const sp<::android::hardware::gnss::V1_1::IGnssMeasurementCallback>& callback,
+ bool enableFullTracking) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
diff --git a/gnss/1.1/default/android.hardware.gnss@1.1-service.rc b/gnss/1.1/default/android.hardware.gnss@1.1-service.rc
new file mode 100644
index 0000000..0cf7c49
--- /dev/null
+++ b/gnss/1.1/default/android.hardware.gnss@1.1-service.rc
@@ -0,0 +1,4 @@
+service gnss-1-1 /vendor/bin/hw/android.hardware.gnss@1.1-service
+ class hal
+ user system
+ group system
diff --git a/gnss/1.1/default/service.cpp b/gnss/1.1/default/service.cpp
new file mode 100644
index 0000000..b3ef710
--- /dev/null
+++ b/gnss/1.1/default/service.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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 "android.hardware.gnss@1.1-service"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+#include "Gnss.h"
+
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::gnss::V1_1::implementation::Gnss;
+using ::android::hardware::gnss::V1_1::IGnss;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::OK;
+using ::android::sp;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IGnss> gnss = new Gnss();
+ configureRpcThreadpool(1, true /* will join */);
+ if (gnss->registerAsService() != OK) {
+ ALOGE("Could not register gnss 1.1 service.");
+ return 1;
+ }
+ joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
+}