Don't rely on gcc extensions

Variable-length arrays of non-POD data types are a gcc extension
not currently supported by clang.

Change-Id: I9cd1aed742ac70e642771ff455582727fbafaec2
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Add timerfd backend to AlarmManagerService

On devices without /dev/alarm, use a new backend based on timerfd.
timerfd has near-equivalent syscalls for the /dev/alarm ioctls we care
about, with two key differences:

1) /dev/alarm uses one fd for all clocks, while timerfd needs one fd per
clock type.

AlarmManagerService addresses this by replacing the fd (int) with an
opaque pointer (long) to the backend-specific state.

2) When the RTC changes, the /dev/alarm WAIT ioctl always returns, while
timerfd cancels (and signals events) only on specially-flagged RTC
timerfds.

The timerfd backend masks this by creating an extraneous RTC timerfd,
specifically so there's always something to signal on RTC changes.

Change-Id: I5aef867748298610347f6e1479dd8bf569495832
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Add /dev/rtc backend to SystemClock

On devices without /dev/alarm, use the settimeofday() syscall and the
standard RTC_SET_TIME ioctl (which are collectively equivalent to the
ANDROID_ALARM_SET_RTC ioctl).

Change-Id: I3c1d741099e253186e43c9369b62603b214b9c9a
Signed-off-by: Greg Hackmann <ghackmann@google.com>

Conflicts:
	core/jni/android_os_SystemClock.cpp

Change-Id: I3c1d741099e253186e43c9369b62603b214b9c9a
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

Conflicts:
	libs/androidfw/AssetManager.cpp

Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
Remove duplicate code in Editor.java

Eliminate duplicates by calling resumeBlink()/suspendBlink().

Change-Id: Ia19ae1bf1a5c981700aa20be67ed9d557e2bfc56
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
Prevent MediaScanner infinite loop with invalid path

including double slash  "/storage/sdcard0/xx//xxx/xxxx"

Change-Id: I112a70c88b5ec662482b79c3151310b9b9b52e40
Memory leak: parseObbFile.footer

Change-Id: Ia9e005e63fad7ab364f6c2c80cb98ec98f89b470
Signed-off-by: You Kim <you.kim72@gmail.com>
fix possible buffer overrun and memory leak

Use snprintf instead of sprintf and fclose() before return.

Change-Id: I3ed193464cc0dc90e9935ae19162667ad367628b
Merge changes I3ed19346,Ia9e005e6,I112a70c8,Ia19ae1bf,I5820f382,I3c1d7410 into kk44

* changes:
  fix possible buffer overrun and memory leak
  Memory leak: parseObbFile.footer
  Prevent MediaScanner infinite loop with invalid path
  Remove duplicate code in Editor.java
  Fix a variety of small publicly-reported bugs.
  Add /dev/rtc backend to SystemClock
Merge changes I5aef8677,I9cd1aed7 into kk44

* changes:
  Add timerfd backend to AlarmManagerService
  Don't rely on gcc extensions