2152 Commits

Author SHA1 Message Date
Raph Levien
832815cb53 Fix for bug 7234184 F/TextLayoutCache: Failed to put an entry...
This bug was triggered by user code concurrently mutating the character
array while calling into a drawText method in another thread. When the
value of the array changed, it caused inconsistent state, leading to
assert failures.

This is arguably bad behavior by the user code, but it shouldn't cause a
native crash. The fix is to do a defensive copy of the text into the
key, so the value is guaranteed to remain constant throughout the text
layout process. The change is mostly deletion of code, because there was
an optimization to try to avoid such a copy. That optimization was not
actually effective, however, because the indexOfKey() operation in the
KeyedVector underlying the TextLayoutCache did the copy anyway. Thus,
even though this change looks like it's introducing a copy where there
wasn't one before, the actual performance impact should be nil.

Note that the ability to handle a mutating argument is now part of the
contract for TextLayoutEngine::getValue(), and is now documented. That
contract may change, as the result of future optimization. Also, care
was taken to only use the value after the copy.

Other performance issues with TextLayoutCache are tracked in bug
7271109.

Change-Id: I9c90e8e4d501f3f37e2f22a7851f032808d46fbe
2012-10-02 12:32:40 -07:00
Chet Haase
6a2d17f713 Fix texture corruption
When memory gets low on a device, activities flush everything they can.
Hardware-accelerated activites, such as Launcher, flush GL resources and destroy
the GL context. However, some resources were still hanging around, due to deferred
destruction policies (we don't delete layers until the DisplayLists they are in
are finalized, to ensure we don't deref deleted objects). This meant that we were
referring to obsolete GL data in these objects. in particular, it meant that we might
come around later, after a new GL context was created, and delete a texture object
that was incorrect. We use the layer's "texture id" to refer to the texture underlying the
layer. But if there's a new GL context, then this texture ID is no longer valid, and
we may be deleting the texture that a different object (layer, icon, whatever) is referring
to, because the driver may return that same ID under the new GL context.

The fix is to more aggressively delete things that we know will not be used again
when the GL context is destroyed. In particular, we delete all resources being used
by all DisplayLists at GL context destruction time.

Issue #7195815 Textures corruption on all devices, in many apps

Change-Id: I52d2d208173690dbb794a83402d38f14ea4c6c22
2012-09-30 15:35:08 -07:00
Raph Levien
54801e120a Merge "Fix for bug 6936752 Tamil text gets truncated on right-hand side" into jb-mr1-dev 2012-09-28 11:14:48 -07:00
Jeff Sharkey
dd78d462f6 Fix JNI method signature.
Change-Id: I156624e0ac55330f43d9c4d7f15d59f6c529aa0a
2012-09-26 18:46:08 -07:00
Glenn Kasten
c6c4365ddb Implement android.media.AudioManager.getProperty()
Bug: 6635041
Change-Id: I0e7d53b99559cdc89f2f107f23048e4b1a8dd383
2012-09-25 17:01:40 -07:00
Romain Guy
ef09a210dd Don't destroy the same texture twice
Bug #7221449

SurfaceTexture already deletes the GL texture when detachFromContext
is invoked. The newly introduced refcount would casue the Layer
object to be destroyed later and attempt to delete the GL texture
again. By the time the second cleanup occurs, the texture name
might have been reused by somebody else, resulting in erroneous
behaviors.

Change-Id: I257c589fea64b34c00f46fbfaa7732e6854a5e41
2012-09-25 12:22:21 -07:00
Ian Rogers
a8a7e7140d Merge "Extra GC heap configuration parameters." into jb-mr1-dev 2012-09-25 11:34:35 -07:00
Raph Levien
1b10241a8f Fix for bug 6936752 Tamil text gets truncated on right-hand side
The getTextRunAdvances() method wasn't accounting for the true width of
the text. On closer examination, in Tamil the clusters consist of a
number of glyphs each of which has a nonzero advance (in some other
scripts, the first glyph in the cluster has an advance, and others are
effectively zero). Previously, we were just using the advance of the
first glyph in the cluster. This patch changes the behavior to sum the
advances of all the glyphs within the cluster.

Change-Id: I77a51235f4bb0dfaa72cbb920a8c3b217ad25404
2012-09-24 16:14:38 -07:00
Romain Guy
87e2f757be Add a property to disable libhwui's scissor optimization
Bug #7158326

When scissor optimization is enabled, OpenGLRenderer will attempt to
minimize the use of scissor by selectively enabling and disabling the
GL scissor test.
When the optimization is disabled, OpenGLRenderer will keep the GL
scissor test enabled and change the scissor rect as needed.
Some GPUs (for instance the SGX 540) perform better when changing
the scissor rect often than when enabling/disabling the scissor test
often.

Change-Id: Idb68862e287a23358f9188d577ae0f86161902fd
2012-09-24 11:47:52 -07:00
Ian Rogers
5325010486 Extra GC heap configuration parameters.
Allows parameters to increase the maximum free size. b/6606849

Change-Id: Ia74ccdbb8e32954820e3bd26f441b2c2fac889f4
2012-09-23 16:38:03 -07:00
Eino-Ville Talvala
5ce25d7170 Merge "NEW_API: Add android.hardware.Camera.CameraInfo#canDisableShutterSound" into jb-mr1-dev 2012-09-21 16:05:59 -07:00
Jeff Brown
e87bf03076 Support HDMI hotplug.
Bug: 7206678
Change-Id: Ia5212b16658a5f5a2ccf8528eca7bebd45ca857a
2012-09-21 15:34:32 -07:00
Romain Guy
3f7c246f3e Merge "Update layers in a single batch at the beginning of a frame Bug #7186819" into jb-mr1-dev 2012-09-21 10:50:12 -07:00
Romain Guy
11cb642756 Update layers in a single batch at the beginning of a frame
Bug #7186819

Change-Id: Ice5926dfedfb3be3a3064e65008dafa2852407da
2012-09-21 00:39:43 -07:00
Raph Levien
3034d45104 Merge "Fix for native crash on image decode OOM" into jb-mr1-dev 2012-09-20 23:25:26 -07:00
Raph Levien
005bfc694d Fix for native crash on image decode OOM
When decoding an image with scaling, if the allocation of the bitmap
data for the scaled bitmap failed, we were just ignoring it and going
on. This was yielding strange native crashes (bug 7196860 and bug
7175536). This patch checks whether the allocation succeeds, and returns
a null bitmap if not.

Of course, if the app really is OOM because it's allocated too many
bitmaps, it'll still get the OOME, but that's a lot nicer than a native
crash or memory corruption.

Change-Id: I8384059ab11c2ab9e93e283b9438d79e6709b7b1
2012-09-20 22:51:47 -07:00
Zhihai Xu
77f6677bcd Merge "ISSUE 6849488 Bluedroid stack, remove system/bluetooth." into jb-mr1-dev 2012-09-20 16:41:02 -07:00
Zhihai Xu
a3ae439425 ISSUE 6849488 Bluedroid stack, remove system/bluetooth.
remove system/bluetooth stuff.

bug 6849488
Change-Id: I9ea87c9cd60d5ecfa0d58d28301554e716cd2893
2012-09-20 10:47:06 -07:00
Eino-Ville Talvala
f7c6c5ad64 NEW_API: Add android.hardware.Camera.CameraInfo#canDisableShutterSound
Allow applications to check if the camera shutter sound can be
disabled.

Bug: 7172643
Change-Id: I3e9184325d3676b24830cc5418ebca8dcade8697
2012-09-19 14:31:26 -07:00
Jamie Gennis
94998c9c4e Merge "SurfaceTexture: remove call to doGLFenceWait" into jb-mr1-dev 2012-09-18 14:32:01 -07:00
Andy McFadden
923c18b142 Merge "Plumb display name into SurfaceFlinger" into jb-mr1-dev 2012-09-18 09:23:30 -07:00
Jamie Gennis
917a3b34a3 SurfaceTexture: remove call to doGLFenceWait
This call is no longer needed as the default behavior of the native
SurfaceTexture class is to do the wait whenever updateTexImage is called.

Change-Id: I995686a5989409e21b00fac913bd33c11f806998
2012-09-17 19:00:19 -07:00
Andy McFadden
3bcbad7bcb Plumb display name into SurfaceFlinger
Pass the display name into SF's createDisplay().

Bug 7058158

Change-Id: Ia21f07063db2c2fb5a34d6526e16d4b2d3694377
2012-09-17 18:32:40 -07:00
Chet Haase
603f6de35f Fix occasional crash bug with layers
Launcher occasionally crashes with a stack trace indicating that the memory
of a Layer object is corrupt. It is possible for us to delete a Layer
structure and then, briefly, use it to draw a DisplayList again before
that DisplayList gets recreated (without the layer that got deleted).

When this happens, if the memory got corrupted, it's possible to crash.

The fix is to add Layer to the other objects which we currently refcount
(bitmaps, shaders, etc.). Then instead of deleting a Layer, we decrement the
refcount. We increment when creating it, then increment it again when it's
referenced from a DisplayList. Then we decrement the refcount instead of
deleting it, and decrement when we clear a DisplayList that refers to it.
Then when the refcount reaches 0, we delete it.

Issue #6994632 Native crash in launcher when trying to launch all apps screen

Change-Id: I0627be8d49bb2f9ba8d158a84b764bb4e7df934c
2012-09-17 11:21:34 -07:00
Elliott Hughes
08153ee01e Switch DateUtils and Time over to using the CLDR for all week and month names.
(cherry-pick of 99c406e42ba154584070ca7ec100e8be7ff8a800.)

Conflicts:

	core/res/res/values-fa/donottranslate-cldr.xml
	core/res/res/values/public.xml

Bug: 6811501
Change-Id: I2ad9608ae34804e02c6b0271197e96611df12b0a
2012-09-14 20:22:17 -07:00
Raph Levien
c1eff0857e am e5905684: am eceb3171: am f4afc401: Merge "framework: fix bug for uninitialized variable"
* commit 'e590568417aa824e7b0e76ae727556d329cb57cf':
  framework: fix bug for uninitialized variable
2012-09-14 12:19:03 -07:00
Raph Levien
eceb317116 am f4afc401: Merge "framework: fix bug for uninitialized variable"
* commit 'f4afc40101c00800c4dc53f165b93f741327416d':
  framework: fix bug for uninitialized variable
2012-09-14 12:15:03 -07:00
Raph Levien
eb1f5349f8 Merge "Fix for b7155617 race condition in TextLayoutCache.cpp" into jb-mr1-dev 2012-09-12 15:44:58 -07:00
Raph Levien
13ba4e478d Fix for b7155617 race condition in TextLayoutCache.cpp
There was the possibility for a race between clearing the caches and
using fonts. This patch simply protects both under the same mLock held
by the TextLayoutCache object.

Change-Id: Ib366e16a9a9ba702a46bc078d1bc0602713991e5
2012-09-12 15:15:51 -07:00
Eino-Ville Talvala
6fc7275d0e Merge "Camera: Add enableShutterSound method." into jb-mr1-dev 2012-09-11 11:06:13 -07:00
Eino-Ville Talvala
69fe527bea Camera: Add enableShutterSound method.
Some camera apps may wish to replace the system camera shutter sound
with their own, especially if they are taking rapid bursts of
images. Add method to allow this when possible.

Hidden for now.

Change-Id: I6520f5441d28675626fafab48c6609c589fc6f7e
2012-09-10 09:09:13 -07:00
Jamie Gennis
f09263e957 SurfaceTexture: add updateTexImage synchronization
This change makes the SurfaceTexture JNI updateTexImage call the native
SurfaceTexture's doGLFenceWait method to perform the needed synchronization.

Change-Id: Ie70a1fe6b44d439d1ffe7b97689a421ff8c02fda
2012-09-09 17:53:27 -07:00
Jeff Brown
7017e48380 Merge "Add support for Wifi display." into jb-mr1-dev 2012-09-07 16:00:13 -07:00
Raph Levien
965e7ff4de Merge "Fix Time.parse and Time.parse3339 crashing bugs. DO NOT MERGE" into jb-mr1-dev 2012-09-07 15:08:42 -07:00
Chet Haase
d15ebf25c5 Enable changing properties of layer paint
Previously, to draw a layered view with a changed Paint object for the
drawLayer operation, you'd have to invalidate the parent view, to get the
native DisplayList to pick up the new Paint properties. This change adds
API and functionality so that the developer can call setLayerPaint(), which
does the proper invalidation (lightweight, doesn't cause redrawing the view).

Issue #6923810 Make it easy to efficiently animate a layer's Paint

Change-Id: I7fea79788d50f6d9c86dd5e5b2a4490cb95142bb
2012-09-07 13:27:02 -07:00
Jeff Brown
cbad976b2a Add support for Wifi display.
Change-Id: I99693786cf9d07d07d3400046c55eb4933730b80
2012-09-07 13:26:31 -07:00
Elliott Hughes
5ef49427b6 Fix Time.parse and Time.parse3339 crashing bugs. DO NOT MERGE
Two reported by users, the other spotted by inspection.

Bug: http://code.google.com/p/android/issues/detail?id=16002
Bug: http://code.google.com/p/android/issues/detail?id=22225
Change-Id: I86fe022fda4af68e5a6fb9dc5dd2abdb75e9d966

This was committed to master, cherry-picking to jb-mr1-dev
2012-09-07 12:42:18 -07:00
Mathias Agopian
63f1c43fbe update to new SurfaceComposerClient API
Change-Id: I8f2c96df56fe3a851b8ec03bb8734db0b6bea3d5
2012-09-04 20:23:23 -07:00
Romain Guy
0baaac5e9a Revert "Revert "Add more support for transformed clip rects and paths""
This reverts commit a8557d2169e14997637f57bc897640c8882d4a46.

Change-Id: I36d4883d548fc47ba6c0b4a42012107d0d2f85a6
2012-08-31 20:31:32 -07:00
Mathias Agopian
a8557d2169 Revert "Add more support for transformed clip rects and paths"
this introduced a dead lock in GradientCache's ctor.

This reverts commit dfe082f63e94cde9aee271c94d13de5e7217e036.

Bug: 7096001
Change-Id: I57b8bbab11fb7cb502fa58e3bbf5d19864db874f
2012-08-31 20:04:18 -07:00
Romain Guy
703bd32647 Merge "Add more support for transformed clip rects and paths" into jb-mr1-dev 2012-08-31 17:18:04 -07:00
Romain Guy
dfe082f63e Add more support for transformed clip rects and paths
Change-Id: I41791b1e1bffef77d503dc9e52428395d2309688
2012-08-31 17:17:40 -07:00
Dianne Hackborn
4120375d46 Remove Binder.getOrigCallingUid().
Replaced all remaining places that used it with explicit user
specification.

While doing this, I ran into stuff that was creating PendingIntent
objects (that now need to specify the explicit user they are for),
which are also posting notifications...  but have no way to specify
the user for the notification.

So the notification manager in the system process now also gets a
formal concept of a user associated with the notification, which
is passed in to all the necessary aidl calls.  I also removed the
old deprecated aidl interface for posting/cancelling notifications,
since we now always need a user supplied.

There is more work that needs to be done here, though.  For example
I think we need to be able to specify USER_ALL for a notification that
should be shown to all users (such as low storage or low battery).
Along with that, the PendingIntent creation needs to be tweaked to
be able to handle USER_CURRENT by evaluating the user at the point the
pending intent is sent.

That's for another change, however.

Change-Id: I468e14dce8def0e13e0870571e7c31ed32b6310c
2012-08-31 15:11:13 -07:00
Zhou Chang
46e942d500 framework: fix bug for uninitialized variable
Some application display error due to uninitialized varibale.
This patch fix the bug

Change-Id: I660169e325ffae60d95c7774aaaeaebf693adf3d
Author: Chang Zhou <chang.zhou@intel.com>
Signed-off-by: Chang Zhou <chang.zhou@intel.com>
Signed-off-by: Chong Xing <chong.xing@intel.com>
Signed-off-by: Hongyu Zhang <hongyu.zhang@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 45356
2012-08-31 10:53:04 +08:00
Jean-Baptiste Queru
38f197863a am 14c0c989: am 4ba4caed: Merge "Fix SkBitmap::fPixels not being locked correctly"
* commit '14c0c989d21531056a5d0a0739c3ffdd1b04b295':
  Fix SkBitmap::fPixels not being locked correctly
2012-08-29 12:00:10 -07:00
Jean-Baptiste Queru
14c0c989d2 am 4ba4caed: Merge "Fix SkBitmap::fPixels not being locked correctly"
* commit '4ba4caede125ff602b0d93f577f9054a07791ff7':
  Fix SkBitmap::fPixels not being locked correctly
2012-08-29 11:55:20 -07:00
Michal Stawinski
35ef567140 Fix SkBitmap::fPixels not being locked correctly
In some cases bitmap's pixels where freed during encoding, which
caused a null pointer dereference.
This fix makes sure that underlaying buffer is locked for the whole
process of compression.

Change-Id: I0ac56821f5d333072271dc2670fa30f1562adfa3
2012-08-29 15:54:01 +02:00
Jeff Brown
64a55af0ac Add plumbing for new surface flinger display API.
Cleaned up the implementation of Surface and SurfaceSession
to use more consistent naming and structure.

Added JNI for all of the new surface flinger display API calls.

Enforced the requirement that all Surfaces created by
the window manager be named.

Updated the display manager service to use the new methods.

Change-Id: I2a658f1bfd0437e1c6f9d22df8d4ffcce7284ca2
2012-08-27 14:34:54 -07:00
Jeff Brown
0b722fe9ce Use new surface flinger API.
Change-Id: Ic888577408a59a36481a48010e19c5e77c24e211
2012-08-27 14:34:53 -07:00
Jeff Brown
572a0859dd Merge "Add FloatMath.pow." into jb-mr1-dev 2012-08-21 23:15:56 -07:00