sr: updater: Use custom bootloader msg offset for stage functions

Edify commands get_stage and set_stage need to be aware of the
custom bootloader msg offset because they write the stage directly
to the BCB.

Change-Id: I155d94ef0a875ddd896c5de0043b8039b9f23194
sr: updater: Fix multi-stage docs and code

* Fix reboot_now comments to reflect actual usage.

* Fix get_stage arg check, it only requires one arg (but allow two
  for compatibility).

Change-Id: I692d626185af24620382f7b318c2b77f643ccfb8
sr: Touch UI

Change-Id: I1c9b78c8fba3c23f2ecddb7659746af0bd12ee55
sr: bu: Show backup/restore progress in dialog text

Change-Id: Id8d7fde4d9bd8b300dc1ee5ea55ac17651019c0f
sr: touch: Only detect release if pressed

This fixes spurious release events for type a devices with
hardware keys.

Change-Id: I866193b34083e6b7b21c91a915c0ed0250fb2ebf
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
Don't abort on read_file if the file is missing.

Change-Id: I85726bf736203d602428114145c3b98692580656
sr: Fix overlay issues

 * Implement double buffering with no memcpy for overlay mode.
 * Move the split display check to the right place, so that the
   sysfs node is actually initialized on initial startup.
 * Cleanup code.

Change-Id: I6d8b249e8ada80fd1a9f83f2e8ca1f762cb78ae5
sr: Fix sideload error paths

 * Stop sideload and re-enable adbd when cancelled from UI.
 * If sideload file is not found, return INSTALL_NONE.
 * Treat INSTALL_NONE as neither success nor failure.

Change-Id: Id4cc0939bad4235fa3b289465c34bc04458dc2e2
sr: Fix overlay harder

 * Use feature test macros instead of QCOM_BSP/MSM_BSP macros:
   - All QCOM targets require overlay and ION.  Remove stub funcs.
   - Split display is detected via MDSS_MDP_RIGHT_MIXER.
 * Alloc ION with ION_SYSTEM_HEAP_ID, as older devices don't have
   ION_SYSTEM_CONTIG_HEAP_ID defined.
 * Put gr_draw back in .bss, it does not need to be on the heap.

Tested and working on p930, mako, e980, find7

Change-Id: I1ec1a70b5d3cb40ee29ad5ae556399bf48bd825b
sr: Only use overlay for MDP 5.x and cleanup a bit

The overlay code currently tries to parse the MDP version to support
MDP 4.0 and higher.  The parsing code fails on most (all?) MDP 4.x
devices because it expects the version to have three digits (4xx).
But the version reported by the kernel only has two digits.  This
means that in practice overlay is only used for MDP 5.x.

Enabling overlay for MDP 4.x revealed the following issues:

 * Older devices with MDP 4.1 and the kernel "mini ION upgrade" such
   as p930 are unable to mmap() the ION memory properly.

 * Newer devices with MDP 4.4 and full ION support such as mako do
   work, but the minui graphics code would need adjusted to work
   because it does not handle the alpha channel properly.

The easiest solution to these issues is to just continue using the
fbdev backend for MDP 4.x.

Also cleanup a couple of error paths while we're here:

 * mmap failure is indicated by MAP_FAILED, not NULL.

 * return NULL when overlay_init fails.

Change-Id: I5236f601fd967111fea736b7382a2295c0551260
sr: Force format /data when wipe_media option is given

Change-Id: I1099fa2d571caa36a8d20db2ff7fc7f30d0f322e
sr: Use in-memory files for SOD and EOD

Change-Id: Ia75203e95837a4a69b420ae769c920992ac6f144