Frameworks: Fix external sdcard mountpoint - (1/2)

Credits: http://forum.xda-developers.com/showthread.php?t=2537793
(cherry picked from commit 5d0ae38c2896f454982d9c3b607803f74f7cf6ec)
Fix FindBugs issues

IntProperty: Infinite recursive loop
SQLiteSession: Null pointer dereference
UsbStoreActivity: Null pointer derefence
LocationManagerService: No relationship between generic parameter and method argument
ActivityManagerService: Call to equals() comparing different types
ChooseAccountTypeActivity: Possible null pointer dereference
RuimRecords: Possible null pointer derefence

Change-Id: I9d631c50c30eb98e32cca5a5085513b6904db676
(cherry picked from commit b6c6242db3d8abba88423019e1fe98e7d4a1f64d)
Don't start keyguard in an attempt to exit it.

exitKeyguardSecurely() will open the keyguard if it's currently disabled
by an app. As this is unwanted here (the user has either already
bypassed the keyguard or the keyguard isn't secure; otherwise he
couldn't click on a notification entry) and as the lockscreen already is
dismissed a few lines above, don't call exitKeyguardSecurely here.

Change-Id: I5582da350d8826e42f9edcd56845a59965865c8b
JIRA:CYAN-99
(cherry picked from commit b874a56936595a02ad6ddd0e98ebfe83aa61a4dc)
SystemUI: fix RecentPanel position in landscape mode.

In landscape mdoe we forcing ltr layout direction. This cause
call to resolvePadding too late and discards paddings
computed by fitSystemWindows. To workaround this we can catch
onRtlPropertiesChanged and force executuin of fitSystemWindows
one more time. To fix scroll issue after padding will be setted
we calling scrollTo with correct position.

Change-Id: I0ac10ac3554142b15114ce7588b61debda27235a

Conflicts:
	packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java

(cherry picked from commit d50ca4019aaa86cc454529494c8970944168a6af)
Fix to NullPointerException when activity is relaunched

When ChooseTypeAndAccountActivity is relaunched and resumed
by ActivityManager a call is made to onActivityResult without
first triggering onResume. This leads to mAccounts object
still being null.

Fixed by properly setting mAccounts object if it is null prior
to use after function onCreate has been called.

Change-Id: Ife7e1e052c473970d923fa43ee6189eb62a1113b
(cherry picked from commit 5bd94ac1c880a83b9ddd3aa3840291a7422632cd)
Keyguard: Set WIDGET_CATEGORY_KEYGUARD when AppWidgetHostView is created

Allows the default lockscreen widget to inherit the keyguard widget
host category.  Without this, only widgets added through
KeyguardActivityLauncher are assigned the correct
OPTION_APPWIDGET_HOST_CATEGORY.

Change-Id: Ic97818d85ca5f00da0ce43bb36006d66a6935363
(cherry picked from commit 75e1d4fe7a94817363e5c1c75dff0a193e6dcf77)
StorageManager: fix android.process.media process stop while plug a discontinuous partitioned SD Card

While get volume state, throw an IllegalArgumentException, catch
this exception in StorageManager and return null to MtpService to
avoid process stoping.

Change-Id: Iebb5c38e375d3f54505d9b9d64fcd0f02a2b60c1
Author: Li Gang <gang.g.li@intel.com>
Signed-off-by: Li Gang <gang.g.li@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: 47459
(cherry picked from commit 98e6485eeb2ffa7f8f6659150b52125823afa70f)
Remove possible leak when exception occurred.

nameUtf8 is not released after exception.
In addtion, Fix code going down after ThrowException.

Change-Id: Id46e8ed55acd98e982ae532f7da2c0c48847f010
(cherry picked from commit b2aec0d43d5fc96d8cfddb1b7aa7058fc6e78d7a)
Wifi: Fix for connection failure between third client and GC.

When third device sends a connection request to the group client, the
existing connection is terminating and also the ongoing connection not
successful.Currently as there is  no use case where third device is
connecting to GC,and the existing onnection getting terminated.This
is addressed by ignoring the new connection request from third client
to GC and the existing connection is intact.
CRs-Fixed: 467049

Change-Id: I784c38b9a4ca0c60b188b9697e3b4af4d09053cc
(cherry picked from commit 16a3c4a0a09016d850cd35e3f38ef42ab916378d)
SystemUI: Add missing recycle calls

Change-Id: I6e5346d9f423350e643d696299136799b78cdd28
(cherry picked from commit 1a0af8df9b68243f6ac15a7647b805bdf238512a)
Correctly set the animation flag of the ActionBar

Showing/hiding the ActionBar is intentionally done without any animation
when done while the Activity is not visible (between onPostResume and
onStop). The issue is the animation flag was not set at all when the
ActionBar was initialized (i.e. getActionBar() called) between these two
lifecycle methods (because mActionBar was null).

A temporary solution is to call getActionBar() to initialize the
ActionBar in onCreate().

This patch simply keeps a flag of the current animation state and
update it whenever the ActionBar and/or the flag has been modified.

Change-Id: Ia28c62410691e95b823d907de0279edaf0592f21
(cherry picked from commit 5eca996d3a3618ba9e846a462c57555136aafb6c)
Update the layer's alpha value upon composition of the layer

Fixes: This patch makes sure that the layer's alpha value is
up-to-date and does not reflect the previous view's alpha value.
it fixes the square block on marquee fading edge when text view
is applied transparency.

Change-Id: I110649db72a75fecc02ba56c201a05773f80328c
(cherry picked from commit a70cf6a2f1e8ad3d4905ff6c8321cfb15494811c)
Memory leak in IInputMethodSessionWrapper executeMessage

In some cases the executeMessage is called with
mInputMethodSession == null. For the messages

DO_UPDATE_SELECTION, DO_APP_PRIVATE_COMMAND

memory is leaked. This commit recycles the args freeing
the allocated memory.

(cherry picked from commit 62f04b2bc286f40bcbf43357ae18829fc072f264)
Fix NPE in ConnectivityService

Could occur when requestRouteToHostAddress is called on a network
with no associated tracker.  Code later in the method handles
this case gracefully but code introduced in JB throws an exception.

Change-Id: I6c8a0e313ecbcca120aeb5dd0802a72114749aa1
(cherry picked from commit 06de9d7fae71c821bff63566e9f652fccda79f60)
Fix a JNI local reference leak in JNIMediaPlayerListener::notify.

Bug: https://code.google.com/p/android/issues/detail?id=62137
Change-Id: I776cd83a66de37fdbbe8af367bf1b26e5e0c7247
(cherry picked from commit d961df884dfdfc3f99cee2ec63ec0f59de9f8627)
SystemUI: update internal state right after hiding transient bars.

Change-Id: Ibcdc45bbf1ce8561fae50f1e026552dbcbcc80ae
(cherry picked from commit d7ee4531cf763f0e3dc5b2245ff6a0e9df9460fa)
Keyguard: smooth background change.

Change-Id: Ia0e4d0000db72b5cdb6fede03791805e34fa311d
(cherry picked from commit 17312e75216d490c5b9877eb90130d22a065f188)
Fix a programmatic smooth scroll bug

Bug: smoothScrollToPosition() stops at child view of which height is
higher than list view itself.

Change-Id: I695ca9db4c706aa7f365967dd3916f9a01917346
Signed-off-by: Yongyi Li <yongyi.li.cn@gmail.com>
(cherry picked from commit bd1844059d9e15361fb224ad432da20713d4459c)
Clear recents screen

(cherry picked from commit 4968c4aadca678c3b70c60b39d2297f4290e11b6)