SensorService now correctly sends the last known
state of a sensor as soon as a new connection is made.
This fixes the issue where, for instance, an application
could wait a long time before getting the light or proximity
sensor initial state.
Change-Id: Ic41392f3626e26c4f15746c7e17c7ecd44bbb10b
remove old sensor service and implement SensorManager
on top of the new (native) SensorManger API.
Change-Id: Iddb77d498755da3e11646473a44d651f12f40281
Hand merge from ics-aah
> Utils: Fix a bug in the linear transformation code.
>
> Fix a bug where an incorrect result would be computed if you used the
> linear transformation code to do a reverse transformation (from B's
> domain into A's domain) when the scaler fraction was negative.
>
> Change-Id: I8e5f109314d235a177ab41f65d3c4cd08cff78be
> Signed-off-by: John Grossman <johngro@google.com>
Change-Id: Id90e18f685c61c1a89fd91c32adcf01363b3e8f3
Signed-off-by: John Grossman <johngro@google.com>
When the app_process is shutting down the main thread will close the
binder fd while pool threads are executing an ioctl (in
IPCThreadState::stopProcess called by AppRuntime::onStarted in
app_main.c).
The binder driver will then return all pending calls in ioctl
without any error and with a command. One of the threads gets a
BR_SPAWN_LOOPER which will create a new thread (the other thread
gets a BR_NOOP). This new thread then calls
vm->AttachCurrentThread. Usually this results in a log entry with
"AndroidRuntime: NOTE: attach of thread 'Binder Thread #3' failed",
but sometimes it also causes a SIGSEGV. This depends on the timing
between the new thread an the main thread that calls DestroyJavaVM
(in AndroidRuntime::start).
If IPCThreadState.cpp is compiled with "#define LOG_NDEBUG 0" the
pool thread will loop and hit the
ALOG_ASSERT(mProcess->mDriverFD >= 0) in
IPCThreadState::talkWithDriver.
Crashes like this has been seen when running the am command and
other commands that use the app_process.
This fix makes sure that any command that is received when the driver
fd is closed are ignored and IPCThreadState::talkWithDriver instead
returns an error which will cause the pool thread to exit and detach
itself from the vm. A check to avoid calling ioctl to a fd with -1
was also added in IPCThreadState::threadDestructor.
Another solution might be to change the binder driver so that it
returns an error when the fd is closed (or atleast not a
BR_SPAWN_LOOPER command). It might also be possible to call exit(0)
which is done when System.exit(0) is called from java.
Change-Id: I3d1f0ff64896c44be2a5994b3a90f7a06d27f429
ISurfaceTexture::dequeueBuffer now returns the buffer's fence for the
client to wait on. For BufferQueue, this means passing it through
Binder so it can be returned to the SurfaceTextureClient. Now
SurfaceTextureClient is responsible for waiting on the fence in
dequeueBuffer instead of BufferQueue: one step closer to the goal.
Change-Id: I677ae758bcd23acee2d784b8cec11b32cccc196d
After a HWC set, each SurfaceFlinger Layer retrieves the release fence
HWC returned and gives it to the layer's SurfaceTexture. The
SurfaceTexture accumulates the fences into a merged fence until the
next updateTexImage, then passes the merged fence to the BufferQueue
in releaseBuffer.
In a follow-on change, BufferQueue will return the fence along with
the buffer slot in dequeueBuffer. For now, dequeueBuffer waits for the
fence to signal before returning.
The releaseFence default value for BufferQueue::releaseBuffer() is
temporary to avoid transient build breaks with a multi-project
checkin. It'll disappear in the next change.
Change-Id: Iaa9a0d5775235585d9cbf453d3a64623d08013d9
FramebufferNativeWindow::dequeueBuffer now waits for the next buffer
to be non-front in addition to being free.
Change-Id: I991f154958cc6b488b1241aba83d1f95a0513b3c
This change updates the uses of ANativeWindow to use the new ANW functions that
accept and return Sync HAL fence file descriptors.
Change-Id: I3ca648b6ac33f7360e86754f924aa072f95242f6
The desc.txt file can now mark parts as 'must finish cleanly' by using
'c' as the part line prefix rather than 'p'. If so indicated, if the
bootanimation is asked to quit it will do so only after waiting to
finish that part.
I considered either making init.c service killing smarter or promoting
bootanim to be a bindable service with a requestExit method. However,
these changes are probably too big/risky given our ship date. So
I used a property as a mailbox between SurfaceFlinger and bootanim.
Bug: 6679877
Change-Id: Id7dca22caa50b450fff25ca94f7242d971034f41
When turning the screen off we could have 2 waiters on the
vsync condition: The main vsync waiter as well as one in
onScreenReleased(). We were only signaling the condition though,
so it it would be possible to wake onScreenReleased() without waking
the main vsync thread which would then be stuck in .wait().
We fix this by just using broadcast() when receiving a vsync event.
We also add a broadcast() to signal when the state of
mUseSoftwareVSync changes. This is important particularly for
the transition from hardware to software vsync because the main
vsync waiter might have observed mUseSoftwareVSync == false
and decided to block indefinitely pending a hardware vsync
signal that will never arrive.
Removed a potentially deadlocking wait for a signal in
onScreenReleased(). The function was trying to wait for the last
vsync event from the hardware to be delivered to clients but there
was no guarantee that another thread would signal it to wake up
again afterwards. (As far as I can tell, the only other other
thread that might wake it up at this point would be a client
application issuing a vsync request.) We don't really need to wait
here anyhow. It's enough to set the mUseSoftwareVSync flag,
wake up the thread loop and go. If there was a pending vsync
timestamp from the hardware, then the thread loop will grab
it and use it then start software vsync on the next iteration.
Bug: 6672102
Change-Id: I7c6abc23bb021d1dfc94f101bd3ce18e3a81a73e
When turning the screen off we could have 2 waiters on the
vsync condition: The main vsync waiter as well as one in
onScreenReleased(). We were only signaling the condition though,
so it it would be possible to wake onScreenReleased() without waking
the main vsync thread which would then be stuck in .wait().
We fix this by just using broadcast() when receiving a vsync event.
We also add a broadcast() to signal when the state of
mUseSoftwareVSync changes. This is important particularly for
the transition from hardware to software vsync because the main
vsync waiter might have observed mUseSoftwareVSync == false
and decided to block indefinitely pending a hardware vsync
signal that will never arrive.
Removed a potentially deadlocking wait for a signal in
onScreenReleased(). The function was trying to wait for the last
vsync event from the hardware to be delivered to clients but there
was no guarantee that another thread would signal it to wake up
again afterwards. (As far as I can tell, the only other other
thread that might wake it up at this point would be a client
application issuing a vsync request.) We don't really need to wait
here anyhow. It's enough to set the mUseSoftwareVSync flag,
wake up the thread loop and go. If there was a pending vsync
timestamp from the hardware, then the thread loop will grab
it and use it then start software vsync on the next iteration.
Bug: 6672102
Change-Id: I7c6abc23bb021d1dfc94f101bd3ce18e3a81a73e
The acquire and release fences aren't yet used; this is just support
for the new version and temporary backwards compatibility for older
versions.
Change-Id: Ia5ccc05a97c86f649042b9a35e11042fa0187e84
HWComposer must abstract the HWC HAL entirely, so that the
HAL can continue to evolve (and break binary compatibility)
without breaking SurfaceFlinger. The HWC data structure had
leaked outside of HWComposer, this is now fixed.
We now have an abstract interface that provide all the
needed functionality, HWCompose provides concrete
implementations of it based on the the HWC version.
Change-Id: I40c4676dc986b682ede5520a1c60efe64037b0bb
SF now has its own implementation of ANW for the
framebuffer and it uses BufferQueue. FramebufferNativeWindow
is now only used by stand-alone apps.
Change-Id: Iddeb24087df62bd92b0f78e391dda9b97ddc859c