Commit Graph

358 Commits

Author SHA1 Message Date
Doris Liu
0b2c83643f Remove unnecessary value setting in AnimatorSet seeking
Also fixed seeking in paused state

BUG:68274315
BUG: 68382377
Test: ag/3835109
Change-Id: Ifa6b717a77a34f2152bd0e7ad285556986dd47ff
2018-04-02 17:55:33 -07:00
Jorim Jaggi
c2333b7ef6 Add ability to override global duration scale on ValueAnimator
This is needed as window animations are being ported over to use
ValueAnimator, and thus ValueAnimator need to ability to support
custom duration scales per object.

Test: ValueAnimatorTests
Bug: 64674361
Change-Id: Iea8d673b66e52866929174bbf6ca4a7ae882807b
2017-11-16 00:07:50 +00:00
Doris Liu
290271695d Fix end() for infinite AnimatorSet
BUG: 66880433
Test: repo steps in the bug above

Change-Id: If34b7386b7ff5cd28144e99c37957abddb068e9c
2017-09-26 17:04:36 -07:00
Wale Ogunwale
a5e833e846 Merge "Ensure that we use SF Vsync Choreographer for the PiP transition." into oc-dev am: e1e0db8ca9
am: 90159a2492

Change-Id: I0092411f5b8bef853b55e6ffe7bdf700876f7715
2017-06-13 01:08:25 +00:00
Winson Chung
4a526c1245 Ensure that we use SF Vsync Choreographer for the PiP transition.
- Move the bounds animation onto the animation thread
- Remove existing code referencing the old sf-vsync choreographer
- Add ability for ValueAnimator subclasses to reference a different
  AnimationHandler, which uses a different FrameCallbackProvider with the
  sf-vsync choreographer in the animations that require it
- Ensure that PiP touch events are batched and sent aligned with the
  sf-vsync
- Move GC onto its own thread to not block other BackgroundThread calls

Bug: 36371375
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: bit FrameworksServicesTests:com.android.server.wm.BoundsAnimationControllerTests
Test: go/wm-smoke

Change-Id: I6a41b35a4e4d4d6dbea82c2673452825fe3ffa58
2017-06-12 10:08:58 -07:00
Doris Liu
ba087b09fc Merge "Merge "Better handle non-recommended use and warn against it in JavaDoc" into oc-dev am: 8d06d8cbf1" into oc-dev-plus-aosp
am: 721ecfd21a

Change-Id: Iec199dd0cfe7beace7549d3e16e888458fd0306c
2017-06-07 03:58:45 +00:00
Doris Liu
8d06d8cbf1 Merge "Better handle non-recommended use and warn against it in JavaDoc" into oc-dev 2017-06-07 03:43:13 +00:00
Doris Liu
88bb31b954 Better handle non-recommended use and warn against it in JavaDoc
BUG: 62386748
Test: Follow repro steps in b/62358678. The issue is no
longer reproducible

Change-Id: Ic3cec7c4947296224edb5365d81988d4da7ee5e1
2017-06-07 01:41:34 +00:00
Doris Liu
7d0b3bbf15 Merge "Ensure start delay is properly scaled with duration scale" into oc-dev am: 9057f846ac
am: 4b5d12d25a

Change-Id: I80a1dc2c898a9456b651f6b1375055e6fcb59540
2017-06-01 01:05:17 +00:00
Doris Liu
2ac6547824 Ensure start delay is properly scaled with duration scale
BUG: 62126024
Test: CTS test in the same target branch
Change-Id: Ia396e69e053ccd90cdf37ac0b59c404c9952e497
2017-05-31 18:09:47 +00:00
Chet Haase
367804f1e4 Merge "Fix infinite loop problem in AnimationHandler" into oc-dev am: 163ec051d1
am: 3fb0e7555f

Change-Id: I91064e4baf1333c25d55d06e4373c83243c3e0da
2017-05-31 14:11:47 +00:00
Chet Haase
da9374211f Fix infinite loop problem in AnimationHandler
AnimationHandler.doAnimationFrame() iterates on a list that may be changed
during the course of the lopp, especially when Battery Saver is enabled, or
animators have zero duration, coupled with user code launching new animators
when old ones end.

The fix is to iterate through the old size of the list, and avoid processing
new animators in the current frame.

Bug: 37376806  Keyboard doesn't come up when battery saver is turned on on Android O
Test: manual
Change-Id: I40ca1d849e6f337779c23edbab22d80760c22f9b
2017-05-26 16:56:12 -07:00
Aurimas Liutikas
01e1b8550d Merge "Remove internal listener when cloning" into oc-dev am: a7dde34a81
am: c59f75af1d

Change-Id: Ia44c46f0784c412d71956c9e7f1e17533c991b9c
2017-05-16 16:00:56 +00:00
Philip Quinn
7fb80f7d27 Update the mTotalDuration for each animation in an AnimatorSet.
A cache was introduced in I677bc289f2ba430466f2d90ebc14368cb7b75118 to
optimise calls to createDependencyGraph(), but the update was removed in
If1dc6e8dbc93a4bf5ade8c5b0dcf43d3ee6ba7b5. This patch reintroduces the
update when calculating child animation start/end times to re-enable the
optimisation.

Test: cts-tradefed run cts-dev --module CtsAnimationTestCases
Change-Id: Ie9dad4049c07a151889b57809bf844ab854ff482
2017-05-15 21:36:30 +00:00
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