Reserve AID_AUDIT

AID_AUDIT will be used by an audit daemon for gathering
audit messages and controlling the Linux audit subsystem.

Change-Id: I95d597524b5547a60f3a59f692b4b0a6df0a9645
Auditd initial commit

Initial commit for an audit daemon that
writes kernel audit messages to a log
file. The daemon runs in uid "audit" or
AID_AUDIT.

The log files are located at /data/misc/audit/
The daemon maintains two files at this location:
audit.log and optionally audit.old. On boot,
if the file is non-zero in size or
when a fixed threshold is hit, the daemon rotates
audit.log to audit.old.

Optionally, if passed the -k option, the daemon searches
dmesg for all lines that contain "audit" and writes
them into the log. After that it continues to operate
as normal, receiving the messages from the netlink
socket.

It also formats the messages so they are compatable with
ausearch (type=<t> msg=<m> format)

Change-Id: I5b5037a5a8b39a054213848249afb7808f8b0ffa

Conflicts:
	auditd/auditd.c
	auditd/libaudit.c
	auditd/libaudit.h
Handle screendumps for all framebuffer sizes

readx() treats a partial read as an error but also consumes the data,
Now exactly the amount of data needed for the screendump is requested.

This bug showed up for framebuffers that were not a multiple of 640
bytes.

Also fix a compiler warning related to handing pipe() failure.

Change-Id: I8b1713923e156d4e3424784152e5dc5cbc7d478d
property: Fix Encryption design issue

Currently, Encryption feature works as below:
1. stop all services in main class, including the ones disabled by default
   and triggered by properties, such as aplogd;
2. load persist props from /data/property to care user changed properties;
3. restart services in main class, pay attention here, only non-disabled
   services would be started here.

So, the issue is mainly on step2.
We only read /data/property, and missed the ones that users never changed,
such as persist.log.aplogd.enable. So that, the services depending on those
properties could not be really restarted.

To resove the issue:
we would re-load all default properties from /system/build.prop and
/system/default.prop, and then load the user changed properties
from /data/property/.

Change-Id: Ia94ead9d525d39fabe193ddd8acc28e2ae57c41d
Signed-off-by: Hong-Mei Li <a21834@motorola.com>
Application return code support for 'adb shell'

Adb shell doesn't return executed application return code.
It's important for testing purpose, for example. This patch
fixes it - adb returns correct return code. Also, Patch
provides some simple infrastructure for adb protocol 'extensions'.
Updated adb provides full backward and forward compatibility.

Change-Id: I32e735100d82d61609c72415ca5b5934a634fa1c
Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
adb: implement "adb reverse <local> <remote>"

This implements the logical opposite of 'adb forward', i.e.
the ability to reverse network connections from the device
to the host.

This feature is very useful for testing various programs
running on an Android device without root or poking at the
host's routing table.

Options and parameters are exactly the same as those for
'adb forward', except that the direction is reversed.

Examples:

  adb reverse tcp:5000 tcp:6000
    connections to localhost:5000 on the device will be
    forwarded to localhost:6000 on the host.

  adb reverse --no-rebind tcp:5000 tcp:6000
    same as above, but fails if the socket is already
    bound through a previous 'adb reverse tcp:5000 ...'
    command.

  adb reverse --list
    list all active reversed connections for the target
    device. Note: there is no command to list all
    reversed connections for all devices at once.

  adb reverse --remove tcp:5000
    remove any reversed connection on the device from
    localhost:5000

  adb reverse --remove-all
    remove all reversed connections form the current
    device.

Reversed connections are tied to a transport, in other
words, they disappear as soon as a device is disconnected.

Simple testing protocol:

  adb forward tcp:5000 tcp:6000
  adb reverse tcp:6000 tcp:7000
  nc -l localhost 7000

in another terminal:
  echo "Hello" | nc localhost 5000

Will print "Hello" on the first terminal.

Change-Id: I761af790cdb06829b68430afa4145a919fa0e6d5