Commit Graph

656 Commits

Author SHA1 Message Date
Mathias Agopian
ca99fb8f65 fix [2594950] Flash: Zooming in on some content crashes the Nexus One and causes it to reboot (runtime restart)
We now limit the size of the surface to the maximum size supported by the GPU.
On Nexus One this will 2048 -- it could be different on other devices.
Surface creation fails if the limit is exceeded.

Change-Id: I9ecfc2e9c58c9e283782b61ebfc6b590f71df785
2010-04-14 16:43:44 -07:00
Eric Laurent
775fa3cd32 Additional fix for isssue 2548710: Native AudioTrack resources never freed.
This changes fixes the issue for the direct output thread that was not
addressed by commit 71f37cd8a175ee00635cb91506d6810fd02b5b51.

Change-Id: I1bbe26be5f444415dd97270e49257650f5d2858f
2010-04-09 06:11:48 -07:00
Eric Laurent
deea502a92 Fix isssue 2548710: Native AudioTrack resources never freed.
The problem is a bug in AudioFlinger::MixerThread::prepareTracks_l() that makes that even if the TrackHandle
is destroyed, the corresponding Track will remain active as long as frames are ready for mixing.
If the track uses shared memory (static mode) and the sound is looped, this track will play for ever.

The fix consists in removing the track from active list immediately if the track is terminated.

Change-Id: I4582aa1d981079ab79be442fb6185f5afaed5cf3
2010-03-31 12:36:34 -07:00
Dianne Hackborn
c85e12e075 Revert "fix [2542425] memory leak during video recording"
This reverts commit 544592e14f8d7643238e40ba9879727497900f35.
2010-03-30 21:04:17 -07:00
Mathias Agopian
77e26d6822 fix [2542425] memory leak during video recording
[Sorted|Keyed]Vector<TYPE> would leak their whole storage when resized
from the end and TYPE had trivial dtor and copy operators.

Change-Id: I8555bb1aa0863df72de27d67ae50e20706e90cf5
2010-03-30 19:02:59 -07:00
Mathias Agopian
caeddc7236 fix [2542425] memory leak during video recording
Vector::sort() is using _do_copy() incorrectly; _do_copy() calls the
copy constructor, not the assignment operator, so we need to destroy
the "destination" before copying the item.

Change-Id: Iaeeac808fa5341a7d219edeba4aa63d44f31473c
2010-03-29 13:45:18 -07:00
Mathias Agopian
c8620b60d6 fix [2545826] calling into gralloc with external lock held
Change-Id: I2d0e017382404c684c768a0dd0423d574213f10a
2010-03-25 14:34:49 -07:00
Mathias Agopian
6795478949 Merge "libutils Condition are now PRIVATE by default" 2010-03-19 17:20:08 -07:00
Mathias Agopian
26d244281a libutils Condition are now PRIVATE by default
Condition must be initialized with SHARED for the old behavior, where
they can be used accross processes.

Updated the two places android that require SHARED conditions.

PRIVATE conditions (and mutexes) use more efficient syscalls.

Change-Id: I9a281a4b88206e92ac559c66554e886b9c62db3a
2010-03-19 16:16:43 -07:00
Christopher Tate
440fd870b2 Ensure that binder incalls to the system process keep the fg cgroup
On binder incalls, the handler thread is given the caller's priority by the
driver, but not the caller's cgroup.  We have explicit code that sets the
handler's cgroup to match the caller's, *except* that the system process
explicitly disables this behavior.  This led to a siuation in which we were
running binder incalls to the system process at nice=10 but cgroup=fg.

That's fine as far as it goes, except that if a GC happened in the handler
thread, it would be promoted to foreground priority and cgroup both, to avoid
having the GC take forever.  Then, when GC finished, the original priority
is reset, and the cgroup set *based on that priority*.  This would push the
handler thread into nice=10 cgroup=bg_non_interactive -- which matches the
caller, but is supposed to be impossible in the system process.

The end result of this was that we could be running "lengthy" operations in
the system process in the background.  Unfortunately, some of the operations
that wound up like this would hold important global system locks for up to
twenty seconds as a result, making the entire device unresponsive to input
for that period.

This CL fixes the binder incall setup to ensure that within the system process,
a binder incall is always begun from the normal foreground priority as well
as cgroup.  In practice now the device still becomes laggy/sluggish when the
offending lock-holding time-consuming incall occurs, but since it still runs
as a foreground task it is able to proceed to completion within a short time
rather than taking 20 seconds.

Fixes bug #2403717

Change-Id: Id046aeabd0e80c48eef94accc37842835eab308d
2010-03-18 18:13:57 -07:00
Eric Laurent
d6ce100464 Merge "Fix issue 2416481: Support Voice Dialer over BT SCO." 2010-03-17 09:16:27 -07:00
Mathias Agopian
ab02873e8f fix [2511580] Window poop on screen - drop down list left some residual when it resized
Change-Id: Ib9a3622e7a568ba26717a93b5bfa4a191651f4d0
2010-03-16 17:54:27 -07:00
Eric Laurent
101e77a31b Fix issue 2416481: Support Voice Dialer over BT SCO.
- AudioPolicyManager: allow platform specific choice for opening a direct output.
 Also fixed problems in direct output management.
- AudioFliinger: use shorter standby delay and track inactivity grace period for direct output
thread to free hardware resources as soon as possible.
- AudioSystem: do not use cached output selection in getOutput() when a direct output
can be selected.

Change-Id: If44b50d29237b8402ffd7a5ba1dc43c56f903e9b
2010-03-16 17:32:18 -07:00
Mathias Agopian
d343e3d5e3 fix [2515291] Native crash and runtime restart while trying to preview captured picture on Sapphire
if a buffer couldn't be allocated because of an OOM, SF could, in some case dereference
a null pointer.

Change-Id: I5321248c38a21e56d5278b6aada2694e64451378
2010-03-15 18:15:20 -07:00
Jean-Michel Trivi
08abf1fa13 Fix bug 2203203 Route STREAM_VOICE_CALL to A2DP when not in call.
Change-Id: I5581702780308658415dc4ad19fbe409fdc5c368
2010-03-14 10:55:57 -07:00
Mathias Agopian
55fa25161a implement connect/disconnect in our native_window_t implementations
the framebuffer implementation doesn't do anything special with this
but the surfaceflinger implementation makes sure the surface is not used
by two APIs simultaneously.

Change-Id: Id4ca8ef7093d68846abc2ac814327cc40a64b66b
2010-03-11 15:06:54 -08:00
Mathias Agopian
d129659347 fix [2483456] Video orientation is wrong on Droid for some videos
Change-Id: I450191f1335f57bffc51aff3e27295395847dbc0
2010-03-11 12:55:39 -08:00
Jean-Baptiste Queru
c3897a2aea Merge "Use proper config to enable LVMX" 2010-03-09 18:43:57 -08:00
Jean-Baptiste Queru
e4623e8754 Use proper config to enable LVMX
Change-Id: Ifa75a82884b99aeee139e055f40e7c510cf28213
2010-03-09 18:13:59 -08:00
Dianne Hackborn
82fecb01df Add ability for some manifest attributes to reference resources.
This loosens our restriction on many manifest attributes requiring
literal string values, to allow various ones to use values from
resources.  This is only allowed if the resource value does not change
from configuration changes, and the restriction is still in place
for attributes that are core to security (requesting permissions) or
market operation (used libraries and features etc).

Change-Id: I4da02f6a5196cb6a7dbcff9ac25403904c42c2c8
2010-03-09 17:18:05 -08:00
Glenn Kasten
d5ea969b41 Initial version of LifeVibes integration.
Also changed tabs to spaces in other audioflinger files.
2010-03-09 14:16:01 -08:00
Jean-Michel Trivi
84cf7d9e88 Fix bug 2329540
Part 1 of the fix: when the user doesn't elect to use the car dock
 for music and media, the APM was not aware of the device being
 docked.
 This is fixed by dissociating the notification for the APM of
 the docking to the dock from the sink state change of the A2DP
 device.
 Also missing was forcing the volumes to be reevaluated whenever
 the device is docked or undocked, as volumes for docks may
 differ, even when the same output device is being used.

Change-Id: If5314e27821a71adbd6df6fdf887c45208241d96
2010-03-09 12:45:55 -08:00
Mathias Agopian
948d69fca4 improve SF logging/debugging a little bit
Change-Id: I6a57f89c25defc293fd748cc1fbd710031c02ec2
2010-03-08 19:30:56 -08:00
Mathias Agopian
7d3f8ed3a5 Merge "Fix a small bug where we could compute SharedBufferStack's tail incorrectly." 2010-03-08 19:24:27 -08:00
Mathias Agopian
c2e30de00c Fix a small bug where we could compute SharedBufferStack's tail incorrectly.
Also add "tail" to the debug dump().

Change-Id: I04b1ea375dfc9ddcc22f0c6b6cd01300e507572e
2010-03-08 19:23:26 -08:00
Mathias Agopian
f23a5e052e Merge "fixes for [2474091] Saw Poor behaviour playing a video." 2010-03-08 15:35:44 -08:00
Mathias Agopian
fcfeb4b597 fixes for [2474091] Saw Poor behaviour playing a video.
- fix a bug when hacking video buffers into gralloc buffers
 where the buffer size was incorrect this was causing the
 "direct-form-texture" mode to fail

- also when the above fails, make sure to revert to the
 "mdp copy mode" before going to "slow mode"

- finally disable completely the "direct-from-texture" mode
 for now. It cannot work because the allocated buffers can't
 respect the GPU constraints (alignment and such). We'll
 have to find a solution for that.
2010-03-08 11:14:20 -08:00
Eric Laurent
219795f5d0 Fix issue 2317760: Change the priority between wired headset and A2DP.
Modified audio policy manager so that wired headset has precedence over A2DP headset.
2010-03-08 06:50:44 -08:00
Eric Laurent
194e485dd1 Merge "Fix issue 2428563: Camera rendered inoperable by voice call interruption." 2010-03-05 16:01:47 -08:00
Eric Laurent
4f1fcc2890 Fix issue 2428563: Camera rendered inoperable by voice call interruption.
The problem is that AudioRecord never exits read() when a timeout occurs while trying
to get new PCM data from audio hardware input buffer: it just keeps waiting and retrying until stop() is called.
In the same time, opencore AndroidAudioInput::audin_thread_func() loop cannot be exited when stuck
in AudioRecord::read() because the iExitAudioThread flag can only be sampled when AudioRecord::read()
returns. We remain stuck with the audio input thread running.

The fix consists in modifying AudioRecord behavior in case of timeout when getting new PCM samples.
We now wait only one timeout period and try to restart audio record, in case the problem is due to a media_server
process crash. If this fails, we exit read() with a number of bytes read equals to 0 so that
AndroidAudioInput::audin_thread_func() loop can exit.

Also modified Audioflinger::RecordThread() loop so that we attempt to recover from HAL read errors.
In case of read error, the input stream is forced to standby so that next read attempt does a
reconfiguration and restart of the audio input device.
2010-03-05 11:54:23 -08:00
Christopher Tate
9855a0575e Calculate bitmask array sizes correctly in the EventHub
We've gotten lucky to date:  the previous calculation of bitmask array
sizes, (maxval+1)/8 only works properly when 'maxval' is one less than
a multiple of 8.  Fortunately, this has either been the case for us,
or there has been sufficient 'unused' space at the end of the defined
max value range that we haven't wound up overreading/overwriting the
allocated buffers.

Change-Id: I563a93a86644ab9f19489565e06c28e06bb53abc
2010-03-04 16:32:32 -08:00
Christopher Tate
2032f98f8c Fix #2489986 : The key bitmask needs to cover all possible keys
Change-Id: Ieebd2f879e6b6fbc0388655dd66f34be89e809a0
2010-03-04 16:00:29 -08:00
Dianne Hackborn
6687fb103d Fix some bugs.
Bug #2376231: Apps lose window focus (and back key causes ANR) if the
lock screen is dismissed while the phone is in landscape mode

This is another case where we weren't recomputing the focused window
after changing the visibility policy.

bug #2479958: Investigate source of "Resources don't contain package
for resource number 0x7f0a0000"

Um, okay, so it turns out there were bugs all over the place where
we would load an XML resource from a another application, but not
use the Resources for that application to retrieve its resources...!
I think the only reason any of this stuff was working at all was
because it typically only cared about retrieving the resource
identifiers of the items (it would look up the values later).

Bug #2401082: Passion ERE26 monkey crash - InputMethodManagerService

Add some null checks.
2010-03-04 11:52:14 -08:00
Dianne Hackborn
71c3eb2a38 Maybe fix issue #2482201: Paired bluetooth device looks like a qwerty keyboard
We now only consider a device to be a default keyboard if its name
has "-keypad".  A hack, but whatever.

Also add some debug logging for the input state to help identify such
issues in the future.
2010-03-02 17:37:45 -08:00
Dima Zavin
4fe6ac33d1 surfaceflinger: remove un-cached buffers hack for Adreno
Change-Id: I5ae4e74bfa3e25b55be2cddf7b3c51368a140ab9
Signed-off-by: Dima Zavin <dima@android.com>
2010-03-02 16:44:46 -08:00
Eric Laurent
134ccbd131 Issue 2071329: audio track is shorter than video track for video capture on sholes
Add API to retrieve number of frames dropped by audio input kernel driver.

Submitted on behalf of Masaki Sato <masaki.sato@motorola.com>
2010-03-02 08:20:13 -08:00
Dianne Hackborn
8eca036d24 Fix issue #2448075: aapt doesn't fix up activity-alias android:targetActivity links
And related:

- The aapt tool now sets a resource configurations sdk level to match any configs
  that have been set (for example if you specify density your sdk level will be
  at least 4).
- New option to modify the targetPackage attribute of instrumentation.
- Clean up of aapt options help.
- Fix of UI type values to leave 0 for "unspecified".
- Make the UI mode config APIs public.
2010-03-01 20:42:14 -08:00
Mathias Agopian
064e1e672e fix [2425395] portrait UI briefly shows in landscape
the "freeze" timeout was not initialized properly which caused it
to kick-in immediately instead of after 5s
2010-03-01 18:36:14 -08:00
Mathias Agopian
285dbde2e0 Added a name to Surface created by SurfaceFlinger
Updated the window manager to use this new facility.
Surfaces name are now printed by "dumpsys".
2010-03-01 18:34:50 -08:00
Ficus Kirkpatrick
dc7caf18da Demote the famous ResourceTypes warning to LOGV.
It is spamming the log bigtime and can be promoted back to LOGW
or worse by whoever decides to actually investigate the bug.

Change-Id: I72d950155378f641ebdfbacabae774f5736a52bc
2010-03-01 16:33:53 -08:00
Mathias Agopian
45853c9759 to help debugging [2461567] Home screen redraw messed up
log SF's idea of the front buffer in dumpsys.
2010-02-26 18:59:23 -08:00
Eric Laurent
83db7782aa Merge "Fix issue 2327064: Music played via line out is interrupted due to the phone call audio on BT hs." 2010-02-25 00:14:47 -08:00
Eric Laurent
15498d6a23 Fix issue 2327064: Music played via line out is interrupted due to the phone call audio on BT hs.
This is not a real fix for the issue but a change to make sure that the behavior is consistent regardless of
external condidions (WIFI ON or OFF, music started before call or not, A2DP device same as SCO device...).

As there is now way to guaranty good quality audio over both SCO and A2DP simultaneously, especially when WIFI is on, We will stick to this behavior:
When music is playing and we are docked to the desk dock and a call is answered with a BT SCO headset, A2DP output will be suspended.
If music is restarted during the call, it will appear muted to the user until the call is terminated.
2010-02-24 11:54:32 -08:00
Kenny Root
f70c4cebcc Merge "Use UTF-8 strings to avoid duplicate caching, part 1" 2010-02-24 07:52:27 -08:00
Eric Laurent
057aa729dd Merge "Fix issue 2305382: Pick up original call makes a noisy beep when wired headset connected." 2010-02-23 23:36:37 -08:00
Eric Laurent
34248170a7 Fix issue 2305382: Pick up original call makes a noisy beep when wired headset connected.
The noise is the residual ring tone that is still playing while the call is answered and the
audio route changed to headset or earpiece.

The fix consists in muting the ringing tone when changing mode from ringtone to in call
and delaying the route change until the audio buffers are emptied.
2010-02-23 11:00:56 -08:00
Kenny Root
9e333ab42c Use UTF-8 strings to avoid duplicate caching, part 1
StringBlock instances containing UTF-8 strings use a cache to convert
into UTF-16, but using that cache and then using a JNI call to NewString
causes the UTF-8 string as well as two copies of the UTF-16 string to
be held in memory. Getting the UTF-8 string directly from the StringPool
eliminates one copy of the UTF-16 string being held in memory.

This is part 1. Part 2 will include ResXMLParser optimizations.

Change-Id: Ibd4509a485db746d59cd4b9501f544877139276c
2010-02-23 10:02:20 -08:00
Mathias Agopian
eda65400f5 remove a dependency of surfaceflinger on libskia
libskia was only used for a small part of SkTransform. We now implement
Transform is surfaceflinger directly.
2010-02-22 17:30:40 -08:00
Mathias Agopian
98e71ddaed remove a dependency of GraphicBuffer (libui) on Parcel (libbinder).
Add a Flattenable interface to libutils which can be used to flatten
an object into bytestream + filedescriptor stream.
Parcel is modified to handle Flattenable. And GraphicBuffer implements
Flattenable.

Except for the overlay classes libui is now independent of libbinder.
2010-02-21 23:27:25 -08:00
Mathias Agopian
ca6fab2b53 Initialize layer position 2010-02-19 17:51:58 -08:00