Do not kill app when closing floating window

Change-Id: I151a475cd81354153951549a6f752b771f04be30

Conflicts:
	packages/SystemUI/src/com/android/systemui/slimrecent/RecentPanelView.java
Revert "listview: ensure active views are filled prior than scrap views"

This reverts commit 949778342a92979122ebba273dbf004422142f9b.
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

Conflicts:
	core/java/com/android/internal/app/LocalePicker.java
MountService: Check for null pointer when looking for vold code

* There is actually no code path that will set an event into
  NativeDaemonConnectorException, so any reference to the event code
  will result in a null pointer exception, taking down MountService and
  the rest of the system with it.

Change-Id: Id62f724953aacc363b3455584c6a3ad1381c6138
Fix bi-directional text advances error

This bug occurs when bi-directional text is split up into left to right
(LTR) and right to left (RTL) runs. computeRunValues is done for each
run and the previous advance values are overwritten due to an offset
error. This change make sure that all new advance values are written at
the end.

Change-Id: I22cc0ae43ea9fe7862dc58ec33d7bcf8597ccbac
Fix systemServer crashes while running cts.

While running android.location.cts.LocationManagerTest on the Emulator,
the systemServer would crash on several tests (even if the test passes).
This is caused by calling enableProvider(NETWORK) when a NETWORK location
provider is not available.

Change-Id: I380ae59250196d8f35ca402f4d1b2c10f6d6dd22
Signed-off-by: Douglas Leung <douglas@mips.com>
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
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 wrong transparent computation when background is transparent

1. when a view is set to be WILL_NOT_DRAW, it would check if the background is
null or not, to change mPrivateFlags follow rules:
    a) background is null, add the flag PFLAG_SKIP_DRAW
    b) background is valid, remove PFLAG_SKIP_DRAW and add PFLAG_ONLY_DRAWS_BACKGROUND
so when flag has PFLAG_ONLY_DRAWS_BACKGROUND, it must exclude PFLAG_SKIP_DRAW.

For transparent region computation, the function gatherTransparentRegion check
"non-PFLAG_SKIP_DRAW" case firstly, but it's wrong for PFLAG_ONLY_DRAWS_BACKGROUND
case,since it always has no PFLAG_SKIP_DRAW, it will always match the "if" part and
never go to the "else if" part, and always be taken as a non-transparent region
without checking background properties, which is wrong behavior.

So check PFLAG_SKIP_DRAW and PFLAG_ONLY_DRAWS_BACKGROUND here at the same time to
get the correct transparent computation.

2. In applyDrawableToTransparentRegion, getTransparentRegion of Drawable returns null
sometimes if subclass not implemented, so add opacity check here to make sure get the
correct transparent region.

3. Visibility change can also influence transparent region computation, so request
layout here to make sure the correct result.

Change-Id: I0978e022add002b94541b14c149ec8990e728ac7
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Reviewed-on: http://android.intel.com:8080/130698
Reviewed-by: Yao, Yong <yong.yao@intel.com>
Tested-by: Chen, HuaqiangX <huaqiangx.chen@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: 120472
Fix PreferenceActivity's isMultiPane on single-pane screens

isMultiPane returns true incorrectly on single-pane screens when under a
preference header.

Change-Id: Ic17e939c257ea4c8db02e69bb961432e9deb0d39
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
PorterDuff Mode comment is inconsistent for SRC_OVER, DST_OVER

I removed Rc.

Change-Id: If3aae9b6e5612358ec7308e633ee91239e3f2af2
Signed-off-by: NoraBora <noranbora@gmail.com>
SystemUI: Fix potential NPE

Does already cause issues on some Halo ports to other ROMs.
Might not cause issues on PA (yet), but better safe than sorry.
KeyguardViewManager: reduce IO for lockscreen and accelerometer rotation

also get rid of a trivial getter

Change-Id: I18eabd2dcab46af6eba41840ad95a79349aefbb0

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