Secure screenshot and screenrecord

* Partial port-forward of Screenshot toggle
* Creates an android:permission for both screenshot and screenrecord,
  as well as corresponding Intents. This disallows rogue apps to access these
  methods in PhoneWindowManager ( takeScreenshot() and takeScreenrecord() ) and
  hijack our system, by locking them down to System and SystemUI with said permissions.

* This is required for the Screenshot toggle, and reimplementation of screenshot navbar action.

Change-Id: I4adac71a0ce924de96c9a7d495b42ae68441e4ad
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
Add screenshot to Power Menu

PS3: Fix whitespace
PS4: Fix order of imports
PS5: Rebase

Change-Id: Ife783d4c0a47b8d24f949d4dd77141038658b21f
Screenshot Toggle

PS 3: Rebase
PS 4: Rebase

Change-Id: Ie5bdd6834a3ce4c2d2fba9bff3cce220b16ada14
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
Screenrecord Toggle

* Secured with secure intent

Change-Id: Ib545d915d961e07f9a22378c8f7e5beccd5b4e1e
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
FW: Power Menu customization

All options can now be set to one of the following:
       * Hidden
       * Showing always
       * Showing always except on keyguard if using secure method

P2: Fix issues, set defaults to match stock, and set mDialog = null when dismissed.

Change-Id: I2f84aa45dcebfcf29800a5c06320da61bb4dfe1c
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
server: Treat non-default route as host route

When constructing ip route command in addRouteWithMetric,
we used to check whether the given route is a host route.
In some cases, the isHostRoute() check can return false for
non-default routes. To make this check more foolproof,
check whether a route is non-default in order to treat it
as a host route.

Change-Id: I5e396e67e1c82bbe22600c47f1e52cc7c750cdc6
Bluetooth: Fix to avoid framework reboot during monkey.

A case where monkey is running & sometimes framework is
disconnected due to unhandled java Exception during the
unbinding of HID device service on unsuccessful unbinding.
Handling java Illegal Argument exception while unbinding
HID device service solves this issue.

Change-Id: I61a5620e756119d25f2a235e67d6404b216f4cbf
CRs-Fixed: 601533
ProcessCpuTracker: Fix ArrayIndexOutofBoundsException in tempSpeeds

If time_in_state file is not available mCpuSpeeds is created with size 0
and subsequent call if the file becomes available there is an
ArrayIndexOutofBoundsException.
This change avoids the crash by breaking out of the loop, also adds error
logging

CRs-Fixed: 553569
Change-Id: Id5e219ca1cd3f058f714aecd5902ec2f6c11ae03
Merge "Secure screenshot and screenrecord" into kitkat
Merge "Add screenshot to Power Menu" into kitkat
Merge "Screenshot Toggle" into kitkat
Merge "Screenrecord Toggle" into kitkat
Merge "FW: Power Menu customization" into kitkat
FW: Hardware rebinding additions

*add kill app to list of available rebinding options
*make longpress rebinding available for back key

RC part: http://gerrit.aokp.co/#/c/15686/

Change-Id: I3f456eefee5620eb7b052f5e0f98ff56988b2ea8
Signed-off-by: Jonathan Steadman <xxwhitehawk@gmail.com>
Merge branch 'kitkat' of github.com:AOKP/frameworks_base into kitkat