aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile.in6
-rw-r--r--xbmc/powermanagement/PowerManager.cpp4
-rw-r--r--xbmc/powermanagement/android/AndroidPowerSyscall.cpp42
-rw-r--r--xbmc/powermanagement/android/AndroidPowerSyscall.h44
-rw-r--r--xbmc/powermanagement/android/Makefile6
5 files changed, 102 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index 360ca216fe..16e71c205f 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -110,7 +110,13 @@ DIRECTORY_ARCHIVES += xbmc/windowing/osx/windowing_osx.a
else
DIRECTORY_ARCHIVES += xbmc/input/linux/input_linux.a
DIRECTORY_ARCHIVES += xbmc/network/linux/network_linux.a
+
+ifeq (@USE_ANDROID@,1)
+DIRECTORY_ARCHIVES += xbmc/powermanagement/android/powermanagement_android.a
+else
DIRECTORY_ARCHIVES += xbmc/powermanagement/linux/powermanagement_linux.a
+endif
+
DIRECTORY_ARCHIVES += xbmc/storage/linux/storage_linux.a
DIRECTORY_ARCHIVES += xbmc/windowing/X11/windowing_X11.a
endif
diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp
index 3dc15583e0..a68910ba58 100644
--- a/xbmc/powermanagement/PowerManager.cpp
+++ b/xbmc/powermanagement/PowerManager.cpp
@@ -39,6 +39,8 @@
#if defined(TARGET_DARWIN)
#include "osx/CocoaPowerSyscall.h"
+#elif defined(TARGET_ANDROID)
+#include "android/AndroidPowerSyscall.h"
#elif defined(_LINUX) && defined(HAS_DBUS)
#include "linux/ConsoleUPowerSyscall.h"
#include "linux/ConsoleDeviceKitPowerSyscall.h"
@@ -68,6 +70,8 @@ void CPowerManager::Initialize()
{
#if defined(TARGET_DARWIN)
m_instance = new CCocoaPowerSyscall();
+#elif defined(TARGET_ANDROID)
+ m_instance = new CAndroidPowerSyscall();
#elif defined(_LINUX) && defined(HAS_DBUS)
if (CConsoleUPowerSyscall::HasDeviceConsoleKit())
m_instance = new CConsoleUPowerSyscall();
diff --git a/xbmc/powermanagement/android/AndroidPowerSyscall.cpp b/xbmc/powermanagement/android/AndroidPowerSyscall.cpp
new file mode 100644
index 0000000000..7f4740d169
--- /dev/null
+++ b/xbmc/powermanagement/android/AndroidPowerSyscall.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#if defined (TARGET_ANDROID)
+
+#include "AndroidPowerSyscall.h"
+#include "android/activity/XBMCApp.h"
+
+CAndroidPowerSyscall::CAndroidPowerSyscall()
+{ }
+
+CAndroidPowerSyscall::~CAndroidPowerSyscall()
+{ }
+
+int CAndroidPowerSyscall::BatteryLevel(void)
+{
+ return CXBMCApp::GetBatteryLevel();
+}
+
+bool CAndroidPowerSyscall::PumpPowerEvents(IPowerEventsCallback *callback)
+{
+ return true;
+}
+
+#endif
diff --git a/xbmc/powermanagement/android/AndroidPowerSyscall.h b/xbmc/powermanagement/android/AndroidPowerSyscall.h
new file mode 100644
index 0000000000..bfcb2bf681
--- /dev/null
+++ b/xbmc/powermanagement/android/AndroidPowerSyscall.h
@@ -0,0 +1,44 @@
+#pragma once
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#if defined (TARGET_ANDROID)
+#include "powermanagement/IPowerSyscall.h"
+
+class CAndroidPowerSyscall : public CPowerSyscallWithoutEvents
+{
+public:
+ CAndroidPowerSyscall();
+ ~CAndroidPowerSyscall();
+
+ virtual bool Powerdown(void) { return false; }
+ virtual bool Suspend(void) { return false; }
+ virtual bool Hibernate(void) { return false; }
+ virtual bool Reboot(void) { return false; }
+
+ virtual bool CanPowerdown(void) { return false; }
+ virtual bool CanSuspend(void) { return false; }
+ virtual bool CanHibernate(void) { return false; }
+ virtual bool CanReboot(void) { return false; }
+ virtual int BatteryLevel(void);
+
+ virtual bool PumpPowerEvents(IPowerEventsCallback *callback);
+};
+#endif
diff --git a/xbmc/powermanagement/android/Makefile b/xbmc/powermanagement/android/Makefile
new file mode 100644
index 0000000000..64313a5313
--- /dev/null
+++ b/xbmc/powermanagement/android/Makefile
@@ -0,0 +1,6 @@
+SRCS=AndroidPowerSyscall.cpp
+
+LIB=powermanagement_android.a
+
+include ../../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))