summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2016-09-03 15:27:36 +0200
committerZiyan <jaraidaniel@gmail.com>2016-09-03 15:27:36 +0200
commit39c6ce79664bf70e3925ff2c7feb579eb61abab9 (patch)
tree100a1f28413a1642c7c1a0164315d6b2802d2a29
parentbda7107b556c410304be9d091591b930bd9c4e38 (diff)
grouper: gps: hex edit for better N userspace compatibility (2/2)
- CRYPTO_malloc calls replaced and adjusted to calloc - removed non-existent android::Singleton<android::SensorManager>::sLock usage
-rw-r--r--libgpsd-compat/libgpsd-compat.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/libgpsd-compat/libgpsd-compat.c b/libgpsd-compat/libgpsd-compat.c
index 9e54969..7775a0e 100644
--- a/libgpsd-compat/libgpsd-compat.c
+++ b/libgpsd-compat/libgpsd-compat.c
@@ -4,7 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
-#include <pthread.h>
#include <utils/Log.h>
#include <hardware/power.h>
#include <hardware/hardware.h>
@@ -14,19 +13,7 @@
* 1. Nexus 10's GPS library was made to work with android L
* 2. Android M changed a few things around that make it not work
* a. Sensor manager API changed in a few places
- * b. BoringSSL replaced OpenSSL
* 3. Due to these now-missing unresolved symbols GPS library will not load or run
- *
- * A tricky but clever solution: INTERPOSITION library
- * 1. We'll edit the GPS library and replace one of its "NEED" record with one referencing a new library
- * which we'll create.
- * 2. Make sure that libgpsd-compat's NEED records include the library whose record we replaced in the GPS
- * library, to make sure that the linker brings it in afterall and all symbols in it are found
- * 3. Implement libgpsd-compat such that it provides the missing things and does them in such a way that the
- * GPS library is happy.
- *
- * Result: GPS library works on M, with the help of libgpsd-compat and a small binary patch to the GPS
- * library itself (replacing one of the "NEED" records with a NEED record for "libgpsd-compat")
*/
@@ -57,18 +44,6 @@
//data exports we must provide for gps library to be happy
/*
- * DATA: android::Singleton<android::SensorManager>::sLock
- * USE: INTERPOSE: a mutes that GPS lib will insist on accessing
- * NOTES: In L, the sensor manager exposed this lock that callers
- * actually locked & unlocked when accessing it. In M this
- * is no longer the case, but we still must provide it for
- * the GPS library to be happy. It will lock nothnhing, but
- * as long as it is a real lock and pthread_mutex_* funcs
- * work on it, the GPS library will be happy.
- */
- pthread_mutex_t _ZN7android9SingletonINS_13SensorManagerEE5sLockE = PTHREAD_MUTEX_INITIALIZER;
-
- /*
* DATA: android::Singleton<android::SensorManager>::sInstance
* USE: INTERPOSE: a singleton instance of SensorManager
* NOTES: In L, the sensor manager exposed this variable, as it was
@@ -93,9 +68,6 @@
//android::SensorManager::createEventQueue(void)
void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr);
- //this used to exist in OpenSLL, but does not in BoringSSL - for some reason GPS library uses it anyways
- void *CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line);
-
//library on-load and on-unload handlers (to help us set things up and tear them down)
void libEvtUnloading(void) __attribute__((destructor));
@@ -108,7 +80,6 @@
* in a package name as a "string16" to the consrtuctor. Since this
* lib only services GPS library, it is easy for us to just do that
* and this provide the constructor that the GPS library wants.
- * The package name we use if "gps.manta". Why not?
*/
void _ZN7android13SensorManagerC1Ev(void *sensorMgr)
{
@@ -137,21 +108,6 @@ void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorM
}
/*
- * FUNCTION: CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line)
- * USE: INTERPOSE: Allocate memory
- * NOTES: In OpenSSL, this just allocates memory and optionally tracks it.
- * Why manta's GPS library chose to use it is a mystery, but to make
- * it happy we must provide it, so we do, backing the allocation with
- * a calloc()-ed memory chunk.
- */
-void *CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line)
-{
- (void)file;
- (void)line;
- return calloc(sz, 1);
-}
-
-/*
* FUNCTION: libEvtUnloading()
* USE: Handle library unloading
* NOTES: This is a good time to free whatever is unfreed and say goodbye