Merge commit 'df34eb0e' into manualmerge

Change-Id: I9807e540bad19933452f4a9f86b74021265f29cf
keep history after reset to GRK39D
merge in ics-release history after reset to master
am df674e5f: (-s ours) am bcc8233b: resolved conflicts for merge of 6900b4e2 to gingerbread-plus-aosp

* commit 'df674e5f0385f09d962a2659032ab1afb592b43b':
  Patch to add Secure Download Mechanism in the libnfc
Reconcile with gingerbread-release gingerbread-mr4-release

Change-Id: Ibcd6e2299e3f03df1a5320041404a42a20546a57
Manual port of 6900b4 from gingerbread:

    Patch to add Secure Download Mechanism in the libnfc

    This patch permit to support secure download update and
    also to avoid locking states in case of download failures

Bug: 5331837
Change-Id: Ia5b6d9baf57231b0193bbbe85c88c7df557017c6
am 6dd94832: Manual port of 6900b4 from gingerbread:

* commit '6dd948323de0f31b413c9f19a905f1c145c9c456':
  Manual port of 6900b4 from gingerbread:
merge in ics-release history after reset to master
Remove NFC I2C workaround for Prime (DO NOT MERGE).

Change-Id: Ie0855f147030552cc1bec0ea05e59576650fa417
Fixes to LLC and DAL to handle unreliable UART.

Use a 100ms timeout in uart_read() when reading LLC payload only.

Allow 200 retries on host.

Note that we use pn544 timeout retransmit instead of an explicit REJ
(do not use CRC_ERROR_REJ). The reason is that after a
dropped frame, a host timeout on read() is the only reliable way to recover
frame alignment, but if we send an immediate REJ then we are constantly reading
and can never regain frame alignment.

Also note that the pn544 timeout (200ms) is higher than the host (100ms). This
allows the host to abort a partial read and return to known state before the
pn544 re-transmits.

We have to turn off timeout for FW mode. Typical read time is ~100ms, but some
are 1 second+

Modify DAL & LLC layer to more reliably handle partial frames by searching for
a LLC length byte again, and log the various error paths.

Also introduce debugging tools:

debug.nfc.LOW_LEVEL_TRACES 2
Will enable LLC header decoding in the trace output.
Only read at NFC init time, use /data/local.prop to enable.

debug.nfc.UART_ERROR_RATE X
Will randomly inject errors at the uart transport, with a probability of X/1000
for every byte. 50% of those errors will be a dropped byte, 50% will be
corrupted. Recommend X=10. FW mode can't handle any errors. Can be enabled
after boot.

adb shell dumpsys nfc
Will now print the number of errors detected at the LLC layer.

Change-Id: I739ed193e3d4caa563a866b6a9d834c154917962
Merge "Remove NFC I2C workaround for Prime (DO NOT MERGE)." into ics-mr0
am 17abc6eb: (-s ours) Merge "Remove NFC I2C workaround for Prime (DO NOT MERGE)." into ics-mr0

* commit '17abc6eb45b326f574c657e227670a8fddf9385e':
  Remove NFC I2C workaround for Prime (DO NOT MERGE).
merge in ics-release history after reset to master
Use a 10s timeout in uart_read() in FW download mode.

This provides a path to flush RX, necessary when we enter FW download mode
with bogus data already in RX. This fixes a problem where NFC was dead on several
HSPA and LTE devices.

Also decrease FW timeout completition from 120s to 60s. Typically FW download
takes 30s, and 120 is unnecessarily large and causes a long delay to bring up
NFC when we need to retry FW.

Bug: 5468674
Change-Id: I0fd40c199daac861fe5acda4f2d214bdcff8e869
Use a 10s timeout in uart_read() in FW download mode.

This provides a path to flush RX, necessary when we enter FW download mode
with bogus data already in RX. This fixes a problem where NFC was dead on several
HSPA and LTE devices.

Also decrease FW timeout completition from 120s to 60s. Typically FW download
takes 30s, and 120 is unnecessarily large and causes a long delay to bring up
NFC when we need to retry FW.

Bug: 5468674
Change-Id: I0fd40c199daac861fe5acda4f2d214bdcff8e869
Merge remote branch 'goog/ics-mr0' into ics-mr1
merge in ics-mr1-release history after reset to ics-mr1
Use NFC HAL for some libnfc settings.

The NFC HAL in libhardware allows us to store and retrieve
product-specific settings. This patch moves two product-specific
settings to the HAL: the device port, and the usage of the i2c
workaround we had for crespo. This means configuring the port
no longer needs to be done from JNI land.

Change-Id: I2e19b6f188f808bc2f2a1f1abc28f2a6c47e6a4c
merge in ics-mr1-release history after reset to ics-mr1