Fix setting change observing.

The observer doesn't deal with keyguard related options only.

Change-Id: Ib185662f4f8ca7508be3dce10091b5132aa823e1
fix AudioTrack and AudioRecord JNI

AudioTrack and AudioRecord JNI should not cast
jshortArray to jbyteArray. This appeared to work with Dalvik
but causes data corruption with ART.

(cherry picked from commit 9d02848e902d04417df616354db3a18c03e639b7)

Change-Id: Ie36624d3ea06042373c64edced4b5e30b7b1ee86
Fix possible NPE in SyncHandler.onBootCompleted()

If onBootCompleted() was called a second time, it would have throw a
NullPointerException since the queue object would have already been
set to null by the previous call. This commit just makes such an
object behave as an empty queue instead of throwing the exception.

Change-Id: I4472ff89a2a8dc93c3064210d2a49e0063f6efc0
PackageManagerService: fix StrictMode violation in getFileCrC

E/StrictMode(  915): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E/StrictMode(  915): java.lang.Throwable: Explicit termination method 'close' not called

Change-Id: I8d68c05f32c0c299e9102ffccfcb4776e21a5b4b
ActivityManager: reduce reuse recycle

These inner classes are registered as services for each system process to dump information
during certain events like ANRs.  We can combine to reduce memory footprint by eliminating
the redundant inner classes and registered services.

Change-Id: I7c85323fb42ea67503841cc0717ef915ae9c851f
frameworks/base: Update quick launch shortcut icons/resources

Update the existing icons and add "xxhdpi" versions created
from a vector template. This commit cleans also the resource
files a bit up.

Screenshot: http://goo.gl/6CrMYr

Change-Id: I45abee5cf13cd239eb5b4402019afac28d6d5952

Conflicts:
	core/java/com/android/internal/util/cm/NavigationRingConstants.java
	core/java/com/android/internal/util/cm/NavigationRingHelpers.java
	core/res/res/values/dimens.xml
	core/res/res/values/symbols.xml
	packages/SystemUI/src/com/android/systemui/cm/ActionTarget.java
Allow subclasses to override bindPreferences().

Allows them to modify adapter behaviour.

Change-Id: I6767e3988740b674fbdf40a903cd2ef3949ca7db
New navring icons for power menu and last app. Let's follow CM changes

Change-Id: I9a012061faa03879c6769cd5a202acc9d7d1f28b

Conflicts:
	core/res/res/drawable-mdpi/ic_navigation_ring_lastapp_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_lastapp_normal.png
	core/res/res/drawable-xxhdpi/ic_navigation_ring_lastapp_activated.png
	core/res/res/drawable-xxhdpi/ic_navigation_ring_lastapp_normal.png
Themes: Style, boot animation, and wallpaper previews

Change-Id: I2b367bf5336c03f2a4972a05b68922065cd4a701
Fix the bug in replacing a fragment with itself.

Summary:

We are facing a bug that some fragments in our app got removed
randomly. We debugged the app and it seems there is a bug in
the fragment API.

When we we are trying to replace a fragment with itself. We will
try to make the operation a null op, then both `op.fragment` and
`f` will be reset to null.

  op.fragment = f = null;

But since it's inside a loop, if the list `mAdded` still have
items to be visited, the code will continue to the next
iteration. Then it will compare the fragment with null, and
reach the line:

  mManager.removeFragment(old, mTransition, mTransitionStyle);

Eventually it will delete all left fragments in the list `mAdded`.

This diff adds a break to abort the searching after we null
the operation.

Test Plan:

1) Tested with our app. No fragment is randomly removed.

Revert Plan:

Change-Id: I5dc2c07a1bb1d1da1b0fd4e5610d970d55a81e86
Tags:
Signed-off-by: Kang Zhang <kangzhang.cn@gmail.com>
ExpandableListView: Fix to nofity group collapse event

ExpandableListView is created with all groups as collapsed but this
isn't relayed to specified adapter. Fix is to invoke onGroupCollapsed
of ExpandableListAdapter via ExpandableListConnector.

Change-Id: I57614b1efb094ff7828d128c2885f7f009854984
frameworks: Make Spinner widget request the itemtype of the adapter

Prior to that change the itemtype is ignored, this prevent Spinner to
work with adapter containing multiple itemtype.

Change-Id: I1554f5bfd04c972f4eddb6da9d611b7f7ef4e0e7
Fix "pm list permissions" crash if resource string missing

The "pm list permissions" command lists detailed information about
each permission on the system, including its label and description,
both of which can be stored as translatable resource strings in APK
files.  However, it is possible that the resource identifiers for
these strings point to non-existent resources.  When this happens, the
loadText() method throws Resources.NotFoundException, causing the "pm"
command to abort prematurely, simply printing "Killed" to stdout and
a stack trace to logcat.

This commit fixes the crash by explicitly catching the
Resources.NotFoundException exception in loadText() and returning null
if it is thrown.  The loadText() method already has the potential to
return null so none of its callers need be modified.  This fixes the
crash and simply shows "label:null" and/or "description:null" in the
output if the string resource is missing.

Change-Id: I92273399e1dac6029163750d004940ee1da67428
Fix NullPointerException in ListView

There is a NullPointerException in `handleHorizontalFocusWithinListItem()`
because `selectedView.findFocus()` returns null and then there is no null
check when when the assigned variable `currentFocus` is used, although
`View.findFocus()` states that it may return null.

Change-Id: I6897027e9a2a238d9283e6b9f5146198989fcac0
Fall back to "tl" if "fil" is absent.

For JB-MR1, there was a hack that used "tl" where
we really meant "fil" because ICU didn't have localizations
for "fil". This has now been fixed, and we now support 3 letter
language codes for AAPT so we can use "fil" where required.

For the benefit of apps that need to target older platforms,
we fall back to "tl" if the app has assets for "tl" and the
resource locale is "fil".

See bugs 7291355, 7207176 and 8049507 for more context.

Change-Id: I1ac8502525f99b40f9091d5efd2df33518d47a41
Fix broken assumptions in LocalePicker.

This code assumed that the locale is always 5 chars in
length and was of the form xx-YY. This is not necessarily
true. The language can be 3 letters in length and the locale
might have a script and variant.

Also cleans up several nasty pieces of code and eliminates
unnecessary array copies and improves readability by using
idiomatic java.

bug: 15873165
bug: 10090157

Change-Id: Iab1cfd7b78e5772b1245654f2153caf63a96033d
Make sure we clean up

pruneDeadThumbnailFile need to close its cursor
in a finally block to avoid leak resouces.

Change-Id: I2646b91970e47ee80a721a2452215b7cae149d10
Fix Aapt so that duplicate package ID errors are not incorrectly reported.

Aapt falsely reports package ID conflicts unless base packages are included
in strictly ascending order based on their package IDs. This fix addresses
that issue while still detecting and reporting conflicts correctly when they
actually exist.

Change-Id: Ic8059b87f919641d086df88d1556f5fa0063739f
WallpaperManager: add NULL pointer check for getCropAndSetWallpaperIntent

Originally the api 'getCropAndSetWallpaperIntent' does not check
whether the parsed parameter is a NULL pointer, as leads to the
whole app crash if it call this api with a null parameter accidentally.
A null pointer check logic is added into its original parameter check
logic, so that this API will throw an IllegalArgumentException if it
is parsed with a null pointer

Change-Id: Ib7de40e571419d09e1a744edc969eb7162766b75
Lockscreen blur and blur radius (1/2)

Change-Id: Iab92bc2adfc2c861cd4f1baccdba2409a5deb788

Lockscreen Blur: Disable if music is playing

Some apps don't employ full screen album art.
In that case album art doesn't override wallpaper & content behind screen is clearly visible.
This fixes that issue.

Conflicts:
	core/java/android/provider/Settings.java
	packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java