Fix deadlock of WebViewCoreThread

There was a deadlock in destroy process.
Investigation showed that WebViewCoreThread is waiting some
callbacks but in this case WebViewCoreThread can not resume
itself not to call notify method.

Flow:
1. CallbackProxy.sendMessageToUiThreadSync
2. WebViewClassic.destroy()
3. CallbackProxy.blockMessages()
4. CallbackProxy.handleMessage is called via MainThread
5. The WebViewCoreThread deadlock is occured.

The cases we have to call notify method are followings.
OVERRIDE_URL
CREATE_WINDOW
SAVE_PASSWORD
NOTIFY
OPEN_FILE_CHOOSER
JS_ALERT
JS_CONFIRM
JS_PROMPT
JS_UNLOAD
JS_TIMEOUT

Change-Id: I9d95ae500bf6338d77b32b5fa15de7cff5720d0f
Avoid NullPointerException in getHandler()

mAttachInfo may be set to null by other threads while running
getHandler().

This fix assigns mAttachInfo to a local variable. Checking null pointer
and getting a member variable are executed through the local variable.
This local variable is constant. So NullPointerException doesn't occur
even if mAttachInfo is set to null while running getHandler().

Change-Id: I4013dfb7951bd864628868ed58f8c4f5b7cbd1d3
fix build
Fix CalendarView to show the month title properly.

Step to reproduce:
Do this test on a Tablet (i.e. do in multi-pane layout)
1. Settings > Date & time > Uncheck the Automatic date & time checkbox.
2. Select 'Set date' and set the month to January and Done.
3. Re-select 'Set date' then you will find no month title just above the calendar.

Change-Id: I2489b454a4526be13f1fbdc61a72edcd6b6942a0
Consider mScrollX when drawing the checkMarkDrawable

When mScrollX has a very large value the checkmark will not show,
unless it is considered when setting the bounds of the drawable.

Change-Id: Ic4c9bce950816686622baa7330ebb2e69ecfb8e6
when locale is non-Enligh, sometimes month spinner needs a number IME

When locale is non-English like korean, chinese, etc.,
month displayed string is started with number.

So, It's better to use Number IME for month selection.

Change-Id: If0444d62679b1f31d98fdedd2f06c2d445cade2a
Fix DatePicker's spinner order in various locales.

DatePicker always effectively uses yyyy MMM dd, so we need to ask
icu4c what order those should appear in for the user's locale. The
existing DateFormat code was an approximation that worked for en_US
but not for all languages (fa being one example).

Bug: 7207103
Change-Id: I7b12568dbc02522ebad6e1db5f8426109cd6f7ce
Show CJK dates as all-numeric in the DatePicker.

Before, we'd have something like 2006 4月12. After, we have 2006 4 12.
The alternative would require using custom NumberPicker.Formatter instances
for the year and day fields in these locales, and that seems significantly
more disruptive.

Bug: 8766552
Change-Id: I568578aae2f80f2acfc53cd277ef3beae6743472
FastScroller: Fix to use appropriate index

Fix FastScroller to use appropriate index to determine the
the position of a section while calculating the y coordinates
of thumb. In case of last section, use totalItemCount to determine
next section position.

Change-Id: I89bfd483949b5c14f85303b50380a73b4a4e635e
Fixed incorrect calculation of dirty invalidation area

Padding was already taken into consideration before calling
invalidateDrawable in ProgressBar.

Change-Id: Id7f23bd15bb19e2294c07adb2acb397100ea97e8
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

Change-Id: Ic9b1673248183060ba7279b63648a85dc39ca3b9
fix white space errors
Use the newer ZoneInfoDB API.

Change-Id: I846c720ae6c262afb4fd7f8a749008c837e76cc4
Use ICU for getDateFormatOrder.

Bug: 7207103
Change-Id: I680bb727cb74cd4b050f237f036d9e696201fc0b
Correct Date format for el_GR, sv_SE and tr_TR locales

Amend DateFormat.getDateFormat to CLDR data from icu4c
instead of locale specific resource entries which are incorrect
for several locales.

No CTS tests are added as they require changing the locale which
is not currently possible.

Bug: https://code.google.com/p/android/issues/detail?id=56385

Change-Id: Ibd11c7fd9b595e19a3e2bf508e1585aa50067e03
Signed-off-by: howardb <android@howardb.com>
Switch DateUtils.formatDateRange over to an icu4c-based implementation.

Bug: 7289514
Change-Id: Ia382f49aa23737bde91b7891d95545da084ec57c
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
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
Replace native Process getpid/getuid with calls to libcore equivalents.

The Process natives were getting called were getting called while
handling a jdwp packet before the vm had a chance to register them.

(cherry-pick of 5bce6a308fc8a3c1e449cf905b8b6e8ace4ef3e2.)

Change-Id: Ia2b4f79b11e427283a712b2d0c52948f394640bf
Switch Process.myTid over to the libcore JNI too.

Change-Id: I80eaecff014fabf809f4be3c9ee8b26aa64bf0cf