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
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
[2/2] AppOps: Add per Op allowed and ignored counters

Change-Id: Ifb3d25e17dbab082b816a0a655b4796a83af336b
AppOps: track op persistence by name instead of id

On XML write, include the op name.  On XML read, map
the name back to op id (if it exists).

Persistent AppOp state now follows the op name instead
numeric id.  This means you can upgrade between
versions of CM and the op number does not matter.
Handy when merging with future android code drops
(CM AppOp ids might be used by Google).

Change-Id: Iffc02095b6838a34ff999f8db51c2c6739dd0db8
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2