Fix pointer index out of range error in StackTapPointerEventListener

Fix to check that pointer index is valid prior to retrieving
X/Y coordinate information from motion event for tap.

Issue was caused by application dropping events from
dispatcher and ending up in bad state for touch.
This patch prevents a system crash.

Change-Id: I23bf9bb487a89e9a4da9ea368ce9392a392b56d7
Fixed issue leading to state loss about child fragments

Fragments may now access the child fragment manager in
onCreate(). This ensures that fragments that exist in the
back stack have an opportunity to call
getChildFragmentManager().putFragment() and hence save
state that includes references to child fragments in a
reliable fashion.

NOTE: onCreateView() is not called for fragments in the
back stack.

Signed-off-by: Benjamin Dobell <benjamin.dobell+git@glassechidna.com.au>
Fix issue in PhoneNumberUtils.compareLoosely

There is an issue with MMS delivery report where
even if the report was received the status is shown
as pending.

If the number of matched digits is greater than or
equal to MIN_MATCH and if one of the input strings
index has reached the lower limit,
PhoneNumberUtils.compareLoosely should return true.
Currently, it doesn't return true as it is expecting
the index to be < 0 which will not happen for the
following case where country code + number is without
"+" prefix or the number is without country code-

This patch fixes the issue by checking the index <= 0.

Change-Id: I22209e4912388411d863fbd28fe3edb27edbb3b0
Signed-off-by: Jeevaka Badrappan <jeevaka.badrappan@intel.com>
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jian Luo <luo.jian@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 64234
IndexOutOfBoundsException on addPreference in PreferenceGroup

IndexOutOfBoundsException thrown when attempting to add preference
to PreferenceGroup and at same time removing all preferences in list.
Issue is caused by a race condition in addPreference that retrieves
index of where to add Preference from binary search of mPreferenceList
outside of synchronized lock. If list is cleared after this point but
prior to adding preference on index returned from binarySearch
exception is thrown.

Solved by moving binarySearch to inside synchronized block. This will
allow thread safety while not impacting behavior as result from search
is only ever used from within synchronized block.

Change-Id: Ic1e7954cf977b1ddd6ddba98d4cf771f21fb4d57
Fix for breakText returning count of glyphs not chars.

Paint.breakText should return the number of characters measured to a given maxWidth, but it returns the number of glyphs instead. The solution loops through the advances and whenever if finds an advance with length bigger than 0 decrements it until reaching zero or the end of the advances. The advance has a zero when a glyphs is for more than on character, for the subsequent characters. The width of the glyphs is added at the first character.

Change-Id: If26fca3a08133d08572dfda1e33536cc0bd8b1e5