summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 99e513cc0710..80c8ee4dcff6 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "BootAnimation"
+
#include <stdint.h>
#include <sys/types.h>
#include <math.h>
@@ -58,13 +60,29 @@ BootAnimation::~BootAnimation() {
}
void BootAnimation::onFirstRef() {
- run("BootAnimation", PRIORITY_DISPLAY);
+ status_t err = mSession->linkToComposerDeath(this);
+ LOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err));
+ if (err != NO_ERROR) {
+ run("BootAnimation", PRIORITY_DISPLAY);
+ }
}
-const sp<SurfaceComposerClient>& BootAnimation::session() const {
+sp<SurfaceComposerClient> BootAnimation::session() const {
return mSession;
}
+
+void BootAnimation::binderDied(const wp<IBinder>& who)
+{
+ // woah, surfaceflinger died!
+ LOGD("SurfaceFlinger died, exiting...");
+
+ // calling requestExit() is not enough here because the Surface code
+ // might be blocked on a condition variable that will never be updated.
+ kill( getpid(), SIGKILL );
+ requestExit();
+}
+
status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,
const char* name) {
Asset* asset = assets.open(name, Asset::ACCESS_BUFFER);