History log of /packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2f61bcadb10697036a5ce5ad893607f5dcdcda9d 22-May-2013 Martijn Coenen <maco@google.com> Use top activity when determining foreground package.

If you have an activity stack where the base activity
belongs to a different package, NfcService would use
the wrong package for determining whether the current
foreground app is allowed to have an ndef message (callback) set.
This could cause Activity stacks like Settings -> Storage ->
Pictures & Videos -> Gallery to fail sending pictures.

Use the top activity instead.

Bug: 9072009
Change-Id: I32fbbea1423333117d2a0522eced98ecf9a758e7
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
7a499e775021bafefbe890d079e2a43f4a54482c 24-Apr-2013 Martijn Coenen <maco@google.com> Avoid P2P/SMX race conditions in NXP stack.

Google Wallet can trigger off field P2P field events
and initiate communication with the SMX. The NXP stack
appears to contain some tricky race conditions around
opening/closing the SMX close to P2P interactions. For now,
do not allow NFCEE access while a P2P link is still active.

Bug: 8552749
Change-Id: I7acae39bc22cebb5d79a484990dcd3fc5f3dad23
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
d72b205b870f4bccb33d466a0b4f704aca8d060a 15-Apr-2013 Martijn Coenen <maco@google.com> Remain compatible with 4.1 handover-over-SNEP devices.

Android Jelly Bean 4.1 shipped with a handover implementation
that (erroneously) used the SNEP server for exchanging handover
messages. This was corrected in future releases, however to maintain
compatibility with the 4.1 devices, continue connecting to SNEP
in case a connection to the handover service fails.

Bug: 8508568
Change-Id: I49ee98ef9c4569bdbff8aab4ee3f45264e019f3f
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
f1ca42a07636d17e7eae14bb994e7208d4d80f9a 09-Apr-2013 Martijn Coenen <maco@google.com> Merge "Properly reset field / listen mode flags in SE object." into jb-mr2-dev
b408fc371821c397b47c8722c339c6b4359e062f 09-Apr-2013 Martijn Coenen <maco@google.com> Properly reset field / listen mode flags in SE object.

On NFC disable, the SE object is "finalized" but not
destroyed. It is reused on the next NFC enable, but
the listen mode / field status flags were not cleared
then.

Bug: 8574917
Bug: 8489820
Change-Id: I8e11c60eda47762404a5d5020a0c2e6ff95ead2a
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
f36089a293850babe57d2dfd48a22e8d1daf0fc0 08-Apr-2013 Martijn Coenen <maco@google.com> Fix Android Beam animation.

SendUi.showStartSend() was being called twice.

Change-Id: I3893c138b1de94d87e556c438bffcf0039b2a086
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
cf4ef456bbf2c10f674b291ef7960af8b6bf6efa 07-Apr-2013 Emily Bernier <ember@google.com> Fixing NFC bug when confirm screen isn't required.

Change-Id: I198235ec91d454dabe34187bb51870cf1b0d4fb5
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
57a44d07a3de327e8cdbbcd622118aa517313dbe 28-Mar-2013 Martijn Coenen <maco@google.com> Deal with pre-MR2 PN544 NXP stack LLCP bugs.

In MR2 we started connecting LLCP on link
activation instead of when the send was confirmed. Pre-MR2
NXP-stack devices have a bug that causes them to only
send the first SYMM after 750 ms (in case they are the
initiator). There is another bug that causes that same stack
to crash if two threads try to send a packet at the same
time.

Unfortunately, this combination of factors creates the
following race:

1) pre-MR2 PN544-initiator initiates p2p link with MR2 device
2) pre-MR2 PN544-initiator starts Touch to Beam animation
3) pre-MR2 PN544 doesn't have data to send, but delays SYMM for 750ms
4) MR2 device finally gets SYMM after 750ms, and sends CONNECT PDU
5) pre-MR2 PN544-initiator device responds to CONNECT PDU with CC on Thread 1
6) Within a ~50 ms window, the user on the pre-MR2 PN544-initiator touches
the screen to confirm the send. This causes Thread 2 to try to send
something, which fails.

As a result, the Beam transaction fails. Unfortunately
this is quite easy to reproduce, since the Beam animation takes
about 750ms, just the same amount of time it takes for the SYMM
to get sent.

To prevent such a race condition, we should make sure that we do
not create multi-threaded access on the remote device. The best way
to do that is to not connect the LLCP services automatically when
talking to a pre-MR2 PN544-initiator.

Long story short, when we don't receive a first packet of data
after 200 ms, we consider the remote device to be a buggy
implementation, and delay the connect until the time the user
decides to send something (in which case it's fine - it's unlikely
the user at the other side tries to send something at exactly the
same time).

Also fixed RF field notifications to be more robust; whenever
p2p is activated, we disable field events, and always treat the
field as being on.

Bug: 8508568
Change-Id: I41b427afb24c7f8d228adc91d258cca553539588
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
cbe27470ef7e67324b9e8cbc32c25088d82e2a86 27-Mar-2013 Martijn Coenen <maco@google.com> Update to new IPC API for getting data to share.

It's now a single IPC call to retrieve potential NdefMessage,
Uris and flags to be shared over Beam. Since we do IPC calls
only when entering p2p range, limiting the amount of calls
reduces the amount of time the devices will need to be held
together.

Bug: 5134061
Change-Id: Id64748ff7994cfa792e97a8753d7b8e1cabb034b
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
1a158c7f354d1e1b031fba88928dbaa022e0d0df 12-Dec-2012 Martijn Coenen <maco@google.com> Make Beam more forgiving.

- Increased debounce time when nobody has pressed send
yet to 3 seconds - this gives users significantly
more time to press send, even when the link is down.
The only downside is that we stick in the Beam-animation
a bit longer, but in 99% of cases users actually intent
to send something, so this should be no problem.
- When the user does touch to send, if the link is down,
an even more forgiving debounce timer is started -
given the user 5 seconds to get the devices back
together. When they do get back together, the send
completes automatically.
- Also show a UI hint to get the devices back together whenever
the user has touched to send, but the link is broken.

Bug: 7124631
Change-Id: I0b0260f4eb92b11bf6bea8e571b43b38759c2bcc
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
3329e45c618c5896cb662f686930a75eb2ee5bbc 26-Feb-2013 Martijn Coenen <maco@google.com> Immediately connect to LLCP services.

When we discover a remote LLCP target, look at what
services the current foreground app has requested,
and immediately connect them.

This should increase our overall chance of success
of completing the transaction, as we no longer
need to setup the connection when the user taps
the screen to confirm the send.

It should also improve RIM interop; RIM devices
break the LLCP link if there are no service connections
within a certain time limit. Connecting the services
immediately prevents this.

Bug: 5155356
Change-Id: Ie4a578c1da31e3d5eb3b392b8236c681b45f9271
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
5bacd361e693472b7d54d31fe0d23b9d22851988 14-Feb-2013 Martijn Coenen <maco@google.com> Catch all exceptions when doing remote Binder calls.

When doing application callbacks for retrieving NDEF
data or notifying the application that an NDEF push
was completed, we should catch all exceptions, not
just RemoteExceptions.

Bug: 8179249
Change-Id: I35d30d52322f05b7998ef2e10f8da9d856a4b0d6
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
3859c5cccb202c20882fb3887cfa87babb1d85a3 08-Jan-2013 Martijn Coenen <maco@google.com> Enforce foreground NDEF push.

Store the calling UID along with the NDEF callback,
to make sure the registered callback is running in
the foreground.

Bug: 5199662
Change-Id: Ia6eb4457309445909629878f3371805a503fc82f
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
525c260303268a83da4c3413b953d13c9084e834 14-Dec-2012 The Android Open Source Project <initial-contribution@android.com> Snapshot 1a6bcf3cca90fedfbad33c1cdd6d05af5774fc01

Change-Id: I3ccb25bf7cde2c22f52260cae0e9957517e6bb5f
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
f5a196b643c654c7ea98a5e2935e3bff6683399b 11-Jul-2012 Martijn Coenen <maco@google.com> Implement connection handover LLCP service.

The Connection Handover specification dictates that we should
exchange Hr/Hs records over a dedicated LLCP service. This adds
the service, and starts using it by default. It will fall back
to the SNEP GET method to remain compatible with Android 4.1
devices. SNEP GET on these devices will return "Not Implemented",
also per the SNEP spec.

Also fixed a bug in endianness of the OOB record.

Bug: 6759842
Change-Id: Iafe67ab119e933df5dfa0a5645a95bc59badd8ae
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
0015304ebb1fda453f8b2ef660c39bf4f11dc771 06-Jun-2012 Martijn Coenen <maco@google.com> Don't assume Bluetooth is present.

Bug: 6620788
Change-Id: I39f7b106885b1bb932353c47c3b0f7370c56e8c4
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
a3715d12aeba988c1104726e935462ea4f39eca7 24-May-2012 Martijn Coenen <maco@google.com> Fall back to NDEF push if handover SNEP get fails.

This allows applications to be able to set both
a Uri (for handover) and an NDEF message, which
will only be sent if the handover request does
not work (as will be the case on pre-J devices).

Also, show a toast if the remote device does
not support connection handover.

Bug: 6561174
Change-Id: I9ffdcfdf0cded319fbb4ab646ae1da5382fcb74a
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
0f2b555fe51f3d8a828cf61d269b8be6eecbf68b 18-May-2012 Martijn Coenen <maco@google.com> Don't use NPP for connection handover.

Handover will only work with SNEP; if SNEP fails,
don't try with NPP.

Change-Id: Ib92c90cb588b99e177fa1c70b89753ef8d0e16ea
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
d82d9db81f30ccecd29a0531e6db9b49c9c2cd95 08-May-2012 Martijn Coenen <maco@google.com> Bluetooth Beam bug fixes, UX and i18n.

- Implemented handover select with carrier power state
- Delay OPP send if remote carrier is activating
- I18n for all handover components
- Cleanup old handover transfers

Bug: 6411485
Change-Id: I84aac3a7c7e703a1fcb423b6016cd9fa3d33d9b1
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
83558889207858d7ce8500f9fce8a707a86b495e 13-Apr-2012 Martijn Coenen <maco@google.com> Support for the new Uri[] Beam push API.

Support multiple URIs, move query for the mime type to NFC service.

Change-Id: Ib055efca843b41f6d29cda7d67b23f4b9946113c
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
43f2fa7ad4c72ef4849f2d2b78a963c1925c63a3 04-Apr-2012 Nick Pelly <npelly@google.com> First cut at Bluetooth Beam

Change-Id: I616fd57b7822d703280ec960b84cf8c5ced6719d
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
eec585407f2cfc47814f572a1e2a0f7d56b41451 02-Apr-2012 Martijn Coenen <maco@google.com> Allow applications to disable default Beam behavior.

By adding a meta-data entry to the application section of
the applications manifest:

<meta-data android:name="android.nfc.disable_beam_default"
android:value="true" />

Bug: 6257668
Change-Id: I73c27d8c642acd85f678fb42b4379f6bc21189b9
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
c96f982f8c0fa061701143a27395acf3b24dfb54 28-Mar-2012 Nick Pelly <npelly@google.com> Keep static NDEF in application rather than NFC Service.

This means we make an IPC callback during Beam for static NDEF, instead
of an IPC every time the static NDEF changes. This results in less IPC,
and the latency increase during Beam is not measurable.

This fixes a bug where a crashed application still leaves its
static NDEF message inside NFC service.

Bug: 5199662
Change-Id: Id4879356b2b2b0d65ce3183d7a1bda9cde455f2c
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
e3728e6676eff6c1c77ad89153d8814d94c79fbc 15-Mar-2012 Nick Pelly <npelly@google.com> Update URL from Market to Play. Add feature parameter.

Change-Id: Ie8d0f65f7055e8bdca1e2f3b322a5b9a280ea2d2
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
6e5a69a21f2a29e5e1d415bb788bbc1f576363f0 06-Mar-2012 Nick Pelly <npelly@google.com> Perform default Beam behavior from system apps.

1) Launch the app if its installed on the other device.
2) Lanch market with a search for the app if it is not installed.

Bug: 6091238
Change-Id: Ifc593f1f2ad120ef1b3b2e90ac157f99c0df5b16
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
fb42b9f2d905015730f2e12772ed9a2a610a3957 10-Feb-2012 Isaac Levy <ilevy@google.com> Allow apps to selectively disable beam

if apps register a callback but return 'null', do not create the
default message.

Fixes b/5943350

Change-Id: I247bb7d508c15777904599c3a211c30e81351f15
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
6f0e3b8e1de5137077127bf3144effa2016c27c6 17-Jan-2012 Martijn Coenen <maco@google.com> LLCP echo server implementation.

Can be used to test the Android LLCP stack with nfcpy. Disabled
by default.

Also fixed unnecessary JNI release call causing warnings in the
logs.

Change-Id: Iaed159e23dadc1601be2df2aadbe1d9c54c50615
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
416e2fc507d696486a127f932105b3b95519d0cb 11-Aug-2011 Jeff Hamilton <jham@android.com> Add event logs for NFC events.

Change-Id: I5607abe5d28ef9682afa084651c50aa651655b60
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
0b3b8ab69835cb66c96691dae3ba9b75705980a5 24-Aug-2011 Nick Pelly <npelly@google.com> NFC service updates for moving NDEF push to a fragment.

enable()/disable() -> set()
ZeroClick -> NdefPush

Change-Id: I21806665b8fd29e4580bd2e3200858d834605f6f
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
69ca6627125c91c44b9e0d8bfa5df83281c2ebe1 22-Aug-2011 Martijn Coenen <maco@google.com> NdefPush animations.

- Sound + vibration whenever devices enter range.
- Rebuilt old send animation - clone off in the background.
- Scale back up for receive, then call startActivity().
- Slowed down animations
- Split sending in two parts: first part is slow and played during
the actual send. When the send is done, the animation is accelerated
and finished. This has as an advantage that there is an immediate
response to the touch (instead of waiting till the send is done).
- Lock rotation.

TODO:
- Integrate firefly background.
- Touch to send hint.
- Tweak debounce time - somehow it still happens a lot
that the link is tore down, the debounce comes in, and
the link comes back up again just after 750ms, causing
flapping anyway.
- After a lot of tapping things seem to become very slow; I'm not
sure yet if this is due to NFC or other ICS code.
- See if we can really do without TYPE_SYSTEM_OVERLAY window params.

Change-Id: I93d472ed566b8201b65e9eee049467995f66e683
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
d2a536159030a932486e6dfd93999f9e43f3566f 18-Aug-2011 Martijn Coenen <maco@google.com> Latest ShareTap UI: low-pass filter and animations.

Change-Id: If0c04284e1e6f1126f85a8bb58014ce553f4e52b
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
8a558ba19be56e71e6c2015dea862d150e6d07cb 13-Aug-2011 Nick Pelly <npelly@google.com> Implement Tap-to-Share and Tilt-to-Share (DropShare).

o Text says "Tap to Share", but tilting (the phone on top sends) also works.
o Move text to top. Remove arrows.
o First Accelerometer value takes ~700ms :(
o Only call onP2pSendComplete on success. If the send failed, we retry quietly.
This improves perceived reliability.
o Reduce debounce from 1000ms to 750ms.

TODO
o Never do orientation change while in the animation activity
o Get rid of black transition when entering/leaivng activity
o Figure out why it takes 700ms to get first accelerometer value
o Improve launch time of animation activity (sometimes it takes 3+ seconds)
o Consider going back to a window overlay?
o Make it snappy snappy snappy

Change-Id: Idbc8e4bb744051b7b69d234a51a3ce69e23b699f
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
77d0b56bfa6a4e4e1449c476a1141a7486f34ad9 11-Aug-2011 Nick Pelly <npelly@google.com> Decouple P2P link management from P2P UX management.

The goal is to make it easier to track the state of the P2P transfer, and
to make it easier to fine-tune UX (sound, vibration, animation) for P2P
transfer.

NdefP2pManager -> P2pLinkManager
It now only handles LLCP and NDEF logic (and no UX). It has a state machine to
track the state of the LLCP link, send and receive. It does debouncing on the
LLCP link. Events are surfaced to P2pEventManager through the P2pEventListener
interface.

P2pEventManager
Handles all UX (sound, vibration, animation) and send confirmation.
The current implementation uses Rotation to confirm send, and
P2pAnimationActivity to animate the send.

Change-Id: Ie498219857afe69403e90f09c77f4d6d1b24ffeb
/packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java