Do not wipe block misc on bootloader msg update

When set_bootloader_message_block() is called, it fopens /misc in write
binary mode, wiping all contents other than what is being written. The
bootloader msg structure is only 1024+32+32 bytes, so some manufacturers
store more than just a bootloader msg on /misc. fopen in read+append
mode so that only the bootloader msg is written and the rest of the
partition is left untouched.

Change-Id: I2d2fbdf067282744864a19d404ca7dc12f688a98
Allow custom bootloader msg offset in block misc

Use board define BOARD_RECOVERY_BLDRMSG_OFFSET with a decimal integer
to define a custom offset where the bootloader message should be
read/written.

Change-Id: Id13a23dd41bb7d907b96d657b8e21eb839dfeaa9
Set SELinux security contexts correctly for init and services.

Otherwise everything is left running in the kernel domain when
booting recovery.

Change-Id: Ie3d86547d5be0b68dd1875a97afe1e00fc3e4da1
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Add seclabel to minivold

Change-Id: Ia5662f4543e4fbb32b02216b64a2f261e22beb25
adbd: switch to su domain when running as root

When adbd runs as root, it should transition into the
su domain. This is needed to run the adbd and shell
domains in enforcing on userdebug / eng devices without
breaking developer workflows.

Use the new device_banner command line option.

Change-Id: Ib33c0dd2dd6172035230514ac84fcaed2ecf44d6
minadbd: remove dead code

Change-Id: Ia1f34a17ae582575f8cd3514ed7bc015b0a5006e
recovery: fix building with pointer-to-int errors turned on

Use intptr_t/uintptr_t to cast between pointer and int to allow
building with -Werror=pointer-to-int-cast and
Werror=int-to-pointer-cast turned on.

Cast to char* instead of unsigned int for pointer arithmetic.

Conflicts:
	minui/graphics.c

Change-Id: Ia862306fdcca53866b330e8cf726f3d62f2248a0
add --shutdown_after option to recovery

The "--shutdown_after" option causes recovery to power down the device
on completion rather than rebooting.

Removes the last vestiges of the "--previous_runs" argument, which
doesn't seem to be used for anything.

Conflicts:
	recovery.c

Change-Id: I465eda2ef59d367e2b1c79a8dc69831263c69a4d
fix vulnerability in bspatch

Patches with control data tuples with negative numbers in the first
and/or second can cause bspatch to write to arbitrary locations in the
heap.

Change-Id: I8c5d81948be773e6483241131d3d166b6da27cb8
exit instead of return if sideload file creation fails

A return here leaves adb sideload in a permanent loop. An exit is
more appropriate for this error.

Change-Id: I80fb8abae4f6378833aa75f9eaf7ec1acd44b274
Signed-off-by: Ethan Yonker <ethanayonker@gmail.com>
Let minivold run in the recovery se domain

The vold secontext doesn't have enough permissions to allow formatting
volumes. CWM uses minivold directly for this purpose, so go ahead and
let it run in the recovery domain to give it all the permissions needed.

Change-Id: I2ca8e5895bd8cba5ffc9f0758264b3f0fbf38943
Touch: slot and tracking updates

Discard type A MT slots if type B MT tracking ID sent: Some devices send
an initial ABS_MT_SLOT event before switching to type B events, so
discard any type A state related to slot.

Track whether ABS_MT_TRACKING_ID was seen in the current sequence to
differentiate between vkeys and hardware keys.

Change-Id: I7ca3bfa4bd82d05ef7f7a208e954898b88bf3865
fix unnecessarily slow writing of EMMC partitions

These were attempts to write partitions "conservatively" in hopes of
fixing the problems with writing the radio partition on Nexus 4.  They
didn't work (a kernel patch was needed), but got left in.  They make
writing of partitions unnecessarily slow (ie, we really shouldn't need
to sync() after every 4kb).  Roll back most of them, but leave the
verification read-back in.

Change-Id: I94badc0979e88816c5aa0485f6316c02be69173c
Tell vold to use the fstype defined in fstab when formatting

If, for whatever reason, a voldmanaged volume had a different filesystem
than the one defined in the fstab, then this filesystem was kept when
formatting. Change the logic to use the filesystem defined in the fstab when
available.

Change-Id: Iffbb5dc42838c1585c21f3ffa66b16921a16abd5
Fix BOARD_RECOVERY_BLDRMSG_OFFSET CFLAG

Including BOARD_RECOVERY_BLDRMSG_OFFSET in BOARD_RECOVERY_DEFINES turns
the define into a string. We need BOARD_RECOVERY_BLDRMSG_OFFSET to be an
int.

Change-Id: Ib75dec0123e6fb318c4c8192645485683c6a5075
Merge pull request #12 from CyanogenMod/cm-11.0

Sync with cyanogenmod