Fix PreferenceActivity's isMultiPane on single-pane screens

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

Change-Id: Ic17e939c257ea4c8db02e69bb961432e9deb0d39
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>
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 thumbnail bug

When there was no thumbnail for a given image, the getThumbNail() convenience
method could return a previously-returned thumbnail instead of null.

b/15771860
https://code.google.com/p/android/issues/detail?id=40714

Change-Id: Ibd18e048145bf347469f800afdf436247ea6b693
Add key layout file for Microsoft Corp. Xbox 360 Wireless Adapter

Change-Id: Ieed2d277e3197767c37d63cff0cedb855ee4fb74
Signed-off-by: John Grub <g@greyltc.com>
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
fix a ellipsis problem if a language setting is Japanese

CTS TextUtilsTest#testEllipsizeCallback will fail if a language
setting is Japanese. CTS program inserts the code \u2026 as an
ellipsis, but TextUtils.ellipsize() uses "..."(three dots)
internally.

Change-Id: I29056fc2e00fa45ecbecb794c62e88c78a2f4f7b
Missing break in switch statement

Change-Id: I1b7e7a94df8d39e162050911e31e510d2ce5447e
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 typo - issue 56748

Fixes a typo where the "package"
was misspelled as "pacakge".

Change-Id: I02289a1a3112d771eee7386a224b060ea1ce813d
Signed-off-by: Manuel R. Ciosici <manuelrciosici@gmail.com>
Update javadoc for android.os.Bundle.

Call out the fact that defaultValue is returned if a null
mapping exists for a given key.

bug: https://code.google.com/p/android/issues/detail?id=68453
Change-Id: Ifa6e94c1dee47809f70cadcb668cb98cb8dbef14
SwipeHelper: Ignore ACTION_OUTSIDE touches

  When using the swiper class within a layout like a notification container
  elsewhere the notification shade, when tapping outside even if the finger will
  not move is easy to detect an ACTION_MOVE event. That will consider it like a
  dragging event and the view swipes to left a bit on its own getting stuck
  until next touch. Break if tapping outside, so it doesn't go mistakely forward
  to ACTION_MOVE event case.

Change-Id: I07e5a3a95b8bbebeadcc97ba2d7d1cf787a37e61
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Fixed grammar in the comment that introduces the Debug.MemoryInfo class.

Change-Id: Ic021e689b7a8c55367277875b321358535c04e6a
Signed-off-by: justinmuller <justin.muller@acm.org>
storage: Don't list removed volumes in storage list

 * Don't tell apps that USB storage or empty SD slots are available for
   use. This fixes errors about trying to create dirs in vold as well
   as the relevant CTS cases.

Change-Id: Ic763d40c19b0bb9f7497cc1515baf1661d76e9ee
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 the creation of empty file when screenshot is failed.

The doInBackground function does not check the return value from
compress method in Bitmap class. So an empty file is created when
compress fails.

The original code does not clean up file and DB when it fails to
create a screenshot.

This fix adds check the return value and cleans up file and DB
when compress method fails.

Change-Id: I80182a1cba8dde74a11a84e718a8a93770b1597b
[1/2] base: added settings for flip camera activation

Change-Id: I4674364780ba28d7fb296c969a084244430a91aa