This fixes kernel panic on find7 when disabling MTP before flashing zips.

Change-Id: Id11a0fb1a88424d9dd70190c313781607bad3bb8
EPOLLWAKEUP handling in minui/events.c

Older trees may not have EPOLLWAKEUP defined so we will work
around the lack of EPOLLWAKEUP support as best we can. This should
only maybe affect how charger handles waking up the screen in off
mode charging in older trees. No impact on TWRP itself.

Change-Id: Ia72ebfc12778b2bcda648edc27d2092c2ead415c
Fix generating symlinks for older trees

Symlinks for unpigz, toolbox, and busybox were not generating in
older trees.

Change-Id: I3ca2a2047510954e66fb3cf49eef6af713d3268e
Revert "Fix USB Mass Storage on some devices"

This reverts commit 9eb1cd47520498e181a2d9fb2f3b464ae5327bd8.

Change-Id: I66d3d6bb5633e6df3e8f7db250fc6d62817a5489
Fix loading of png images in custom themes

Change-Id: I7eebc474c025eda534adb04d061795623ebecdda
Attempt to set the proper uid/gid/contexts on new files and dirs

Files and folders that we create during backups, copy log, or MTP
operations often do not have the proper uid/gid/contexts assigned.
We will attempt to read the proper contexts from the settings
storage path and assign those same contexts to any files or dirs
that we create.

Change-Id: I769f9479854122b49b499de2175e6e2d026f8afd
Improve resource error logging

Actually display the name of the item or the filename of the item
that we were unable to load in the log to make it easier to
determine what went wrong.

Change-Id: I027b35aab286e4d0f1957bcfb28ed40d81f9bbb2
Fix compiling of dosfstools for arm64

Change-Id: If99d0be4b73cdeb388c6cb1b35a215d3b8b3b58d
Fixes for compiling crypto in older trees

Some of these fixes needed to be made anyway. Note that older
trees will still need to have files / repos copied into them from
newer trees. Namely we need:
system/security/softkeymaster
hardware/libhardware/include/hardware/keymaster.h

Maybe others as I did not document very carefully what I was
pulling in.

Change-Id: I465fd1fbe228803ec02fba047b151f07ea13d5ca
recovery-twrp: set RGBX_8888 color offsets only if not already initialized in inverse order

Workaround to achieve compatibility between the nameless oneplus
kernel and the framebuffer driver in omni's oppo kernel that still
expects color offsets in a non-standard inverse order (see change-id
I5068897f18e1d119a9bb7f1fe59f9b662153e1b0).

This fixes the failing framebuffer initializiation in twrp with the
nameless oneplus kernel.

Change-Id: I8a85809314596500ef8eb71797e098643299f22c
crypto: add missing header

Change-Id: Ia01a82eb856abaa6cd1ed45b88741a518974ba68
init: import init.recovery.target.rc

Change-Id: Ib9b4825b7047fe05625f3e6f26c5456af8982ab8
Add support for custom kernel headers

Change-Id: I39fe4de8919e59dd75e8cb535fa0648948035c26
Fix adb sideload page on 1440x2560 layout

Change-Id: If79086b0128e57087fd87f07d56984eb2a15d8b2
Update SuperSU to 2.40

The SuperSU install process is getting rather complicated, so we
will modify the install script slightly and use it to install
all the things and stop trying to check to see if root permissions
have been lost like we used to do.

Change-Id: Ibdb64c909d2bd16e12bb35b4f31f572cc29add47
Toggle MTP during ADB sideload

Windows does not do very well if you try to sideload while MTP is
enabled due to drivers. This will toggle MTP off and back on if
MTP is currently enabled before and after a sideload operation.

Change-Id: I022dbedecc97565b50b6ae1fda8922b822f63440
Fix include paths in crypto

Change-Id: Ia9fd0cd75bd6ee6e14909890cb18a8edb3b22267
Recovery init.rc setenforce 0 to make SELinux permissive

This will only work if the sepolicy is changed by also applying:
https://gerrit.omnirom.org/10924
Otherwise the sepolicy will deny the request.

Change-Id: I8a52cdfdd38bda19aa89686ff0ad31b90e1aa3b7
MTP add/remove storage instead of disabling MTP

Implement a pipe between TWRP and MTP to allow TWRP to tell MTP
to remove storage partitions as they become unavailable (e.g.
during a wipe, unmount, etc) instead of disabling MTP completely.
This includes some fixes and improvements in destructors to
properly remove / delete various items. This also means that we
will not be toggling adb off and on quite as often.

I do not like that we had to add another thread, but we were
unable to use select() on the mtp_usb character device because
this device does not support polling. Select always returned
indicating that the mtp file descriptor was ready to be read and
the resulting read would block. The read block prevented us from
being able to include reading of the pipe between TWRP and MTP in
the main MTP thread.

We might want to add a return pipe letting TWRP know if the
removal of the storage device was successful, but I am not sure
how we want to implement this. It would invovle timeouts in both
TWRP and MTP to ensure that we returned a failure indicator in a
timely manner to TWRP and prevent deleting the storage device in
the case of a failure. Right now we make no attempt to ensure that
an MTP operation is underway like a large file transfer, but we
were not doing anything like this in the past. In some respects we
have limited control over what happens. If the user installs a
zip that unmounts a storage partition, we will not know about the
change in storage status anyway. Regular Android does not have
these troubles because partitions rarely get unmounted like in
recovery. At some point, we have to hold the user accountable for
performing actions that may remove a storage partition while they
are using MTP anyway.

Ideally we do not want to toggle the USB IDs and thus toggle adb
off and on during early boot, but I am not sure what the best way
to handle that at this time.

Change-Id: I9343e5396bf6023d3b994de1bf01ed91d129bc14
variables: append "-nameless" to version string

 * to make users aware that it is not official TWRP

Change-Id: I8ce884f117e262039dcd711f8ca29296e6d2e521