From 77d789de2664ebab2e38448c78edc41487dc8158 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Sat, 11 Feb 2012 00:44:22 -0800 Subject: libhardware_legacy: Remove set_screen_state The early-suspend/late-resume interface to /sys/power/state is being moved to the default/legacy Power HAL. The emulator interface is being moved to the emulator Power HAL. Change-Id: I66a1e611e6d907f20335f047001745f818dfc846 Signed-off-by: Todd Poynor --- power/Android.mk | 5 ----- power/power.c | 47 +---------------------------------------------- power/power_qemu.c | 28 ---------------------------- power/power_qemu.h | 24 ------------------------ 4 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 power/power_qemu.c delete mode 100644 power/power_qemu.h (limited to 'power') diff --git a/power/Android.mk b/power/Android.mk index a524d0e..3e3ff5d 100644 --- a/power/Android.mk +++ b/power/Android.mk @@ -1,8 +1,3 @@ # Copyright 2006 The Android Open Source Project LOCAL_SRC_FILES += power/power.c - -ifeq ($(QEMU_HARDWARE),true) - LOCAL_SRC_FILES += power/power_qemu.c - LOCAL_CFLAGS += -DQEMU_POWER=1 -endif diff --git a/power/power.c b/power/power.c index 8b448b4..c4fa370 100644 --- a/power/power.c +++ b/power/power.c @@ -30,28 +30,20 @@ #define LOG_TAG "power" #include -#include "qemu.h" -#ifdef QEMU_POWER -#include "power_qemu.h" -#endif - enum { ACQUIRE_PARTIAL_WAKE_LOCK = 0, RELEASE_WAKE_LOCK, - REQUEST_STATE, OUR_FD_COUNT }; const char * const OLD_PATHS[] = { "/sys/android_power/acquire_partial_wake_lock", "/sys/android_power/release_wake_lock", - "/sys/android_power/request_state" }; const char * const NEW_PATHS[] = { "/sys/power/wake_lock", "/sys/power/wake_unlock", - "/sys/power/state" }; const char * const AUTO_OFF_TIMEOUT_DEV = "/sys/android_power/auto_off_timeout"; @@ -61,9 +53,6 @@ static int g_initialized = 0; static int g_fds[OUR_FD_COUNT]; static int g_error = 1; -static const char *off_state = "mem"; -static const char *on_state = "on"; - static int64_t systemTime() { struct timespec t; @@ -97,11 +86,8 @@ initialize_fds(void) //pthread_once(&g_initialized, open_file_descriptors); // XXX: not this: if (g_initialized == 0) { - if(open_file_descriptors(NEW_PATHS) < 0) { + if(open_file_descriptors(NEW_PATHS) < 0) open_file_descriptors(OLD_PATHS); - on_state = "wake"; - off_state = "standby"; - } g_initialized = 1; } } @@ -158,34 +144,3 @@ set_last_user_activity_timeout(int64_t delay) return errno; } } - -int -set_screen_state(int on) -{ - QEMU_FALLBACK(set_screen_state(on)); - - ALOGI("*** set_screen_state %d", on); - - initialize_fds(); - - //ALOGI("go_to_sleep eventTime=%lld now=%lld g_error=%s\n", eventTime, - // systemTime(), strerror(g_error)); - - if (g_error) - goto failure; - - char buf[32]; - int len; - if(on) - len = snprintf(buf, sizeof(buf), "%s", on_state); - else - len = snprintf(buf, sizeof(buf), "%s", off_state); - - buf[sizeof(buf) - 1] = '\0'; - len = write(g_fds[REQUEST_STATE], buf, len); - if(len < 0) { - failure: - ALOGE("Failed setting last user activity: g_error=%d\n", g_error); - } - return 0; -} diff --git a/power/power_qemu.c b/power/power_qemu.c deleted file mode 100644 index 742276f..0000000 --- a/power/power_qemu.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ -#include "qemu.h" -#include "power_qemu.h" -#include -#include -#include - -int -qemu_set_screen_state(int on) -{ - qemu_control_command( "power:screen_state:%s", on ? "wake" : "standby" ); - return 0; -} - diff --git a/power/power_qemu.h b/power/power_qemu.h deleted file mode 100644 index c689da3..0000000 --- a/power/power_qemu.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2008 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 _power_qemu_h -#define _power_qemu_h - -#include - -extern int -qemu_set_screen_state(int on); - -#endif /* _power_qemu_h */ -- cgit v1.1