NavRing : Fix FC on rotate

onAttachToWindow() is not guaranteed to be called prior to the framework
invoking commands on the panel. This patchset moves over initialization
over to onFinishInflate();

Reproduction steps :

1. Activate search panel view (long press home/swipe up from navbar)
2. Rotate device

Change-Id: I37b5b0de180040bdf1b521bcb8fc014b23c238df
Pie controls: Fix flickering nav bar in full screen

On rare occasions the pie service will deadlock. When this
happens, full screen mode can no longer hide the
navigation bar, since it is masked out internally.

This commit switchs from a self cooked mask mechanism within
the WindowManager to the private flag
WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_NAV_BAR.

Note that this will avoid flickering when pie service get
stuck in the activation path, but it will not resolve the
deadlock.

Change-Id: I2b64867081b37d9d6070df8086975e4327d97f5d
Pie controls: Catching activation corner cases

As stated before there are still corner cases that may
deadlock pie controls.

This commit makes PieInputFilter respect ACTION_CANCEL,
simplifies monitoring mechanics in PieService and
fixes some corner cases in PieController that allowed that
activations got lost and thus pie controls got stuck.

Test case for PieController:
1) Enable pie controls
2) Enable top/bottom snap position for pie
2) Enable expanded desktop and check if it works
3) Disable expanded desktop
4) Lock your phone
5) Swipe from the top down/bottom up, as if you want to
   activate the pie from that position
6) Dismiss the notification tray and unlock your phone
   again
7) Enable extpanded desktop
8) Pie controls will no longer show up and
   "dumpsys pieservice" will show a active record.

Change-Id: Id9d2df6b2735a743eec2fd1ba809fd72be9474cc
Fix the flipping animation sometimes being played when pulling the quick
settings with two fingers.

Commit c5e8dca7f11d3c085dd1e98692fcc21f1bcc0f6f already tried to fix
this before, but was incomplete (and incorrect). The actual issue is
that on the first pointer down event, a 'peek' animation runs and
expands the notification panel by some pixels (on mako: 160). This
amount of pixels is significantly larger than the handle height (on
mako: 72). Depending on the timing between peek animation and the second
pointer down event, the flip animation would play (if animation already
revealed more than 72 pixels) or not.

Fix that by not playing the flip animation if only peeking, as the
actual panel content is not visible at that point anyway. Also remove
the previous incomplete fix in the process.

Change-Id: I8997dc7b70143940a519f41da29ffd4d738d8d0c
Check themes of current user, not user 0.

Change-Id: I5d685a04289b434a12e460b4fdacc43a41ff2be1
JIRA:CYAN-1303
Finally fix incorrect flipping to quick settings.

Commit f6685c5ca84a42f5a47bf40827d6229dd998dee4 fixed this for the
two-finger pulldown. It reverted commit
c5e8dca7f11d3c085dd1e98692fcc21f1bcc0f6f in the process, which was
incorrect, but fixed another condition of this problem occuring
nevertheless. The actual problem the latter fix tried to fix was that
the flip decision was dependant on the timing of the view layout:
getMeasuredHeight() returned whatever was set in the last layout, which
might not have happened when hiding the view, so at the time of the next
ACTION_DOWN getMeasuredHeight() returned the height from the time the
panel was last visible.
Fix that problem by using the height scheduled for the next layout, so
we're always up-to-date.

Change-Id: Ib97f34f9aa0a6f28d48b4ec3e16c82a814cda0d0
Fix incorrect fragment animation used for hiding fragments

Mirror of support lib patch
https://android-review.googlesource.com/#/c/60032/ into
frameworks/base.

AOSP Commit: https://android-review.googlesource.com/#/c/60167/

Change-Id: I8d1cb2e217721336674b8e3e2ef8722a8d9baefd
change "next" to "done" in minute IME option under 24-hour format

We don't need "next" button under 24-hour format any more.
So, we changed from "next" button to "done" in IME option
when setting minute under 24-hour format

AOSP commit: https://android-review.googlesource.com/#/c/54121/3

Change-Id: Ic9b1673248183060ba7279b63648a85dc39ca3b9
Fixing crash in PhoneNumberUtils getNumberFromIntent

Handling intent with no data when trying to retrieve number from
intent.

AOSP commit: https://android-review.googlesource.com/#/c/57890/

Change-Id: If7c5930e7048aec732fb7a3fbeb3391e1408b071
Fix NPE in NavigationBarView during bugreport

Commit "Merge Navigation Bar and Pie Controls button config (1/2)"
changed the tag field on the navigation bar buttons. This was not
reflected in NavigationBarView#dump() method, which lead to a NPE.

Also take into account that back and recents buttons may not be
present in the navigation bar.

Change-Id: Ie590608a4ad27753b673320132af7ec42d7a2ade
Fix theme provider crashing for non-primary user.

PackageManagerService's context is for user 0, so if the theme provider
for other users was invoking the getInstalledThemePackages() method, the
themes provider crashed as it doesn't have the INTERACT_ACROSS_USERS
permission.
Fix that (and simplify code) by making getInstalledThemePackages()
return the installed themes for the current user, which was probably the
intent anyway.

Change-Id: I02002cee005b74128f3b2f7cc7a93b9b8514f1f3
Don't assume any ringtone is present on external storage.

If that assumption doesn't hold true, the user will lose his ringtone
and won't know why.

Change-Id: I89409e1351792d020c5458f5104f4bb9f2a040f2
AssetRedirectionService: Check for permissions before running dump()

Fix android.security.cts.ServicePermissionsTest failure

Change-Id: I9d629d19f3ff231db477d156c8bf557d4b8ee861
Fix mobile data button in power widget.

Change-Id: Ide0417768350081250af24518b6831d70196ba73
JIRA:CYAN-1189
Close notification panel when swiping away the last clearable
notification.

Change-Id: I4e5114f66e799a7c80e18b38abce5678da460846
Hide navigation ring if no targets are configured.

Change-Id: Ieca5c700f628e9c990483999367aa48d153fd6a5
Derp fix.

Change-Id: I124eb9e6b74556c6ff4ddb1e5335a758dc9250bf
Framework: Add support to enable/disable Electron Beam (1/2)

Parts were brought over from CM9 but not all of it.  This completes
the port.

Change-Id: I2ab24581ca775ec7af3eecf7e1dcac72c91e3124

Conflicts:
	core/res/res/values/config.xml
Needed for CRT setting
ThemeUtils: Retain the original package name in themed UI context

In order for themes to reflect on system elements, we're changing
their context, including the package name.

This breaks anything that tries to identify system elements,
most notably any users of the uiautomator. Trying to do
'UiSelector().packageName("android")' to find, for example,
a force-close dialog will fail.

Fixes com.android.cts.uiautomatortest.CtsUiAutomatorTest#testUiWatcher

Change-Id: Ic05c3024b20ac3772ed5597846fbfa4a184ebb0d