Release locked buffer when it fails to acquire graphics buffer

The JNI buffer in ImageReader_imageSetup is not released when
it fails to acquire graphics buffer. After all JNI buffers are
exhausted, ACQUIRE_MAX_IMAGES will be returned and leads to
error. The JNI buffer should be released when it fails to acquire
graphics buffer.

Change-Id: I3319a58ac44e36c8593b404672a685c4b589a735
Keyguard: Ensure that a widget and page is attached before attaching the ChallengeLayout.OnBouncerStateChangedListener

otherwise it can result in a NPE due that the page was not loaded. Especially on low end
devices this can happen (see zoomOutToBouncer() method @KeyguardWidgetPager)

Change-Id: I7e940eb2fdf885f158f4c5ff2872ebafcda76da0
Structure device not freed in error case

In case of an error in the call usb_device_get_fd()
the memory created by usb_open_device() is never
freed.

Added a call to usb_device_close in case of error to
release the allocated memory.

Change-Id: Iaa83674f000242d80604dd30c782236f7afd90c2
Fixed a possible infinite loop in JsonReader#skipValue()

Bug: https://code.google.com/p/android/issues/detail?id=65846

Change-Id: Idaa0e75fc5612550c4b9ccb9afa5535ea5b189df
Remove java.io.tmpdir assignment in AndroidRuntime.

This value is overridden by the framework anyway
(see ActivityThread.handleBindApplication). Besides,
it doesn't seem like a great idea to let tools clutter
/sdcard/ with temp files.

Change-Id: I26c710cbea7397f89e6103e54a73044a87da95b1
EGL14.eglCreateWindowSurface should set producerControlledByApp

Interface of Surface class changed.
To reflect the change for EGL14, add producerControlledByApp flag.
Similar change can be seen in 0fa257fe53bf520bdde93996a1901ce6bc3e1788

Change-Id: Ic8911d3131e033747cfdabe59ac2fea1e90bb4a0
Revert "Added sahlnaskh arabic font and give it higher precedence than DroidNaskh"

This reverts commit aea94c1a973cb7113bb933d3765e7896bcb6e1cb.

Change-Id: Ifb42e403af60cc58cff09e07ecb110bb9939e8ab
Revert "Added sahlnaskh arabic font to Android.mk & fonts.mk files to actually get the font installed"

This makes it too small.

This reverts commit b827bd795c9e4b9fc5a7dc5d6739750812ab581e.

Change-Id: I50908eb1a6e87a683eecc671c3e1468b3ecf7745
Fix for positioning of glyphs within a bitmap

For positioning of glyphs within a bitmap, roundf(int + float) is used,
where the float is the glyph position and the int is the text position.
When the text position is varied, this may lead to the sum being rounded
in different directions, due to floating point rounding, caused by that
floating point numbers have different precision in different ranges.

This may therefore lead to slightly different positioning for glyphs and
therefore slightly different widths and heights for text strings,
depending on the position they are rendered at.

The solution in this patch is to use int + (int) roundf(float), which
has consistent rounding, and also enables us to use the full range of
ints.

Change-Id: Id1143cdfcbdfa9915ced878ae04df589a3e03cee
Fixed upgrading from forward-lock application to system application

Fixes the case when the app on system is newer than the
currently installed. Something that can happen e.g. after
a FOTA update.

Change-Id: I102e9cdd5693d5e66667c0c8989dc2643c72dd16
Fix graphics corruption caused by HWUI caches

Some caches(PatchCache, TextureCache, PathCache) for HWUI
uses deferred removal for their cache entries even though
actual resource objects are immediately freed by
ResourceCache.
For this reason, the uniqueness of a resource address in
the caches is not guaranteed in specific cases.
(Because malloc() can return the same address when malloc()
and free() called very frequently.)

So it can be possible the cache have two cache entries for
two different resources but the same memory address.
(Of course one of the resources is already freed.)
It also can be possible mGarbage vector in PatchCache has
duplicated addresses and this can lead to duplicated free
blocks in the free block list and graphics corruption.
(Deferred removal was implmeneted based on an assumption of
unique resource addresses.)

So this patch makes sure resource objects are freed after
the resources are removed from the caches to guarantee
the uniqueness of a resource address and prevent graphics
corruption.

Change-Id: I040f033a4fc783d2c4bc04b113589657c36fb15b
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>

Fix AOSP build - DO NOT MERGE

Change-Id: I42b420c2ce89ce364a2809b28b827964e6923fa1
Code fixes for MSIM Telephony

TODO: Fixes up msim statusbar layout

Revert "Use java.util.Objects instead on internal API"

This reverts commit 0886c6348bd95d87c5f2e62228d82f12232de848.

Change-Id: I6e9f351bf84cd569812a0d5014a3fab4c8444617

Keyguard

Change-Id: Ibc9cf20790b659c02a213611b3d1f6fcaa500dbc
underp PhoneStatusBar

Change-Id: I5ad292d5bddd1d5458ec5f8fba0ed96e0e6a3003
Tiny code fix

Change-Id: Ib0858b64aa4eecc3216e2eacab80ba5268c4d310
Fix tracking of broadcast reference count

Decrement the mBroadcastrefCount when an element is
deleted from mTriggeredUids list. And in failure case
reset mBroadcastRefCount to 0.

Change-Id: Id002bb7a8439ef93eabe031bf318bd424cefc88b
Bluetooth-OBEX: Reduce the MTU size if default OBEX MTU > 8k

Add a check for default OBEX MTU. If MTU is greater than 8k and
setMTU flag is true then reduce the MTU to 8k.

CRs-Fixed: 613931
Change-Id: I5785fd372241f682427ea3aca0b56ac747820d52
VideoView: Correct a type error in the previous patch

- Correct the type error, change "http://" to "https://"

Change-Id: Id914d669a5c9e1fc73f51f428abdc2249b2d52b9
Bluetooth: Fix for FileDescriptor leakage causing ANR

Fix to close the native fds gracefully. detachFD has been removed
in order to close the native fds

Change-Id: I6afca60bcf6adc82ad6a63d8706267d8ed3bd579
CRs-fixed: 623575
Bluetooth: Added new key to store last connected A2dp Sep type

Changes made to add new key and API to store, retrieve the last
connected A2dp Sep type using Content Resolver.

CRs-fixed: 599358
Change-Id: I2648603cc456921ec1896fb498b602416bd79e72
Use java.util.Objects instead on internal API

Not needed since java.util.Objects implements all the needed
functionality.

Change-Id: I996cce37c44fc7325a1824bb51ccf8bee17364b0