Squashed commit of the theme engine support.

Updated 4.2 support for the old T-Mobile theme engine, as usual
needs the provider and switcher apps installed as well.

I'm finally dropping the 400+ commit history on this, since everybody
else keeps picking it up from CM as a single patch anyway... But
for the record, nothing of this would be possible without Josh, Ed,
and the rest of the TMo guys who wrote and maintained it until 2.2:

amit chabra <amit.chabra@t-mobile.com>
Amit Kohli <amit.kohli@t-mobile.com>
Chris Cogar <chriscogar@t-mobile.com>
Dirk Sigurdson <dirk.sigurdson@t-mobile.com>
Ed Carrigan <edward.carrigan@t-mobile.com>
Gaurav Sharma <gaurav.sharma3@t-mobile.com>
Hui Feng <hui.feng@t-mobile.com>
John Ritz <john.ritz1@t-mobile.com>
Josh Guilfoyle <josh.guilfoyle@t-mobile.com>
Mark Roberts <mark.roberts48@t-mobile.com>
Pankaj Kumar <Pankaj.kumar6@t-mobile.com>
Samuel Cheung <samuel.cheung@t-mobile.com>
Sergey Ten <sergey.ten6@t-mobile.com>

Change-Id: I7148d51be48f28a2dc4bdf9ec9018f04b268ffc4

Conflicts:

	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	policy/src/com/android/internal/policy/impl/GlobalActions.java
	services/java/com/android/server/NotificationManagerService.java
	services/java/com/android/server/SystemServer.java
	services/java/com/android/server/am/ActivityManagerService.java
	services/java/com/android/server/wm/WindowManagerService.java
SystemUI: Reinflate on theme change

Summary:
Reflect the updated assets immediately once the config_changed
notification happens

Change-Id: I480a719fbdd45875277871af39ce65849918ec0a

Test Plan: build, test, merge

Reviewers: synergy, anders3408, jriordan001, raymanfx, donald.munn

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D168
Bring in internal framework for all the CFX Feature winning!
Bring in CAF/CM Bluetooth resources. Much love and respect to all!

Summary: Resources needed for Qcom device BT support

Test Plan: Get it to compile with other needed revisions, get it to work, merge

Reviewers: synergy, anders3408, jriordan001, raymanfx, donald.munn

Differential Revision: http://review.codefirex.com/D191
gps: Add support for Qualcomm GPS hardware

 * This ABI is changed, but we aren't using the new features in MR1.
 * Add a little translation for the changed fields and methods.

Change-Id: Ieecc2235b42f64fc69d4651855f4e9edfe7d738d
Add support for Samsung extended AGPS

The AGPS implementation in the GPS chipset used in some Samsung devices
(i9100, i9300) can make use of the Psc field. Adapt the relevant
functions hiding the changes incompatible with other devices under the
AGPS_USE_PSC #define.

Credit to Qaweck from xda-developers forum for finding the meaning
of the field.

Change-Id: Ie4691c79ca379a1f5c0a87500c1b06b56ae7ac0d
fix for screenshot animation glitch in portrait

Summary:
edits by Stefano Semeraro aka Suxsem.

Change-Id: I7a03a24c5b1bfdfe616f940b2bd7be42091f45a6

framework: fix screenshot and rotation animation for devices with abnormal hw rotation

port foreward from cm10.1:
https://github.com/CyanogenMod/android_frameworks_base/commit/ac555b9ca9a76d13a26fc9ea40980fe57258761b#diff-d6f7bba268a742c91252cc9e64e2381a

Change-Id: I14b6e2403b9be345a1a591138f8a3a12ca8e4f89

Test Plan: build, test, merge

Reviewers: synergy, jriordan001, donald.munn, raymanfx, randall.rushing, anders3408

Reviewed By: anders3408

Differential Revision: http://review.codefirex.com/D187
Reboot menu credit @CyanogenMod

Summary: Depends on D202

Test Plan: wait for Settings commit then test and merge

Reviewers: synergy, anders3408, jriordan001, raymanfx, donald.munn

Differential Revision: http://review.codefirex.com/D218

Conflicts:

	core/res/res/values/strings.xml
	core/res/res/values/symbols.xml
	policy/src/com/android/internal/policy/impl/GlobalActions.java
qcom cam/audio

Summary:
Add support for ICS camera blobs

Change-Id: Icf9010f4b6059405275107fadd5aac81cd294182

wifi: Set the mode at native layer

 * Set normal/AP mode so that the HAL can specify correct module
   arguments when loading the driver.

Change-Id: I6eee2cc53b5f1e70306e252e52c909833f220515

Allow purging of asset bitmaps

It seems that neither CM9 nor CM10.x includes the actual framework-side
code to facilitate user-controllable bitmap purging. Odd, since the
CyanogenMod Settings app in both CM9/CM10.x includes the option.

Backported from original Gingerbread commit:
http://review.cyanogenmod.org/#/c/3908

Original description:

Allow the system to reclaim more free RAM when needed on 'low' memory devices
(e.g. Droid/Milestone) that are struggling with 2.3. This option enabled
efectively restores the froyo way of forcePurgeable BitmapFactory asset
handling.

Change-Id: I6a3b8a05b7be9c214a8548d6c6d1621e6533a1e0

camera: Add support for sending raw commands

 * Certain camera drivers need magic commands to select special modes
   such as ZSL or HDR. Add support for sending raw commands from
   applications.

Change-Id: I512a765c7a67ffd2877e465cf6493ffc2b3b54ac

FileUtils: add method to get UUID of a volume

Change-Id: I41b76c5e01c82a2f8e67b33133a76947877a2814

android_os_FileUtils_getVolumeUUID: Fix the incorrect logical for call blkid_get_tag_value.     There are two problems in here.   1. For the function blkid_get_tag_value third parameter is should be the device, not the mount pointer, in the...

...MediaPrivader.attachVolume, it will pass the mount path to call this function.   2. The UUID for device is hex, so call atoi is not right. I think call strtol is better than atoi.

Change-Id: I76598a0993f08add3e9c7541cbc082d8d85e9af4

Camera: Add support for QC camera features.

Added APIs and keys for all QC features. This
will enable application to get/set paramters.

Change-Id: I58a53c7b9133a3acddc34b268dac086c9562d533

frameworks/base: Fix to remove exception in tonegenerator

- Framework reboot happens, if tonegenerator fails to create
  a track in audioflinger.
- The cause for framework reboot is, an exception thrown by
  tonegenerator if fails to init.
- Fix is to remove the exception and delete the tonegenerator
  instance.
CRs-fixed:466491

Change-Id: Ie7b87f787d8a885cc70be9af4ba9d04ecd691cc2

frameworks/base: Add changes for Incall Music Delivery

- Add Flag and Stream type required for incall music delivery.
- Add Tone types for ToneGenerator

Change-Id: Ic05cd1af1172dda3c527af826c6e9a48d6ae20d5

Camera: Adds support for meta data callbacks

- This change adds a new type of callback
  that will be called when there are pending
  meta data notifications.

Change-Id: I84f5cbafe4f023c7b0efa9ec8620756b0eaa428d

Camera: Add support for QC camera features.

Added APIs and keys for all QC features. This
will enable application to get/set paramters.
(cherrypicked from commit d0c5a0ee7e9af41320fed00ff324c6d0f22eb697)
Change-Id: I68c23aaf7267645efeb4d4743b390a048292b7fd
(cherry picked from commit ad2fd19b7ed6a610cab4bd3ae261178bcafa66af)
(cherry picked from commit cfcebdf9c402bb5f1976f07ba5dc1e15f5811fc2)
(cherry picked from commit 4ef4a5e937b2ec7355c5893c80dbc103d163364d)

audio: add support for MSM audio formats

- Add support for EVRC, QCELP, and WMA formats
- Add definition for 5.1 channel recording
- Reference change If3676b88fa287b484ef8616c0a6b67177b61a720

Change-Id: I6b6e5ca98921adeadd2a3d76580fe85fb28eeaf0
(cherry picked from commit 10c4f204bb5ac78b9cf3854b536663ccd3d50333)
(cherry picked from commit 3f99cc5f134b0f00a52218ae1c0273cc11ae7702)
(cherry picked from commit 1d35b52c7c9cf1cfd3a3de372391a7a57f593af9)

audio: audio enhancements for playback and recording.

- Add playback and record support for EVRC, QCELP,
  WMA, AMRWBPLUS, WAV, ACE, and EC3.
- Add support for 5.1 channel recording.
- Add support for in call music.
- Add constants for call_state and vsid.
- Add definition for FM and proxy audio devices.
- Remove unnecessary format checks in frameworks.

Change-Id: If3676b88fa287b484ef8616c0a6b67177b61a720
(cherry picked from commit 6ca6cc15af88992ea485a458e67a8546b156672e)
(cherry picked from commit f65028d1752969bf43c853c1bb12ecd12055d5e8)
(cherry picked from commit b1952442db41188b74f331bd2397a579424821ab)

audio: Support for MSM audio formats

  -Add audio format support for Voip.

Change-Id: Ie045ba926b3e1266afd3fb6fba09af3a55daaeef
(cherry picked from commit d1810964ecd2d50064a1fed51049ddc354b9a788)
(cherry picked from commit cd9c6dc56bedcabca77c2a01c6fb15f4d2e8edd5)
(cherry picked from commit 01c09aeae38716860ef1a806985cc946dca93f60)

audio: Add ifdefs for QCOM_HARDWARE audio features

Change-Id: I0ea423f9a28934dc1fee73bbb53c0d9d867877ff

ActivityTrigger:  New class to invoke when activity starts/resumes

Change-Id: I46fa419e7b97953ba5581ee03127f0e3f93e48f0
(cherry picked from commit 71a57d30370584488a246a904750e7bdad5ba9a0)
(cherry picked from commit 5d2abff8e4d399e6bd320ea11bf672ad3b3be980)
(cherry picked from commit ffd89bcf976985acf0392c0dd667f8b5241d77ac)

frameworks/base: update perflock path name in Activity Trigger

Update the perflock path name and add
backup path for backward compatibility

Change-Id: I3d2c6f6fe1b3c63ec02827d06d5af667266db8d5
(cherry picked from commit 4db57e5021c4091352f40f6e4399b0b929f63151)
(cherry picked from commit b9fc7b99697a1b2f891dc642ff27c8a4194ca79d)
(cherry picked from commit 5910b639f0dea078049e31718e00bede2eb2ec00)

frameworks/base: update library path name in Activity Trigger

Change path from /system/lib to /vendor/lib
since it is no longer needed.

Change-Id: I5fa7a367b21d4128c92ab7190944c176a1f4dae6
(cherry picked from commit 7abea046455c1c8fc99126ae6cf9a6d4823ca50f)
(cherry picked from commit 5aadc3f081bef5b26b13e0bb4955354e3be0bcd7)
(cherry picked from commit 133db12892589a21865a900c3709073ed86eaf8a)

Register the ActivityTrigger on all QCOM devices

Change-Id: Iaecb5dd82be64fea5a625cc42243203d0f2f2ce9

frameworks/base: vectorize Bitmap operations

Enable gcc vectorizing optimizations for Bitmap operations within
libandroid_runtime.so.  Adds -ftree-vectorize -mvectorize-with-neon-quad
-fprefetch-loop-arrays to functions and compiles Bitmap.cpp in ARM mode
(necessary to enable vectorizing optimizations) for appropriate targets.

Change-Id: If52a789b6f592b137e64e85077665c9ce5957f79

Add support for QC's time_daemon

Enabled by BOARD_USES_QC_TIME_SERVICES=true, it requires the device
to provide its own time_daemon executable and libtime_genoff.so
proprietaries. The library should be copied by the device's setup
config to $OUT/obj/lib for linkage (and pushed to the final build,
obviously)

Change-Id: Ie6964dbe2692dc33fc04093a5b89b6922d8443c8

Put FileUtils back into android_runtime

We still use it for non-fat volume management

Change-Id: I42efeb83b8f12e7734e4bf03326526cc220d022a

libaudioeffect_jni: GREF leak fix for JB

- Excessive JNI global reference in AudioEffects.
- Global references created during native setup
  are not deleted.
- Global references are deleted in setup failure
  and during native release.

(cherry picked from commit a04a2bf4563dc20c52f4d4239e01f80b220077a5)
CRs-fixed: 413633

Change-Id: Ia4340a2128850101b394e00c8e1db9db49f516fd

video: Add support for extended media listener

Added changes to handle additional message types for
dash playback.

Change-Id: Id07828866de8cae44137f26c1e74417aaa45704f

ifeq QCOM: video: Add support for extended media listener

Bulid fails with error: 'MEDIA_QOE' was not declared in
this scope on other targets
Change-Id: Ic83be8f1acc4188b81fb903911023b39c614775b

hwui: Don't discard framebuffer on exynos4

The layers gets empty/not cleaned and redrawn on top of the preview,
causing beautiful glitch on homescreen, and drawing black instead
of transparency.

Change-Id: I633b104224c73c625f1193ee3dde41823cddc5bf

Remove opaque check in preparing dirty region

Since preserve swap is enabled, we need to clear the color buffer
when the scissor rect is prepared for a new process. This prevents
garbage being present from the previous process in the color buffer.

CRs-Fixed: 549755

Change-Id: Icd12ae388077b8c9ed329c37314e896500078543
(cherry picked from commit 48b6a9767317e08a24e189c9cbee21043543682a)
(cherry picked from commit 777610a5ddf19cebcad30b7e9a481e9dfe38b74c)

Update the layer's alpha value upon composition of the layer

Fixes: This patch makes sure that the layer's alpha value is
up-to-date and does not reflect the previous view's alpha value.
It fixes the square block on marquee fading edge when text view
is applied transparency.

CRs-Fixed: 562000

Change-Id: I397308b739f5f4fe4b630cf594825f401c97e0e3

Fix stencil buffer bug.

Stencil test is enabled by setStencilFromClip(), but not disabled
in some use case, which causes some of the pixels are discarded by
mistake in draws followed. Disable stencil test when there is no
dirty clip.

CRs-Fixed: 539456

Change-Id: I318fb47212e49e2da89bcbfd161a1689ef91b02f

hwui: Apply hwui qcom fixes to all adreno-bearing hardware

Even if the device doesn't fully use the qcom stack, changes to
libhwui are generally workarounds for adreno-specific issues and
apply across the board without other dependencies

Change-Id: I10455ebf09c1d00762b06e3c092398604bb39796

frameworks/base: media: add support for DIVX files

Change-Id: I6e922c5d6e17ee590606268af97b7894f35d19ae
(cherry picked from commit 47fea00316203aebba194644f95ca58ef4ff4400)
(cherry picked from commit 1f3ab64cf5bb19ec2e8a996750f44389d4d07187)
(cherry picked from commit 066dff510ec44ee06c3a375e32133e21fbedf9fb)

fix merge fail

Test Plan: use in conjunction with a new manifest branch, kk-devel-tele

Reviewers: synergy, anders3408, randall.rushing, raymanfx, donald.munn

CC:

Differential Revision: http://review.codefirex.com/D209

Conflicts:

	core/res/res/values/symbols.xml
	libs/hwui/OpenGLRenderer.cpp
FW/Base patch for CM cam integration.

Summary:
Camera: Video HDR Feature Integration.

Added framework support for camera applications to query supported
video HDR modes and set the required mode.

Change-Id: Ie318e586838a2f035e59e30fa51af35b52f7c886

Camera: add ISO mode support

Change-Id: Ied2075f950269990d836fc768b2c6c36088d494f

camera: add power mode support

Based on commit 7036d66bec7697160ba1b2e255f1e7fae0c8c435 from CAF,
branch ics_chocolate.

Change-Id: I8a60668b18980fd5e6f9dd341db5a8a63deb99d0

Fix Photosphere/Camera FCs

Photosphere is setting a few parameters "blindly"
while the API says it should check the device capabilities first.

On TF101 (and probably other devices) the camera HAL doesn't handle
FLASH_MODE & SCENE_MODE and so it sends the required RuntimeException
for these, which makes Photosphere FC the Camera app.

=> Fix: check device capabilities & ignore these 2 parameters if the device doesn't support them.

Fix based on following Team EOS patch: https://review.teameos.org/#/c/1598/

Change-Id: Idd80299802e9213a3c40414ace3d516d39f47783

Media: Add quality levels for two 4k resolutions for camcorder

Add quality levels for two 4k resoltuions for camcorder
(cherrypicked from commit 96cade18e068306a3d04ec943b4c61e2817ea54b )

Change-Id: I1c9e9d0bafd566071e98d335ca6f2de6eb96a71d
(cherry picked from commit d3ff34920391435de1cda07f1674ac4047b4967e)
(cherry picked from commit 152f78ae3f314a6efb02a4602bce4fba65569c48)

Test Plan: test with cm_cam branches in packages/apps/Camera2 && Gallery2 for inclusion of camera from CM. Likely requires D209 as well.

Reviewers: randall.rushing, synergy, anders3408, raymanfx

Differential Revision: http://review.codefirex.com/D216
TEMPORARY: Reintroduce button-backlight (and respective inactivity timeout)

The power manager rewrite from Change I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
completely removed support for control of the button backlights, which makes
all capacitive buttons out there stay dark. The commit message in that change
mentions it hasn't been implemented _yet_, so this fix should be temporary
until upstream does their own implementation

Change-Id: I6094c446e0b8c23f57d30652a3cbd35dee5e821a
PowerManagerService: Implement setButtonBrightnessOverrideFromWindowManager method

Differs from Android 4.1 (and earlier) implementation in that the
overridden button light still turns off after BUTTON_ON_DURATION instead of
staying on until screen off.  However, button lights are annoying, and
really the purpose of this is to allow apps (e.g., Screen Filter) to
_disable_ the button lights altogether.
power: Add CPU boosting interface

 * Boosts CPU using Power HAL for the given duration.
 * Duration is given in microseconds.
 * Power HAL must implement POWER_HINT_CPU_BOOST.

Change-Id: Ic79baf7e3d0f75483c2fe8a242b4c3d93368b68b

Conflicts:
	services/jni/com_android_server_power_PowerManagerService.cpp
Keyboard light: Fix the physical keyboard not light when it's visiable.

Change-Id: I595afd3cb6b422a17ae0f6ec20aa51979db13810
keyboard: adding functional alt/shift lights

This is useful for devices that has QWERTY keyboard
and leds for the Alt/Shift (Fn/Caps) keys, like
htc doubleshot.

Depends on libhardware patch for the light ids:
http://review.cyanogenmod.org/34902

Change-Id: I66ebc2d881438f5b51db77eaa885421e65a7da0d
Keep keyboard lit until the screen is dimmed

Do not use button timeout for keyboard (which is intrusive on QWERTY
sliders). Keep it lit until the screen dims instead of turning it off
like the buttons after 5 seconds. Also consider setting keyboard
visibility as a user activity.
Add PowerManager integration for button and keyboard backlight.

Allows setting button and keyboard backlight brightness as well as
button timeout.

Change-Id: I550cccafc0a8f90d6347de9261adb26b75955cc4

Conflicts:
	core/java/android/provider/Settings.java
	services/java/com/android/server/power/PowerManagerService.java
keyboard: re-add code to detect lid state

This was lost in the cm-11 merge. Without this, a change in lid state
isn't generated to light up the keyboard backlight

Change-Id: Ief35cebcb62da13afe1ae7531d69ab58e196be9e
services: Fix tethering (softap) startup.

The interface must be started after firmware reload. If it's not
started, the driver is unable to configure it.

Thanks to Emerson Pinter <dev@pinter.com.br> for the jb version of this.

Change-Id: If8819d463d8c3820e2e159cd365f8ba4af8c0064

Conflicts:
	core/res/res/values/config.xml

Conflicts:
	core/res/res/values/symbols.xml
frameworks/base: support devices with SoftAp that don't require firmware reload

Partial forward port from ICS.
Original Change-Id: If2db6e8ce675c3214ce645231c7a354f41ea0cc6

Change-Id: Iacb2498ec0f567a0a7c4e0dbf9127b70f09223bd

Conflicts:

	core/res/res/values/public.xml
	services/java/com/android/server/NetworkManagementService.java