klte-common: Add RIL shim library

Change-Id: I20a803530d5c77e7cb464e3ef6d13afe16a90ded
This commit is contained in:
Ethan Chen 2015-10-21 13:46:36 -07:00
parent 999fcca38e
commit 596d0d52b9
4 changed files with 89 additions and 0 deletions

View File

@ -98,6 +98,10 @@ PRODUCT_PACKAGES += \
NfcNci \
Tag
# Radio
PRODUCT_PACKAGES += \
libril_shim
# Ramdisk
PRODUCT_PACKAGES += \
fstab.qcom \

13
ril/Android.mk Normal file
View File

@ -0,0 +1,13 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := liblog libcutils libbinder libutils
LOCAL_SRC_FILES := \
ril_shim.c
LOCAL_MODULE := libril_shim
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
include $(BUILD_SHARED_LIBRARY)

70
ril/ril_shim.c Normal file
View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2015 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.
*/
#define LOG_TAG "SEC_RIL_SHIM"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <utils/Log.h>
//various funcs we'll need to call, in their mangled form
//android::Parcel::writeString16(char16_t const*, unsigned int)
extern void _ZN7android6Parcel13writeString16EPKDsj(void **str16P,
uint16_t const *str, unsigned int len);
//code exports we provide
void _ZN7android6Parcel13writeString16EPKtj(void **str16P,
unsigned short const *str, unsigned int len);
//library on-load and on-unload handlers (to help us set things up and tear them down)
void libEvtLoading(void) __attribute__((constructor));
void libEvtUnloading(void) __attribute__((destructor));
/*
* FUNCTION: android::Parcel::writeString16(unsigned short const*, unsigned int)
* USE: INTERPOSE: write String16 to binder
* NOTES: This function no longer exists in M, instead now one must pass
* in a char16_t instead of a short. M So we'll craft the same call here.
*/
void _ZN7android6Parcel13writeString16EPKtj(void **str16P,
unsigned short const *str, unsigned int len)
{
_ZN7android6Parcel13writeString16EPKDsj(str16P, str, len);
}
/*
* FUNCTION: libEvtLoading()
* USE: Handle library loading
* NOTES: This is a good time to log the fact that we were loaded and plan to
* do our thing.
*/
void libEvtLoading(void)
{
ALOGV("libbinder interposition library loaded");
}
/*
* FUNCTION: libEvtUnloading()
* USE: Handle library unloading
* NOTES: This is a good time to free whatever is unfreed and say goodbye
*/
void libEvtUnloading(void)
{
ALOGV("libbinder interposition library unloading. Goodbye...");
}

View File

@ -29,6 +29,8 @@ import init.qcom.usb.rc
import init.target.rc
on early-init
export LD_SHIM_LIBS /system/lib/libril.so|libril_shim.so
# Increase max readahead size to 512 KB
write /sys/block/mmcblk0/queue/read_ahead_kb 512
write /sys/block/mmcblk0/queue/scheduler noop