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

(cherry picked from commit 7971cb0bc06ca63dd10c8838ad47d43749d6f37b)
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>
(cherry picked from commit 449be18df3160cccde8749f1dbbfe62b8d6167f3)
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
(cherry picked from commit a47a1fa3d11d5a353940193c529cc3315e6e9b71)
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
(cherry picked from commit 4a4d3d1434f3be47e5e82895f215dcdb1fb33f1a)
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
(cherry picked from commit ef06048b900ed8f4acbca4b9eb0900541b223d4a)
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
(cherry picked from commit b49fd00ec24d9e0c57c991318cba2791ddc4863c)
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
(cherry picked from commit 522bdade25059f1c10036dd6eb390821ee5bbfde)
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
(cherry picked from commit 2e2abe1f3c94c57248d70ac3b2bcbc0672f6e325)
Make sure we clean up

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

Change-Id: I2646b91970e47ee80a721a2452215b7cae149d10
(cherry picked from commit e5b5747e1fc7b58514fb2513f59ed7db58977072)
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
(cherry picked from commit 81a234de045162e9a27cf0c9aaf34d3a99548317)
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
(cherry picked from commit 6fce50dbc081869de5199a3ef4d56c703a99494e)
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

(cherry picked from commit c928fe12e3243ced1235359d0a7a356a7f403ec8)