Permalink
Browse files

droid: add function for enabling forced screen-on

  • Loading branch information...
1 parent 635f16c commit 9dfb02fd57a970c20243e7631758dd6aa336f634 Cory Fields committed Mar 1, 2013
Showing with 11 additions and 0 deletions.
  1. +10 −0 xbmc/android/activity/XBMCApp.cpp
  2. +1 −0 xbmc/android/activity/XBMCApp.h
@@ -45,6 +45,7 @@
#include "utils/log.h"
#include "ApplicationMessenger.h"
#include "JNIThreading.h"
+#include <android/window.h>
#define GIGABYTES 1073741824
@@ -151,6 +152,7 @@ void CXBMCApp::onCreateWindow(ANativeWindow* window)
if(!m_firstrun)
{
XBMC_SetupDisplay();
+ SetScreenLock(true);
XBMC_Pause(false);
}
}
@@ -889,3 +891,11 @@ void CXBMCApp::SetSystemVolume(JNIEnv *env, float percent)
env->DeleteLocalRef(cAudioManager);
}
+void CXBMCApp::SetScreenLock(bool enabled)
+{
+ if (enabled)
+ ANativeActivity_setWindowFlags(m_activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
+ else
+ ANativeActivity_setWindowFlags(m_activity, 0, AWINDOW_FLAG_KEEP_SCREEN_ON);
+}
+
@@ -96,6 +96,7 @@ class CXBMCApp : public IActivityHandler
static int GetMaxSystemVolume();
static int GetDPI();
+ static void SetScreenLock(bool enabled);
protected:
// limit who can access Volume
friend class CAESinkAUDIOTRACK;

0 comments on commit 9dfb02f

Please sign in to comment.