Clarify the documentation of SparseArray.indexOfValue.

Bug: https://code.google.com/p/android/issues/detail?id=53297
Change-Id: I28725a2d03d4c11948bfe4fb90d730c86bf41481
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
Fix for NullPointerException in HTML5VideoViewProxy

There is a missing null check of mHTML5VideoView.

Change-Id: Ic49ad02703717c3b76da4371e80abfdebff90873
GlobalAction dialog ref not set to null

When a GlobalAction dialog is dismissed when screen goes into
sleep the reference mDialog is not set to null. Next time the
long presses power button and brings up the GlobalAction dialog
the old reference still exist and we try to dismiss the dialog
again even if it does not exist.

The dialog reference in this case holds on to the dialog object
using more memory than neccesary, and in rare cases we might get
a crash when the dialog object is dissmissed the second time.

Change-Id: I44ef1c385d90777e8f6dd9fe111eb3d9b0d3cf3f
Add argument to binder call to check key types

Before there was only one key type supported, so we didn't need to query
a key type. Now there is DSA, EC, and RSA, so there needs to be another
argument.

(cherry picked from commit b91773bce1126d28a93f73fbef18f3a79245f24e)

Bug: 10600582
Change-Id: I5d2be3c514ff7404a90df76dc263484c5f226e6f
Fix NullpointerException in MediaMetadataRetriever

According to the API documentation and the ICS implementation
the setDataSource(String) method throws an
IllegalArgumentException if path is null. In JB a
NullpointerException is thrown instead. This fix restores
the earlier behaviour.

Change-Id: Ic47baadf91076acc227d92d84f6b8d1d6ecd0c03
Return the actual interpolator of the ViewPropertyAnimator

The implementation of getInterpolator() was always returning null
(probably a quick copy-paste from the default Animator implementation).
This patch fixes the problem by returning the interpolator set by
setInterpolator(TimeInterpolator) or the default one if none has been
set yet.

This patch also avoid creating multiple instances of ValueAnimator in
order to retrieve some default values.

Change-Id: I8880f419f021a8b980fb32bebe927915fde19bf7
Prevent nullPointerException by updateBondedBluetoothDevices

In some very rare cases difficult to identify, it seems that the
IBluetooth.getBondedDevices() returns a Set with a null element.

This patch will prevent calling getBondState() if the device is null to
avoid a nullPointerException.

Change-Id: I9bcad60c37e03c77ec39227e5c947c002a3ae2c7
Orig-Change-Id: I8845f0e6b8fdcda679bc71e2b5c33fd4a52f3ac5
Signed-off-by: Patrick Combes <patrick.combes@intel.com>
Reviewed-on: http://android.intel.com:8080/116592
Reviewed-by: Bondier, CedricX <cedricx.bondier@intel.com>
Reviewed-by: Chen, HuaqiangX <huaqiangx.chen@intel.com>
Reviewed-by: Yao, Yong <yong.yao@intel.com>
Reviewed-by: Aquilone, RaffaeleX <raffaelex.aquilone@intel.com>
Tested-by: Lestienne, ChristopheX <christophex.lestienne@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@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: 90085
Framewors: bluetoothmanager avoid NPE

callback on unregister get sometimes null. Not sure
where it comes from currently due that all instances
calling the unregisterStateChangeCallback are
well. Whatever to prevend the NPE check callback for null
like stated in RemoteCallBackList.java

Change-Id: Ie49c2a507dcecdbdaa155fd1a5d93fc5d6a2baf8
Avoid IllegalArgumentException in Preference.java compareTo()

In some situations the collection.sort() algoritm fails in compareTo()
with a: java.lang.IllegalArgumentException: Comparison method violates
its general contract!, due to a more strict validation of the compare
contract.
This strict validation was introduced in java 1.7.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6804124
This fix should prevent the sorting from crashing.

Change-Id: I64230e7f62f83c99d7a6274964bb2988ae843826
Avoid NullPointerException in getHandler()

mAttachInfo may be set to null by other threads while running
getHandler().

This fix assigns mAttachInfo to a local variable. Checking null pointer
and getting a member variable are executed through the local variable.
This local variable is constant. So NullPointerException doesn't occur
even if mAttachInfo is set to null while running getHandler().

Change-Id: I4013dfb7951bd864628868ed58f8c4f5b7cbd1d3
Avoid IndexOutOfBounds Exception in ActivityManagerService

1. finishActivityLocked() doesn't give guaranty to remove only
   one ActivityRecord from the history stack.
2. Unfortunaly if our topRunningActivity is top of the stack,
   then there is potential IndexOutOfBounds Exception in
   ActivityManagerService.
To avoid it, we can just traverse to the top of the history stack.

Change-Id: Idf06356e643789ccfd493d7097278cea44bdf395