MountService: unlink death notification when unregistering listeners

Change-Id: I09045cfe67f7da84bc68a50fc5440ea2c6b754e5
Modify installd to set the SELinux security context on package directories.

installd already sets the UID/GID/mode for package directories.
Extend it to also call libselinux to set the SELinux security context.

Change-Id: I22d38e3e7facdfcee20a34bf30f1412dbb87761f
stagefright aacenc: Add parentheses in expression with mixed && and ||

This doesn't maintain the exact behaviour, but seems closer to
what the original author probably intended.

This avoids a warning.

Change-Id: I191292faa0a25f715f2b7d46ec770827e2ac0b7b
aapt: Remove terminal pointer incrementaion

When initialization, 'end' pointer refers terminal
character in a string. But it is incremented in
while loop. It occurs the access to non-secure memory.

Issue detail
  http://code.google.com/p/android/issues/detail?id=24896

Change-Id: I751d1154d797738c87a66374a66933528c045be5
Add JNI bindings for some of the libselinux interfaces.

Change-Id: Ifcc68cb06f9f56a04f3bc64dd9906a9436fabc88
Lid switch state is incorrect

InputManager#getSwitchState() returns AKEY_STATE_UP(0=OPEN)
and AKEY_STATE_DOWN(1=CLOSE).
mLidOpen is opposite from a real lid status.

Change-Id: I40aa4e0defb95d82b6144ff6b7514f721bf9030f
frameworks/base: release references of UriPermissionOwner

Change-Id: I72e2310458de15f18e6f2c67f383bbb5c8f60ae2
Merge "Fix length of pattern." DO NOT MERGE.

After skipping * with "token++", the length should decrease by 1 as
well.

(merged from 996b073e813ba1a22a13282ccdebb664f14ba898)

Change-Id: Ie6232ef603bb31e25e03b926e6c1bb92ac34902d
Input: Fix some Applications ANR issue in monkey test

Issue Description:
When do monkey test on some applications, there is big probability get ANR issue. one example is as following:
    adb shell monkey -p com.google.android.street -v 500000

Root Cause:
situation 1. InputDispatcher Thread calls findTouchedWindowTargetsLocked routine, there is a AMOTION_EVENT_ACTION_DOWN event
             and it can find a splittable touched window for this event , then mTouchState.split set to true.

situation 2. WMS Thread calls setInputWindows routine and all TouchedWindows associated with mTouchState are removed ,
             mTouchState.split status still keep true.

situation 3. InputDispatcher Thread calls findTouchedWindowTargetsLocked routine, there is a AMOTION_EVENT_ACTION_POINTER_DOWN event
             and it can find found touched window, exit window loop in following code :
                  if (windowInfo->visible) {
                    if (! (flags & InputWindowInfo::FLAG_NOT_TOUCHABLE)) {
                        isTouchModal = (flags & (InputWindowInfo::FLAG_NOT_FOCUSABLE
                                | InputWindowInfo::FLAG_NOT_TOUCH_MODAL)) == 0;
                        if (isTouchModal || windowInfo->touchableRegionContainsPoint(x, y)) {
                            if (! screenWasOff
                                    || (flags & InputWindowInfo::FLAG_TOUCHABLE_WHEN_WAKING)) {
                                newTouchedWindowHandle = windowHandle;
                            }
                            break; // found touched window, exit window loop
                        }
                    }

situation 4. The following code will have problem after situation 3 in below conditions:
             newTouchedWindowHandle doesn't support split , isSplit is true ( last time touched window is splittable )
             mTempTouchState.getFirstForegroundWindowHandle will always return NULL due to situation 2

            // Figure out whether splitting will be allowed for this window.
            if (newTouchedWindowHandle != NULL
                    && newTouchedWindowHandle->getInfo()->supportsSplitTouch()) {
                // New window supports splitting.
                isSplit = true;
            } else if (isSplit) {
                // New window does not support splitting but we have already split events.
                // Assign the pointer to the first foreground window we find.
                // (May be NULL which is why we put this code block before the next check.)
                newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle();
            }

            The window says it does not want to support splitting, so the touches should go to one of the previously split windows except
            that there are none, which result to "goto Unresponsive" in findtouchedWindowTargetsLocked routine.
            This is not the correct behavior because the user did actually touch something.

situation 5. InputDispatcher Thread will call dispatchOnce repeated to try to dispatch this AMOTION_EVENT_ACTION_POINTER_DOWN event,
             then ANR timeout ( 5000ms ) will be exceeded after several times "goto Unresponsive"in findtouchedWindowTargetsLocked routine.

Solution:
In situation 4 we should drop the touch. If the newly touched window was splittable then we wouldn't drop the touch.
It's only when the newly touched window was not splittable where we will drop the touch.

Change-Id: Iab2c06ce0597ac77eb886ccd9d84646c86723bdb
Author: Jeffrey Brown <jeffbrown@android.com>
Author: Erjun Ding <erjunx.ding@intel.com>
Author: Zhenghua Wang <zhenghua.wang@intel.com>
Author: Jack Ren <jack.ren@intel.com>
Author: Bruce Beare <bruce.j.beare@intel.com>
Merge "Lid switch state is incorrect"
Merge "Input: Fix some Applications ANR issue in monkey test"
Merge "Merge "Fix length of pattern." DO NOT MERGE."
Merge "aapt: Remove terminal pointer incrementaion"
Fix dumpPowerState method

dumpPowerState method shows the current power manger service state but,
BUTTON_BRIGHT_BIT is omitted.

Add a routine of checking BUTTON_BRIGHT_BIT
Signed-off-by: jaiyoung.park <jaiyoung.park@lge.com>

Change-Id: I00484fb384963bafdc58ce89b3251a1f5585d992
Tweak default ignore-assets path

Add .DS_Store to the list of ignored files that are silently
ignored (other dot-files are ignored but aapt emits a "(skipping <x>)"
message.)

Also, add a "!" prefix to the *~ pattern for Emacs/Vim/Gedit backup
files.

Finally, move the !*.scc pattern up in front of the .* pattern, such
that it doesn't match the earlier .* pattern (which is verbose, unlike
!*.scc).

Change-Id: Id3e96490f1802486aea8c58366d43e9d413971b8
Added mpga as valid MediaFile extension

Added mpga as a valid media file extension, it is treated as mp3.

Change-Id: Ie39036d61b6ca50439861fa10be0d824dcc65ed3
Aligning native Parcel implementation to Java.

The Java implementation of writing the RPC response header
calculates the length of the header including the 4 bytes
specifying the header length but the native implementation
excludes the 4 bytes specifying the length from the header
length.
The native implementation has been aligned to the Java impl.

Change-Id: I325bf272a63152d8fded4cf4e51a906b5a9bfe19
Merge "Tweak default ignore-assets path"
Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6.

With SDK 10.6 without _DARWIN_UNLIMITED_STREAMS aapt sometimes fails
right away with the error "Too many open files" when calling fopen().

Change-Id: Ifa7bd8a9530d706aa47f98be8186f1aefe943d76
Merge "Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6."