Memory leak: parseObbFile.footer

Change-Id: Ia9e005e63fad7ab364f6c2c80cb98ec98f89b470
Signed-off-by: You Kim <you.kim72@gmail.com>
Before requerying a cursor, check if it is closed.

Before updating a cursor,
it needs to be checked if it is valid.
Currently a defence code only checks
if it is not null.
But in case of "Cursor", it is not valid,
if it is closed.
So just like in CursorAdapter.onContentChanged(),
add the additional defence code to check validation.

Change-Id: I1302f1b6d009897815d4bdb2f20f625688cf9901
Add NULL check in updateProxyConfig

If the exclusionList was null in updateProxyConfig the VM would
crash when converting it to a UTF8 string. Avoid this by adding a
null check.

Change-Id: I0d8106fd54385bd9ae9c652a6c67d459a119cf2b
MountService listeners can not be unregistered

When unregistering MountService listeners, their Binder proxy
objects were compared to registered listeners instead of their
backing objects.

Change-Id: Ie98a686b1d17544f1eda59fb3eb0dc02d836c1b2
Fix preference puts with "null" values.

Null values were being written out as <null /> elements in the
XML prefs file (as expected). This allowed the getFoo() functions
to work correctly because they treated null values as missing mappings
but containsKey would fail.

bug: https://code.google.com/p/android/issues/detail?id=64563
Change-Id: I1f466d01db96bf26e208d4fed3a6f257228bea5d
onAccountsUpdated shouldn't be called back after listener unregistered

There is a problem of AccountManager that onAccountsUpdated() is
called back even after the OnAccountsUpdatedListener is unregistered.
It may cause application crash.

For example, when rotating a tablet 180 degree with Settings apk
running, com.android.settings.Settings is re-launched 2 times
successively. (Destroy->Create->Destroy->Create)
It repeats adding&removing OnAccountUpdatedListener.

When dialog was being opened in the following cases,
NullPointerException at BackStackRecord.getBreadCrumbTitle()
was happened on 10 inch tablet which has 2 panes on Settings.
* Settings > Language&input > Language
* Settings > Language & input > Text-to-speech output > Speech rate
* Settings > Wi-Fi > Menu > Advanced > Keep Wi-Fi on during sleep
* Settings > Wi-Fi > Menu > Wi-Fi Direct > Rename device

This fix prevents the undesirable callback.

Change-Id: I081f69c90539cca821cf686b4587495135f375e4
ProcessList: use different polling interval when screen off

We are using the same time interval for both screen off and screen on.
For process on top: ActivityManager.PROCESS_STATE_TOP, we will poll PSS
information every 120 sec.
During polling PSS, we are grep /proc/%d/smaps which is a 10k lines file.
This cost quite a lot of CPU resource. But when screen off, we don't need to update
TOP process PSS so frequently since we are not operating it. Lower polling
circle to every 15min to reduce power.

Change-Id: Ia4cd26290d44d066f034d5270ce5523650a3c493
Fix visibility of multiple non-fullscreen activities.

Issue detail:
Assume X, Y are non-fullscreen activities.
 a.Home starts an activity X in task A in application stack.
 b.X starts an activity Y in <task A> or <new task B>
 c.Activity X will be invisible.

How to fix:
Because the function "isActivityOverHome" means an activity is able to see home.
But there may have many non-fullscreen activities between the top non-fullscreen activity and home.
If flag "behindFullscreen" is set, those middle activities will be invisible.
So it should only take care from who is adjacent to home.
Then check two flags frontOfTask(task root) and mOnTopOfHome for constraining the condition.

Change-Id: I60bcea304976414e44835a0a38675aae365e9e19
Add explicit close of Scanner input

The UsbDeviceManager is using a Scanner to identify
the ALSA card/device numbers to use for USB Gadget
audio, with a FileInputStream as its input.

Since FileInputStream implements the Closeable interface
it provides a close() method that should be explictly
called in order to close the stream source and release
any system resources that it might hold.

Change-Id: Ia0ff86d1f3cdf8916becec9c8603915dcbf4d2c8
Fix memory leak in PatchCache

Patch object should be deleted when removing its corresponding
cache entry from PatchCache.

Change-Id: I8dfd7f557f6e5c6e9a9c04ba915372790e6f34f5
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
Keyguard: don't refresh ui when screen off

KeyguardStatusView is doing refresh all the time,
which cause high power when screen off.

Change-Id: Ifabdde4419a23e919cd52fe77e78ec3160575af1
Bluetooth: HID: Add support for HID Device Role

This patch adds the HID Device Role support in Bluetooth framework.
Also AIDL and callback related files for HID Device role are added
to provide interface for third party applications to communicate with
HID device Service.

Change-Id: Id03a362b7bcfa2e76056fa0197eaac12ce49b5a2
CRs-Fixed: 573086
Bluetooth: Changes for LPP and extended LE scan

This patch includes implementation of a new Bluetooth
Adapter named QBluetoothAdapter for implementing LE
specific tasks that the default adapter doesnt perform.
This patch also implements Low power proximity and extended
LE scan functionality based on service UUIDs.

CRs-Fixed: 581289
Change-Id: I63e0593f79c8929d4e18cee0472fcb401c8892e7
OBEX: Reduce Obex MTU size for A2DP or SCO concurrency

Reduce Obex MTU to 8k from 64k when OPP send is tried with
SCO / A2DP streaming in progress, so that the continue
response for first complete Obex PUT packet is received
from SOC within 50 seconds time frame.

CRs-Fixed: 571865
Change-Id: I1eae114f57f2a92ee4b26c82d8f55fafe02775b8
Bluetooth: Cleaning up sap service object to avoid serviceRecord leaks

A case where script is running to do BT ON/OFF 2000 times. Sap service
class object is leaked while turning OFF BT, when it is referenced
(Directly OR Indirectly due to its member variables). So Garbage
Collector doesn't collect class object which is referenced. Setting
NULL for service class object & service connection, while cleaning up
those variable to mark as weak reference. Any objects memory is
immediately claimed by GC, which are marked as weak reference.

Change-Id: I905d1e542c159c8f9addcb8491aee900697c9006
CRs-Fixed: 591180
Bluetooth: Fix to avoid framework reboot during monkey.

A case where monkey is running & sometimes framework is
disconnected due to unhandled java Exception during the
binding of DUN, SAP, HID device & PAN service on unsuccessful
binding. So it never handled. Handing java exception while binding
DUN, SAP, HID device & PAN  services to solve this issue.

Change-Id: Idea710593a3f9496305f636042605303e73e7749
CRs-Fixed: 564709
Fix a variety of small publicly-reported bugs.

Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp.
https://code.google.com/p/android/issues/detail?id=61556

Missing fclose in core/jni/android_os_Debug.cpp.
https://code.google.com/p/android/issues/detail?id=61546

Bad loop guards in core/jni/android_util_Process.cpp.
https://code.google.com/p/android/issues/detail?id=61557

Assignment to wrong variable in libs/androidfw/AssetManager.cpp.
https://code.google.com/p/android/issues/detail?id=61560

Missing delete[]s in libs/androidfw/ObbFile.cpp.
https://code.google.com/p/android/issues/detail?id=61549

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
Make SurfaceView layers captured by screenshotApplications()

Since SurfaceView layers are located below application layers,
SurfaceView is not captured by screenshotApplications()
when the application is running in fullscreen.

Moreover, ws.isFullscreen(dw, dh) returns mostly true
on the devices which do not use the navigation bar.

Change-Id: Ia1036c79054950384a97504714929fd85c8147de
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
wlan: Do not disable the network on Assoc Reject/Authentication Failure.

A failed network, if disabled, would result in no further connection
attempts for the same.Thus, do not disable the network rather enable
all the disabled networks, as supplicant shall disable the networks
temporarily on subsequent failures and would give fair chance to
select the prioritized networks.

Change-Id: I27bfdfed420e935c1bc21fb968d6a5ba75ca92aa
CRs-fixed: 582883
Bluetooth: HID-C: Add support for error parameter for reportError

This patch adds support for error parameter in reportError providing
better flexibiltiy to application to respond to errors for Set Report
received from HID Host.

Change-Id: Ieada7be8a6a91d310f20849af9e5a9b04766f4a5
CRs-Fixed: 595139