Revert "Bring psx_light on par with fat_lady regarding Settings-Definitions"

This reverts commit e36f9d328c018ca4ea6f75c309348e5f20588aba.
Do integrity_check only once
(Remove multiple integrity_check call for all attached databases)

"PRAGMA integrity_check" checks not only main database
but also all of attached databases.

Change-Id: I9a5940a4b1e27d24432f61961bff117662295e8d
Release SQLite page cache as much as it can

Call sqlite3_release_memory() until it returns 0

Change-Id: Id7a0942805c2c3ad5a7efe8bc3ecd8b7fffbf75b
fix surfaceview bug when surface format changed should not call surfaceDestroyed

formatchange should not destroy surface

Change-Id: I20fa219a4a8ecb7b504518f5eba7e342dd55c569
Author: Hongyu Zhang <hongyu.zhang@intel.com>
Signed-off-by: b529 <b529@borqs.com>
Signed-off-by: Hongyu Zhang <hongyu.zhang@intel.com>
Signed-off-by: Bing Deng <bingx.deng@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 37272
fix bug about view cache in RemoteViews

clear the data in cache before reloading new items,
& the method 'getCount()' returns tmpMetaData.count.

Change-Id: I0d37d7a99408f60b1d63fa5ca0c0a0f265dd0a8a
Handle IllegalArgumentException caused by invalid pointer index

There is no check routine for invalid PointerId.
If we getX or getY from invalid PointerId,
it will make IllegalArgumentException - pointerIndex out of range.
The exception will make system reboot, of cource it random.

Change-Id: I4a5707409ceeaeb31250d88cf69d1f4e27c8a009
Fix leak in videoEditor_renderMediaItemPreviewFrame

This change makes sure that the pString is released
even if any of the error paths are taken later.

Change-Id: I533f8254cb853767a21571cddb1c130f8efde2b4
specified the number type float instead of double.

Change-Id: I5336e8c738fe896c52865ac5f385a8b606889b1c
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
Fix ArrayIndexOutOfBoundsException when restore apk from backup

When the end of the input stream has been reached, writing to apk
stream should be stopped.

Change-Id: I551474ddb4b2af492aad3050e83e5be1d8654ee4
Avoid a double decrease of reference counter for unstable provider

In some APIs unstable provider is released twice.
Unexpected release of unstable provider makes the reference counter
for unstable provider invalid state and it causes application crash.

This change avoids unexpected double decrease of reference counter
for unstable provider by setting null to prevent extra release
in finally block.

Change-Id: Ie2985c316ffcb6a9db7570c46347035c24d226af
Fix to avoid NullPointerException in RecentsPanelView

The content of mRecentTaskDescriptions is loaded in an AsyncTask
in RecentTasksLoader and mRecentTaskDescriptions can occasionally
be null. Added checks to avoid NullPointerException in RecentsPanelView.

Change-Id: I4bb9d39f4bfca948d836114e9792370c36863b45
Finish the window in onItemLongClick() to replace in onStop().

Event will send to new activity to replace "Choose an action" activity.
ANR is voided.

rootcause:
The ResolverActivity is finished in onStop() and causes window state is abnormal.

Change-Id: I926fa4a47ecd04f1f211b29f757dcee720b09dee
Author: Bing Deng <bingx.deng@intel.com>
Signed-off-by: Bing Deng <bingx.deng@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 59540
Prevent SystemUI crash by limiting the number of popups on long click

Recent apps screen shows multiple popup windows by long click
for multiple items. Sometimes outdated popup windows left causes
SystemUI crash. By only having single popup window, SystemUI crash
can be avoided.

Bug: http://code.google.com/p/android/issues/detail?id=66376
Change-Id: Ifc2fbe797a2350ee9ce01092caf6087fab08d0ae

Conflicts:
	packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
Allow line-breaking after close punctuation

Improves the approximation of the Unicode line-breaking algorithm in
StaticLayout slightly.

Change-Id: I9f8a3eed1904bd8482bb5cee4fb7b00ee6667df1
fix wrong transparent computation when background is transparent

1. when a view is set to be WILL_NOT_DRAW, it would check if the background is
null or not, to change mPrivateFlags follow rules:
    a) background is null, add the flag PFLAG_SKIP_DRAW
    b) background is valid, remove PFLAG_SKIP_DRAW and add PFLAG_ONLY_DRAWS_BACKGROUND
so when flag has PFLAG_ONLY_DRAWS_BACKGROUND, it must exclude PFLAG_SKIP_DRAW.

For transparent region computation, the function gatherTransparentRegion check
"non-PFLAG_SKIP_DRAW" case firstly, but it's wrong for PFLAG_ONLY_DRAWS_BACKGROUND
case,since it always has no PFLAG_SKIP_DRAW, it will always match the "if" part and
never go to the "else if" part, and always be taken as a non-transparent region
without checking background properties, which is wrong behavior.

So check PFLAG_SKIP_DRAW and PFLAG_ONLY_DRAWS_BACKGROUND here at the same time to
get the correct transparent computation.

2. In applyDrawableToTransparentRegion, getTransparentRegion of Drawable returns null
sometimes if subclass not implemented, so add opacity check here to make sure get the
correct transparent region.

3. Visibility change can also influence transparent region computation, so request
layout here to make sure the correct result.

Change-Id: I0978e022add002b94541b14c149ec8990e728ac7
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Reviewed-on: http://android.intel.com:8080/130698
Reviewed-by: Yao, Yong <yong.yao@intel.com>
Tested-by: Chen, HuaqiangX <huaqiangx.chen@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 120472