[1/3] base: omniswitch as default recents

OmniSwitch provides broadcast events for showing
and hiding the overlay

We need to make sure that OmniSwitch service is really
running else we will get no recents at all. Also on startup
it will take some time until the OmnISwitch service
has been started.

OmniSwitch will send a service start and stop broadcast
that will guard the usage of OmnSwitch

Change-Id: I31c5ae8839603b6e92b1a4613c793a9427aad2e2

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Frameworks: apple can do...we can do as well

incredible apple engineers speeded up the overall UI and reduced per default slightly
the animation scales. Well we do as well and reduce it from 1 to 0.75...smooth, looks well
and does not break anything

Change-Id: Icbcc889e49c8d3ab24cf2b1c10bbe0e8bf7e7637
Keyguard: Do not show maximized on simpin.

* Show a maximzed widget container on first boot when simpin
  or puk is requested does not make any sense. In this case
  show it as normal view
* A bit codecleanup and centralize
* Fix animation was visible on screnn turn on. Now it is directly
  maximized visible

PS2/3: Whitespaces.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Ied8fe65b6a5cbd019bfc76f72b8d52a5bd8d3a46
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