summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-02-05 02:15:28 -0800
committerMathias Agopian <mathias@google.com>2012-02-05 02:15:28 -0800
commit587ae01ad65a331ba259c31fbc1729cb5fbdf226 (patch)
tree272960d0ca1dec6f76057dee504a9f2a24e02141 /services
parentcf7f0c7328a02b68259c791752944113a1796b6c (diff)
downloadframeworks_base-587ae01ad65a331ba259c31fbc1729cb5fbdf226.zip
frameworks_base-587ae01ad65a331ba259c31fbc1729cb5fbdf226.tar.gz
frameworks_base-587ae01ad65a331ba259c31fbc1729cb5fbdf226.tar.bz2
fix a crasher when starting SF with the screen off
SF could end-up in an infinite crash-loop during startup if it was stopped while the screen was off. This happened because the thread that manages screen blanking was started before other important pieces of SF were initialized. Change-Id: I0dded11dbf2395fdd57b673859a7aa0fa9eb32b6
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp16
-rw-r--r--services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h3
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp1
3 files changed, 11 insertions, 9 deletions
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
index 09f1906..69f1aca 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
@@ -43,14 +43,6 @@ DisplayHardwareBase::DisplayEventThread::DisplayEventThread(
DisplayHardwareBase::DisplayEventThread::~DisplayEventThread() {
}
-void DisplayHardwareBase::DisplayEventThread::onFirstRef() {
- if (initCheck() == NO_ERROR) {
- run("DisplayEventThread", PRIORITY_URGENT_DISPLAY);
- } else {
- ALOGW("/sys/power/wait_for_fb_{wake|sleep} don't exist");
- }
-}
-
status_t DisplayHardwareBase::DisplayEventThread::initCheck() const {
return ((access(kSleepFileName, R_OK) == 0 &&
access(kWakeFileName, R_OK) == 0)) ? NO_ERROR : NO_INIT;
@@ -120,6 +112,14 @@ DisplayHardwareBase::DisplayHardwareBase(const sp<SurfaceFlinger>& flinger,
mDisplayEventThread = new DisplayEventThread(flinger);
}
+void DisplayHardwareBase::startSleepManagement() const {
+ if (mDisplayEventThread->initCheck() == NO_ERROR) {
+ mDisplayEventThread->run("DisplayEventThread", PRIORITY_URGENT_DISPLAY);
+ } else {
+ ALOGW("/sys/power/wait_for_fb_{wake|sleep} don't exist");
+ }
+}
+
DisplayHardwareBase::~DisplayHardwareBase() {
// request exit
mDisplayEventThread->requestExitAndWait();
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h
index 91ea602..fba211b 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h
@@ -35,6 +35,8 @@ public:
~DisplayHardwareBase();
+ void startSleepManagement() const;
+
// console management
void releaseScreen() const;
void acquireScreen() const;
@@ -52,7 +54,6 @@ private:
public:
DisplayEventThread(const sp<SurfaceFlinger>& flinger);
virtual ~DisplayEventThread();
- virtual void onFirstRef();
virtual bool threadLoop();
status_t releaseScreen() const;
status_t initCheck() const;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 88666ea..ab09bfa 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -300,6 +300,7 @@ status_t SurfaceFlinger::readyToRun()
// start the EventThread
mEventThread = new EventThread(this);
mEventQueue.setEventThread(mEventThread);
+ hw.startSleepManagement();
/*
* We're now ready to accept clients...