aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMister Oyster <oysterized@gmail.com>2017-11-24 15:31:59 +0100
committerMister Oyster <oysterized@gmail.com>2017-11-24 15:33:14 +0100
commit4c3a67975657f7e94361c43fc296f3d34eece2a9 (patch)
tree612e08113e9ce81244b8075ef1a6bb45c8b57baf
parent298502b93802ac74f2fc69b1b1e7550ad2428c04 (diff)
shim: add libshims from N device tree
-rw-r--r--VendorProduct.mk9
-rw-r--r--libshims/Android.mk67
-rw-r--r--libshims/agps/crypto.c13
-rw-r--r--libshims/agps/icu53.c72
-rw-r--r--libshims/agps/ssl.c24
-rw-r--r--libshims/audio/mtk_audio.cpp46
-rw-r--r--libshims/gui/SensorManager.cpp265
-rw-r--r--libshims/gui/SensorManager.h102
-rw-r--r--libshims/gui/mtk_gui.cpp10
-rw-r--r--libshims/ui/mtk_gbc1.cpp13
-rw-r--r--libshims/ui/mtk_ui.cpp10
-rw-r--r--libshims/xlog.c16
12 files changed, 647 insertions, 0 deletions
diff --git a/VendorProduct.mk b/VendorProduct.mk
index 2b938d3..56d3c91 100644
--- a/VendorProduct.mk
+++ b/VendorProduct.mk
@@ -6,3 +6,12 @@ PRODUCT_PACKAGES += \
#android.hardware.power@1.0-impl // non-lineage imp
#TARGET_TAP_TO_WAKE_NODE=
+
+# Mtk symbols & shim
+PRODUCT_PACKAGES += \
+ libshim_agps \
+ libshim_asc \
+ libshim_gui \
+ libshim_snd \
+ libshim_ui \
+ libshim_xlog
diff --git a/libshims/Android.mk b/libshims/Android.mk
new file mode 100644
index 0000000..c5a82f9
--- /dev/null
+++ b/libshims/Android.mk
@@ -0,0 +1,67 @@
+LOCAL_PATH := $(call my-dir)
+
+## libshim_agps
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ agps/crypto.c \
+ agps/icu53.c \
+ agps/ssl.c
+
+LOCAL_SHARED_LIBRARIES := liblog libicuuc libssl libcrypto
+LOCAL_MODULE := libshim_agps
+LOCAL_CFLAGS := -O3 -Wno-unused-variable -Wno-unused-parameter
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
+
+
+## libshim_ui
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := ui/mtk_ui.cpp
+
+#ui/mtk_gbc1.cpp
+
+LOCAL_SHARED_LIBRARIES := libbinder libui
+LOCAL_MODULE := libshim_ui
+LOCAL_CFLAGS := -O3 -Wno-unused-variable -Wno-unused-parameter
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
+
+
+## libshim_gui
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ gui/mtk_gui.cpp \
+ gui/SensorManager.cpp
+
+LOCAL_SHARED_LIBRARIES := libbinder libgui liblog libui libutils
+LOCAL_MODULE := libshim_gui
+LOCAL_CFLAGS := -O3 -Wno-unused-variable -Wno-unused-parameter
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
+
+
+## libshim_snd
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := audio/mtk_audio.cpp
+
+LOCAL_SHARED_LIBRARIES := libbinder libmedia
+LOCAL_MODULE := libshim_snd
+LOCAL_CFLAGS := -O3 -Wno-unused-variable -Wno-unused-parameter
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
+
+
+## libshim_xlog
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := xlog.c
+
+LOCAL_SHARED_LIBRARIES := liblog
+LOCAL_MODULE := libshim_xlog
+LOCAL_CFLAGS := -O3 -Wno-unused-variable -Wno-unused-parameter
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libshims/agps/crypto.c b/libshims/agps/crypto.c
new file mode 100644
index 0000000..c3a4e43
--- /dev/null
+++ b/libshims/agps/crypto.c
@@ -0,0 +1,13 @@
+#include <malloc.h>
+
+void CRYPTO_free(void *str) {
+ free(str);
+}
+
+void *CRYPTO_malloc(int num, const char *file, int line) {
+ return malloc(num);
+}
+
+void CRYPTO_lock(int mode, int type, const char *file, int line) {
+ CRYPTO_lock(mode, type, file, line);
+}
diff --git a/libshims/agps/icu53.c b/libshims/agps/icu53.c
new file mode 100644
index 0000000..a7752fd
--- /dev/null
+++ b/libshims/agps/icu53.c
@@ -0,0 +1,72 @@
+#include "unicode/ucnv.h"
+
+U_STABLE UConverter* U_EXPORT2
+ucnv_open_53(const char *converterName, UErrorCode *err)
+{
+ return ucnv_open(converterName, err);
+}
+
+U_STABLE void U_EXPORT2
+ucnv_close_53(UConverter * converter)
+{
+ return ucnv_close(converter);
+}
+
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP_53(
+ const void *context,
+ UConverterToUnicodeArgs *toUArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ UCNV_TO_U_CALLBACK_STOP(context, toUArgs, codeUnits, length, reason, err);
+}
+
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP_53(
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ UCNV_FROM_U_CALLBACK_STOP (context, fromUArgs, codeUnits, length, codePoint, reason, err);
+}
+
+U_STABLE void U_EXPORT2
+ucnv_setToUCallBack_53(UConverter * converter,
+ UConverterToUCallback newAction,
+ const void* newContext,
+ UConverterToUCallback *oldAction,
+ const void** oldContext,
+ UErrorCode * err)
+{
+ ucnv_setToUCallBack(converter, newAction, newContext, oldAction, oldContext, err);
+}
+
+U_STABLE void U_EXPORT2
+ucnv_setFromUCallBack_53(UConverter * converter,
+ UConverterFromUCallback newAction,
+ const void *newContext,
+ UConverterFromUCallback *oldAction,
+ const void **oldContext,
+ UErrorCode * err)
+{
+ ucnv_setFromUCallBack(converter, newAction, newContext, oldAction, oldContext, err);
+}
+
+U_STABLE void U_EXPORT2
+ucnv_convertEx_53(UConverter *targetCnv, UConverter *sourceCnv,
+ char **target, const char *targetLimit,
+ const char **source, const char *sourceLimit,
+ UChar *pivotStart, UChar **pivotSource,
+ UChar **pivotTarget, const UChar *pivotLimit,
+ UBool reset, UBool flush,
+ UErrorCode *pErrorCode)
+{
+ ucnv_convertEx(targetCnv, sourceCnv, target, targetLimit, source, sourceLimit,
+ pivotStart, pivotSource, pivotTarget, pivotLimit, reset, flush,
+ pErrorCode);
+}
diff --git a/libshims/agps/ssl.c b/libshims/agps/ssl.c
new file mode 100644
index 0000000..f028d98
--- /dev/null
+++ b/libshims/agps/ssl.c
@@ -0,0 +1,24 @@
+#include <openssl/ssl.h>
+
+long SSL_ctrl(SSL *s, int cmd, long larg, void *parg) {
+ switch (cmd) {
+ case 8: { /* SSL_CTRL_GET_SESSION_REUSED */
+ return SSL_session_reused(s);
+ }
+ default: break;
+ }
+ return -1;
+}
+
+long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) {
+ switch (cmd) {
+ case 32: { /* SSL_CTRL_OPTIONS */
+ return SSL_CTX_set_options(ctx, larg);
+ }
+ case 44: { /* SSL_CTRL_SET_SESS_CACHE_MODE */
+ return SSL_CTX_set_session_cache_mode(ctx, larg);
+ }
+ default: break;
+ }
+ return -1;
+}
diff --git a/libshims/audio/mtk_audio.cpp b/libshims/audio/mtk_audio.cpp
new file mode 100644
index 0000000..4a6fda5
--- /dev/null
+++ b/libshims/audio/mtk_audio.cpp
@@ -0,0 +1,46 @@
+#include <stdint.h>
+
+extern "C" {
+ bool _ZN7android11AudioSystem24getVoiceUnlockDLInstanceEv(){
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem23GetVoiceUnlockDLLatencyEv(){
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem17SetVoiceUnlockSRCEjj(uint32_t outSR, uint32_t outChannel){
+ return 0;
+ }
+
+ bool _ZN7android11AudioSystem18startVoiceUnlockDLEv(){
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem15ReadRefFromRingEPvjS1_(void*buf, uint32_t datasz, void* DLtime){
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem20GetVoiceUnlockULTimeEPv(void* DLtime) {
+ return 0;
+ }
+
+ void _ZN7android11AudioSystem25freeVoiceUnlockDLInstanceEv(){}
+
+ bool _ZN7android11AudioSystem17stopVoiceUnlockDLEv(){
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem12SetAudioDataEijPv(int par1,size_t byte_len,void *ptr) {
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem15SetAudioCommandEii(int var1,int var2) {
+ return 0;
+ }
+
+ int _ZN7android11AudioSystem15GetAudioCommandEiPi(int var1) {
+ return 0;
+ }
+}
+
diff --git a/libshims/gui/SensorManager.cpp b/libshims/gui/SensorManager.cpp
new file mode 100644
index 0000000..b58f241
--- /dev/null
+++ b/libshims/gui/SensorManager.cpp
@@ -0,0 +1,265 @@
+/*
+ * Copyright (C) 2010 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 "Sensors"
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+#include <utils/Singleton.h>
+
+#include <binder/IBinder.h>
+#include <binder/IServiceManager.h>
+
+#include <gui/ISensorServer.h>
+#include <gui/ISensorEventConnection.h>
+#include <gui/Sensor.h>
+#include "gui/SensorManager.h"
+#include <gui/SensorEventQueue.h>
+
+// ----------------------------------------------------------------------------
+namespace android {
+// ----------------------------------------------------------------------------
+
+android::Mutex android::SensorManager::sLock;
+std::map<String16, SensorManager*> android::SensorManager::sPackageInstances;
+
+// MTK
+static const String8 packageName8("");
+
+
+// be compatible with MTK Lollipop blobs
+extern "C" {
+ android::Mutex _ZN7android9SingletonINS_13SensorManagerEE5sLockE;
+ SensorManager *_ZN7android9SingletonINS_13SensorManagerEE9sInstanceE = nullptr;
+}
+
+
+// compatible ctor
+SensorManager::SensorManager()
+ : mSensorList(0), mOpPackageName("")
+{
+ // okay we're not locked here, but it's not needed during construction
+ assertStateLocked();
+}
+
+
+sp<SensorEventQueue> SensorManager::createEventQueue() {
+ return createEventQueue(packageName8, 0);
+}
+// MTK
+
+SensorManager& SensorManager::getInstanceForPackage(const String16& packageName) {
+ Mutex::Autolock _l(sLock);
+ SensorManager* sensorManager;
+ std::map<String16, SensorManager*>::iterator iterator =
+ sPackageInstances.find(packageName);
+
+ if (iterator != sPackageInstances.end()) {
+ sensorManager = iterator->second;
+ } else {
+ String16 opPackageName = packageName;
+
+ // It is possible that the calling code has no access to the package name.
+ // In this case we will get the packages for the calling UID and pick the
+ // first one for attributing the app op. This will work correctly for
+ // runtime permissions as for legacy apps we will toggle the app op for
+ // all packages in the UID. The caveat is that the operation may be attributed
+ // to the wrong package and stats based on app ops may be slightly off.
+ if (opPackageName.size() <= 0) {
+ sp<IBinder> binder = defaultServiceManager()->getService(String16("permission"));
+ if (binder != 0) {
+ const uid_t uid = IPCThreadState::self()->getCallingUid();
+ Vector<String16> packages;
+ interface_cast<IPermissionController>(binder)->getPackagesForUid(uid, packages);
+ if (!packages.isEmpty()) {
+ opPackageName = packages[0];
+ } else {
+ ALOGE("No packages for calling UID");
+ }
+ } else {
+ ALOGE("Cannot get permission service");
+ }
+ }
+
+ sensorManager = new SensorManager(opPackageName);
+
+ // If we had no package name, we looked it up from the UID and the sensor
+ // manager instance we created should also be mapped to the empty package
+ // name, to avoid looking up the packages for a UID and get the same result.
+ if (packageName.size() <= 0) {
+ sPackageInstances.insert(std::make_pair(String16(), sensorManager));
+ }
+
+ // Stash the per package sensor manager.
+ sPackageInstances.insert(std::make_pair(opPackageName, sensorManager));
+ }
+
+ return *sensorManager;
+}
+
+SensorManager::SensorManager(const String16& opPackageName)
+ : mSensorList(0), mOpPackageName(opPackageName) {
+ // okay we're not locked here, but it's not needed during construction
+ assertStateLocked();
+}
+
+SensorManager::~SensorManager() {
+ free(mSensorList);
+}
+
+void SensorManager::sensorManagerDied() {
+ Mutex::Autolock _l(mLock);
+ mSensorServer.clear();
+ free(mSensorList);
+ mSensorList = NULL;
+ mSensors.clear();
+}
+
+status_t SensorManager::assertStateLocked() {
+ bool initSensorManager = false;
+ if (mSensorServer == NULL) {
+ initSensorManager = true;
+ } else {
+ // Ping binder to check if sensorservice is alive.
+ status_t err = IInterface::asBinder(mSensorServer)->pingBinder();
+ if (err != NO_ERROR) {
+ initSensorManager = true;
+ }
+ }
+ if (initSensorManager) {
+ // try for 300 seconds (60*5(getService() tries for 5 seconds)) before giving up ...
+ const String16 name("sensorservice");
+ for (int i = 0; i < 60; i++) {
+ status_t err = getService(name, &mSensorServer);
+ if (err == NAME_NOT_FOUND) {
+ sleep(1);
+ continue;
+ }
+ if (err != NO_ERROR) {
+ return err;
+ }
+ break;
+ }
+
+ class DeathObserver : public IBinder::DeathRecipient {
+ SensorManager& mSensorManager;
+ virtual void binderDied(const wp<IBinder>& who) {
+ ALOGW("sensorservice died [%p]", who.unsafe_get());
+ mSensorManager.sensorManagerDied();
+ }
+ public:
+ DeathObserver(SensorManager& mgr) : mSensorManager(mgr) { }
+ };
+
+ LOG_ALWAYS_FATAL_IF(mSensorServer.get() == NULL, "getService(SensorService) NULL");
+
+ mDeathObserver = new DeathObserver(*const_cast<SensorManager *>(this));
+ IInterface::asBinder(mSensorServer)->linkToDeath(mDeathObserver);
+
+ mSensors = mSensorServer->getSensorList(mOpPackageName);
+ size_t count = mSensors.size();
+ mSensorList =
+ static_cast<Sensor const**>(malloc(count * sizeof(Sensor*)));
+ LOG_ALWAYS_FATAL_IF(mSensorList == NULL, "mSensorList NULL");
+
+ for (size_t i=0 ; i<count ; i++) {
+ mSensorList[i] = mSensors.array() + i;
+ }
+ }
+
+ return NO_ERROR;
+}
+
+ssize_t SensorManager::getSensorList(Sensor const* const** list) {
+ Mutex::Autolock _l(mLock);
+ status_t err = assertStateLocked();
+ if (err < 0) {
+ return static_cast<ssize_t>(err);
+ }
+ *list = mSensorList;
+ return static_cast<ssize_t>(mSensors.size());
+}
+
+ssize_t SensorManager::getDynamicSensorList(Vector<Sensor> & dynamicSensors) {
+ Mutex::Autolock _l(mLock);
+ status_t err = assertStateLocked();
+ if (err < 0) {
+ return static_cast<ssize_t>(err);
+ }
+
+ dynamicSensors = mSensorServer->getDynamicSensorList(mOpPackageName);
+ size_t count = dynamicSensors.size();
+
+ return static_cast<ssize_t>(count);
+}
+
+Sensor const* SensorManager::getDefaultSensor(int type)
+{
+ Mutex::Autolock _l(mLock);
+ if (assertStateLocked() == NO_ERROR) {
+ bool wakeUpSensor = false;
+ // For the following sensor types, return a wake-up sensor. These types are by default
+ // defined as wake-up sensors. For the rest of the sensor types defined in sensors.h return
+ // a non_wake-up version.
+ if (type == SENSOR_TYPE_PROXIMITY || type == SENSOR_TYPE_SIGNIFICANT_MOTION ||
+ type == SENSOR_TYPE_TILT_DETECTOR || type == SENSOR_TYPE_WAKE_GESTURE ||
+ type == SENSOR_TYPE_GLANCE_GESTURE || type == SENSOR_TYPE_PICK_UP_GESTURE) {
+ wakeUpSensor = true;
+ }
+ // For now we just return the first sensor of that type we find.
+ // in the future it will make sense to let the SensorService make
+ // that decision.
+ for (size_t i=0 ; i<mSensors.size() ; i++) {
+ if (mSensorList[i]->getType() == type &&
+ mSensorList[i]->isWakeUpSensor() == wakeUpSensor) {
+ return mSensorList[i];
+ }
+ }
+ }
+ return NULL;
+}
+
+sp<SensorEventQueue> SensorManager::createEventQueue(String8 packageName, int mode) {
+ sp<SensorEventQueue> queue;
+
+ Mutex::Autolock _l(mLock);
+ while (assertStateLocked() == NO_ERROR) {
+ sp<ISensorEventConnection> connection =
+ mSensorServer->createSensorEventConnection(packageName, mode, mOpPackageName);
+ if (connection == NULL) {
+ // SensorService just died or the app doesn't have required permissions.
+ ALOGE("createEventQueue: connection is NULL.");
+ return NULL;
+ }
+ queue = new SensorEventQueue(connection);
+ break;
+ }
+ return queue;
+}
+
+bool SensorManager::isDataInjectionEnabled() {
+ Mutex::Autolock _l(mLock);
+ if (assertStateLocked() == NO_ERROR) {
+ return mSensorServer->isDataInjectionEnabled();
+ }
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+}; // namespace android
diff --git a/libshims/gui/SensorManager.h b/libshims/gui/SensorManager.h
new file mode 100644
index 0000000..11a5179
--- /dev/null
+++ b/libshims/gui/SensorManager.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef ANDROID_GUI_SENSOR_MANAGER_H
+#define ANDROID_GUI_SENSOR_MANAGER_H
+
+#include <map>
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/IBinder.h>
+#include <binder/IPCThreadState.h>
+#include <binder/IServiceManager.h>
+
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+#include <utils/Singleton.h>
+#include <utils/Vector.h>
+#include <utils/String8.h>
+
+#include <gui/SensorEventQueue.h>
+
+// ----------------------------------------------------------------------------
+// Concrete types for the NDK
+struct ASensorManager { };
+
+// ----------------------------------------------------------------------------
+namespace android {
+// ----------------------------------------------------------------------------
+
+class ISensorServer;
+class Sensor;
+class SensorEventQueue;
+// ----------------------------------------------------------------------------
+
+class SensorManager :
+ public ASensorManager
+{
+public:
+ static SensorManager& getInstanceForPackage(const String16& packageName);
+ ~SensorManager();
+
+ ssize_t getSensorList(Sensor const* const** list);
+ ssize_t getDynamicSensorList(Vector<Sensor>& list);
+ Sensor const* getDefaultSensor(int type);
+
+ // MTK
+ sp<SensorEventQueue> createEventQueue(String8 packageName, int mode = 0);
+ sp<SensorEventQueue> createEventQueue();
+
+ bool isDataInjectionEnabled();
+
+private:
+ // DeathRecipient interface
+ void sensorManagerDied();
+
+ SensorManager(const String16& opPackageName);
+
+ // MTK
+ SensorManager();
+
+
+ status_t assertStateLocked();
+
+private:
+ static Mutex sLock;
+ static std::map<String16, SensorManager*> sPackageInstances;
+
+ Mutex mLock;
+ sp<ISensorServer> mSensorServer;
+ Sensor const** mSensorList;
+ Vector<Sensor> mSensors;
+ sp<IBinder::DeathRecipient> mDeathObserver;
+ const String16 mOpPackageName;
+};
+
+// MTK
+extern "C" {
+ extern android::Mutex _ZN7android9SingletonINS_13SensorManagerEE5sLockE;
+ extern SensorManager *_ZN7android9SingletonINS_13SensorManagerEE9sInstanceE;
+}
+// MTK
+
+
+// ----------------------------------------------------------------------------
+}; // namespace android
+
+#endif // ANDROID_GUI_SENSOR_MANAGER_H
diff --git a/libshims/gui/mtk_gui.cpp b/libshims/gui/mtk_gui.cpp
new file mode 100644
index 0000000..e47f781
--- /dev/null
+++ b/libshims/gui/mtk_gui.cpp
@@ -0,0 +1,10 @@
+#include <ui/GraphicBufferMapper.h>
+#include <ui/Rect.h>
+
+extern "C" {
+ void _ZN7android19GraphicBufferMapper4lockEPK13native_handlejRKNS_4RectEPPv(buffer_handle_t, uint32_t, const android::Rect&, void**);
+
+ void _ZN7android19GraphicBufferMapper4lockEPK13native_handleiRKNS_4RectEPPv(buffer_handle_t handle, int usage, const android::Rect& bounds, void** vaddr) {
+ _ZN7android19GraphicBufferMapper4lockEPK13native_handlejRKNS_4RectEPPv(handle, static_cast<uint32_t>(usage), bounds, vaddr);
+ }
+}
diff --git a/libshims/ui/mtk_gbc1.cpp b/libshims/ui/mtk_gbc1.cpp
new file mode 100644
index 0000000..0bebe2e
--- /dev/null
+++ b/libshims/ui/mtk_gbc1.cpp
@@ -0,0 +1,13 @@
+#include <string>
+
+extern "C" {
+ void _ZN7android13GraphicBufferC1EjjijNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE(
+ void *(pthis), uint32_t inWidth, uint32_t inHeight, int inFormat,
+ uint32_t inUsage, std::string requestorName);
+
+ void _ZN7android13GraphicBufferC1Ejjij(void *(pthis), uint32_t inWidth, uint32_t inHeight, int inFormat, uint32_t inUsage) {
+ _ZN7android13GraphicBufferC1EjjijNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE(
+ pthis, inWidth, inHeight, inFormat, inUsage, "<Unknown>");
+ }
+
+}
diff --git a/libshims/ui/mtk_ui.cpp b/libshims/ui/mtk_ui.cpp
new file mode 100644
index 0000000..f849dc5
--- /dev/null
+++ b/libshims/ui/mtk_ui.cpp
@@ -0,0 +1,10 @@
+#include <ui/GraphicBufferMapper.h>
+#include <ui/Rect.h>
+
+extern "C" {
+ void _ZN7android19GraphicBufferMapper9lockYCbCrEPK13native_handlejRKNS_4RectEP13android_ycbcr(buffer_handle_t, uint32_t, const android::Rect&, android_ycbcr*);
+
+ void _ZN7android19GraphicBufferMapper9lockYCbCrEPK13native_handleiRKNS_4RectEP13android_ycbcr(buffer_handle_t handle, int usage, const android::Rect& bounds, android_ycbcr *ycbcr) {
+ _ZN7android19GraphicBufferMapper9lockYCbCrEPK13native_handlejRKNS_4RectEP13android_ycbcr(handle, static_cast<uint32_t>(usage), bounds, ycbcr);
+ }
+}
diff --git a/libshims/xlog.c b/libshims/xlog.c
new file mode 100644
index 0000000..59a2afd
--- /dev/null
+++ b/libshims/xlog.c
@@ -0,0 +1,16 @@
+#include <cutils/log.h>
+
+struct xlog_record {
+ const char *tag_str;
+ const char *fmt_str;
+ int prio;
+};
+
+void __attribute__((weak)) __xlog_buf_printf(__unused int bufid, const struct xlog_record *xlog_record, ...) {
+ va_list args;
+ va_start(args, xlog_record);
+
+ __android_log_vprint(xlog_record->prio, xlog_record->tag_str, xlog_record->fmt_str, args);
+
+ return;
+}