Fix sluggish to launch an app

The new trace feature/code in 4.0.4, which will dump the app stack
trace every 500ms if an app can't be launched within 500ms, is
holding the global ActivityManagerService lock unnecessarily. It
slows down the app's startup.

Change-Id: I91fbb043912b4d1fcf3e80d8ac4e61cd20ad89d1
Solution: move the trace file write operations out of sync block.
Java crash when switching Google Map and Home quickly on 4.0.3

Build 4.0.3 or upper version (with GMS) and flash the image to phone.
Put Google Map icon on the desktop
Swiching Google Map and Home very quickly.

Change-Id: Ic901e0f09df985d2d5d5f27c2092c454ec4f4fcb
http://code.google.com/p/android/issues/detail?id=27562
Fixed a crash when switching languages

When the user switches a languages on a CDMA phone the GsmServiceStateTracker
crashes. The fix is to unregister the intent receiver listening for the
locale changed intent in dispose.

Change-Id: Id9e21c4f89d2efb41ebe10afc337724d4cd78507
Fix NPE during startup when battery is low

During startup the mConfiguration in the ActivityThread for the
system_server process is null until the CONFIGURATION_CHANGED
message is received. This message is sent by the
WindowManagerService.PolicyThread (and later another one is sent
by the SystemServer.ServerThread). If the PolicyThread happens to be
scheduled a bit later for some reason the LAUNCH_ACTIVITY message
for the ShutdownActivity will be received first, causing a NPE in
performLaunchActivity when executing new Configuration(mConfiguration);

Change-Id: I004b02038ba0e55ded399b3b2fe5b74ad0a76c78
Omitting Big Endian caused corrupt characters

When sending a terminal reponse to SIM containing unicode
characters, big endian must be explicitly stated to
avoid corrupt characters.

Change-Id: I69a10a380247be7b511d6b9d37b7f222da4e6992
Increase javax.obex performance

When a file is transferred over OBEX the javax.obex classes allocate
the same amount of memory multiple times simply to copy the same data
around internally, only to throw those allocations away when the next
data block is processed. In the Bluetooth OPP case that meant that
64Kb was allocated around 15 times for every 64Kb transferred. Since
the transfer speed is around 1.3Mbps that means almost 2.5Mb of
memory is garbage collected every second, increasing the time needed
for each block transfer.
Fixed by keeping data in reusable byte buffer objects instead.
The time to transfer a 39MB file is reduced by about 10-20%.

Change-Id: I182c0374c2915d1b37ca12200fb36de57dabc67e

Conflicts:

	obex/javax/obex/ServerOperation.java
Fix cursor memory leak

In current code, if an application opens a cursor to access a
provider, and doesn't close that cursor, later, when this cursor
is garbage collected, it won't get closed. This will cause a memory
leak in the provider. The leaked memory can only be reclaimed when
the application with the leaked cursor was dead.

The solution is, close the cursor when it's garbage collected.

Change-Id: I786915c46d4672b6b1b37414b3bc1ff8cea2e00b
Fix for dial request when there is already an active call.

When there is one active call and the user tries to place second
call,the active call should be put on hold first and after receiving
hold response, the dial request should be placed for second call.

Change-Id: I68d3e25494f67ef561e12a96982a91b11eb3caf3
Display Unicode name for China Operators.

The operator name is displayed in the phone using latin
characters by default (the SPN field). The SIM can be
configured to display a unicode name instead using the
PLMN field. However, many Chinese operators requires
this to be a customizable setting as well.

A property, ro.operator.use-plmn, can be set to override
default behaviour and display operator name as unicode
is introduced.

Change-Id: I0b2183cc40fd76bee88ffbe98b99a1d6fa9e2f5b
Musicplayer application can not display DRM files of internal storage.

Make DRM-protected files transferred over MTP be detected.
Previously it was inserted into the database as MEDIA_TYPE_NONE,
the result of this was that the file was not detected properly.
With this fix the file is scanned from the beginning.

Change-Id: Idf17d39e3d529394cd4a03d71fb250e69b395533
Avoid crash if sw codec is shut down while stopping

If stop() is called on a sw codec when executing the component
is requested to change state to Idle. This is done asyncronous.
When the destructor is called on the codec it is also requesting
the component to change state to Idle. If these two calls
happens soon after each other the transition may be invoked twice.
This commit will check if component is already in Idle state and
just return if it is instead of aborting.

Change-Id: I65e78d08bf67b8ff89b75207ec7c8eea7d53f3c9
Changing to avoid character corruption in endFile().

To avoid the occurrence of character corruption in endFile(),
I modified that convertValue() will be skipped when shift JIS characters.
Properly handle quick switch between Home button and Gallery app

This change fixes the following bug:

1. Playing a movie (especially Full HD) by Gallery.
2. Press the Home button.
3. Press the Gallery shortcut on Launcher.
4. Very quickly repeat #2 and #3 several times.

Result: "Sorry, this video cannot be played" alert is shown.

Change-Id: Idf9d222ca1e0bb90bfe06f6dc807dfbc71b6415b
Signed-off-by: Yuriy Zabroda <yuriy.zabroda@ti.com>
Display not updated when starting new activities in the same task

The problem occurs when the activity process has not yet been
started and we keep starting new activities in an existing
task. Make sure to not ask for showStartingIcon to be shown
when many activities are started fast in the same task.

Change-Id: I14a4c1394cab23cf9a7687d486cfc3089efbd5e7
Telephony: Fix SmsManager to throw IllegalArgumentException

IllegalArgumentException condition for:
enableCellBroadcastRange() and disableCellBroadcastRange() is
if endMessageId < startMessageId.

IllegalArgumentException condition for divideMessage() is if input text
is null, for copyMessageToIcc() it is if pdu is null.

Change-Id: Ib75ab4bef137bc9265cd219ed3de5d5e8d387266
Telephony: Fixed problem with short operator name

This patch solves the problem with erroneous service
provider name that is visible in status row. The name
of the service provider is one character short. This
happen when loading the service provider name from
EF_SPN_CPHS or EF_SPN_SHORT_CPHS.

Change-Id: Iccd15de347ef39a0d7def7aa01de7c82518a6a66
Setting time zone might cause processes to have different time zones

If you set the default time zone during heavy load of the system,
java processes listening to ACTION_TIMEZONE_CHANGED might not
get the new time zone value.

1. The time zone is stored in a static variable. That value is based
on a system property. Setting a new time zone triggers all
processess to reset the static variable by fetching from the system
property, but sometimes the system property has not been populated
yet, causing processes to reset the static variable with the old
value.

Solution: add param with the new time zone when updating
all processes.

2. Updating the process default time zone is posted to a Binder
Thread while the broadcast of ACTION_TIMEZONE_CHANGED is posted
to main. If the Binder Thread is busy, the broadcast might
get handled on the main thread before the time zone is updated.

Solution: Make sure that the time zone is updated before calling
onReceive

Change-Id: I0cb99e986b326aa5052a37b1b3e4a53102473008
Adds missing Bluetooth as network type.

The network connection type for Bluetooth is added so
that it is possible to use Bluetooth as Hotspot during
download from the Internet.

Change-Id: If8e8a3f69821beef742bc91d7a292a091861b48b

Conflicts:

	core/java/android/app/DownloadManager.java
Minimize APPWIDGET_UPDATE in ordered broadcast queue

Widget providers would receive all APPWIDGET_UPDATE intent
which is not set with a target component name by the sender.
This is a waste of the system resource, and resulting the
poor performance.

Solution:
Before broadcast the intent APPWIDGET_UPDATE, minimize the
receivers in the list by removing those ones the widget ID was
not part of the target widget specified in the intent extra fields.

Change-Id: I3c772062e039aabeb257ccc063f6b0d88ca51bb5
Ringtone is not routed to headset when silent mode is activated

People were missing phone calls when their phones were in silent
mode and they were listening to music on their headsets.

This is also important for 'manner mode'

Change-Id: Id9011b0456057e2eecd0723549652721df48133d