Free resources in correct order in ResStringPool::uninit

mOwnedData contains the mHeader data structure

Change-Id: I0ae9ba3a0d18fc3f368c629501fadebce8807198
Update thumbnail when file is updated

When a file is updated, even if it's different content but the same
file name, the thumbnail file is not updated. We need to renew the
thumbnail for another content that uses an existing file name.
"Media.MINI_THUMB_MAGIC" should be set to 0 to trigger creation/re-creation
of thumbnail in MediaProvider.

Change-Id: Iaf5a0ea0c1069a0d7b3b47ee89c2357793278c17
Re-read shortcut labels if the language has changed

The shortcut label isn't updated to the current language
if the phone's language has changed.

The problem was that the shortcut label is stored in a
static variable which is set once and kept throughout the
life time of the process.

Change-Id: I89c5875fbf28fb82e073166c472ca205d28674fb
Move NTP updates outside locks

When the ServerThread handles ACTION_SHUTDOWN intent it sometimes get
stuck on mStatsLock in NetworkStatsService.java.
0  com.android.server.net.NetworkStatsService$5.onReceive()
1  android.app.LoadedApk$ReceiverDispatcher$Args.run()
2  android.os.Handler.handleCallback()
3  android.os.Handler.dispatchMessage()
4  android.os.Looper.loop()
5  com.android.server.ServerThread.run()
This happens when the NetworkStats thread is already holding the
mStatsLock while updating NTP.
0  libcore.io.Posix.getaddrinfo()
1  libcore.io.ForwardingOs.getaddrinfo()
2  java.net.InetAddress.lookupHostByName()
3  java.net.InetAddress.getAllByNameImpl()
4  java.net.InetAddress.getByName()
5  android.net.SntpClient.requestTime()
6  android.util.NtpTrustedTime.forceRefresh()
7  com.android.server.net.NetworkStatsService.performPoll()
8  com.android.server.net.NetworkStatsService.access$100()
9  com.android.server.net.NetworkStatsService$2.onReceive()
10 android.app.LoadedApk$ReceiverDispatcher$Args.run()
11 android.os.Handler.handleCallback()
12 android.os.Handler.dispatchMessage()
13 android.os.Looper.loop()
14 android.os.HandlerThread.run()
Since the NTP update consists of several socket operations it may get
stuck long enough to trigger a System Server Watchdog even though the
socket timeout is set to 20 second.
Further, the NTP update doesn't actually need to be performed inside
the locks and an attempt to change this was made earlier, but the code
wasn't actually moved outside the locks.

Change-Id: Ib37a2b8c2d51a01adb7ff01764f82309433703f0
Allow three digit phone numbers

The comment for the PHONE pattern says:

"<digit><digit|sdd>+<digit>"

But the actual pattern requires that the string contains
more than that. A phone number should be allowed to be
three digits.

Change-Id: I86d2f3d634cd0c1654dad9814906f151055dc23a
Detach engines before destroying WallpaperService

WallpaperService contained a race condition where the service might be
destroyed before all its engines had been detached. For subclass
ImageWallpaper this would leak the engine's BroadcastListener, which in
turn would trigger a system crash (as ImageWallpaper runs as part of
the system).

Change-Id: Ia900173a1d3070cbf6bcf769f68376c8c8cbc62a
Fixing NULL pointer access causing segmentation fault in aapt

In cases where resource packages are generated which does
not have public resources for all resource types - NULL
pointers sneaks into the mOrderedConfigs vector causing
the aapt tool to crash. The solution in this fix simply
ignores the NULL elements when later processing the sorted
vector.

The NULL elements are inserted during applyPublicEntryOrder
function call

Change-Id: I8b7135932e2d235018da2e2f7e09f0d22f1b2f59
Framework/base: Added synchronization block to avoid race condition

Fix for the synchronization issue leading to access of an array
Index out of bounds. Issue occurs due to race condition between
removing the activities of a crashed process from history stack
and resuming a separate activity.

Change-Id: I14bb5834e778c15b674248e46fe93b0ce9f37967