Stop using system properties to publish information about
the key character map path. Instead, we can retrieve it
on demand by asking the window manager.
It was possible to exhaust the supply of system properties
when repeatedly adding and removing input devices.
Bug: 5532806
Change-Id: Idd361a24ad7db2edc185c8546db7fb05f9c28669
This change fixes race conditions that occur very regularly when
content providers are accessed from multiple threads at the same
time.
When a content provider is not already in the application's cache,
the application needs to ask the ActivityManager to obtain it.
Meanwhile, another thread can come along and do the same thing.
This can cause problems because the application attempts to
install two copies of the provider and the reference counts
and other bookkeeping can get muddled.
Similarly, there are races between releasing the last reference
to a content provider and acquiring the content provider. It's
possible for one thread to snatch the content provider from the
jaws of death. We need to handle this explicitly to ensure that
the content provider does not accidentally get released right
after it was acquired by the other thread.
This change ensures that the reference count bookkeeping and
provider map are maintained in parallel while holding the same lock.
Previously because the lock was dropped and reacquired in the
middle of acquisition and removal, it was possible for a
content provider with a zero reference count to be returned
to the application. Likewise, it was possible for a content
provider with a non-zero reference count to be disposed!
This change also performs compensatory actions when races are
detected to ensure that the necessary invariants are maintained
throughout. In particular, it ensures that the application
drops a duplicate reference to a content provider when no
longer needed.
Another way to solve this problem would be to explicitly prevent
the races from happening in the first place by maintaining a
table of content providers that are in the process of being
acquired. The first thread to attempt to acquire the provider
would store a record. The next thread would find the record
and block until the first thread was finished. I chose not
to implement the code in that manner because we would still
have needed to perform compensatory actions in the case where
the same provider binder has multiple logical names. Also,
it could cause deadlocks if the attempt to acquire
a content provider were re-entrant for some bizarre reason.
Bug: 5547357
Change-Id: I2ad39a8acc30aaf7ae5354decd0a0a41e9b9c3da
...the "Complete action using" dialog
I have never been able to reproduce this consistently, but here is
another stab in the twilight. It looks like during boot we have
a potential race where we could reset the config sequence number after
we had gone through a config change, causing ActivityThread to ignore
a following config change. Maybe this change will help.
Change-Id: I4b731df5fd5c63894ca2e9bd34693b31ab1c0565
This updated tablet layouts to support showing album art and transport
control views in PIN, pattern and password screens of lock screen.
It also allows the addition of a background protect asset and
the ability to show the system wallpaper on layouts that define a
transport_bg_protect view.
Also updated layout to use new ICS-style buttons on lock screen and
fixed bug with "forgot pattern" button where we were showing the
emergency call icon.
To avoid problems with leading ones in the mono-space clock font,
we now right-justify status text on tablet and remove the AM/PM
indicator.
Status font size adjusted by UX.
Added background protection drop shadow to transport control.
Fixed portrait mode to be right-justified when transport is showing.
Change-Id: I790292fc39f4588f87adc9d9241706817ae6baab
* commit '6200a4b7eb07507055af93ec1a054640a39b9751':
DO NOT MERGE Cherry pick from ics-mr1 - Bug 5275928 - Don't try to open an overflow menu under invalid circumstances.
When audio effects are enabled, a noise can be heard at the
beginning of the new song when skipping to next song in music app.
This is because some effects (especially virtualizer) have a tail.
This tail was not played when previous song was stopped because effects were
not processed when no tracks were present on a given session. This is to
reduce CPU load when effects are enabled but no audio is playing.
The tail was then rendered when the new song was started.
Added a delay before stopping effect process after all tracks have been removed from a session.
Issue 5584880.
Change-Id: I815e0f7441f9302e8dfe413dc269a94e4cc6fd95
The AudioFocus death handler was correctly updating the audio
focus stack when an audio focus client dies, but the death handler
was leaking GREF if unlinkToDeath() is not called.
The fix consists in making sure unlinkToDeath() is always called
by calling it in its finalizer.
Change-Id: I0c5343b4986ab582cadbf171fc53816952dc16f5
Traceview showed approximately 10% of total parse time inside the
synthetic 'trampoline' methods generated to provide inner classes
with access to their outer class's private fields. The bottleneck
in this particular case is in XmlBlock and its inner class Parser.
Making the bottlneck outer-class members and methods package-scope
instead of private removes that 10% overhead being spent within
these access trampolines.
Traceview tends to overemphasize the significance of very small
methods such as these trampolines. That said, the measured speed
gain on the ParseLargeXmlResFg op due to this patch is between
5% and 6%.
Change-Id: Ia0e3ae5408d1f9992b46e6e30dd2407090379b07
We were not passing the length of the UTF-16 string to
String16::setTo. As a result, it was copying the contents of
the text up to the first null it found.
First problem, these strings are not typically null terminated!
Second problem, if the string contained a null character, then
we might truncate it. However, we only truncated the string
when the copy constructor was invoked (say, when we called
get() on the cache) but not in internalTextCopy() (before
adding the key to the cache).
As a result of the second problem, we would first search
the cache for a key that matched a partially copied truncated
string (potentially reading uninitialized memory that followed it).
Finding none, we would add the entry to the cache using
the correct key.
If the cache already had a value associated with the correct key,
then the put would fail, returning false. Charging ever onwards,
we would add the size of the entry to the cache size.
Proceeding in this manner, it was possible for the cache to
believe it had less remaining space than it really did. At that
point, it was possible for the cache to evict all entries and
yet still not think it had room to add a new one, so it would
continue trying to make space indefinitely.
Bug: 5576812
Change-Id: I05251594f6b2da0a5dc09f7200f04fe9100ec766
This came up from bug #5601885: Memory increase (leak?) in system_server
Stingray MR1
This isn't *really* a leak in the system process -- it is a leak in an
application process that is causing the system process to keep around
a bunch of ActivityRecord objects longer than it should, until that app
process is ultimately killed.
Unfortunately these days leaking an ActivityRecord also often means
leaking a thumbnail, which is a big slab of memory.
So make the activity manager better about this, using a weak reference
from the handle the object has so we can still clean away most of the
state associated with the ActivityRecord even if the client side leaks
its own reference.
Change-Id: Idbab45e09749cdfb54899203da7981e7b3576e25
This change adds the ANDROID suffix to the all the types and functions
defined by the EGL_ANDROID_blob_cache extension.
Change-Id: I087875b96d9a7053efb9c8d5614f9f765eed799d
* Don't call context.getResources() redundantly when unnecessary;
similarly for Resources.getCompatibilityInfo()
* During bitmap creation, don't bother clearing to 0: it's unnecessary
because now that the raw bits are stored in a VM-side byte array, it
was cleared at initialization time. Also, don't use the sanity-
checking public entry point to erase to a color, because we know
that we're by definition in a "legal" path to erase to the initial
contents and don't need to incur the overhead of the (inappropriate)
sanity checking.
Change-Id: Idaca4d64fdecefd5d51337646ead32e1db510e02
...LoadedApk.ServiceDispatcher.connected , LoadedApk.forgetServiceDispatcher
Don't be stupid if we receive a new binding to a ServiceConnection after it
has already been unbound.
Change-Id: I85a49de97372bf9af55542a89031f0b7a2ac8fbb
Send CONNECT_OTHER_PROFILE to Device profile for low priority hfp and a2dp
incoming connect. In the case when HFP autoconnect is off but a2dp autoconnect
is on, if HF autoconnect to HFP, phone will reject HFP but connect a2dp.
Before this fix, phone reject HFP. A2dp will not get connected unless the HF do
media auto-connect, which most carkits do not do.
Also do similar change for incoming a2dp connection
bug 5091838
Change-Id: Ife1815f527bcd94e0d9ffc645028484fa9c49a43