perf: Per-app performance profiles

 * Performance Profiles is going to grow into a much more powerful
   feature which can apply advanced optimizations or power saving
   techniques depending on both the state of the hardware as well
   as the current applications in use.
 * Refactor the original code and move it into PowerManager so
   that it's managed from the same place.
 * Implement "automatic performance profiles". This feature will
   automatically select a profile when specific activities are
   running. Currently this list is static and engages performance
   mode for several benchmarks (trollface).
 * Added support for a new power hint, POWER_HINT_SET_PROFILE.
   Currently, these profiles are fired using a property trigger
   in init. This is easy, but the PowerHAL can do more.
 * Moved the setting to Settings.Secure and also wrapped calls
   to the service in the DEVICE_POWER permission. Nobody should
   mess with this stuff except the system.
 * Powersave profile will automatically activate Android's built-in
   low power mode.
 * Original patch by Jorge Ruesga

TODO:
 * Implement API for per-app configuration by user
 * Quicksettings tile

Change-Id: I140ebc0648c4cf05900e005923247c3180be8c93
Add testing api to SELinuxMMAC code.

Added needed api for local unit testing.

Change-Id: If52555ecb4f0e6bc06e153b6a17e2c706b11253e
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
Mods to the SELinuxMMAC engine code.

* We now require that all certs used to sign the apk and all
  certs stored with policy be tested for set equality. Prior
  efforts required that the cert included with policy only
  needed to match one of the certs included with an apk.

* Allowed a new tag to be included with policy describing the
  signatures. <cert signature=""/> is now allowed as a child
  element of the <signer> tag describing multiple certs. The
  old way of describing signatures attached as attributes to
  the root signer tag is still supported. The engine now treats
  it the same as if they used the new layout with the outer
  signature as the first signature value.

* Moved the class which holds all policy from an inner static
  to a builder pattern governed by the Policy.PolicyBuilder
  class. This will help provide more clarity and allow for
  easier enforcement of certain invariants as the policy
  representation is being built.

* Loads of new comments.

Change-Id: I38eb00ed8962fdef71bc9f2e7370cb910cadeff4
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
Replacing FloatMath native implementation with calls to Math

On modern versions of Android running in AOT mode
FloatMath is slower than Math. Calls to Math.sqrt(),
etc. are replaced by intrinsics which can be as small
as a single CPU opcode.

When running in interpreted mode the new
implementation is unfortunately slower, but I'm
judging this acceptable and likely to be improved
over time. This change saves a small amount of native
code.

Example timings:

Mako AOSP AOT:

Method: Original / New / Direct call to Math
ceil: 596ns / 146.ns / 111ns
sqrt: 694ns / 56ns / 25ns

Mako AOSP interpreted:

Method: Original / New / Direct call to Math
ceil: 1900ns / 2307ns / 1485ns
sqrt: 1998ns / 2603ns / 1788ns

Other calls Mako AOT:

Method: Original / New
cos: 635ns / 270ns
exp: 566ns / 324ns
floor: 604ns / 150ns
hypot: 631ns / 232ns
pow: 936ns / 643ns
sin: 641ns / 299ns

The advice to use Math directly, in preference to
FloatMath, is still good. FloatMath will be deprecated
separately.

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I8d1947d88b3c576643138b1df589fb9da7c1ab88
Revert "Replacing FloatMath native implementation with calls to Math"

This reverts commit 32b88b48daa7383880088246d7222dd93cf55285.

Change-Id: I40ea17f3a68f2b53eb013aebd3ba1becdc724f94
Replacing FloatMath native implementation with calls to Math

On modern versions of Android running in AOT mode
FloatMath is slower than Math. Calls to Math.sqrt(),
etc. are replaced by intrinsics which can be as small
as a single CPU opcode.

When running in interpreted mode the new
implementation is unfortunately slower, but I'm
judging this acceptable and likely to be improved
over time. This change saves a small amount of native
code.

Example timings:

Mako AOSP AOT:

Method: Original / New / Direct call to Math
ceil: 596ns / 146.ns / 111ns
sqrt: 694ns / 56ns / 25ns

Mako AOSP interpreted:

Method: Original / New / Direct call to Math
ceil: 1900ns / 2307ns / 1485ns
sqrt: 1998ns / 2603ns / 1788ns

Other calls Mako AOT:

Method: Original / New
cos: 635ns / 270ns
exp: 566ns / 324ns
floor: 604ns / 150ns
hypot: 631ns / 232ns
pow: 936ns / 643ns
sin: 641ns / 299ns

The advice to use Math directly, in preference to
FloatMath, is still good. FloatMath will be deprecated
separately.

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: If07fcbd78543d13bc6d75f9743f999860e8d58d7
Frameworks/base: Wall Werror in core/jni

Turn on -Wall -Werror in core/jni. Fix warnings.

Clang TODO: For GCC we need to turn off Wunused-but-set-variable in
the GL bindings. However, Clang doesn't have that warning and thus
complains about an unknown pragma. It is necessary to make the
pragma #ifdef-ed on the compiler being GCC.

Change-Id: I14cab48d45c2771eef0432082356c47ed44a3d7f

Conflicts:
	core/jni/Android.mk
Frameworks/base: AndroidRuntime standalone preloaded-classes

Change AndroidRuntime::startVM to give the new standalone
preloaded-classes file to the runtime for compilation of images.

Bug: 18305157

(cherry picked from commit 995c62d6abd4b7080e52a60d1bffa32ae4a798a3)

Change-Id: I32a13357893222b25fbce60bf2367c23fb36ab22
Frameworks/base: Compiled-classes support

Let AndroidRuntime check for /system/etc/compiled-classes and push
it to the runtime for boot image creation.

Bug: 18410571

(cherry picked from commit ca775941f3b7981aabf3a6a3b84d6c94f4f76aff)

Change-Id: I2510316381f2661166af24d7e14b013f4e045556
Lose some unnecessary JNI from the zygote.

Bug: 18719692
Change-Id: Ie2d50400f10f3c54cfbf94e54656f6d704eac267

Conflicts:
	core/java/com/android/internal/os/ZygoteConnection.java
	core/jni/com_android_internal_os_ZygoteInit.cpp
Move frameworks users over to libcore hex encoding API.

Removes dependency on apache-http.

bug: 18027885
Change-Id: I508db016747985ecdd68e02d5d4efcd0ddd694df
Throw IllegalArgumentException on invalid hex-strings.

Beats returning null since there's let's chance it will be interpreted
as the lack of a password.

Change-Id: I4986a8e806d9066129f696ab9f2e80655424e723
Frameworks/base: New GL bindings

Generated new bindings after glgen update.

Change-Id: I96f2e3eee99f1e12ad84aa10e8f7826a905e909c
Revert "Frameworks/base: Wall Werror in core/jni"

This reverts commit a7c6f0d9f07e47fbab8557e087302166504cadc3.
Merge CyanogenMod
Whoa!  It was HUGE update maybe.. haha