summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-03-26 15:10:29 -0400
committerMike Lockwood <lockwood@android.com>2010-03-26 15:10:29 -0400
commita495ba262154042091dca97f89bf82c8064878e2 (patch)
treedd87113d7c62126c0d8d45b274ebb02a9ffa25c4
parent7d39f981badf7ec75138d6ef97d37c57a63ab5f0 (diff)
downloadbase-a495ba262154042091dca97f89bf82c8064878e2.tar.gz
Add support for GPS privacy lock. DO NOT MERGE
Change-Id: I370f6fe9995236d31c119a563847dbbd31457e3d Signed-off-by: Mike Lockwood <lockwood@android.com>
-rwxr-xr-xcore/jni/android_location_GpsLocationProvider.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/core/jni/android_location_GpsLocationProvider.cpp b/core/jni/android_location_GpsLocationProvider.cpp
index f84587818ecc..f97be2930dfe 100755
--- a/core/jni/android_location_GpsLocationProvider.cpp
+++ b/core/jni/android_location_GpsLocationProvider.cpp
@@ -41,6 +41,7 @@ static jmethodID method_reportNiNotification;
static const GpsInterface* sGpsInterface = NULL;
static const GpsXtraInterface* sGpsXtraInterface = NULL;
static const AGpsInterface* sAGpsInterface = NULL;
+static const GpsPrivacyInterface* sGpsPrivacyInterface = NULL;
static const GpsNiInterface* sGpsNiInterface = NULL;
// data written to by GPS callbacks
@@ -222,15 +223,27 @@ static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject o
sAGpsInterface->init(&sAGpsCallbacks);
if (!sGpsNiInterface)
- sGpsNiInterface = (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE);
+ sGpsNiInterface = (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE);
if (sGpsNiInterface)
- sGpsNiInterface->init(&sGpsNiCallbacks);
+ sGpsNiInterface->init(&sGpsNiCallbacks);
+
+ // Clear privacy lock while enabled
+ if (!sGpsPrivacyInterface)
+ sGpsPrivacyInterface = (const GpsPrivacyInterface*)sGpsInterface->get_extension(GPS_PRIVACY_INTERFACE);
+ if (sGpsPrivacyInterface)
+ sGpsPrivacyInterface->set_privacy_lock(0);
return true;
}
static void android_location_GpsLocationProvider_disable(JNIEnv* env, jobject obj)
{
+ // Enable privacy lock while disabled
+ if (!sGpsPrivacyInterface)
+ sGpsPrivacyInterface = (const GpsPrivacyInterface*)sGpsInterface->get_extension(GPS_PRIVACY_INTERFACE);
+ if (sGpsPrivacyInterface)
+ sGpsPrivacyInterface->set_privacy_lock(1);
+
pthread_mutex_lock(&sEventMutex);
sPendingCallbacks |= kDisableRequest;
pthread_cond_signal(&sEventCond);
@@ -472,11 +485,10 @@ static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jo
static void android_location_GpsLocationProvider_send_ni_response(JNIEnv* env, jobject obj,
jint notifId, jint response)
{
- if (!sGpsNiInterface)
- sGpsNiInterface = (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE);
- if (sGpsNiInterface) {
- sGpsNiInterface->respond(notifId, response);
- }
+ if (!sGpsNiInterface)
+ sGpsNiInterface = (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE);
+ if (sGpsNiInterface)
+ sGpsNiInterface->respond(notifId, response);
}
static JNINativeMethod sMethods[] = {