diff options
| author | Christopher R. Palmer <crpalmer@gmail.com> | 2016-01-04 14:11:43 +0530 |
|---|---|---|
| committer | Ashwin <ashwinr64@gmail.com> | 2016-01-10 17:24:10 -0800 |
| commit | b0e67bb4e02dc2ec010e5d52c1e06bc7dc2654c5 (patch) | |
| tree | d07e0e3608d78dc5c14f1c4aff98af0e59c5065c | |
| parent | c1dad43788d1c755cd4f65100f6d2351a8759e3c (diff) | |
condor: Bring back libcondor for camera
Change-Id: I89b3b12b6608aa0ca038f727e9f60d244922e7af
| -rw-r--r-- | device.mk | 4 | ||||
| -rw-r--r-- | libcondor/Android.mk | 25 | ||||
| -rw-r--r-- | libcondor/moto_camera.c | 124 | ||||
| -rw-r--r-- | ramdisk/init.device.rc | 4 |
4 files changed, 157 insertions, 0 deletions
@@ -32,6 +32,10 @@ $(call inherit-product-if-exists, vendor/motorola/condor/condor-vendor.mk) PRODUCT_COPY_FILES += \ $(call find-copy-subdir-files,*,${LOCAL_PATH}/prebuilt/system,system) +# libcondor +PRODUCT_PACKAGES += \ + libcondor + # Stlport PRODUCT_PACKAGES += \ libstlport diff --git a/libcondor/Android.mk b/libcondor/Android.mk new file mode 100644 index 0000000..b3625b1 --- /dev/null +++ b/libcondor/Android.mk @@ -0,0 +1,25 @@ +# Copyright (C) 2016 The CyanogenMod 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. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +# Camera +LOCAL_SRC_FILES := moto_camera.c +LOCAL_SHARED_LIBRARIES := libutils libgui liblog libbinder +LOCAL_MODULE := libcondor +LOCAL_MODULE_TAGS := optional + +include $(BUILD_SHARED_LIBRARY) diff --git a/libcondor/moto_camera.c b/libcondor/moto_camera.c new file mode 100644 index 0000000..77bdc70 --- /dev/null +++ b/libcondor/moto_camera.c @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2016 The CyanogenMod 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <pthread.h> +#include <utils/Log.h> +#include <hardware/power.h> +#include <hardware/hardware.h> + +//various funcs we'll need to call, in their mangled form + + //android::String8::String8(char const*) + extern void _ZN7android7String8C1EPKc(void **str8P, const char *str); + + //android::String8::~String8() + extern void _ZN7android7String8D1Ev(void **str8P); + + //android::String16::String16(char const*) + extern void _ZN7android8String16C1EPKc(void **str16P, const char *str); + + //android::String16::~String16() + extern void _ZN7android8String16D1Ev(void **str16P); + + //android::SensorManager::~SensorManager() + extern void _ZN7android13SensorManagerD1Ev(void *sensorMgr); + + //android::SensorManager::SensorManager(android::String16 const&) + extern void _ZN7android13SensorManagerC1ERKNS_8String16E(void *sensorMgr, void **str16P); + + //android::SensorManager::createEventQueue(android::String8, int) + extern void _ZN7android13SensorManager16createEventQueueENS_7String8Ei(void **retVal, void *sensorMgr, void **str8P, int mode); + +//data exports we must provide for camera library to be happy + + /* + * DATA: android::Singleton<android::SensorManager>::sLock + * USE: INTERPOSE: a mutes that camera 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 camera 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 camera 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 + * a singleton and one could just access this directly to get + * the current already-existing instance if it happened to + * already exist. If not one would create one and store it + * there. In M this is entirely different, but the camera library + * does not know that. So we'll init it to NULL to signify that + * no current instance exists, let it create one, and store it + * here, and upon unloading we'll clean it up, if it is not + * NULL (which is what it would be if the camera library itself + * did the cleanup). + */ + void* _ZN7android9SingletonINS_13SensorManagerEE9sInstanceE = NULL; + + +//code exports we provide + + //android::SensorManager::SensorManager(void) + void _ZN7android13SensorManagerC1Ev(void *sensorMgr); + + //android::SensorManager::createEventQueue(void) + void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr); + +/* + * FUNCTION: android::SensorManager::SensorManager(void) + * USE: INTERPOSE: construct a sensor manager object + * NOTES: This constructor no longer exists in M, instead now one must pass + * in a package name as a "string16" to the consrtuctor. Since this + * lib only services camera library, it is easy for us to just do that + * and this provide the constructor that the camera library wants. + * The package name we use if "camera.msm8226". Why not? + */ +void _ZN7android13SensorManagerC1Ev(void *sensorMgr) +{ + void *string; + + _ZN7android8String16C1EPKc(&string, "camera.msm8226"); + _ZN7android13SensorManagerC1ERKNS_8String16E(sensorMgr, &string); + _ZN7android8String16D1Ev(&string); +} + +/* + * FUNCTION: android::SensorManager::createEventQueue(void) + * USE: INTERPOSE: create an event queue to receive events + * NOTES: This function no longer exists in M, instead now one must pass + * in a client name as a "string8" and an integer "mode"to it. M + * sources list default values for these params as an empty string + * and 0. So we'll craft the same call here. + */ +void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr) +{ + void *string; + + _ZN7android7String8C1EPKc(&string, ""); + _ZN7android13SensorManager16createEventQueueENS_7String8Ei(retVal, sensorMgr, &string, 0); + _ZN7android7String8D1Ev(&string); +} + +void _ZN7android8AMessageC1Eji() {} +void _ZN7android10MediaCodec12CreateByTypeERKNS_2spINS_7ALooperEEEPKcbPi() {} +void _ZN7android11AudioSourceC1E14audio_source_tjj() {} diff --git a/ramdisk/init.device.rc b/ramdisk/init.device.rc index f53acf5..9f4ac35 100644 --- a/ramdisk/init.device.rc +++ b/ramdisk/init.device.rc @@ -2,6 +2,10 @@ on early-init # Create PDS mount point mkdir /pds 0755 root root +on init +# Symbols required for Motorola blobs + export LD_PRELOAD "/system/lib/libcondor.so" + on fs # Mount PDS wait /dev/block/platform/msm_sdcc.1/by-name/pds |
