Commit Graph

344 Commits

Author SHA1 Message Date
Doris Liu
c457547cbd Remove internal listener when cloning
BUG: 38270215
Test:  adb shell am instrument -w
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ia80d5f8958e320ad7d51ef7a08168763c8988146
2017-05-13 01:39:07 +00:00
Doris Liu
56b2df05f5 Fix racy clone
BUG: 38184803
Test: cts AnimatorSet tests
Change-Id: I308ae9cc014f13a6aa928d8d82e339f476f4b3de
2017-05-12 04:17:50 +00:00
Doris Liu
02eabdff6b Refine JavaDocs for AnimatorSet#getCurrentPlayTime()
This is to address API concil's feedback.

BUG: 37673139
Test: make -j20 docs
Change-Id: I2e360c7996f8368c77c30c55271e006f94736f90
2017-04-26 22:08:24 +00:00
Doris Liu
5fb129c2ab Behavior compat for child being manipulated outside Animatorset
When a child animator is being manipulated outside of the AnimatorSet,
such as when the child animator is running before the AnimatorSet gets
started, we need to make sure we maintain the behavoir on N:
The child animator will be re-started at its scheduled start time in
the AnimatorSet.

BUG: 37507882
Test: Repro steps in comment #1 & ag/2144081/
Change-Id: Ib97e85706f01d18a2e72fb4d1d678e22cf959894
2017-04-21 21:13:52 +00:00
Doris Liu
ae570c04c0 Remove workaround for end() not supported in some app
BUG: 36241584
Test: Follow repro steps of comment #1 in the bug above

Change-Id: I1bf27a7cc9cc2bd398c372623d7978e838f1d8b2
2017-04-03 18:53:55 +00:00
Doris Liu
d7968dc174 Fix 0 duration scale for pre-O apps
This CL fixed an issue where pre-O apps receive animation
end callbacks before all animations have ended.

BUG: 36157561
Change-Id: Id0ea05e76c91a21a678ec05b1ed0c898ee36ee43
Workaround: 36241584
Test: repro steps in comment #1
2017-03-16 11:05:46 -07:00
Doris Liu
21ba77f6b6 Ensure behavior consistency for 0 duration scale
BUG: 35590176
Test: cts in the same topic branch
Change-Id: Ia0a2518a1376d3f82ee6c5a7b27e3cb24ed54cbf
2017-03-07 10:59:47 -08:00
Doris Liu
e8a5d8d211 Fix start time modification outside of updatePlayTime()
BUG: 35340235
Test: manually start the chrome photos app, no crash
      and CTS at: ag/1908702

Change-Id: I3c0a6f140ee497020b562f25cade241dcd993c2a
2017-02-14 11:54:40 -08:00
Doris Liu
c9b5034178 Correctly handle infinite start time
BUG: 34837854
Test: ag/1901799
Change-Id: If60dc9432df189642e67ff544e14a4cda7d5e0ec
2017-02-10 18:07:55 -08:00
Doris Liu
dd65ab0407 Add getter for current play time
BUG: 30993532
Test: cts tests in the same topic branch
Change-Id: I45ee9c61f53051fcac3399eebc378aa2c0ce056d
2017-02-10 16:06:42 -08:00
Doris Liu
6d45209205 Fix reverse with start delay
Test: cts in the same topic branch

Change-Id: Ie8793f25d39e0104c880f1a873f68650b918bffa
2017-02-10 12:21:11 -08:00
TreeHugger Robot
466149d78c Merge "Fix start delay for ValueAnimator" 2017-02-04 03:47:37 +00:00
Doris Liu
3b466875bc Fix start delay for ValueAnimator
This CL ensures that doAnimationFrame() is called the frame
after start() is called, so that AnimatorSet can pulse frames
 into single animators as soon as they are start()'ed.

Test: new cts test in  same topic branch

Change-Id: I4f9522ce9e1a54ca3bcad6c696e6b248c945ff90
2017-02-03 18:07:18 -08:00
Doris Liu
5c71b8cc4a Make sure start() is called for custom animators
BUG: 34758281
Test: ag/1848837

Change-Id: Iae5d2fb41c4556ee201b9c4dfbc356996dc475a5
2017-01-31 17:52:54 -08:00
Doris Liu
6ba5ed322c Use listener to determine whether an Animator has ended
BUG: 34736819
Test: ran cts test for ValueAnimator and AnimatorSet
Change-Id: Ia1070f83833940cb09d26243f5873751d9ca2a38
2017-01-26 19:23:22 -08:00
Doris Liu
1f6c3fb286 Merge "Work around a bug in an An app" 2017-01-26 20:56:51 +00:00
Doris Liu
66c564e390 Work around a bug in an An app
An app has Animators (NoPauseAnimatorWrapper) that does not
check their listeners against null before cloning. The previous
implementation of AnimatorSet has masked this issue. But the
underlying bug should be fixed in this app.

For now, work around the bug by adding a listener to all the child
animators.

BUG: 34736819
Test: Manual

Change-Id: I968450aab62cf5d308e3b64e76dcf018178af67e
2017-01-26 12:21:20 -08:00
Doris Liu
40e8469789 Refine the comparator for the animation event sorting
BUG: 34719156
Test: manual
Change-Id: Iad96967c8ee6a3b3b661fb9de4e750d7b935b3f7
2017-01-25 19:40:51 -08:00
Doris Liu
13351997aa New functionalities for AnimatorSet: Reverse, Seek
This CL adds reverse and seek to AnimatorSet's capabilities.

Structural changes:
1) Child animators are now being pulsed by AnimatorSet in a more
   timeline manner, as opposed to the old listener based style.
   This timeline based approach avoids the time offset in between
   sequential animations, and therefore produces a more accurate
   overall duration.
2) Timeline is done by representing start and end of each child animator
   in two separate events. All the events are then sorted based on the
   time they happen, such that it's clear what should happen in between
   last frame and the new frame (i.e. which animations should start
   or end).

Test: CTS (in the same topic branch)
Bug: 30993532

Change-Id: If1dc6e8dbc93a4bf5ade8c5b0dcf43d3ee6ba7b5
2017-01-25 02:13:25 -08:00
Doris Liu
ad804a9b43 Add API info about Keyframe and PropertyValuesHolder am: 21b93c1f66
am: 046f615de8

Change-Id: I22ca65d40ef4fc04be2cf1fec214409a20aa8e07
2016-12-09 21:30:44 +00:00
Doris Liu
21b93c1f66 Add API info about Keyframe and PropertyValuesHolder
BUG: 32713413
Test: make -j20 docs
Change-Id: Ib2d11fe16cb470609058d2698b6b00173ae1928b
2016-12-05 21:16:10 +00:00
Aurimas Liutikas
67e2ae8639 Fix import statement in view|transition|animation packages.
This change also remove trailing whitespace.

Test: code still compiles
Change-Id: I7eff4546320d67d2bae58d31bad0625ea0791b8f
2016-10-12 09:09:52 -07:00
Chet Haase
49a513b571 Add API to query whether animators are enabled
Animators can be scaled to have zero duration globally in any device.
This can happen either via Developer Options (an uncommon path) or
Battery Saver mode (much more common for real users).
In general, this works fine; it just causes app animations to be jump-cuts
instead (which is the desired effect, either to make transitions faster
(Developer Options setting) or to optimize battery usage by rendering
fewer frames (Battery Saver mode).

But sometimes, choreographed animations can have undesired artifacts. For
example, an animation that calls an end listener to restart itself
will end up doing this almost constantly due to this effect. Other artifacts
can also occur, such as intermediate results in a complex choreography of
multiple animations can show several intermediate results in a way that is
confusing to the user.

For these cases, there is nothing that the platform can do to automatically
determine how to best handle the result. Instead, we surface this new
API to help developers discover this behavior and compensate accordingly.

Bug: 31052471 Animation playback is abnormally fast during Battery saver mode
Test: unit tests, CTS test upcoming

Change-Id: Id7ef1a9652ac5c6cdaca0c126756e82582d49b1c
2016-10-10 19:52:07 +00:00
Doris Liu
2d7cb10ea4 Allow null target in ObjectAnimator if the target has never been set am: 4d04b1a446 am: fd2c4f186b
am: 07c6140cda

Change-Id: I230e79daa0e13dffeaa6137ea513272e0b9d45c5
2016-09-27 07:29:03 +00:00
Kevin Hufnagle
930012063b docs: Added note in LayoutTransition class reference that APPEARING and DISAPPEARING animation timelines cannot overlap am: 5232329b4e am: 1456a0a321
am: 4cb055832b

Change-Id: I7c28aef0e439a22a74c86cb7cdb4a5c1061bfb50
2016-09-27 02:11:31 +00:00
Doris Liu
fd2c4f186b Allow null target in ObjectAnimator if the target has never been set
am: 4d04b1a446

Change-Id: I5438b8d79f6e245e8a87e1480023c0ac77243f10
2016-09-27 00:43:23 +00:00
Kevin Hufnagle
8e9b8b6c74 docs: Added note in LayoutTransition class reference that APPEARING and DISAPPEARING animation timelines cannot overlap am: 5232329b4e
am: ad5cafd283

Change-Id: I8593de353f1186b2aa892cf541a4718d64474b15
2016-09-26 23:50:14 +00:00
Kevin Hufnagle
4cb055832b docs: Added note in LayoutTransition class reference that APPEARING and DISAPPEARING animation timelines cannot overlap am: 5232329b4e
am: 1456a0a321

Change-Id: I1771afca56ff1cf1b4bcc7bf9573a71d9b566e54
2016-09-26 23:50:12 +00:00
Kevin Hufnagle
ad5cafd283 docs: Added note in LayoutTransition class reference that APPEARING and DISAPPEARING animation timelines cannot overlap
am: 5232329b4e

Change-Id: Ib3f8ffa61495a237c6e69b8f9260b46027c26a2a
2016-09-26 23:15:18 +00:00
Doris Liu
4d04b1a446 Allow null target in ObjectAnimator if the target has never been set
BUG: 31684571
Test: http://ag/1484115

Change-Id: I867fc3f93ddf70c58ae4387317ac875c5bafbebe
2016-09-26 22:32:41 +00:00
Kevin Hufnagle
5232329b4e docs: Added note in LayoutTransition class reference that APPEARING
and DISAPPEARING animation timelines cannot overlap

Bug: 16808571
Change-Id: I8cbac11da4f866f2d3bcde45996b039e9bdfb801
2016-09-19 12:02:33 -07:00
Teng-Hui Zhu
76817faf29 Add TestApi to ValueAnimator for AnimationScaleListDrawable CTS test. am: 0a815bb94f am: 3687be955f
am: d607d75790

Change-Id: Id83875c14472af2ba44f0194c897460ec6aa427d
2016-08-29 22:39:09 +00:00
Teng-Hui Zhu
0a815bb94f Add TestApi to ValueAnimator for AnimationScaleListDrawable CTS test.
Also rename an internal class.

b/30877925

Change-Id: Ib971ed090907a0ab387dd7c768e2b77eb9b69f75
2016-08-24 16:12:20 -07:00
Doris Liu
f66d2f6f31 Fix out of order listener callback for animator set containing empty sets
BUG: 31016584

CTS test for this fix is added at:
https://googleplex-android-review.git.corp.google.com/#/c/1348858/

Change-Id: I9427a6791f4e0aafc33f5cc9fac16c3518d1cdbe
2016-08-22 14:30:48 -07:00
Justin Klaassen
a06d1f8fec Fix NPE in ValueAnimator am: 543a7ed7af
am: 705e2fb40c

Change-Id: I5beab0d64c1544344f1153f183c513839f673a1f
2016-07-26 15:11:27 +00:00
Justin Klaassen
543a7ed7af Fix NPE in ValueAnimator
- Reset mAnimationEndRequested to false in ValueAnimator#start(boolean)
  so that previously canceled animated (with a start delay) can be
  canceled again.
- In ObjectAnimator#animateValue(float) check if target == null
  regardless of mTarget == null since it's possible the target was
  explicitly set to null prior to the animator being cancelled.

Bug: 30190459
Change-Id: I6da55737df30a28f48355fc7a41ab91d05979deb
2016-07-25 12:40:09 -07:00
Doris Liu
2c0a36a1ec Merge "Rounding per-channel interpolation in ArgbEvaluator to closest integer" 2016-06-27 18:49:51 +00:00
Doris Liu
d0ff41c406 Rounding per-channel interpolation in ArgbEvaluator to closest integer
In case of interpolating between x+1 and x in a color channel, the
previous implementation would jump to x in the *beginning* of the
animation, as it rounds down the interpolated float that's [x, x+1].
This CL rounds the per-channel interpolated float to the closest
integer.

Change-Id: I8610fb14ab3dd0ee2b1816868977c5653c178660
2016-06-27 11:32:35 -07:00
Doris Liu
91fcf575f1 Merge \\"Fix NPE for checking for whether animators should play together\\" into nyc-mr1-dev am: 7f9c189f06
am: b53c9c1658

Change-Id: Ia8b14a4e79c60e3c83f12ab07160ff2d36247088
2016-06-24 17:58:08 +00:00
Doris Liu
c470466d7c Fix NPE for checking for whether animators should play together
BUG: 29586505
Change-Id: Ic2a67d51d2ac8d5bfb11ed7773c7c7e413cc28c7
2016-06-24 00:01:39 +00:00
George Mount
0eba1dfba0 Notify end animation after setting the state to not running.
Bug 28404635

Change-Id: I13a480b54bb652e52d6b36addfe6d3799ece7568
2016-06-14 10:35:31 -07:00
Doris Liu
c88ded5a50 Merge \"Merge \\\"Fix setCurrentPlayTime for started but not yet pulsed animations\\\" into nyc-dev am: 42d39300cf am: a28f0003eb\" into nyc-mr1-dev-plus-aosp
am: 18b9573517

Change-Id: I6b9360bdbb145d4d0b6947ae11dd9dce7bdcbd5e
2016-06-13 22:39:07 +00:00
Doris Liu
a28f0003eb Merge \"Fix setCurrentPlayTime for started but not yet pulsed animations\" into nyc-dev
am: 42d39300cf

Change-Id: I7c1f2adb31ece266b082ffb9ea85b17c083b518c
2016-06-13 20:31:32 +00:00
Doris Liu
caa2ebf814 Fix setCurrentPlayTime for started but not yet pulsed animations
Also fix the behavior for calling reverse() immediately after
start(). Such case now triggers end() right away, which is
consistent with what the animation would do in M.

Bug: 29271714
Change-Id: I045e36e039179a3c462f22bc6a3a765437de4074
2016-06-13 17:29:03 +00:00
George Mount
51cfa78b25 Merge "Ensure Animators and AnimatorSets run together are sync'd" 2016-06-10 14:16:08 +00:00
George Mount
b04a0e57a7 Ensure Animators and AnimatorSets run together are sync'd
Bug 18122022

Previously, each animator would wait a frame after it was
started the animation was actually started. This is fine
for the first frame of an animation, but when it is within
an AnimatorSet, each animator will add a frame of delay.
This skews the animations so that they can no longer be
synchronized.

This CL refrains from waiting for an animation frame when it
is started during the animator callback and just start
the animation immediately on that frame.

Change-Id: I007dad9aef7596f0e954377a36a17afd4801b7fe
2016-06-09 16:55:27 -07:00
Doris Liu
c9493879d7 Support Keyframe definition for AVD on RT
BUG: 27441613
Change-Id: Iece386f65f3704d1b7caa2b3690a8d3048ccf6e2
2016-06-09 14:40:32 -07:00
Doris Liu
a57e95a6a3 Throw Exception for wrong valueType with API guard
Previously, wrong valueType error is swallowed in jni. As a result,
some animations are quietly skipped without letting developers know.
This CL maintains that behavior for pre-N, and throws Exception
to notify developers of the error for N and above.

Bug: 29009391
Change-Id: I3e8f003cdb97d214da72af3f93a84f64797b1c2c
(cherry picked from commit 94db09917a)
2016-06-09 14:39:18 -07:00
TreeHugger Robot
a282745fb8 Merge "Simplify KeyframeSet to avoid caching." 2016-06-09 19:26:50 +00:00
Doris Liu
7e1d493267 Merge "Support Keyframe definition for AVD on RT" 2016-06-09 00:05:41 +00:00