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