Update sources to compile on Android Nougat

This commit is contained in:
Mr Jenkins 2016-09-01 21:24:22 +02:00
parent 0329896674
commit 08e3e47c27
169 changed files with 305 additions and 12643 deletions

View file

@ -16,8 +16,7 @@
#ifndef __AWKEYMASTER_MODULEAPI_INCLUDE_H_
#define __AWKEYMASTER_MODULEAPI_INCLUDE_H_
#include <hardware/keymaster.h>
#include <hardware/keymaster0.h>
int aw_keymaster_req_libsym(void *handle);

View file

@ -3,7 +3,7 @@
#define __AWKEYMASTER_LOGAPI_INCLUDE_H_
#include <utils/Log.h>
#include <hardware/keymaster.h>
#include <hardware/keymaster0.h>
#ifdef __cplusplus
extern "C" {

View file

@ -13,13 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define keymaster_device keymaster0_device
#define keymaster_device_t keymaster0_device_t
#include <errno.h>
#include <string.h>
#include <stdint.h>
#include <keymaster_aw.h>
#include <log_aw.h>
#include <hardware/hardware.h>
#include <hardware/keymaster.h>
#include <hardware/keymaster0.h>
#include <nativehelper/UniquePtr.h>
#include <dlfcn.h>
#include <cutils/log.h>
@ -452,20 +456,16 @@ static int aw_device_open(const hw_module_t* module, const char* name,
}
static struct hw_module_methods_t keystore_module_methods = {
open: aw_device_open,
.open = aw_device_open,
};
struct keystore_module HAL_MODULE_INFO_SYM
struct hw_module_t HAL_MODULE_INFO_SYM
__attribute__ ((visibility ("default"))) = {
common: {
tag: HARDWARE_MODULE_TAG,
module_api_version: KEYMASTER_MODULE_API_VERSION_0_2,
hal_api_version: HARDWARE_HAL_API_VERSION,
id: KEYSTORE_HARDWARE_MODULE_ID,
name: "Keymaster AllSoftwinnertech HAL",
author: "The Android Open Source Project",
methods: &keystore_module_methods,
dso: 0,
reserved: {},
},
.tag = HARDWARE_MODULE_TAG,
.module_api_version = KEYMASTER_MODULE_API_VERSION_0_2,
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = KEYSTORE_HARDWARE_MODULE_ID,
.name = "Keymaster AllSoftwinnertech HAL",
.author = "The Android Open Source Project",
.methods = &keystore_module_methods,
};

View file

@ -22,6 +22,7 @@
#include <poll.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <sys/select.h>
#include <dlfcn.h>
#include <cutils/log.h>
@ -42,8 +43,8 @@ AccelSensor::AccelSensor()
mPendingMask(0),
convert(0.0),
direct_x(0),
direct_y(0),
direct_z(0),
direct_y(0),
direct_z(0),
direct_xy(-1),
mInputReader(16),
mDelay(0)
@ -54,45 +55,45 @@ AccelSensor::AccelSensor()
#endif
if (strlen(gsensorInfo.sensorName)) {
if(! gsensor_cfg())
ALOGE("gsensor config error!\n");
ALOGE("gsensor config error!\n");
}
memset(&mPendingEvent, 0, sizeof(mPendingEvent));
memset(&mAccData, 0, sizeof(mAccData));
mPendingEvent.version = sizeof(sensors_event_t);
mPendingEvent.sensor = ID_A;
mPendingEvent.type = SENSOR_TYPE_ACCELEROMETER;
mPendingEvent.acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
mUser = 0;
#ifdef DEBUG_SENSOR
#ifdef DEBUG_SENSOR
ALOGD("%s:data_fd:%d\n", __func__, data_fd);
#endif
#endif
if(!strcmp(ACC_DATA_NAME, "lsm303d_acc")) {
sprintf(gsensorInfo.classPath, "%s/%s/%s", gsensorInfo.classPath,
sprintf(gsensorInfo.classPath, "%s/%s/%s", gsensorInfo.classPath,
"device", "accelerometer");
ALOGD("gsensorInfo.classPath:%s", gsensorInfo.classPath);
}
}
AccelSensor::~AccelSensor() {
}
char* AccelSensor::get_cfg_value(char *buf) {
int j = 0;
int k = 0;
int k = 0;
char* val;
val = strtok(buf, "=");
if (val != NULL){
val = strtok(NULL, " \n\r\t");
}
buf = val;
return buf;
}
@ -102,12 +103,12 @@ int AccelSensor::gsensor_cfg()
int name_match = 0;
char buf[128] = {0};
char * val;
if((fp = fopen(GSENSOR_CONFIG_PATH, "rb")) == NULL) {
ALOGD("can't not open file!\n");
return 0;
}
while(fgets(buf, LINE_LENGTH, fp))
{
if (!strncmp(buf, GSENSOR_NAME, strlen(GSENSOR_NAME))) {
@ -116,7 +117,7 @@ int AccelSensor::gsensor_cfg()
ALOGD("val:%s\n",val);
#endif
name_match = (strncmp(val, gsensorInfo.sensorName, strlen(gsensorInfo.sensorName))) ? 0 : 1;
if (name_match) {
convert = (GRAVITY_EARTH/gsensorInfo.priData);
#ifdef DEBUG_SENSOR
@ -124,44 +125,44 @@ int AccelSensor::gsensor_cfg()
#endif
memset(&buf, 0, sizeof(buf));
continue;
}
}
}
}
if(name_match ==0){
memset(&buf, 0, sizeof(buf));
continue;
}else if(name_match < 5){
name_match++;
val = get_cfg_value(buf);
val = get_cfg_value(buf);
#ifdef DEBUG_SENSOR
ALOGD("val:%s\n", val);
#endif
if (!strncmp(buf,GSENSOR_DIRECTX, strlen(GSENSOR_DIRECTX))){
direct_x = (strncmp(val, TRUE,strlen(val))) ? convert * (-1) : convert;
if (!strncmp(buf,GSENSOR_DIRECTX, strlen(GSENSOR_DIRECTX))){
direct_x = (strncmp(val, TRUE,strlen(val))) ? convert * (-1) : convert;
}
if (!strncmp(buf, GSENSOR_DIRECTY, strlen(GSENSOR_DIRECTY))){
direct_y =(strncmp(val, TRUE,strlen(val))) ? convert * (-1) : convert;
if (!strncmp(buf, GSENSOR_DIRECTY, strlen(GSENSOR_DIRECTY))){
direct_y =(strncmp(val, TRUE,strlen(val))) ? convert * (-1) : convert;
}
if (!strncmp(buf, GSENSOR_DIRECTZ, strlen(GSENSOR_DIRECTZ))){
direct_z =(strncmp(val, TRUE,strlen(val))) ? convert * (-1) : convert;
direct_z =(strncmp(val, TRUE,strlen(val))) ? convert * (-1) : convert;
}
if (!strncmp(buf,GSENSOR_XY, strlen(GSENSOR_XY))){
direct_xy = (strncmp(val, TRUE,strlen(val))) ? 0 : 1;
direct_xy = (strncmp(val, TRUE,strlen(val))) ? 0 : 1;
}
}else{
name_match = 0;
break;
}
memset(&buf, 0, sizeof(buf));
}
char property[PROPERTY_VALUE_MAX];
property_get("ro.sf.rotation", property, 0);
switch (atoi(property)) {
@ -182,24 +183,24 @@ int AccelSensor::gsensor_cfg()
ALOGD("direct_x: %f,direct_y: %f,direct_z: %f,direct_xy:%d,sensor_name:%s \n",
direct_x, direct_y, direct_z, direct_xy, gsensorInfo.sensorName);
#endif
if((direct_x == 0) || (direct_y == 0) || (direct_z == 0) || (direct_xy == (-1)) || (convert == 0.0)) {
fclose(fp);
return 0;
}
fclose(fp);
return 1;
}
int AccelSensor::setEnable(int32_t handle, int en) {
int err = 0;
//ALOGD("enable: handle: %ld, en: %d", handle, en);
if(handle != ID_A && handle != ID_O && handle != ID_M)
return -1;
if(en)
mUser++;
else{
@ -207,13 +208,13 @@ int AccelSensor::setEnable(int32_t handle, int en) {
if(mUser < 0)
mUser = 0;
}
if(mUser > 0)
err = enable_sensor();
else
err = disable_sensor();
if(handle == ID_A ) {
if(en)
mEnabled++;
@ -222,10 +223,10 @@ int AccelSensor::setEnable(int32_t handle, int en) {
if(mEnabled < 0)
mEnabled = 0;
}
//update_delay();
#ifdef DEBUG_SENSOR
ALOGD("AccelSensor enable %d ,usercount %d, handle %d ,mEnabled %d, err %d",
ALOGD("AccelSensor enable %d ,usercount %d, handle %d ,mEnabled %d, err %d",
en, mUser, handle, mEnabled, err);
#endif
@ -236,12 +237,12 @@ int AccelSensor::setDelay(int32_t handle, int64_t ns) {
// ALOGD("delay: handle: %ld, ns: %lld", handle, ns);
if (ns < 0)
return -EINVAL;
#ifdef DEBUG_SENSOR
#ifdef DEBUG_SENSOR
ALOGD("%s: ns = %lld", __func__, ns);
#endif
mDelay = ns;
return update_delay();
}
@ -259,32 +260,32 @@ int AccelSensor::readEvents(sensors_event_t* data, int count) {
int numEventReceived = 0;
input_event const* event;
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
if ((type == EV_ABS) || (type == EV_REL) || (type == EV_KEY)) {
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) {
int64_t time = timevalToNano(event->time);
if (mPendingMask) {
mPendingMask = 0;
mPendingEvent.timestamp = time;
if (mEnabled) {
*data++ = mPendingEvent;
mAccData = mPendingEvent;
count--;
numEventReceived++;
}
}
}
if (!mPendingMask) {
mInputReader.next();
}
} else {
ALOGE("AccelSensor: unknown event (type=%d, code=%d)",
type, event->code);
@ -300,24 +301,24 @@ void AccelSensor::processEvent(int code, int value) {
switch (code) {
case ACC_EVENT_X :
mPendingMask = 1;
if(direct_xy) {
mPendingEvent.acceleration.y= value * direct_y;
}else {
mPendingEvent.acceleration.x = value * direct_x;
}
break;
case ACC_EVENT_Y :
mPendingMask = 1;
if(direct_xy) {
mPendingEvent.acceleration.x = value * direct_x;
}else {
mPendingEvent.acceleration.y = value * direct_y;
}
break;
case ACC_EVENT_Z :
@ -325,31 +326,31 @@ void AccelSensor::processEvent(int code, int value) {
mPendingEvent.acceleration.z = value * direct_z ;
break;
}
#ifdef DEBUG_SENSOR
ALOGD("Sensor data: x,y,z: %f, %f, %f\n", mPendingEvent.acceleration.x,
mPendingEvent.acceleration.y,
mPendingEvent.acceleration.z);
#endif
mPendingEvent.acceleration.z);
#endif
}
int AccelSensor::writeEnable(int isEnable) {
char buf[2];
int err = -1 ;
char buf[2];
int err = -1 ;
if(gsensorInfo.classPath[0] == ICHAR)
return -1;
int bytes = sprintf(buf, "%d", isEnable);
if(!strcmp(ACC_DATA_NAME, "lsm303d_acc")) {
err = set_sysfs_input_attr(gsensorInfo.classPath,"enable_device",buf,bytes);
}else {
if(!strcmp(ACC_DATA_NAME, "lsm303d_acc")) {
err = set_sysfs_input_attr(gsensorInfo.classPath,"enable_device",buf,bytes);
}else {
err = set_sysfs_input_attr(gsensorInfo.classPath,"enable",buf,bytes);
}
return err;
}
@ -366,9 +367,9 @@ int AccelSensor::writeDelay(int64_t ns) {
char buf[80];
int bytes = sprintf(buf, "%lld", ns/1000 / 1000);
if(!strcmp(ACC_DATA_NAME, "lsm303d_acc")) {
int err = set_sysfs_input_attr(gsensorInfo.classPath,"pollrate_us",buf,bytes);
if(!strcmp(ACC_DATA_NAME, "lsm303d_acc")) {
int err = set_sysfs_input_attr(gsensorInfo.classPath,"pollrate_us",buf,bytes);
} else {
int err = set_sysfs_input_attr(gsensorInfo.classPath,"delay",buf,bytes);
}
@ -394,4 +395,3 @@ int AccelSensor::getEnable(int32_t handle) {
}
/*****************************************************************************/

View file

@ -18,6 +18,7 @@
#include <errno.h>
#include <unistd.h>
#include <poll.h>
#include <memory.h>
#include <sys/cdefs.h>
#include <sys/types.h>
@ -60,7 +61,7 @@ ssize_t InputEventCircularReader::fill(int fd)
if (numEventsRead) {
mHead += numEventsRead;
mFreeSpace -= numEventsRead;
if (mHead > mBufferEnd) {
size_t s = mHead - mBufferEnd;
memcpy(mBuffer, mBufferEnd, s * sizeof(input_event));
@ -83,7 +84,7 @@ void InputEventCircularReader::next()
{
mCurr++;
mFreeSpace++;
if (mCurr >= mBufferEnd) {
mCurr = mBuffer;
}

View file

@ -19,6 +19,7 @@
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <memory.h>
#include <poll.h>
#include <unistd.h>
#include <dirent.h>
@ -40,7 +41,7 @@ LightSensor::LightSensor()
{
char buffer[PROPERTY_VALUE_MAX];
memset(&mPendingEvent, 0, sizeof(mPendingEvent));
mPendingEvent.version = sizeof(sensors_event_t);
mPendingEvent.sensor = ID_L;
mPendingEvent.type = SENSOR_TYPE_LIGHT;
@ -48,8 +49,8 @@ LightSensor::LightSensor()
property_get("ro.lightsensor.threshold", buffer, "10");
mThresholdLux = atoi(buffer);
#ifdef SENSOR_DEBUG
#ifdef SENSOR_DEBUG
ALOGD("%s:data_fd:%d\n", __func__,data_fd);
#endif
@ -75,8 +76,8 @@ int LightSensor::setDelay(int32_t handle, int64_t ns)
char buf[80];
int bytes = sprintf(buf, "%lld", ns/1000 / 1000);
int err = set_sysfs_input_attr(ligSensorInfo.classPath,"ls_poll_delay",buf,bytes);
@ -85,20 +86,20 @@ int LightSensor::setDelay(int32_t handle, int64_t ns)
int LightSensor::setEnable(int32_t handle, int en)
{
char buf[2];
int err = -1;
char buf[2];
int err = -1;
if(ligSensorInfo.classPath[0] == ICHAR)
return -1;
int flags = en ? 1 : 0;
if (flags != mEnabled) {
int bytes = sprintf(buf, "%d", flags);
int bytes = sprintf(buf, "%d", flags);
err = set_sysfs_input_attr(ligSensorInfo.classPath,"enable",buf,bytes);
mEnabled = flags;
}
return 0;
}
#if 0
@ -115,7 +116,7 @@ int LightSensor::setIntLux()
return -1;
}
memset(buf, 0, 6);
if ((n = fread(buf, 1, 6, fd)) < 0) {
ALOGE("Unable to read %s\n", ls_sysfs_path);
return -1;
@ -129,7 +130,7 @@ int LightSensor::setIntLux()
/* Set low lux and high interrupt lux for polling */
strcpy(&ls_sysfs_path[ls_sysfs_path_len], "int_lt_lux");
fd = fopen(ls_sysfs_path, "r+");
if (fd) {
memset(buf, 0, 6);
@ -138,10 +139,10 @@ int LightSensor::setIntLux()
fclose(fd);
} else
ALOGE("Couldn't open %s file\n", ls_sysfs_path);
strcpy(&ls_sysfs_path[ls_sysfs_path_len], "int_ht_lux");
fd = fopen(ls_sysfs_path, "r+");
if (fd) {
memset(buf, 0, 6);
snprintf(buf, 6, "%d", int_ht_lux);
@ -165,32 +166,32 @@ int LightSensor::readEvents(sensors_event_t* data, int count)
int numEventReceived = 0;
input_event const* event;
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
if ((type == EV_ABS) || (type == EV_REL) || (type == EV_KEY)) {
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) {
int64_t time = timevalToNano(event->time);
if (mPendingMask) {
mPendingMask = 0;
mPendingEvent.timestamp = time;
if (mEnabled) {
*data++ = mPendingEvent;
count--;
numEventReceived++;
mPreviousLight = mPendingEvent.light;
}
}
}
if (!mPendingMask) {
mInputReader.next();
}
} else {
ALOGE("AccelSensor: unknown event (type=%d, code=%d)",
type, event->code);
@ -206,14 +207,12 @@ void LightSensor::processEvent(int code, int value) {
if (code == EVENT_TYPE_LIGHT) {
mPendingMask = 1;
mPendingEvent.light = value;
#ifdef SENSOR_DEBUG
#ifdef SENSOR_DEBUG
ALOGD("light value: %f\n", mPendingEvent.light);
#endif
//setIntLux();
}
}

View file

@ -22,13 +22,14 @@
#include <poll.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <sys/select.h>
#include <dlfcn.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include "PressSensor.h"
#define PRESS_DATA_NAME "mpl3115"
#define PRESS_DATA_NAME "mpl3115"
#define PRESS_SYSFS_PATH "/sys/class/input"
#define PRESS_SYSFS_DELAY "poll"
#define PRESS_SYSFS_ENABLE "enable"
@ -59,7 +60,7 @@ PressSensor::PressSensor()
mPendingEvent[temperature].type = SENSOR_TYPE_TEMPERATURE;
mPendingEvent[temperature].orientation.status = SENSOR_STATUS_ACCURACY_HIGH;
mPendingEvent[temperature].version = sizeof(sensors_event_t);
if(sensor_get_class_path(mClassPath))
{
ALOGE("Can`t find the press sensor!");
@ -82,7 +83,7 @@ int PressSensor::setEnable(int32_t handle, int en)
mEnabled[what]++;
else
mEnabled[what]--;
if(mEnabled[what] < 0)
mEnabled[what] = 0;
if(mEnabled[press] > 0 || mEnabled[temperature] > 0)
@ -101,7 +102,7 @@ int PressSensor::setDelay(int32_t handle, int64_t ns)
if (ns < 0)
return -EINVAL;
int what = press;
switch(handle){
case ID_P : what = press; break;
case ID_T : what = temperature; break;
@ -150,7 +151,7 @@ int PressSensor::readEvents(sensors_event_t* data, int count)
}
}
}
if (!mPendingMask) {
mInputReader.next();
}
@ -316,4 +317,3 @@ int PressSensor::sensor_get_class_path(char *class_path)
}
/*****************************************************************************/

View file

@ -19,6 +19,7 @@
#include <math.h>
#include <poll.h>
#include <unistd.h>
#include <memory.h>
#include <dirent.h>
#include <sys/select.h>
@ -36,19 +37,19 @@ ProximitySensor::ProximitySensor()
mInputReader(4),
mPendingMask(0)
{
memset(&mPendingEvent, 0, sizeof(mPendingEvent));
mPendingEvent.version = sizeof(sensors_event_t);
mPendingEvent.sensor = ID_PX;
mPendingEvent.type = SENSOR_TYPE_PROXIMITY;
memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
#ifdef DEBUG_SENSOR
ALOGD("%s:data_fd:%d\n", __func__,data_fd);
#endif
#if 0
#if 0
if (data_fd > 0) {
strcpy(input_sysfs_path, "/sys/class/input/");
strcat(input_sysfs_path, input_name);
@ -80,8 +81,8 @@ int ProximitySensor::setDelay(int32_t handle, int64_t ns)
char buf[80];
int bytes = sprintf(buf, "%lld", ns/1000 / 1000);
int err = set_sysfs_input_attr(proSensorInfo.classPath,"ps_poll_delay",buf,bytes);
@ -89,20 +90,20 @@ int ProximitySensor::setDelay(int32_t handle, int64_t ns)
}
int ProximitySensor::setEnable(int32_t, int en) {
char buf[2];
int err = -1;
char buf[2];
int err = -1;
if(proSensorInfo.classPath[0] == ICHAR)
return -1;
int flags = en ? 1 : 0;
if (flags != mEnabled) {
int bytes = sprintf(buf, "%d", flags);
int bytes = sprintf(buf, "%d", flags);
err = set_sysfs_input_attr(proSensorInfo.classPath,"enable",buf,bytes);
mEnabled = flags;
}
return 0;
}
@ -118,31 +119,31 @@ int ProximitySensor::readEvents(sensors_event_t* data, int count)
int numEventReceived = 0;
input_event const* event;
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
if ((type == EV_ABS) || (type == EV_REL) || (type == EV_KEY)) {
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) {
int64_t time = timevalToNano(event->time);
if (mPendingMask) {
mPendingMask = 0;
mPendingEvent.timestamp = time;
if (mEnabled) {
*data++ = mPendingEvent;
count--;
numEventReceived++;
}
}
}
if (!mPendingMask) {
mInputReader.next();
}
} else {
ALOGE("AccelSensor: unknown event (type=%d, code=%d)",
type, event->code);
@ -161,10 +162,10 @@ void ProximitySensor::processEvent(int code, int value) {
#ifdef DEBUG_SENSOR
ALOGD("distance value: %f\n", mPendingEvent.distance);
#endif
}
}
float ProximitySensor::indexToValue(size_t index) const

View file

@ -19,6 +19,7 @@
#include <math.h>
#include <poll.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#include <sys/select.h>
#include <stdlib.h>
@ -42,7 +43,7 @@ SensorBase::~SensorBase() {
if (data_fd >= 0) {
close(data_fd);
}
if (dev_fd >= 0) {
close(dev_fd);
}
@ -53,7 +54,7 @@ int SensorBase::open_device() {
dev_fd = open(dev_name, O_RDONLY);
ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno));
}
return 0;
}
@ -62,15 +63,15 @@ int SensorBase::close_device() {
close(dev_fd);
dev_fd = -1;
}
return 0;
}
int SensorBase::getFd() const
{
if (!data_name) {
return dev_fd;
int SensorBase::getFd() const
{
if (!data_name) {
return dev_fd;
}
return data_fd;
}
int SensorBase::setEnable(int32_t handle, int enabled) {
@ -93,10 +94,10 @@ void processEvent(int code, int value) {
int64_t SensorBase::getTimestamp() {
struct timespec t;
t.tv_sec = t.tv_nsec = 0;
clock_gettime(CLOCK_MONOTONIC, &t);
return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
}
int SensorBase::set_sysfs_input_attr(char *class_path,const char *attr, char *value, int len)
@ -108,24 +109,24 @@ int SensorBase::set_sysfs_input_attr(char *class_path,const char *attr, char *va
|| attr == NULL || value == NULL || len < 1) {
return -EINVAL;
}
snprintf(path, sizeof(path), "%s/%s", class_path, attr);
path[sizeof(path) - 1] = '\0';
fd = open(path, O_RDWR);
if (fd < 0) {
ALOGD("Could not open (write-only) SysFs attribute \"%s\" (%s).", attr, strerror(errno));
close(fd);
return -errno;
}
if (write(fd, value, len) < 0) {
ALOGD("path:%s", path);
if (write(fd, value, len) < 0) {
ALOGD("path:%s", path);
ALOGD("Could not write SysFs attribute \"%s\" (%s).", attr, strerror(errno));
close(fd);
return -errno;
}
close(fd);
return 0;
@ -144,31 +145,31 @@ int SensorBase::openInput(const char* inputName) {
dir = opendir(dirname);
if(dir == NULL)
return -1;
strcpy(devname, dirname);
filename = devname + strlen(devname);
*filename++ = '/';
while((de = readdir(dir))) {
if(de->d_name[0] == '.' &&
(de->d_name[1] == '\0' ||
(de->d_name[1] == '.' && de->d_name[2] == '\0')))
continue;
strcpy(filename, de->d_name);
fd = open(devname, O_RDONLY);
if (fd>=0) {
char name[80];
if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
name[0] = '\0';
}
//
// ALOGD("name is %s \n", name);
// ALOGD("inputName is %s \n", inputName);
// ALOGD("inputName is %s \n", inputName);
if (!strcmp(name, inputName)) {
break;
} else {
close(fd);
@ -176,17 +177,14 @@ int SensorBase::openInput(const char* inputName) {
}
}
}
closedir(dir);
#ifdef DEBUG_IF
ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName);
#endif
return fd;
}
int SensorBase::readEvents(sensors_event_t* data, int count) {
return 0;
}

View file

@ -21,6 +21,7 @@
#include <stdlib.h>
#include <poll.h>
#include <unistd.h>
#include <memory.h>
#include <dirent.h>
#include <sys/select.h>
#include <dlfcn.h>
@ -32,12 +33,12 @@
TempSensor::TempSensor()
: SensorBase(NULL, TEMP_DATA_NAME),
mEnabled(0),
mEnabled(0),
mInputReader(4),
mPendingMask(0)
{
memset(&mPendingEvent, 0, sizeof(mPendingEvent));
mPendingEvent.sensor = ID_T;
mPendingEvent.type = SENSOR_TYPE_TEMPERATURE;
mPendingEvent.version = sizeof(sensors_event_t);
@ -53,21 +54,21 @@ TempSensor::~TempSensor()
int TempSensor::setEnable(int32_t handle, int en)
{
//ALOGD("enable: handle: %ld, en: %d", handle, en);
char buf[2];
int err = -1;
char buf[2];
int err = -1;
if(tempSensorInfo.classPath[0] == ICHAR)
return -1;
int flags = en ? 1 : 0;
if (flags != mEnabled) {
int bytes = sprintf(buf, "%d", flags);
int bytes = sprintf(buf, "%d", flags);
err = set_sysfs_input_attr(tempSensorInfo.classPath,"enable",buf,bytes);
mEnabled = flags;
}
return 0;
}
@ -86,8 +87,8 @@ int TempSensor::setDelay(int32_t handle, int64_t ns)
char buf[80];
int bytes = sprintf(buf, "%lld", ns/1000 / 1000);
int err = set_sysfs_input_attr(tempSensorInfo.classPath,"delay",buf,bytes);
@ -106,31 +107,31 @@ int TempSensor::readEvents(sensors_event_t* data, int count)
int numEventReceived = 0;
input_event const* event;
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
if ((type == EV_ABS) || (type == EV_REL) || (type == EV_KEY)) {
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) {
int64_t time = timevalToNano(event->time);
if (mPendingMask) {
mPendingMask = 0;
mPendingEvent.timestamp = time;
if (mEnabled) {
*data++ = mPendingEvent;
count--;
numEventReceived++;
}
}
}
if (!mPendingMask) {
mInputReader.next();
}
} else {
ALOGE("AccelSensor: unknown event (type=%d, code=%d)",
type, event->code);
@ -156,4 +157,3 @@ void TempSensor::processEvent(int code, int value)
/*****************************************************************************/

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- packages who's name in the array will not be killed by -->
<string-array name="background_services_whitelist">
<item>android</item>
<item>com.android</item>
<item>com.google</item>
<item>com.softwinner</item>
<item>google</item>
<item>com.sohu.inputmethod</item>
<item>com.baidu.input</item>
<item>com.iflytek.inputmethod</item>
<item>com.tencent.qqpinyin</item>
<item>com.komoxo.octopusime</item>
<item>com.ting.mp3.android</item>
<item>com.kugou.player</item>
<item>cn.kuwo.player</item>
<item>com.ting.mp3</item>
<item>com.netease.cloudmusic</item>
<item>fm.xiami.bmamba</item>
<item>com.tencent.qqmusic</item>
<item>com.iflytek.ringdiy</item>
<item>com.duomi.android</item>
<item>com.tencent.mobileqq</item>
<item>com.tencent.mm</item>
<item>fm.qingting.qtradio</item>
<item>intelligent.voice</item>
<item>com.douban.radio</item>
<item>InternetRadio</item>
<item>com.itings.myradio</item>
<item>com.ximalaya.ting.android</item>
</string-array>
</resources>

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 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.
-->
<resources>
<string-array name="pdf_printer_media_sizes" translatable="false">
<item>NA_LETTER</item>
<item>NA_GOVT_LETTER</item>
<item>NA_LEGAL</item>
<item>NA_JUNIOR_LEGAL</item>
<item>NA_LEDGER</item>
<item>NA_TABLOID</item>
<item>NA_INDEX_3X5</item>
<item>NA_INDEX_4X6</item>
<item>NA_INDEX_5X8</item>
<item>NA_MONARCH</item>
<item>NA_QUARTO</item>
<item>NA_FOOLSCAP</item>
</string-array>
</resources>

View file

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 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.
-->
<resources>
<string-array name="pdf_printer_media_sizes" translatable="false">
<item>ROC_8K</item>
<item>ROC_16K</item>
<item>PRC_1</item>
<item>PRC_2</item>
<item>PRC_3</item>
<item>PRC_4</item>
<item>PRC_5</item>
<item>PRC_6</item>
<item>PRC_7</item>
<item>PRC_8</item>
<item>PRC_9</item>
<item>PRC_10</item>
<item>PRC_16K</item>
<item>OM_PA_KAI</item>
<item>OM_DAI_PA_KAI</item>
<item>OM_JUURO_KU_KAI</item>
</string-array>
</resources>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Some files were not shown because too many files have changed in this diff Show more