Squashed commit of Android 4.3 Release 3.1 updates

Merge tag 'android-4.3_r3.1' of https://android.googlesource.com/platform/frameworks/base into cm-10.2

Android 4.3 Release 3.1

Conflicts:
	core/java/android/net/IConnectivityManager.aidl
	services/java/com/android/server/AppOpsService.java
	services/java/com/android/server/ConnectivityService.java

Change-Id: Id980378cb850c329229f4e458035a14226a84bf1

Fix merge from android-4.3_r3.1

Change-Id: I8918574a6eb71502db1e79e3f1c862db715989d5
Revert "framework: Privacy Guard"

Change-Id: I82ab85092e54c577a0817f3bedc85063c9a3054a
Privacy Guard : Reimplement backed by AppOps

Re-implements privacy guard to use appops.

Change-Id: I2b52e8cf0d6e126fb156f83df885b5551503cd9d
SystemUI: don't crash when user disable default apps

If the user has disabled the default clock or calendar application,
System UI will crash when the user clicks the Clock or Calendar
from the notification bar. This patch fixes the issue.

Change-Id: Icdc3679cdd35b5b3a24086e1ada67d0defabc5cb
PackageManager: Let system-defined permissions take precedence over settings

If a permission was already present in the device's settings due to having
no prior system definition, and the system tried to take it over
(after a version upgrade, for example), it'd fail, since the saved
value would clobber the one previously read from the permissions XML.

This breaks system-behavior changes (gid grants, in particular) unless
the user performs a factory reset after upgrading, which isn't acceptable.

Change-Id: If2e44110f6db735ad29cdf1086e814bd1299e290
Fix certain setting writes being incorrectly skipped.

If a value that previously had a very long value (over the 500 char
threshold) is now set to null, isRedundantSetValue would incorrectly
return true even though the value was changed.

Change-Id: Ia5304743024ec01024be98aa51ed260d38caf93c
Audio: Fix abnormal keytone playback during silent mode changing

Change-Id: Icfc4003c9756b3c33578c137e59dc4a2b4f25647
Author: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Ertao Zhao <ertaox.zhao@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 19084 4898
platform: Fix the gid for the theme manager service

It was mismatched with fs_config, resulting in attribution of the
"-1" gid

Change-Id: Ia6d55af0b39f659da2965f9bc0bda0df5c775ba4
Use generic alarm intent.

Change-Id: Ibb911c1e34ec95cdd52867b8a68cce25f09dbc10
services: Fix the bug in NFC shutdown logic

nfcOff should be checked for NFC shutdown instead of radioOff,
which is used for radio status.

Change-Id: Iafd620dc89ae8bed7855e313676527d4de32cb7c
Rework thumbnail handling

Since ids of media file are usually not continuous, the original file of thumbnail are
sparse. When there are big numbers files on ex\
ternal storage, the size of this file will be horrible.
Ex, when the id is 20000, then the .thumbnails/.thumbdata3-xx file will be 50000*10k = 488.28M.
Can refer http://stackoverflow.com/questions/12396715/android-huge-thumbdata4-file-in-dcim-folder
Because after 4.0, MediaProvider will scan any files, this will be a big problem. So I modify MiniThumbFile.java to avoid this.
According to the id, we now produce an index file. In this index file, one id will use BYTES_PER_MINTHUMB_INDEX(8) bytes in offset (i\
d+1)*BYTES_PER_MINTHUMB_INDEX. The data of these 8 bytes is the index of thumbnail file. The first BYTES_PER_MINTHUMB_INDEX bytes kee\
p next available index. And when you need insert a thumbnail, the index increase by 1. In this way, the block data in thumbnail file \
will be continuous. And thus unnecessary zero paddings will not be saved.

Change-Id: I66005dd69b0a5c8f4353bd7a8225d163a654fd2d
Frameworks: add never sleep screen mode (1/2)

to qs ScreenTimer Tile
to PW ScreenTimer toggle
as general option as well

Change-Id: Ic78356c1b96044562efbce3cb0d0d5c93d773a19
privacy guard: changes part 1

the new cm implementation from our privacy guard is not the best.
Some changes we needd to do next week. For first give back the ability
to filter critical apps + do not show apps without any permissions

to do
- enable only the critical permissions the app is using
- add another active icon to notify the user if he modiefied another permission then the default ones
- add ability to disable notifications

Change-Id: I59fac120dd00126533e99cb65f5136b11f42e20b
Merge remote-tracking branch 'slim/jb4.3' into slim4.3

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/ClockStock.java
	telephony/java/com/android/internal/telephony/DctConstants.java