diff options
author | Mathias Agopian <mathias@google.com> | 2009-10-02 18:12:30 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-10-02 18:12:30 -0700 |
commit | 0c4cec7e4df87181486d280c98fba9c0f4774c37 (patch) | |
tree | 4d3aa4fe0101104a1816af9208d367d588bb4f4d /libs/ui | |
parent | 7b16834adc1003f492cd2be4b1bcc3fb73a78c23 (diff) | |
download | frameworks_base-0c4cec7e4df87181486d280c98fba9c0f4774c37.zip frameworks_base-0c4cec7e4df87181486d280c98fba9c0f4774c37.tar.gz frameworks_base-0c4cec7e4df87181486d280c98fba9c0f4774c37.tar.bz2 |
Attempt to fix [2152536] ANR in browser
The ANR is caused by SurfaceFlinger waiting for buffers of a removed surface to become availlable.
When it is removed from the current list, a Surface is marked as NO_INIT, which causes SF to return
immediately in the above case. For some reason, the surface here wasn't marked as NO_INIT.
This change makes the code more robust by always (irregadless or errors) setting the NO_INIT status
in all code paths where a surface is removed from the list.
Additionaly added more information in the logs, should this happen again.
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/SharedBufferStack.cpp | 13 | ||||
-rw-r--r-- | libs/ui/Surface.cpp | 8 |
2 files changed, 15 insertions, 6 deletions
diff --git a/libs/ui/SharedBufferStack.cpp b/libs/ui/SharedBufferStack.cpp index 9ad4349..47c596c 100644 --- a/libs/ui/SharedBufferStack.cpp +++ b/libs/ui/SharedBufferStack.cpp @@ -114,6 +114,12 @@ uint32_t SharedBufferBase::getIdentity() return stack.identity; } +status_t SharedBufferBase::getStatus() const +{ + SharedBufferStack& stack( *mSharedStack ); + return stack.status; +} + size_t SharedBufferBase::getFrontBuffer() const { SharedBufferStack& stack( *mSharedStack ); @@ -135,7 +141,6 @@ String8 SharedBufferBase::dump(char const* prefix) const return result; } - // ============================================================================ // conditions and updates // ============================================================================ @@ -375,8 +380,10 @@ status_t SharedBufferServer::unlock(int buffer) void SharedBufferServer::setStatus(status_t status) { - StatusUpdate update(this, status); - updateCondition( update ); + if (status < NO_ERROR) { + StatusUpdate update(this, status); + updateCondition( update ); + } } status_t SharedBufferServer::reallocate() diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp index 64522fb..285edb4 100644 --- a/libs/ui/Surface.cpp +++ b/libs/ui/Surface.cpp @@ -733,9 +733,11 @@ status_t Surface::getBufferLocked(int index, int usage) index, usage); if (buffer != 0) { // this should never happen by construction LOGE_IF(buffer->handle == NULL, - "requestBuffer(%d, %08x) returned a buffer with a null handle", - index, usage); - if (buffer->handle != NULL) { + "Surface (identity=%d) requestBuffer(%d, %08x) returned" + "a buffer with a null handle", mIdentity, index, usage); + err = mSharedBufferClient->getStatus(); + LOGE_IF(err, "Surface (identity=%d) state = %d", mIdentity, err); + if (!err && buffer->handle != NULL) { err = getBufferMapper().registerBuffer(buffer->handle); LOGW_IF(err, "registerBuffer(...) failed %d (%s)", err, strerror(-err)); |