Fix executing hooks with different prototypes

Note: performance penalty unknown
v35
adjust license notice
v36: Merge upstream changes

Included commits (all for Android 4.3):

commit 68a032936e5922ddda271c751400b64712f8f03b
Author: Nick Kralevich <nnk@google.com>
Date:   Tue Apr 23 15:30:45 2013 -0700

    Don't set ADDR_COMPAT_LAYOUT on the emulator

    Don't work around third party app bugs on the emulator.

    (cherry picked from commit fc17dc2548234461eb43ff83539ede4c9893a825)

    Change-Id: I35246c447de65ad4649b9aa3eb67194234fd6378

commit 6ad0452e6301c0650f58f3991f7c523f6f279ddb
Author: Jamie Gennis <jgennis@google.com>
Date:   Mon Apr 15 18:53:24 2013 -0700

    Disable tracing from Zygote

    This change disables all atrace tracing in Zygote immediately after it is
    initialized.  This is necessary because Zygote has no way to receive
    notifications that the enabled trace tags have been changed.  Tracing is
    re-enabled when other processes fork from Zygote.

    Change-Id: If2983858fb0c4890ba9ab041849b1c4d98f66c13

commit 9a9350550a7ca51feb97218101ef90c2cb90be71
Author: Nick Kralevich <nnk@google.com>
Date:   Fri Mar 15 13:12:28 2013 -0700

    app_process: don't pollute the environment

    Give a hoot - don't pollute!

    Change-Id: I30d6c05cecab483f0e9d8063907f7bc0ef2bb104

commit 1fe21bd1b6ca8b94c78fbf3666a1e8e0472355de
Author: Nick Kralevich <nnk@google.com>
Date:   Fri Mar 15 11:38:29 2013 -0700

    Never call app_main more than once

    Different kernels seem to handle ADDR_COMPAT_LAYOUT differently,
    sometimes passing it to its children, sometimes not. If it's not
    passed to its child successfully, we can end up in a restart loop.

    Instead of testing for the presence of ADDR_COMPAT_LAYOUT, use an
    environment variable instead, which is handled more predictably.

    Bug: 8392487
    Change-Id: Ia531dd2abb4e1cd46f3430d844e644f53581f530

commit 5fa1ee779e2170fd2e3e96b1e0887f15b04b1f76
Author: Nick Kralevich <nnk@google.com>
Date:   Thu Mar 14 16:31:34 2013 -0700

    Don't use ADDR_COMPAT_LAYOUT on the emulator

    For the emulator, we want people to see memory as it
    actually is, not how we're hacking around buggy apps. Don't
    set ADDR_COMPAT_LAYOUT on the emulator.

    For reasons that I don't understand, personality(ADDR_COMPAT_LAYOUT)
    does not persist across an exec on the emulator. app_main gets
    into a tight loop restarting itself because of this. This change
    also works around that bug.

    Change-Id: Ia73a7d2d623c25cf39d248145d97307945d554da

commit 8a0a929422682ba3eb6a205dc6c0638e68b909de
Author: Nick Kralevich <nnk@google.com>
Date:   Thu Mar 14 13:23:52 2013 -0700

    Respawn app_main if ADDR_COMPAT_LAYOUT is not set

    Bug: 8358800
    Change-Id: Id81aa26d74dfd16a49f0ee5926ea2cdb3c2106d8
Check --xposedversion before setting ADDR_COMPAT_LAYOUT

Otherwise this parameter might not work if the file is not stored
as /system/bin/app_process. This also means that we trust ourself
not to do those bad things which the workaround is needed for.
Fix asm patch when replaced ARM code is not in thumb mode
Load atrace_set_tracing_enabled() function dynamically

By avoiding the hard dependency on it, it should compile on SDK16
and work for SDK16 to (at least) SDK18.

Also enabled the ADDR_COMPAT_LAYOUT fix starting from SDK16.
Fix build for SDK15
v37
Merge remote-tracking branch 'origin/master'

Conflicts:
	app_main.cpp