Allow changing screen-off animation (1/2)

* Allow enabling/disabling screen-off animation
* Allow selection between fade & crt effects if the device allows it

Ported from CM-11.0

Change-Id: I24a39867053c5ae7309adecaeb457698e3750290
SystemUI: Add double tap to sleep gesture

http://review.cyanogenmod.org/#/c/55645/
Ported from CM-11.0

Change-Id: I1c12bc9dccc91191975d68ed176437195490cc34
Add double tap sleep feature to secure lockscreens.

In its current state double tap works on the status bar on unsecure
lockscreens this adds the feature to pin, password, and pattern
lockscreens.

 - pin and password: double tap the text entry view.
 - pattern: double tap anywhere on the pattern view.

Patch Set 3:
 - add to slide lockscreen(glowpad): double tap glow pad to sleep
 - update commit message

http://review.cyanogenmod.org/#/c/57257/
Ported from CM-11.0

Change-Id: I3e21eca011feeadce79dc93866ed50c100267d5f
Allow configuration of the default screen-off animation style

http://review.cyanogenmod.org/#/c/63150/

Ported from CM-11.0

Change-Id: I707bc2994885bcb4579a661a9e6364fa26858c0a
settings: Enable the status bar double-tap to sleep gesture

http://review.cyanogenmod.org/#/c/64276/

Ported from CM-11.0

Change-Id: I6e7207620a849b5f548d3b64dbeb4bd684fae081
settings: Fix loading of some initial values

http://review.cyanogenmod.org/67992

Ported from CM-11.0

Change-Id: Id8aa93d633a012e3a39d2305941fa98c91b2e0ef
 Rebuild quick settings tile layouts.

The chief motivation here is to allow two lines of text when
necessary. So much refactoring over so small a thing, but
the result is satisfying: most quick settings tiles do not
need their own layouts. Additionally, tiles with odd-shaped
icons (I'm looking at you, alien potato mode) no longer fall
off the grid.

It should be possible to further reduce the complexity of
quick settings, but for now this will suffice.

Bug: 7216734 // vertical alignment issues
Bug: 7216868 // wrap text in QS tiles
Bug: 7365911 // NPE in some tiles

https://github.com/CyanogenMod/android_frameworks_base/commit/b5538e642118209add5abd7c5da1472a0b608b07

Ported from CM-10.2

Change-Id: I73328c4e1bc1e00563d59c2ab961d7d04b22bad8
 Lockscreen widgets not always announced.

1. The accessibility events for switching a widget were dispatched
   before we update the important for accessibility property. We
   were lucky to get events in some cases since the pages in the
   pager had alpha grater than zero, i.e. the page was already
   set as important for accessibility, due to a running animation.

2. Accessibility focus clear event not fired if we give focus to
   another view. The old focus was correctly cleared just the
   events were not dispatched.

bug:8599670

https://github.com/CyanogenMod/android_frameworks_base/commit/4293e233dce185e2b8163b23efa8c17ec3266a87

Ported from CM-10.2

Change-Id: I5f9f2427344738bd01f79ee0fe595667164bbf52
Fix battery level quick settings tile bug.

Bug: 8726138

https://github.com/CyanogenMod/android_frameworks_base/commit/d3fc956a119b771e43ef8387635572f25e5df7f1

Ported from CM-10.2

Change-Id: I18e22b31fe0e6e7ebdd9b6160a8678a11cb4e0a4
Fix Quick Settings layout.

http://review.cyanogenmod.org/46377

Ported from CM-10.2

Change-Id: I6749a94145bab2e4105473149a0b2c8924abf76a
Expose PreferenceManager constructor / Preference#performClick

Expose PreferenceManager constructor and Preference#performClick so they can be
used by other UIs beyond the standard PreferenceActivity. Marked @hide so public
API is not affected.

Change-Id: Ieb4aecba5f86e40ff70f2b252458602e6b9ad1ee
Fix issue #6595555: deal better with fragmentless headers.

If you constructed a preference activity whose first header
didn't have a fragment, this would crash in two-pane mode
because it would try to use that header as the initially
selected header but not have a fragment to show.

We need to have a fragment for whatever header we switch to,
so the code now looks for the first header with a fragment
as the initial header.

Also added some error checks to throw more descriptive
exceptions on bad headers -- when there is no header at all
with a fragment, if the app tries to manually switch to a
header without a fragment.

Change-Id: Ia84221fcb2fe5755bb674e0606ac2a1fcde4cdc9
Avoid IllegalArgumentException in Preference.java compareTo()

In some situations the collection.sort() algoritm fails in compareTo()
with a: java.lang.IllegalArgumentException: Comparison method violates
its general contract!, due to a more strict validation of the compare
contract.
This strict validation was introduced in java 1.7.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6804124
This fix should prevent the sorting from crashing.

Change-Id: I64230e7f62f83c99d7a6274964bb2988ae843826
PreferenceActivity should not leave message in looper when destroyed

When a PreferenceActivity is destroyed as soon as created,
there is a problematic case that messages for the activity are
sometimes left in the looper even after the activity is destroyed.
For example, by clearing user data of the selecting IME on
Settings apk, com.android.settings.Settings is re-launched
2 times successively. (Destory->Create->Destroy->Create)
Due to the left message, application crash can happen.
(NullPointerException at BackStackRecord.getBreadCrumbTitle())

Two cases have been found to observe this issue.
[Case 1]
 1,Launch IME in advance.
 2,Go to Settings >Apps > All and choose the IME package.
 3,Click "Clear data"
 4,Application crash occurs on com.android.settings.
[Case 2]
 1,Go to Settings > Language&input > Language.
 2,ListView dialog to choose language is shown.
 3,Rotate the tablet 180 degree so that 90 degree rotation occurs twice.
 4,Application crash occurs on com.android.settings.

Change-Id: I5ce36ea7a40ab7bc7737b7dca6641a4c3d77a480
Ignore list item clicks if PreferenceActivity is paused.

Since list item clicks are delivered asynchronously, it's possible to
get click callbacks after the activity has already paused.

This should actually be blocked further up the event chain, ideally,
so that the list selection state is not out of sync with the application.

Bug: 9752185
Change-Id: I1058d64cba98e9093b462e2e581bdbccdace1420
Fix handling of ListPreference.setValue()

Previously, setValue() was not calling notifyChanged(). This
prevented the summary from updating correctly. Now it calls
notifyChanged() the first time it's called and when the value
actually changes.

BUG: 9987962
Change-Id: I02dd4be6bde2969f39d30921a62a7ba908128e0e
Don't check for valid fragment when switching to another fragment

Bug: 10184429
Change-Id: I09b39682d907a1cd7ce140e0be0faaddfaba6bd1
Use more styles for preferences to allow single pane 10"

Change-Id: Ib3b1032ca45f22bca08546eb65b2c42bc1975bdf
Add implicit parent dependency for Preferences

Also removes unused dependency change listener interface.

BUG: 10117838
Change-Id: I03f0eb37e7ba69942f7997a8b32adb38a3dee0bd
Allow recycling of Preferences in com.android.* packages

Refactors hasSpecifiedLayout to canRecycleLayout for readability's
sake. All boolean references to the method have been inverted.

BUG: 10079104
Change-Id: Ie6beda9f0b837f889a6cc6a80377349e98cc4883