summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMike Cailean <mcailean@codeaurora.org>2019-07-11 10:59:46 -0700
committerMike Cailean <mcailean@codeaurora.org>2019-07-29 12:53:32 -0700
commit8a6244be7c1debde865c7770b786ee48b5f06b13 (patch)
tree15fdfc8817b7dee496b6bbde2c794afb73463f12 /android
parent8a95c11408aecf63c582555bd0b4c828f100acae (diff)
downloadgps-8a6244be7c1debde865c7770b786ee48b5f06b13.tar.gz
Allow NFW enable/disable as in 'P'
Make changes in HAL coupled with a few recommended changes in JAVA/JNI layer to allow 'P' behavior for setting NFW GPS LOCK Change-Id: I6580eaeffefe0c10bc226660439701057e09e4a4 CRs-fixed: 2488332
Diffstat (limited to 'android')
-rw-r--r--android/2.0/GnssConfiguration.cpp38
1 files changed, 34 insertions, 4 deletions
diff --git a/android/2.0/GnssConfiguration.cpp b/android/2.0/GnssConfiguration.cpp
index d2a8763..363d2b1 100644
--- a/android/2.0/GnssConfiguration.cpp
+++ b/android/2.0/GnssConfiguration.cpp
@@ -23,6 +23,7 @@
#include <log_util.h>
#include "Gnss.h"
#include "GnssConfiguration.h"
+#include "ContextBase.h"
#include <android/hardware/gnss/1.0/types.h>
namespace android {
@@ -32,6 +33,7 @@ namespace V2_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::GnssConstellationType;
+using namespace loc_core;
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
}
@@ -109,8 +111,7 @@ Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
return false;
}
- GnssConfig config;
- memset(&config, 0, sizeof(GnssConfig));
+ GnssConfig config = {};
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
switch (lppProfile) {
@@ -162,8 +163,37 @@ Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol)
return mGnss->updateConfiguration(config);
}
-Return<bool> GnssConfiguration::setGpsLock(uint8_t /*lock*/) {
- // deprecated function. Must return false to pass VTS
+Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
+
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config = {};
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ switch (lock) {
+ case 0:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ break;
+ case 1:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
+ break;
+ case 2:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
+ break;
+ case 3:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
+ return false;
+ break;
+ }
+
+ mGnss->updateConfiguration(config);
+ // Must return false to pass VTS
return false;
}