History log of /packages/apps/Nfc/src/com/android/nfc/SendUi.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
595ab7e9788f61125fa14d1ff2768f995ac7b7e7 10-Apr-2013 Martijn Coenen <maco@google.com> Fix Beam animation deadlock.

There was a path possible where finish() was
being called while a screenshot was still
captured on another thread. When the thread
finished, it would throw up the animation
and never exit.

This fix stores the request to finish() in the
state, waits for the screenshot thread to complete,
and moves to the IDLE state in case.

Also made the entire view touchable for initiating
the Beam.

Bug: 8576613
Bug: 8578026
Change-Id: I0d0158fb95918e23e32dc22c6537f5dac2aa46b1
/packages/apps/Nfc/src/com/android/nfc/SendUi.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/SendUi.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/SendUi.java
82792d9a73138f209d1f46f156604c4c65f69c0b 14-Feb-2013 Mathias Agopian <mathias@google.com> Split Surface/SurfaceControl fallout

Change-Id: I7293782504fe594f364403fa4c3f99d0aa4cd572
/packages/apps/Nfc/src/com/android/nfc/SendUi.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/SendUi.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/SendUi.java
d5517553782b29d8e2e5069631e9b443caac97cd 17-May-2012 Craig Mautner <cmautner@google.com> Eliminate obsolete flag.

The FLAG_KEEP_SURFACE_WHILE_ANIMATING has been removed.

Change-Id: Ia9623fb1fd5a124145bbb827acfb77767b05f636
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
f570dca6b0fa0ce883f5c950815e43acae4f51b2 28-Mar-2012 Martijn Coenen <maco@google.com> Dejank Android Beam animation.

After profiling, it turns out the Beam animation was mostly janky
because of the initial buffer allocations that take place in the
graphics driver. Modified both the animation and firefly
renderers to swap the buffers three times before drawing anything,
thereby making sure the buffers are allocated.

Do not scale the screenshot while rendering fireflies,
as that can cause jank as well.

Also modified the FireflyRenderer to keep most of its state alive
between subsequent Beams, causing it to come up faster.

Cleaned up some old code and added documentation.

Change-Id: Ica231861dd7ede178ad2ec1ab09aa00d1c876624
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
37bb7b23886d7c058f7e9589ee5522b4a467b1b0 21-Nov-2011 Nick Pelly <npelly@google.com> Replace vendor specific NfcGoogle.apk with generic Nfc.apk

The access control changes allow us to just use Nfc.apk with
the regular platform certificate, instead of the custom signed
NfcGoogle.apk. So we can compeltely get rid of vendor/google/apps/NfcGoogle
and just build it out of packages/apps/Nfc now.

The package name is also reverted from com.android.nfc3 to com.android.nfc

The NFC uid needs to get bumped (25 to 27) to allow the cert change.

Bug: 5608249
Change-Id: I4437dff96f2529f0b9e7d8e65c21359c3eeccd0b
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
f7a151e2fe02af5026d6aad37447f13bff60c56a 07-Nov-2011 Martijn Coenen <maco@google.com> Merge "Remove static background image from Beam when no hw-acceleration." into ics-mr1
a21816821f6e1ff024cf93662150f8819bc5e3c9 04-Nov-2011 Martijn Coenen <maco@google.com> Merge "Check for navigation bar when cropping Beam screenshot." into ics-mr1
d59b331655f0113dc0454aa5d000b269d7cf8b49 04-Nov-2011 Martijn Coenen <maco@google.com> Remove static background image from Beam when no hw-acceleration.

The Beam scale down animation on is really jerky on devices where
we can't use hardware acceleration. This seems to be due the fact
that we have a static background over which we scale. Removing it
makes the scaling nice and smooth.

Bug: 5567020
Change-Id: Id04bae45713eaa368d03001e5352271f47d26603
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
e3cfbec7045220294c172d55122daf55ab6cb058 04-Nov-2011 Martijn Coenen <maco@google.com> Check for navigation bar when cropping Beam screenshot.

This fixes the Beam animation on crespo.
Change-Id: I1bc374dc532a4e83622c62b31ee5b4de2b5fa3ba
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
4e0ab3174beafb4915388d8c11286a48e362ed7c 04-Nov-2011 Martijn Coenen <maco@google.com> Don't finish Beam animation again.

Bug: 5553836
Change-Id: I1bfd7e0aa3a1420decea7d793e851f44cb433cf2
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
4dd3c020b434aec0ccca030afeb57a861bc9a2f3 14-Oct-2011 Martijn Coenen <maco@google.com> Final NFC animation tweaks.

Bug: 5318512
Change-Id: Iae150be1210bf25c1fc58b41ec24dc301547cf7f
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
90e1b000b385d7fa11481ddca4d61d6b425d7579 12-Oct-2011 Martijn Coenen <maco@google.com> NFC: Remove statusbar/navbar from animated screenshot.

This just crops the status bar and the navbar from the screenshot we take.
This makes the animation look right in all cases, except for when we are full screen:
in that scenario we're cropping away too much.

Also removed the clone view (was no longer used) and cleaned FireflyRenderer
a bit.

Bug: 5318512
Change-Id: I37189a576f19937c2cae4ec368f26ac0725a1b62
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
674cd01fd74b403a4625efbfd2743e179c3d9eca 08-Oct-2011 Brandon Keely <lbk@google.com> NFC screenshot animation adjustments:
- eliminate discontinuous jump when starting failure animation (mScaleUpAnimator)
- simplify success animation: fade live app in at scale=1, rather than scaling it back up
- minor timing and motion curve tweaks

Change-Id: I1fd5989a6e58e493087653d3a865f774cfc2b32d
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
e31749eae9b242d5019eb5cf5f09069d60df9f71 22-Sep-2011 Nick Pelly <npelly@google.com> Show NFC call-to-action text immediately.

Pull out all the code the track success/failure for the hint.

Doing this as a standalone commit so we can easily revert if we want it back.

Bug: 5350022
Change-Id: Ieb70af10ebaabdf82421c128d72ed1fc374130d2
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
217edd31f93c3917a8bb02420366b88d27c431c2 02-Sep-2011 Martijn Coenen <maco@google.com> Render fireflies with OpenGL.

- Show a static (scaling in) background in case we're not hw-accelerated.
- Modify the cloning animation a bit.

Change-Id: I808238fb515c2c8d7832a4ab8bc70a37e1198de5
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
f7966d1dadff2d78f01bbdb134e8252b53343179 03-Sep-2011 Dianne Hackborn <hackbod@google.com> Remove this unneeded (and gone) flag.

Change-Id: I5f6840359502ee1982ff84e9905b95f4c0ad094c
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
0c4fce176e6acb1a1a74e9248cf83eb0314490aa 01-Sep-2011 Martijn Coenen <maco@google.com> Latest zeroclick animations.

- Only hw-accelerate when we have the resources for it;
- Disallow status bar interaction;
- Remove background;
- On failure, gradually scale back up;
- On receive, slide out to the right.

TODO:
- OpenGL fireflies

Change-Id: I1deae65f24f40a226c8a575130ca22b72ff9e05e
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
be7d37a1c6622c8907869fd30e9e6da73fd77290 25-Aug-2011 Martijn Coenen <maco@google.com> Touch to send hint for NdefPush.

Show hint when:
- First time sharing (until successful again).
- 3 share failures (until successful again).
- 3 seconds in p2p range and no confirmation (fade in).

Change-Id: I413d45b76ee8588d4aa99351e34212ecc38d8f8e
/packages/apps/Nfc/src/com/android/nfc/SendUi.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/SendUi.java
b2112cff553c3b6658440bf06060c7a08f82df5c 19-Aug-2011 Nick Pelly <npelly@google.com> First cut at reverting to tap-to-share.

A lot more polish to go, but this gest the basic tap-to-share
behavior working again.

Change-Id: Ic1f1df4200c9a1424018df7602fe5cb278cdc1e6
/packages/apps/Nfc/src/com/android/nfc/SendUi.java
5438ab0e17064e20870ac893a2dd2b9e1219eef1 18-Aug-2011 Nick Pelly <npelly@google.com> 0-click UI update

o New start sound
o Vibrate only when
- starting send
- send success
- receive success
o Play sound only when
- starting send
- send success
- send failure (out of range before complete)
- receive success
o Introduce HoldingItWrongUi with the new image
o P2pAnimationActivity -> SendUi, and a huge cleanup of it
- no longer an activity. It took 350ms to inflate the views on
first onCreate() as an activity, but we can cache this ahead
of time as a window.
- Use ObjectAnimator instead of ViewAnimator, much less code
o Use ACCELEROMETER instead of GRAVITY to get faster tilt detection.

TODO (in order of priority)
o LLCP has started crashing a lot again. About 1/10 times I come into
P2P range the stack crashes now on my Nexus S TMO.
At first I thought it was because I was doing animations during LLCP
send, which might affect timing to pn544 due to CPU load. So I changed
my first implementation (one animation) to split it into a pre-send
and post-send, so we don't do any work during the actual send. Still
seems to crash though. We really need to make it solid again.
o Change notification text and settings text+image as per Rachel's email
o Do some simple low-pass filter on ACCELEROMETER so we don't get caught
out when the user shakes the phone
o Plumb through a starting receive callback, and play sound + vibrate
o Prevent touch during send animations. Not a big deal right now because
we complete it so fast.
o Prevent notification shade from being pulled during HoldingItWrongUi
and SendUi
o Prevent orientation change during SendUi

Change-Id: Ieec1efb741244c68270e34a712c15c58621b1446
/packages/apps/Nfc/src/com/android/nfc/SendUi.java