Improve scrolling cache

Scrolling cache helps make short scrolls/flings smooth but will
cause stutter when long flings are made. This patch disables
scrolling cache when long flings are made.

This patch also fixes a related bug where scrolling cache will
not be enabled properly when transitioning from flinging to scrolling.

Patch Set 2: Calculate threshold based on maximum velocity (Sang Tae Park)

Credits: Pawit Pornkitprasan

Change-Id: I1fdbaad92263c9f983a32900e74eba1f0367902b
Signed-off-by: Arham Jamal <arhamjamal@gmail.com>
frameworks/base: Fix USB media removed notification to be dismissable

Cleanly removing a USB media after unmounting leaves a permanent notification.
This fix makes it dismissable.

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

Re-implements privacy guard to use appops.
PrivacyGuard: add missing @hides to method definitions

Causing DroidDoc compile errors, this fixes it by adding
a @hide to the respective function definitions.

Change-Id: I27675cd6a75fcc1535c812566e5b9098b11335e1
[2/2] Framework AppOps: Forward port ops from cm-10.2

    Squash of:

    Author: Sam Mortimer <sam@mortimer.me.uk>
    Date:   Fri Sep 27 21:30:34 2013 -0700
    [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

    Author: Kun Liang <kunliang@codeaurora.org>
    Date:   Fri Aug 30 23:56:59 2013 -0700
    AppOps: Add data connect control into AppOps
    Check user permission before enabling/disabling mobile data.
    Change-Id: I6e1895b130788dfccbc0a8523dadf1559b698988

    Author: Shashank Mittal <mittals@codeaurora.org>
    Date:   Thu Sep 5 17:24:44 2013 -0700
    AppOps: Add Bluetooth enable control into AppOps
    Check user permission before enabling bluetooth.
    Change-Id: Iefa4ea3319b33b2639beaf38d261d83649bbcf85

    Author: Shashank Mittal <mittals@codeaurora.org>
    Date:   Tue Sep 3 19:23:10 2013 -0700
    wifi: Confirm user permission before toggling wifi.
    Check user permissions before enabling/disabling wifi.
    Change-Id: I1ddae6e47f42b6d3fc831c2c135ece75cf9e935d

    Author: Qaweck <qaweck@gmail.com>
    Date:   Dec 6, 2013 06:21
    Fix bluetooth and data enable with ProfileManager
    Handle the case of system uid in AppOpsManager
    Change-Id: I5f9c3ba2e2ed0b1c825b995bf2724066ae796bb4

Change-Id: I1d403d4325f105cd91f815f790cb01dd9b9f5516
[2/2] Framework AppOps: Add per Op allowed and ignored counters

Port from cm-10.2

Change-Id: Ifb3d25e17dbab082b816a0a655b4796a83af336b
[2/2] Framework AppOps: Add BOOT_COMPLETED operation.

Add BOOT_COMPLETED operation in AppOps.

This operation is used to allow user to control auto start of
applications and services at bootup.

Change-Id: Ie8488ec1b4683c8617ca569cfc858709f0d35ba2
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 allows upgrades between versions of
android that have different code<>name mappings.

Change-Id: Iffc02095b6838a34ff999f8db51c2c6739dd0db8
[2/2] Framework AppOps: MODE_ASK and xml whitelist

  Squash of:

  Author: Shashank Mittal <mittals@codeaurora.org>
  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

  Author: Kun Liang <kunliang@codeaurora.org>
  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>
Frameworks AppOps: Enable MODE_IGNORED for OP_WAKE_LOCK

  *) Kitkat commit log highlights that the current
     implementation state is for auditing only
     https://android.googlesource.com/platform/frameworks/base/+/713df150b92a0a5eea877f99405e31eefbf93a09

  *) We go one step further and honour MODE_IGNORED
     when for OP_WAKE_LOCK.

Change-Id: I889227ca24a508a0d96bd43594c5179ba758ae3d