Clear loaders array after they are destroyed.

See change Ia577caecbacb226a3ce525a01a66283efb6ba754 for details.

Change-Id: I9f07eeceaa3829f71008e6f6a38ab849095bd69c
Signed-off-by: Roman Mazur <mazur.roman@gmail.com>
Potential NPE in SQLiteConnection

Change-Id: I4d768bda5ea2fccb4a7c6ce7a5f074bf41563eac
Signed-off-by: Sylvain Becuwe <sylvain.becuwe@gmail.com>
Keep native callbacks when primary SQLiteConnection is recreated

When a database was ATTACHed/DETACHed to a database that had Write-Ahead
Logging enabled, the primary SQLConnection was recreated but the
registered native callbacks were not restored.

Change-Id: I8787fee78e68197ae472e05cc694d11381defa71
Disable usage of WAL in DatabaseHelper

According to SQLite documentation, WAL can not be used when database
partition is not accessible for writing (even when the client just
performs read operation).
However, such situation may happen when the partition is full.
As SettingsProvider should always be able to read a value of ANDROID_ID
from corresponding database, this commit disables usage of WAL.
Without this we risk ending up in a situation where /data is full
and the phone is unable to boot properly.

Change-Id: I1f79bbcd8d0f64bf35dc9d7b846bcfb2664d2eac
Fix PointerCoords Parcel incorrectly storing values as Int32

PointerCoords stores its values as float and its Parcel should
do the same. Wrong behaviour may be noticed when MotionEvent is
injected using Instrumentation method sendPointerSync. All its
PointerCoords values(size, orientation, pressure, etc) will be
casted to integer omitting their decimal part. This fix addresses
this issue.

Change-Id: Ifa3dfce4d5c2e6c060852f4208cb5684e827c7e6
Signed-off-by: Ilya Polenov <daioptych@gmail.com>
DateView: Use Intent.ACTION_LOCALE_CHANGED to refresh notification bar clock

Add the Intent.ACTION_LOCALE_CHANGED to DateView BroadcastReceiver for detect when the
user change the locale. Otherwise, the notification bar clock is not refreshed until
the next tick or time changed occurs.

Change-Id: Ic8830fbabf24b62b60a6d3babe5e211f14948d08
Handle hotplug events as described instead of rescanning

Hotplug events say which display they're for and whether the display
was connected or disconnected. Before, this info was ignored, and the
event just triggered a rescan of all displays. If a display was
disconnected and then reconnected quickly, the rescan would treat this
as a no-op or a device property change and wouldn't turn the display
on.

Now the display manager attempts to update its state with the change
the event describes. So a quick disconnect/connect cycle will cause
the display to be turned on since the display manager will have
updated its internal state to reflect the disconnect event, and will
treat the connect event as a new display rather than a device property
change.

Bug: 7491120
Change-Id: Ia83f7c96b7f16f4c1bed2a73e9b56b0bf7ee3984
Process all display events in order

Display events in each batch received from IPC were being processed in
reverse order, and stopped after the first vsync event (latest
chronologically) was handled. This makes perfect sense for vsync
events, but is broken for hotplug events.

Now we process them all in order, handling all except vsync as we see
them. For vsync events, only the last is reported.

Bug: 7491120
Change-Id: I448d139d21dc27128d75ca1d661de666fff51bcb
MediaStore.Audio.Media.getContentUriForPath() returns unexpected content

MediaStore.Audio.getContentUriForPath() returns an uri to
internal storage if anything but /mnt/sdcard/ is sent in.
This fix checks if there is an additional sdcard
(normally called ext_card) or usb mass storage attached to
the device and then returns an uri to the external db.
The extra sdcard name and the usb mass storage name info is read from
the system environment variable SECONDARY_STORAGE so if a customer
chooses to change the name this will work as expected.

Change-Id: Ib78bca929fe382d4770df895149a0132f0e56994