AppOpsService: Add MODE_ASK support to AppOps.

Add support for new mode(MODE_ASK) in AppOpsService to show a permission
dialog box to user to confirm user permission before allowing or ignoring
that operation.

All strict operations (defined in AppOpsManager) are going to be in
MODE_ASK by default.

Operations will be moved to MODE_ALLOWED or MODE_IGNORED according to
user's choice.

Change-Id: I1314125a2b8be558e422e4a9eea0ff066c21bf94
AppOps: Add support for whitelist of packages.

By default AppOps gives MODE_ASK permission to all strict operations.
This can degrade user experience for pre-installed apps.

This change adds support for passing a whitelist XML file to AppOps.
Operations requested by packages listed in whitelist file will be set
to MODE_ALLOWED by default.

User can still go into settings and override permissions of these
operations.

Whitelist XML file should have following format:
Example: whitelist_appops.xml

<whitelist-pkgs>
    <pkg name="com.android.settings"/>
    <pkg name="com.android.systemui"/>
    .
    .
    .
</whitelist-pkgs>

Change-Id: I78bf5e7baa95f0e86f9856fb38bf1ca238691303
wifi: Confirm user permission before toggling wifi.

Check user permissions before enabling/disabling wifi.

Change-Id: I1ddae6e47f42b6d3fc831c2c135ece75cf9e935d
AppOps: Add Bluetooth enable control into AppOps

Check user permission before enabling bluetooth.

Change-Id: Iefa4ea3319b33b2639beaf38d261d83649bbcf85
AppOps: Add data connect control into AppOps

Check user permission before enabling/disabling mobile data.

Change-Id: I6e1895b130788dfccbc0a8523dadf1559b698988
frameworks/base: Fix memory leak in BitmapRegionDecoder

When un-supported image is passed to bitmap decoder, mStream object
of SkMemoryStream class is leaking its resources. This is getting
called frequently when gallery app is trying to render thumbnails
in album view and due to this frequent sigkills were seen on
gallery3d app with adj 0 value

CRs-Fixed: 551617
Change-Id: I1d9401310566b529d81b406213f4e37be3104d95
Framework: Update German translations

Change-Id: I7e6e062f221fa23f1e39cac36dbc7f2d130ea1b3
services: Add hook to run device specific shutdown code.

Add hook to call OEM specific shutdown synchronously. OEMs need to add
ShutdownOem class and define deviceRebootOrShutdown function in that.

ShutdownThread class would call this OEM defined function just before shutting
down the device.

Change-Id: I620495bfc99c6b0855a98ac54c6ede96e20ff1b8
services: Fix device-specific shutdown hook to support restart

Update device-specific shutdown hook such that it is invoked for
restart as well as for shutdown.

Change-Id: I8c9cbe674000e0d664d41ecc98a341112e1cb060
EMFILE exception in system_server due to socket fd leaks

NativeCrashListener creates a socket connection with debuggerd.
When native crash is observed, NativeCrashListener gets new socket
file descriptor from debuggered. This socket is never closed.
Multiple native crashes are causing "Too many files opened" EMFILE
exception in system_server.

CRs-Fixed: 545566

Change-Id: Idb12e87a4f91c978169435ce95abe11b40c6d0dc
frameworks/base: Fix race conditions on resume/suspend using power key

The wakelock PowerManagerService.Display sometimes cannot be released
after two quick power key pressings like a double click during phone
sleep (the target will resume then supposedly suspend shortly).

The second key event disturbs display power state on resume, as a
result display resources won't get released on suspend, which is fixed
in this change.

CRs-Fixed: 566059
Change-Id: I633fd377ab235f203ebfb649a74449a2385740c4
/platform/frameworks/base: Fix SystemUI crash on Recent App

Issue: SystemUI crash is observed when Context MenuItem is
       selected on the recent apps activity [Long pressing
       two recent apps at same time or Long press, lock and
       unlock the screen]

Fix: Changed the code to make sure that only one context
     menu is active at a time and also dismissed the
     context menu on pause of the RecentsActivity

CRs-Fixed: 539509

Change-Id: Ia50bed7bfad6fde7beeaec37fa6402177eee1d40
Merge "Framework: Update German translations" into cm-10.2
Merge "AppOpsService: Add MODE_ASK support to AppOps." into cm-10.2
Merge "AppOps: Add support for whitelist of packages." into cm-10.2
Merge "wifi: Confirm user permission before toggling wifi." into cm-10.2
Merge "AppOps: Add Bluetooth enable control into AppOps" into cm-10.2
Merge "AppOps: Add data connect control into AppOps" into cm-10.2
AppOps: Fix resetAllModes() in AppOpsService

  *) Array iteration with inline deletion was broken
     causing PrivacyGuard reset not to work properly.

  *) Kanged fixed code from Kitkat

Change-Id: If36d38f9199e6282fe52eabc32cd652d8aca86fe
[2/2] AppOps: Add alarm wakeup op

When alarm wakeups are denied/ignored,
the alarm types are remapped as follows:

RTC_WAKEUP -> RTC
ELAPSED_REALTIME_WAKEUP -> ELAPSED_REALTIME

Change-Id: I3a5023e1f6260004319290e776bdb2daf73e9fdf