SystemUI: Fix missing top task in recent panel.

If preloadRecentTasksList was not called or was called too
late and RecentsActivty already started and last top activity has
excludeFromRecents flag setted it might be missing
from recent application list.

Change-Id: Idf7153824805ceea9fcaf04ac645b73a5e93a4d9
fb: handle globalmenu in SlimActions not over Powerbutton anymore

We used till now a hacky workaround to show up the Power menu which worked
but is indeed not the best way. Last tweek on it broke 3rd party root application
which use similar hackish workaround.

Whatever make global menu over wm service available and call it from
SlimActions directly. This respects of course the usual security checks
if the device is provisioned etc

PS
- derp
PS
- puh I just should go sleeping :(

Change-Id: Ia12ce467cee0d60741079b3fa2c78449d707a09f

Conflicts:

	core/java/android/view/IWindowManager.aidl
fb: unbreak recents animations on thumbnail click or dismiss recents screen

We load now correctly the recents screen and preload the first task on press
down off any key to get always recents without issues up. We cancel only
if any other key was pressed. I discovered during I am working on new recents
that this solves all issues but has one downside that if he user dismiss he recents
screen or click on one of the thumbnails to bring the choosen app to forground
that of course the last thumbnail is not cleared. Due that the entry animation
and some other things depent on what is currently preloaded we need to cancel
first task to have always in all cases the right animation.

Fix it with just calling cancelPreloadingFirstTask() if the user either
clicked on one of the thumbnails or dismissed the recents screen.

PS
- do the same when all thubmnails are swiped away
PS
- derp

Change-Id: I786c05d929f6a02b6d4928fc4a96aeb9a8e2d03e
Perform NTP lookup at Mobile data connections

If NITZ isn't supported by the current carrier the Android framework
relies instead on a remote NTP server to set the system clock. The
NetworkTimeUpdateService class polls for NTP time during the first 4
minutes after boot, failing to get NTP time within these minutes will
increase the polling interval to 24 hours. Hence, if a data connection
isn't activated directly after boot it can take a long time for the
system clock to be updated. To prevent this situation, NTP lookup is
scheduled as soon as a Mobile data connection has been established.

Change-Id: I046e0330147e7ace4b720a7e70f9d5047d42cfe6
AssetManager cookies should be int32_t and not void*.

Cookies are really indices into vectors and arrays, so
they don't need to be void*. We choose int32_t instead
of size_t to allow their width to be well specified.

(cherry picked from commit ebfdd0f467e39c3af8d92cade78263935340acb7)
(cherry picked from commit a7fa2e592e2e579e5acdb903dba83fc074ebc215)
(cherry picked from commit a9d5701b034ed2d9771b3f0943e1add00741d7cd)

Change-Id: I2aed3db568b6fdc487bf99e2c5dd123206736fda
Fix dest == src bugs in Matrix.cpp.

The main bug was that the AutoJavaFloatArray autoSrc was not passing in
read only. This meant that the destructor overwrote the data which
the autoDst AutoJavaFloatArray had written in it's destructor.
This case only happened if src == dest and the arrays were copies.
Also improved performance by passing in read only a few other places.

Bug: 12570144

Change-Id: Idc8764087dc165433c584b87a0f9d4ed0ec795e8
Fixed race condition in Spinner.DialogPopup on null reference.

NullPointerException is triggered when DialogPopup is
dismissed due to object mPopup being null when not showing.
Race condition is triggered when dialog is dismissed before
touch event to dismiss dialog has been processed properly.

Fixed by adding a null check prior to accessing mPopup object.

Change-Id: I3c4fe9c279d92a7103fb4f68189d1d42beedc606
[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager

Symptom:
When press Home key to home screen, user is able to see the activity's window shown on top of wallpaper and below launcher(widgets).

Root Cause:
The ensureActivitiesVisibleLocked() is called pretty often (for example when a new process bound).
If the top activity "B" was finishing, then the previous activity "A" should be visible.
Therefore, the activity "A" window will be set to visible and then launched activity "A", but it does not updates the visible state in ActivityRecord for "A".
There has a timing issue that if a new activity "C" is started, "C" becomes the new top activity and be resumed.
In that case, Activity "A" window will remain visible even if it is behind a full screen activity "C" because the ActivityRecord.visble of "A" is still false, so the window visibility won't be update.
So when user press home key and back to launcher, the surface of activity "A" will be composed on top of wallpaper.

Solution:
Updates ActivityRecord.visible to true for "A". After "C" is started, the "A" will be called WindowManagerService.setAppVisibility() to set invisible, then called onStop() when execute ensureActivitiesVisibleLocked() again.

Change-Id: I536ba04b95d8d274fea6d679a6493e620bc981e2
GpsLocationProvider: look for config file in /etc/gps.<ro.hardware.gps>.conf

The property ro.hardware.gps can be specifid to allow a single system
image to work with differrent GPS chips.  The HAL layer will use it to load
/system/lib/hw/gps.<ro.hardware.gps>.so.  Add support to GpsLocationProvider
to use the same property to find /etc/gps.<ro.hardware.gps>.conf, falling
back to /etc/gps.conf if the property is not set or the file is not present.

Change-Id: Ib285c4d28b0d0be5e038a1e61822edd8bc6d97d9