init: Add "export_rc" command to export env from a specified file

New export_rc command to import environment variables from
a specified file at the time the command is executed.

Differences between "import" and "export_rc":
1) export_rc can only import environment vars
2) export_rc is performed when the command
   is executed rather than at the time the
   command is parsed (i.e. "import")

Example:
in /init.rc:
    on post-fs
        export_rc /system/etc/init.xyz.rc

in /system/etc/init.xyz.rc:
    export LD_PRELOAD /system/lib/libxyz.so

Change-Id: If616dea5b508c27e9f7a95b5e9db696ecea2fdee
sdcard: Allow building as a static library

 * Split main() out in order to allow linking with a multi-call
   executable such as recovery.

Change-Id: I3325135e47e4dd5af3912f5ce67ec64007d54a63
fix up adb to prefer /sbin/sh if it exists

Change-Id: I5c15731c95d123488e90aaeac5b497f556b53363
audio: Changes for LPA/Tunnel mode

 Intitial changes to enable LPA/Tunnel mode

Change-Id: I099480931661c1190b53363d2ee6716a78b81ccb
system/core: Add command NATIVE_WINDOW_SET_BUFFERS_SIZE

Add native window command to set user defined buffer size.

Change-Id: Id6d1f96daba81e8aba83479b5bda6ce0bfabb6e7
init: Bring back support for arbitrary chargermode cmdlines

This was accidentally removed while debugging the init breakage
fixed in change I8ef5c932efcd5e7f8d6f6fce0915683d84c3ee11. Put
it back

Change-Id: If35b9d5db281f8aab6de26f2bb63717d28b2db30
init: add detection of charging mode

Based on Prashant Somashekar's patch which is in turn based on techomancer's
patch http://goo.gl/I19GG.

When BOARD_CHARGING_MODE_BOOTING_LPM is set, init will read that
value (usually from /sys) and enable charging mode when set to 1.

This differs from the original patch in that Samsung-specific lpm.rc
is not loaded, but instead, init.rc is loaded using the "charger" class,
which is how AOSP devices handle charging.

The change is because the either the SELinux or the init.rc changes is
causing lpm.rc to not work, and porting lpm.rc to the Android system
is easier than trying to fix it.

Change-Id: Ice7a074da7e982f9a64aaa97de28bfcbccdc8b91
init: Fix memory corruption when sanitizing platform paths

This commit fixes code that incorrectly increments s when it
hits the terminator character of the string being sanitized.
This means it will randomly start trashing memory beyond the
end of the string being sanitized until it happens to hit two
NULs (\0\0) which will break it out of the loop.

Change-Id: I76553d7f183236a78a0bc7b408e92559b98f732f
toolbox: Add setfattr

Change-Id: I1981604f72d96c9ad38583f03f7f65df1ab865b7

Conflicts:
	toolbox/Android.mk

Change-Id: I3e723c67436a374269767ec2e0594ca35af8d003
charger: allow home button to wake

A squashed commit of the following:

commit 6ce21d726a967b2cc942476758b9ab3851ff39f1
Author: Pawit Pornkitprasan <p.pawit@gmail.com>
Date:   Sun Feb 3 22:21:32 2013 +0700

    charger: do not suspend when handling home

    When using Google's suspend implementation, home press should also wake
    the device from suspend

    Change-Id: I51f3e45c5cb418b0b3718e7223a1336876379043

commit 75a7cf84df719d8cf5cd77093b3f9fee3c09017e
Author: Pawit Pornkitprasan <p.pawit@gmail.com>
Date:   Sat Jul 21 22:09:37 2012 +0700

    charger: allow home button to wake

    On certain devices (e.g. galaxysmtd), the user expects the physical
    home button to be able to wake the device as well as the power button.

    Change-Id: If764f36aba3810dfa5233af8baf0a740b04889e0

Change-Id: I362b227e26bc864a2cad471df799bce2d682ecee
mkbootimg: Support 32K 64K and 128K pagesizes

Signed-off-by: ChampionSwimmer <android@championswimmer.tk>
Signed-off-by: Michael Bestas <mikeioannina@gmail.com>

Change-Id: I0ee608b74a1daefe536b9247f99368f3e043f93d
healthd: charger: only reboot under NORMAL mode

If charger is not launched from normal poweroff charging,
we don't want device to reboot. Just leave charger process
to exit by itself but not reboot when not under NORMAL mode.

Change-Id: I9f6535042d7016e21d172d167069a134c8851fa6
system: core: increase the polling time for remount_ro

eMMC4.5 introduces an addition of cache on the device.
We experienced long flush durations in some of the devices,
and therefore the adb reboot resets the target before the flush
completes.

CRs-Fixed: 562350
Change-Id: I3f54901e12ffd232a7696dadfde1edec99ef91c6
init: Do not call recursive_restorecon on soc.0

During coldboot calling restorecon_recursive on soc.0 causes boot
time delays and failing the framework to bootup.Increase the coldboot
timeout to accomodate recursive restorecon on "/sys/devices/"

Change-Id: Ie364a3ca30db3a1344ea95def04f09660947a13f
Revert "healthd: charger: Support alarm in power off charging mode"

This reverts commit 0041eb9ba5643c99724fa92e79886deb5758c8e1.

Change-Id: I6920564d072c13d9219a90816f4a21bc5f5b63fd
healthd: Support alarm in power off charging mode

To implement this feature need to let the phone reboot some time
earlier than the alarm time.

Change-Id: I6505a99b51932ffa23518769f8fd4d2590021543
adb/fastboot: Support SuperSpeed USB devices

When enumerating USB 3.0 devices, a 6-byte SuperSpeed companion
descriptor follows each standard descriptor. The ADB and Fastboot
Linux clients currently fail to interpret these additional
descriptors and simply bail. Fix this by skipping over them.

Change-Id: I254dad8ed81e8de74a4fac36e8ce54b5da9715fe
Make tombstones directory to not follow symlink.

Use file descriptor to change ownership.

Change-Id: I3e00ccb8496d8d91bae9b78ce5e38e4cabd4a3d6
system: core: increase the polling time for remount_ro to 3600

eMMC4.5 introduces an addition of cache on the device.
We experienced long flush durations in some of the devices,
and therefore the adb reboot resets the target before the flush
completes.
Latest tests show that increasing it to 2400 wasn't enough thus
it was increased to 3600.

Change-Id: Ifbe7af16aa1861d0d57c808b0240361c0317d5c5
CRs-fixed: 581363
system: core: fastboot: Increase USB protocol buffer size to 1024

With USB3.0 SS support the max packet size supported by USB protocol
is 1024 bytes. When connected to a USB device in SuperSpeed, if only
512 bytes are sent at a time the device would interpret each transfer
as a short packet and slows down overall throughput. To accommodate
for SuperSpeed USB bulk endpoints, increase the buffer size to 1024.

Change-Id: I4f447fe38045bc0008e2d6dd3f36c2d6819d6c15