From 7b0ad9c638176dc364dabb65b363536055a0ea9c Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Fri, 5 Aug 2016 18:00:04 -0700 Subject: Switch recovery to libbase logging Clean up the recovery image and switch to libbase logging. Bug: 28191554 Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35 Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35 --- wear_touch.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'wear_touch.cpp') diff --git a/wear_touch.cpp b/wear_touch.cpp index 51a1d31b2..cf33daa9f 100644 --- a/wear_touch.cpp +++ b/wear_touch.cpp @@ -14,9 +14,6 @@ * limitations under the License. */ -#include "common.h" -#include "wear_touch.h" - #include #include #include @@ -25,8 +22,11 @@ #include #include +#include #include +#include "wear_touch.h" + #define DEVICE_PATH "/dev/input" WearSwipeDetector::WearSwipeDetector(int low, int high, OnSwipeCallback callback, void* cookie): @@ -49,11 +49,11 @@ void WearSwipeDetector::detect(int dx, int dy) { } else if (abs(dx) < mLowThreshold && abs(dy) > mHighThreshold) { direction = dy < 0 ? UP : DOWN; } else { - LOGD("Ignore %d %d\n", dx, dy); + LOG(DEBUG) << "Ignore " << dx << " " << dy; return; } - LOGD("Swipe direction=%d\n", direction); + LOG(DEBUG) << "Swipe direction=" << direction; mCallback(mCookie, direction); } @@ -105,7 +105,7 @@ void WearSwipeDetector::process(struct input_event *event) { void WearSwipeDetector::run() { int fd = findDevice(DEVICE_PATH); if (fd < 0) { - LOGE("no input devices found\n"); + LOG(ERROR) << "no input devices found"; return; } @@ -127,14 +127,14 @@ void* WearSwipeDetector::touch_thread(void* cookie) { int WearSwipeDetector::openDevice(const char *device) { int fd = open(device, O_RDONLY); if (fd < 0) { - LOGE("could not open %s, %s\n", device, strerror(errno)); + PLOG(ERROR) << "could not open " << device; return false; } char name[80]; name[sizeof(name) - 1] = '\0'; if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) { - LOGE("could not get device name for %s, %s\n", device, strerror(errno)); + PLOG(ERROR) << "could not get device name for " << device; name[0] = '\0'; } @@ -143,7 +143,7 @@ int WearSwipeDetector::openDevice(const char *device) { int ret = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); if (ret > 0) { if (test_bit(ABS_MT_POSITION_X, bits) && test_bit(ABS_MT_POSITION_Y, bits)) { - LOGD("Found %s %s\n", device, name); + LOG(DEBUG) << "Found " << device << " " << name; return fd; } } @@ -155,7 +155,7 @@ int WearSwipeDetector::openDevice(const char *device) { int WearSwipeDetector::findDevice(const char* path) { DIR* dir = opendir(path); if (dir == NULL) { - LOGE("Could not open directory %s", path); + PLOG(ERROR) << "Could not open directory " << path; return false; } -- cgit v1.2.3