adb: do not chown/chmod files pushed to sdcard

Commit "adb: configure /system file permission with fs_config" can cause
'Operation not permitted' errors when pushing files to sdcard because
chown and chmod are not allowed. Omit chown and chmod operations if the
destination directory has sdcard in the group name.

Change-Id: I05767a2699b152392b4ff1606194826285cbcb1e
adbd: Don't close/reopen FFS ep0 on disconnect

In case of bulk read/write failure or disconnect, transport_usb
calls usb_ffs_kick in order to force the daemon to re-open the
FunctionFS ep files as a way to soft restart the kernel driver.

However, there's no reason to always close the ep0 file, as it
would need to be reopened and the descriptors rewritten--this
is unnecessary, especially in the simple/frequent case of cable
disconnect, and causes the kernel driver to unbind and bind *all*
of the function drivers. This is causing USB Chapter 9 tests to fail.

Thus, try to reuse the same ep0 file handle across reconnects. In
case there is a failure, the ep1/ep2 opens would fail and all the
file handles get dropped. For the adb root case, the entire daemon
gets restarted anyway.

CRs-fixed: 571846
Change-Id: I0840085c52a0795dcb2d751c39aa4a436c039ee2
restorecon_recursive("/sys") speed boot time

Currently, the restorecon_recursive("/sys") call in
init.c takes approx 2 seconds on hammerhead. This change
reduces the delay to 1.2 seconds.

1) Avoid double stat call when using nftw (time savings
of 0.3 seconds)
2) Avoid the repeated calls to is_selinux_enabled() (time
savings of 0.5 seconds)

Avoid calling lsetfilecon if the file is already properly
labeled. This doesn't speed up the restorecon on /sys,
but it should help when handling files on /data.

Change-Id: Icf344edc5bfc9520d3a0ebd9527a065d29832f87
Revert "adb: do not chown/chmod files pushed to sdcard"

This reverts commit cce64d4cb8c7ade0c8fc0ad654632a14a4229f2a.

Change-Id: I9c5d63a72501fc570e1a872807e4236de31f77a3
Fix "adb push /sdcard/filename"

Don't assume that calling chown(filename, getuid(), getgid())
will always succeed. In the case of /sdcard, a file you create
will be owned by root, so the chown call will fail.

Instead, use uid=gid=-1 so that the chown call is truly a no-op.

Ignore the results of calling chmod. Again, for /sdcard, the
chmod call will never succeed, because the file isn't owned by
the shell user.

Bug: 12441485
Change-Id: I11eaf1d6f6049c1158afc29754fbb7af2baf2c78