restorecon /data/misc/media.

Otherwise it will be mislabeled on upgrades with existing userdata.

AOSP: https://android-review.googlesource.com/79022/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Change-Id: Ibde88d5d692ead45b480bb34cfe0831baeffbf94
init.rc: Restored TCP performance tuning

This patch tunes the TCP buffer sizes for high
performance data links including global max rmem
and wmem.

Change-Id: I78dc92bc8190883686678230b0a34a8e32507fa5
CRs-Fixed: 439205 435908
init: Allow load of lpm.rc by parsing a cmdline argument

A usage example could be:
BOARD_LPM_BOOT_ARGUMENT_NAME := lpm_boot
BOARD_LPM_BOOT_ARGUMENT_VALUE := 1
Where lpm_boot is the argument to read, and 1 the value of it when kernel says we should enter offline charging mode

Change-Id: I2b073a0968d65ba9e3bf6b397280241c1fb0c0f9
Add support for -R (recurse) to init chown builtin.

This is helpful for setting ownerships on entire directory trees,
such as sysfs and selinuxfs, particularly when the precise set of
files is dynamically generated at runtime.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>

Change-Id: I81070ea36fd7ffcab4ee8b3ef1bb0028d4b7839c
init: uevent: Add msm video symbolic link handling

Create meaningful symbolic links for video encode/decode
devices based on link_name sysfs node so that video client
doesn't have to rely on dynamic dev node names like device32,
device33 etc.

(cherry picked from commit d26280b5d327994c3c89c573de7738b3f47b8600)
(cherry picked from commit c8f57166fadd26648bd9ee0a979a789c944ccba3)
(cherry picked from commit 72e4c35b308270f44795ebcc196319096397c6c1)
(cherry picked from commit aec73795517e7f49c5ebbea611da612b99ba75fb)

Change-Id: Id308a10d3e601616b63ecd1373809c96f0d04435
init: Check for symlinks with lstat() not open()

Using open() with an O_NOFOLLOW flag will result in a file falsely
being determined to be a symlink if the open fails for another
reason.

For example, a character device that isn't ready due to the
underlying hardware not being initialized yet will fail to open()

An example of this are any CG2900 device files prior to
execution of ste-cg29xx_ctrl

This uses lstat() instead of open() with O_NOFOLLOW to check
whether a file is a symlink or not.

Change-Id: Ie0d8d94b426c84c29b1b04d41a4cc15536cb307c
Merge "Add support for -R (recurse) to init chown builtin." into android-4.4
Revert "sdcard: Allow building as a static library"

For some reason (maybe gcc) the sdcard daemon is broken for some devices

I can't reproduce this error but I got some logs below:

from logcat
http://paste.omnirom.org/view/380f6994

from kernel
http://paste.omnirom.org/view/3ebfe137

This reverts commit 1e8b51531e4d9ff356da0c09da4bf2860d523c8c.

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: I56b0b8c0b50fdc53101494557c773ce717273bd0
Merge "Revert "sdcard: Allow building as a static library"" into android-4.4
init: add a restorecon_recursive built-in command to init.

Functionally equivalent to the restorecon -R toolbox command.

Also, fix error handling and documentation for restorecon command.

<3>[    5.447612] init: /init.rc: 230: invalid command 'restorecon_recursive'

Signed-off-by: Humberto Borba <humberos@gmail.com>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Change-Id: Ia7fbcc82645baf52c6bff0490d3492f458881cbb
init: Add vendor-specific initialization hooks

Allow optional vendor-specific initializations
within init.  This can be used for runtime
initialization setup that init rc scripts do
not support.

Change-Id: I7623a0d59b18f9ec8e3623958e2f7ccd72b877bf
(cherry picked from commit a36f7998a135a63934465889f089f96deefe7c42)
(cherry picked from commit 2ce27688b13bbc9a2237442ec2d6a554325ef658)
(cherry picked from commit 8e4dc4f79011bf0a8832e8d1251fc17b3e542057)
liblog: add required function

Some Motorola proprietaries require a function named __android_log_loggable. This
change adds the function and solves problems with radio and other
binaries on qualcomm based Motorola phones. This code is activated with
TARGET_USES_MOTOROLA_LOG:=true

Change-Id: I722b42d34198c027f265c3cf9f220d9798814915
Merge "init: Add vendor-specific initialization hooks" into android-4.4
Allow a device to define the max number of service groups in init.h

Certain proprieatary binaries (such as tcmd for instance) require
more than 12 supplementary service groups.  By definiing:
TARGET_NR_SVC_SUPP_GIDS := in BoardConfig this can now be changed
per device.

Change-Id: I8f968adc21768ca90232ded7b7e1ffa68dc7ea78
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
init: Allow basic environment variable expansion in env assignment

Allow environment variable expansion in 'export' command if the
value begins with "${_var_}" (where "${_var_}" will be replaced
with the current value of environment variable _var_).  Expansion
will only occur one time.

e.g.
export BOOTCLASSPATH ${BOOTCLASSPATH}:/system/framework/abc.jar
(cherry picked from commit 7940299507f15055851a6e8b61ae8d8a7d7f3484)

Change-Id: If9e4adfa1aba2c7a4ca243978ced3c46c2cb4d73
init: Fix serial number display for semc msm7x30 devices

Add proper check since semc msm7x30 bootloader exports
"serialno" in cmdline instead of the standard androidboot.serialno,
so init doesn't pick it

Signed-off-by: Michael Bestas <mikeioannina@gmail.com>

Change-Id: Ib4e715fafc64dd47fb667aeb63a7307334cca844
charger: allow custom charger res

Change-Id: I9fefc823f72fd34b10073179e9f6d4b1f4831895
Example: BOARD_CHARGER_RES := device/samsung/galaxys2/res/charger
Merge "restorecon /data/misc/media." into android-4.4
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.

Conflicts:
	libcutils/android_reboot.c

Change-Id: Ifbe7af16aa1861d0d57c808b0240361c0317d5c5