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
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
Active display: turn off display if device gets pocketed again

Change-Id: Icb4c002add915b75de7607f71c0d400e323feb5b

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java
Revert "Active display: turn off display if device gets pocketed again"

This reverts commit f540a873ccd5295935638744953b091ba3079b20.
Clean up recents
FW: Toggles vibrate on click (1/2)

PS2: Make also BaseToggle type toggles to vibrate on single click.
PS3: Forget about observer

JB-MR2 Bring-up

PS2: respect global vibrate setting

Change-Id: I11d060d64365256c2f72695eb557c2a10c9c32ce

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/toggles/BaseToggle.java
Active display: make sure mNotificaiton is set correctly

Change-Id: I4111ca843e340cca4d6dac4b2c2922ce3039e487
Active display: register/unregister recievers and listeners when enabled/disabled

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

Change-Id: I82ab85092e54c577a0817f3bedc85063c9a3054a

Conflicts:
	core/java/android/app/ActivityManagerNative.java
	core/java/android/content/ContextWrapper.java
	core/java/android/provider/Settings.java
	core/res/AndroidManifest.xml
	core/res/res/drawable-hdpi/stat_notify_privacy_guard.png
	core/res/res/drawable-mdpi/stat_notify_privacy_guard.png
	core/res/res/drawable-xhdpi/stat_notify_privacy_guard.png
	core/res/res/drawable-xxhdpi/stat_notify_privacy_guard.png
	core/res/res/values/cm_strings.xml
	core/res/res/values/symbols.xml
	services/java/com/android/server/am/ActivityManagerService.java
	services/java/com/android/server/am/BroadcastQueue.java
	services/java/com/android/server/pm/PackageManagerService.java
	services/java/com/android/server/pm/PackageSettingBase.java
	test-runner/src/android/test/mock/MockContext.java
	test-runner/src/android/test/mock/MockPackageManager.java
Privacy Guard : Reimplement backed by AppOps

Re-implements privacy guard to use appops.

Change-Id: I2b52e8cf0d6e126fb156f83df885b5551503cd9d

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/cm_strings.xml
Revert "Active display: register/unregister recievers and listeners when enabled/disabled"

This reverts commit 0661419b26177c19e2d3fd4c08d5ace080de1222.
Fixes
Revert "Set subscription_mode in the database to a default value"

This reverts commit 2e8d1ecaee7f5972a52b20838b56276d75234343.
Revert "base: App crash when select suggestion's length more than specified."

This reverts commit dcf75fbfd06c6a940e4124550edd19e191656047.

Change-Id: I6d236f16e9c428b06caf4423903839d54cf24bd0
Active display: unregister proximity if pocket mode not used or active display disabled
[log]
special thanks to Der-Schubi for helping to fix this

Change-Id: I7c634e1ee48e82024faad53bb1bae8fe19da439d

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java
Revert "Active display: unregister proximity if pocket mode not used or active display disabled"

This reverts commit 888baa8f349b545b7ec3edb0e5fbee80eafc71ad.
Active display: register/unregister recievers and listeners when enabled/disabled

Change-Id: Ic73e63da2c9634bc864ab1a1387eb9145eb0b5b0
Active Display: check if recievers and listeners are registered

Change-Id: I1a881aebcbfc2bae92535a4e9ea55ba3789d8b43
Active display: Catch Resources.NotFoundException

This caused the SystemUI to FC when the device was powered and a notification was fired.
Display stayed off and the SystemUI kept restarting until the device was unlocked manually.

Change-Id: Ibfd82242e82aa9ee5c0898f5f0714e490eac0ea9