Merge commit 'e80cbcc05168a6de6896f0e176f72c708e6cd900' into HEAD

* commit 'e80cbcc05168a6de6896f0e176f72c708e6cd900':
  merge two restore scale to one.
Merge commit 'c9d0a87d504b3f0322b43f971f9cb4838ee521fb' into HEAD

* commit 'c9d0a87d504b3f0322b43f971f9cb4838ee521fb':
  types update.
  Rough implemetation of ForEach. Remove launchID from root graphics script.
  Fountain update.  Update field names to match legacy expectations. Cleanup java code.
Moved the DOWNLOAD_CACHE to /sdcard/.cache
 (Or whatever is exported in init.rc)

Don't use DOWNLOAD_CACHE variable as this is specified sometimes in
boot images that we are unable to change, use EXTERNAL_STORAGE
instead, I understand this may cause a problem if there is none
specified, however most of the time this will not be a problem.
Reverted because it breaks LED notifications.
In particular, those which are received when the screen is on such as missed calls.

The logic doesn't make sense. Instead of using mLedNotification == null to disable the notification, it is using !mPendingPulseNotification, but if the screen is on at any point mPendingPulseNotification is set to false, which disables the notification before it has even happened.
Whatever they were trying to do by writing this code, it doesn't work!

Revert "Only pulse notification light if a new notification has been received since the screen was last turned off"

This reverts commit 2117f6fa3880e55e6a90fbd8b3a12d469c9b738b.
ProcessStats.java: Fix for bootloops.
mBuffer size was too small causing the CPU frequency array to be truncated causing exceptions and then the bootloop issue.
MAX_SPEEDS was too small, due to the additional overclocking steps.

http://code.google.com/p/oxygen-rom/issues/detail?id=507
NotificationManager/KeyguardUpdateMonitor: Charging behaviour
Only turn LED green when battery is actually fully charged, not at 90%
Also, don't display 'charged' on the lockscreen until the battery is fully charged
automatic backlight: Allow level decrease and increase
activitymanager: fix for onstartcommand
onstartcommand is not being called with a null intent, which causes services not to be restarted, in particular the EAS service.
http://groups.google.com/group/android-developers/msg/0968c394999f2967
Should resolve issue 741 providing it doesn't cause any regressions.
audiosystem: Alter audio routing policy
This will work around 2 issues.
1) the stream pause whilst media is playing.
2) the strange camera crashing behaviour when a headset is plugged in. Issue 709.
I don't think this will break anything or alter the behaviour of anything else.
NotificationManager: Don't play notification if in call
Fix for issue 779
Fix for what seems to be a typo responsible for some cases of issue 2207
(http://code.google.com/p/android/issues/detail?id=2207)

Change-Id: I61503990035718fef98e61f020fc7799e848424c
Merge fix for PduParser.java - Part 1

It looks like there was a merge issue in PduParser.java that duplicated
some code when the gingerbread code was merged.  The change in
gingerbread essentially put the entire PduPart.P_CONTENT_DISPOSITION in
an if statement, and set it to positive for all devices.

This fixes MMS problems on the Nexus One, and possibly other phones.

Change-Id: I47b0f17327f906055e1d358226b5db0ddfb2241f
Reduce Call Answer Delay

This patch sets a boolean acceptingIncomingCall to true on
acceptCall.  In setAudioMode, we set the mode as IN_CALL if the call is
ringing and acceptingIncomingCall is true.  This initializes the
microphone sooner, and should reduce the microphone delay.

Not sure if this is the best way to do this, but this reduces call
delay to under a second for me.  I thought I might as well upload it so
others could have a look at it.

Change-Id: Ied21acb81c8447fc9949cecf861c0be4ca67ebb0
aapt: Allow raw "%" in unformatted string-arrays

Commit 15fe2cb added format checking for translatable strings, enforcing
the use of positional args.  This check can be disabled on <string>
values with translatable="false" or formatted="false".  But they didn't
check for those attributes on <string-array>, so some of CM's strings
fail when they're not really format strings, just because they contain
percent signs.  (e.g. brightness widget's "Auto/Dim/40%/100%")

So now the formatted/translatable attributes are checked in string-array
too, and we can restore our proper percent signs.

Change-Id: I88df7b9ae38760be202d9d75e68f707abdbf3d95
PackageManager: Restrict system packages to protected storage

Don't allow packages signed with the platform key to be
installed into user (or app) controlled storage

Change-Id: I4dff8a33a9be7e1877812cf821bf6148e03e7bab
use new libreboot method of rebooting

relevant change here: http://review.cyanogenmod.com/6128

Change-Id: Ide576ee90c3488b31785799dc873edb200f1ad9e
surfaceflinger: allow targets to override the electronbeam duration

The Electron beam animation is constrained by the framerate the device
can achieve on GL. On adreno200, and even 205, the original 24 frames
resulted in a fairly smooth animation; on Tegra2, the animation is just
too fast.
From experimentation, I'd say the total number of frames should never be
less than half the attainable framerate (i.e., a half-second animation).

To use this, set TARGET_ELECTRONBEAM_FRAMES to half the desired value
(the default is 12 for a 24-frame animation)

Change-Id: I875b74ee3969ba0c8d38c234f7cb0f4402581ffb
Switch Databases to WAL mode. Set autocommit to 100.

Change-Id: I852f439e2565d1732a55548f1519cbd2c77ebd64

frameworks/base:
Add check for READ ONLY databases (WAL can be used with R/W DBs only).

CRs-Fixed: 278062

Change-Id: Iadcbd868c1ef47e75bbdf5343868e542353ac9f2

frameworks/base: Use WAL mode for selected databases. Others use default mode: DELETE.

Change-Id: I4cb3c87a751f83bf47a73c4652ce1d8bf64a60fd

frameworks/base: Disable fsync in selected databases.

As an add-on to the WAL optimization, disable fsync in databases where
corruption and data consistency aren't a problem.

Change-Id: I41a85fa55ea71dc8dd3c4011102c28d2c1db8d3d
framework: Add reboot menu and reboot options

This is a collection of changes from several people, forward
ported to gingerbread.

Steve Kondik <shade@chemlab.org>
Adds a reboot option to the power menu.

Eddie Ringle <eddie@eringle.net>
Froyo's ShutdownThread wants a reboot reason (we use null to just reboot)

Eddie Ringle <eddie@eringle.net>
Add Reboot string for phone options dialog

Diogo Ferreira <diogo@underdev.org>
Add recovery and bootloader popup options to reboot dialog.

Steve Kondik <shade@chemlab.org>
Add strings for reboot option on power menu.

Eddie Ringle <eddie.ringle@gmail.com>
Use the reboot strings during a reboot

framework: Prevent the reboot option from popping up when it's not supposed to.

If you press reboot then cancel and press shutdown, the reboot menu appears.
This logic fixes that.

Change-Id: I596781714c8ed5191cb2486bca6b204a1a82287f

frameworks: fix copy/paste error on the reboot dialog

The dialog currently has two buttons saying 'ok' due to a c/p error.

Change-Id: I95a247d6c728a347905740170cbe7141e70d53ae

Fix bug in Power Off menu.

We need to catch hardware "Back key" too.

Change-Id: If69051addf4314d5e271c754405e1a24af157d78

Added a separate reboot recovery icon for the Global Actions dialog

Change-Id: I7041eaf9340578c3a9cd86a42d9b4a3aa5f10ce3

Make the reboot icon less blurry

Change-Id: Ibf820c6cad2997d3219736afbd752978d4ed2bda

Clean up power/reboot icons

Change-Id: Id3e00bee6feeb3ec2c77ccb78c0552cec985c27d

Fix color profile error from previous commit

Change-Id: If28f99567325d6a007f00e73649ede12e6a6b434
Generate screenshot intent from global actions menu

Add a new option to the global actions for screenshots, which
simply generates the android.intent.action.SCREENSHOT broadcast
intent.

There needs to be an app (like CMScreenshot) listening for that
intent for something to happen.

Change-Id: Ieeb9f91bae12a2804c6f417932175d03e62a31d7