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
restorecon /data/misc/media.

Otherwise it will be mislabeled on upgrades with existing userdata.

Change-Id: Ibde88d5d692ead45b480bb34cfe0831baeffbf94
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Merge "restorecon /data/misc/media." into cm-11.0
adb: Allow configuring the adb shell with a persistent property.

To set to bash: setprop persist.sys.adb.shell /system/xbin/bash

Change-Id: I24e65f4592aaf23356c13db02c9869076df3b841
Add DC-HSPA+ TCP buffer sizes

Change-Id: I5e7ca981ed79a3563215dd7fcef3504c39e973d5
fs_mgr.c: fix i++ error and optimize code

Change-Id: I4d7c9846143ec5b9f76af42c7ee4d5a7c2a3fd6d
Fix overflow in adb_client

Credit: Joshua Drake
Bug: 12060953

(cherry picked from commit e89e09dd2b9b42184973e3ade291186a2737bced)

Change-Id: I8a9b2592a5e4f7527c607abfe4ea6df6eb550aa8
Add a restorecon_recursive built-in command to init.

Functionally equivalent to the restorecon -R toolbox command.
A use case is given by:
I48eaa2b9901ac8c978192c14493ba1058a089423

Also, fix error handling and documentation for restorecon command.

Change-Id: Ia7fbcc82645baf52c6bff0490d3492f458881cbb
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
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)
chmod: Fix for displaying help

Validate options and number of argument to display help

Change-Id: Ia003bd362c44d5d868e68f45c7dcfea50864dc7b
CRs-Fixed: 589737
sdcard: Respect check_caller_access_to_name on readdir() calls

While looking at a blocked path failed as expected when trying
to access it with a stat(), read(), or getattr(), readdir() still
returned the entry, making devices with mounted external storage fail
com.android.cts.appsecurity.AppSecurityTests#testExternalStorageWrite
by trying to interact with otherwise invisible paths.

Fixit by skipping all entries that would've been made invisible at
LOOKUP

Change-Id: Ia8afac0703fa10f78c89046f029776bd290e4846