Commit Graph

263 Commits

Author SHA1 Message Date
Doris Liu
c4bb185d41 VectorDrawable native rendering - Step 5 of MANY
This is reverting the revert of what reverts the revert of the original
implementation. Fourth revert is a charm!

This reverts commit df7fdb1e0b.

Change-Id: I6fc3a5accfd8b79c3da31bbc101ad9e9b4d6e7dd
2016-02-19 13:51:31 -08:00
Doris Liu
df7fdb1e0b Revert "Revert "Revert "VectorDrawable native rendering - Step 5 of MANY"""
This reverts commit 0d20a275a5.

Change-Id: I97c782f1164a5d39ab74dc098cca71d9e1b30cd8
2016-02-18 18:37:02 +00:00
Doris Liu
0d20a275a5 Revert "Revert "VectorDrawable native rendering - Step 5 of MANY""
This reverts commit e03ef25a3e.

Change-Id: I9c2e1c891667451a3ee668e414bf337ad67279ab
2016-02-12 19:49:29 -08:00
John Reck
e03ef25a3e Revert "VectorDrawable native rendering - Step 5 of MANY"
Bug: 27136799

This reverts commit 18bdf443e3.

Change-Id: I825b061eec2a591f2d18119ba64494624b9ad4f2
2016-02-11 17:02:33 +00:00
Doris Liu
18bdf443e3 VectorDrawable native rendering - Step 5 of MANY
Implemented reset() (public API for AVD)
and reverse() (internal API that needs to be supported)

Change-Id: Ife1650049f271cad1347943151a5800c40c20aa2
2016-02-11 01:08:47 +00:00
Doris Liu
766431aa57 Revert "Revert "VectorDrawable native rendering - Step 4 of MANY""
This reverts commit 5a11e8d0ba.

Change-Id: I7a48b59c4f930dad65ddc8590c25a12636244ea2
2016-02-04 16:29:51 -08:00
Doris Liu
5a11e8d0ba Revert "VectorDrawable native rendering - Step 4 of MANY"
b/26949340 and b/26975469, b/26975079 as well 

This reverts commit f276acd984.

Change-Id: I4b55177daf0d289bc03604c71fd4bf579f65073a
2016-02-04 20:59:00 +00:00
Doris Liu
f276acd984 VectorDrawable native rendering - Step 4 of MANY
This CL runs VectorDrawable animation on RenderThread. The changes in this CL
include:
- Convert all the animators in AnimatorSet for AVD into a set of RenderNodeAnimators.
- Hook up the new animators with RenderThread
- Add drawOp in RecordingCanvas for drawing VD so that during the animation
  on RenderThread, all the property changes on VD can be reflected on the screen.

TODO:
- Implement reverse and reset for AVD.

Change-Id: I2df1d754f2db0ad098d9c15dde4bb2bdfafc2315
2016-02-02 15:04:01 -08:00
George Mount
0f5fd2d870 Merge "Add IntDefs for Animator and Transition classes." 2016-01-14 16:21:27 +00:00
George Mount
7764b920f2 Add IntDefs for Animator and Transition classes.
Bug 23593341

Change-Id: Ifcb30322cb90efb32262c80f5d11c2d39efc5080
2016-01-13 15:21:51 -08:00
Chet Haase
406a02b59d Don't double-set keyframe values when Property exists
There is logic in PVH.setupValue() that sets the value of
the appropriate keyframe from a Property, if that Property object
exists for the animator. But after that is done, it goes ahead and sets
the same keyframe value based on the getter for the target object.
This is not only redundant; it is wrong (in the odd situation in which
a getter would return something different than Property.get()).

The solution is to return early once we've set the value with the
Property object.

Issue #26471646  PropertyValuesHolder uses reflection in setupValue when a Property is being used

Change-Id: I12634a25661400f13f44872ba17625b32e93ca19
2016-01-11 16:27:20 -08:00
Doris Liu
804618d086 VectorDrawable native rendering - Step 2 of MANY
Introduced PathData in Java, which is effectively a thin layer around the
native instance. PathData holds the verbs and points which is being used
in path morphing/interpolation. The verbs and points can be interpreted
into skia path commands, which is now done in native and therefore saves
a handful of JNI calls during path creation.

Removed the old PathDataNode mechanism and changed the PathEvaluator
to use PathData instead.

Also added tests and a microbench. Also ran CTS tests for VectorDrawable
and AnimatedVectorDrawable, and passed all of the existing tests.

Change-Id: Ia166f5172ff031fe18b154327967f911a62caec1
2015-11-18 13:38:23 -08:00
Doris Liu
66d4856653 Fix animator sometimes not being ended when end() is called without start()'ing
Bug: 23713124
Change-Id: I2e00cedb9c74e14d2361579bba89d3d1dbfe4d22
2015-11-09 14:44:35 -08:00
George Mount
f2aeca34ba Change wrong doc about using linear interpolator.
Bug 24986885

Change-Id: I79f2cd0c6439749bf1fc412d28471e865501aa5a
2015-10-16 10:47:57 -07:00
Doris Liu
8b7c99cca2 New public API for calculating the total duration of an animation
Total duration is the total amount of time an animation takes from
start to finish. It include start delay (if any), child animation
sequence, accounting for repeat.

Change-Id: Id5b36a63c02e25586aefd38612aa5867492e1adb
2015-10-12 18:24:40 -07:00
Doris Liu
fbe94ece70 More refactor on ValueAnimator
mPlayingBackwards is confusing when placed next to mReversing.
One means the overall direction of animation playing, the other
indicates the direction of playing in the current iteration.

mCurrentIteration and mPlayingBackward are redundant together,
as the latter can be derived from the former, given the overall
direction of animation playing. Redundant variables pose risk of
getting out of sync and therefore are refactored out in this CL.
Instead, an overall fraction that ranges from 0 to mRepeatCount + 1
was introduced. It can capture both the current iteration and the
fraction in the current iteration. It gives a much better idea of
the overall progress of the animation.

Change-Id: Ic0ea02c86b04cfc01c462687d1ebbd46184cbab7
2015-10-08 18:40:05 -07:00
Chet Haase
4365e5a137 Fix ValueAnimator.getCurrentPlayTime()
Return a valid value for the current play time if the animator has
been seeked to a play time or fraction, but not yet started.

Issue #24717972 animator.getCurrentPlayTime() is all messed up

Change-Id: I15f1329b65410b4b0366a23a3419b5987305a865
2015-10-08 12:47:10 -07:00
Doris Liu
7b67734fe3 Merge "Fix behavior change for animators without a start delay" 2015-10-02 17:16:34 +00:00
Doris Liu
f57bfe2fef Fix behavior change for animators without a start delay
This CL maintains the behavior that animators without any
start delay will get started right away, instead of being delayed
to the first frame as it was in the previous refactor.

Bug: 23825781
Change-Id: I7873bc6c7a761c1b4d48ee5e17af631b359fd676
2015-10-01 18:48:15 -07:00
Doris Liu
2b2e2c8d25 Update doc to reflect requirement of a Looper for changing animation's frame delay
Bug: 24569533
Change-Id: Ie886394a5e3cd7ceebbedbf09e2d9645b464a9c6
2015-10-01 11:11:04 -07:00
Doris Liu
ee684556ce Correct isRunning() behavior for AnimatorSet
isRunning() for an Animator indicates whether an animator has gone
past its start delay and not yet finished. As a subclass of Animator,
AnimatorSet should follow the same principle. The implemention prior
to this CL returns whether any child animation is running, which is
inconsistent with the javadoc for isRunning() and general behavior
for Animator.

Change-Id: Iece814dfcd609ee292dbc00bd55dc64c7bda8e57
2015-08-28 13:21:03 -07:00
Doris Liu
3dbaae1ef4 Prevents recursive call into end() or cancel()
end() and cancel() in ValueAnimator will trigger onAnimationCancel
or onAnimationEnd callback on its listeners. If additional end()
or cancel() request comes from the callback, a loop will be formed.
Therefore, we need to mark when the end is reuqested so we do not
process end() or cancel() request multiple times during one animation
run, and also effectively terminate the loop.

Bug: 23596652
Change-Id: Iefb69eb8969071b43124c09d7cccbe9ff5ba5dcc
2015-08-27 16:13:48 -07:00
Doris Liu
f310e88939 Fix build
Change-Id: Ib454858f0fe3eb9171297c2c1ccece33729c487b
2015-08-27 13:40:07 -07:00
Doris Liu
3618d30f8a Internal cleanup for Animator framework
This CL includes the following changes:
1) Remove redundant field mPlayingState in ValueAnimator.
2) Refactor AnimationHandler so that all of its interaction with Choreographer
   is through an interface. A custom provider that implements this interface can
   be plugged in and provide timing pulse that are independent of Choreographer.
3) Better encapsulate AnimationHandler and ValueAnimator. Interaction between
   the two is done through register/unregister frame callbacks as well as
   AnimationFrameCallback interface.
4) Change how animation delay is handled.

Change-Id: Icd49f727321c362dab49b5b33815333c9ea559e0
2015-08-26 18:05:04 -07:00
Doris Liu
458f20ed5a Exclude DelayAnim in child animation value setup
Change-Id: I5f3274d3c1a6fee7b22bb59cdb80f9bce8c4420e
2015-08-11 15:21:37 -07:00
Doris Liu
49db4242b1 Add cache for each animation's duration in AnimatorSet
Each animator's total druation is cached in the set, so that when
their duration changes, the dependency graph will be updated to
reflect the change.

Change-Id: I677bc289f2ba430466f2d90ebc14368cb7b75118
2015-08-10 13:33:06 -07:00
Doris Liu
1cbcbf3f4d Merge "Make sure the correct AnimatorListeners gets called" 2015-08-06 22:03:02 +00:00
Doris Liu
6f2276bf79 Make sure the correct AnimatorListeners gets called
This CL fixes the bug where when there're AnimatorSet inside of
AnimatorSet, incorrect AnimatorListeners get notified of the
Animator's lifecycle events.

Bug: 22940651
Bug: 22954352
Change-Id: I2bf66413d54dcfc75dc7fa779e723443763a30a5
2015-08-06 14:42:00 -07:00
Doris Liu
dbf69e4652 Exclude delay animation from getChildAnimations() list
Bug: 22975427
Change-Id: I8bd9a51f0a886873346d77e9452662301a7c0363
2015-08-06 11:02:32 -07:00
Doris Liu
5e66616c04 Fix clone in AnimatorSet
Change-Id: I277d801897b08889c53522affdfc5581953c4f01
2015-08-03 16:06:56 -07:00
Doris Liu
1309914ebf Refactor AnimatorSet in prep for adding more functionalities
This refactor changes how relationships (i.e. with/after/before)
among Animators in an AnimatorSet are represented. Specifically,
a directed graph is used: parent-child indicates sequential
relationship, and siblings will fire simultaneously.

This CL also fixed the issue where start delays for Animators that
play together are not handled correctly.

Bug: 11649073
Bug: 18069038
Change-Id: I5dad4889fbe81440e66bf98601e8a247d3aedb2e
2015-07-30 15:09:33 -07:00
Chet Haase
81728b862e Merge "Clarify docs for Animator.isStarted()" into mnc-dev 2015-06-10 14:27:47 +00:00
Chet Haase
4ddd9257d6 Clarify docs for Animator.isStarted()
Behavior is different than spec'd for one-shot animators, clarified
docs to reflect that.

Issue #21087798 better docs for isStarted()

Change-Id: I499a5d52cf02ef715acb6ae0635ede4328c93de8
2015-06-10 10:42:50 +01:00
Doris Liu
2787cebfdc Infer value type for ObjectAnimator, too
Previously, changes have been made to infer value types for
PropertyValuesHolder when no value type is defined. This CL applies
the same inferring logic to ObjectAnimator too.

Bug: 21645431
Change-Id: Ifdf163a7d32da990dc2281080f87f94c0df0e9ce
2015-06-08 14:42:13 -07:00
Doris Liu
a2f043822b Merge "Use ArrayMap instead of HashMap for storing relavant nodes" into mnc-dev 2015-05-11 21:31:42 +00:00
Doris Liu
d7444427d9 Use ArrayMap instead of HashMap for storing relavant nodes
This fix is to take advantage of ArrayMap, which is a key-value
mapping data structure that is more memory efficient than HashMap.

Bug: 11604254
Change-Id: I57006880de570a4d7f3899e274cf0a06355d116b
2015-05-11 13:23:31 -07:00
Alan Viverette
6a8c79bb2b Merge "Improve keying for theme caches, rebase system theme on config change" into mnc-dev 2015-05-07 21:19:59 +00:00
Alan Viverette
e54d245b99 Improve keying for theme caches, rebase system theme on config change
Themes now use an array of applied styles rather than a String to store
their history. They are keyed based on a hash code computed from the
history of applied styles. The themed drawable cache has been abstracted
out into its own class.

Also updates system context to use DayNight as the default and ensures
that GlobalActions uses the correct context, which exercises the change.

CTS tests have been added in another CL.

Bug: 20421157
Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
2015-05-06 10:41:43 -07:00
Chet Haase
0698594d47 Fix leak in LayoutTransition
Previously, an OnPreDrawListener was added to clean things up, including
removing the listener, after animations are started.
But if the view is detached before that listener is called, the
listener will remain on that ViewTreeObserver.

This change adds an OnAttachStateChangeListener to perform that cleanup
step when the view is detached, just in case.

Issue #20824645 Leak in LayoutTransition

Change-Id: I264812f8e02dda673789712ba83d208e87cdc5a4
2015-05-05 20:57:58 -07:00
Doris Liu
7eaccbfbc2 Remove distance based animation duration API
Bug: 20500107

This reverts commit 0084e37095.

Change-Id: I57f1f3a22c5adfefd966447050b100a50e7141b2
2015-04-23 18:33:39 -07:00
Doris Liu
7b380329ec Merge "Infer value type for keyframes when it is undefined" 2015-04-23 01:13:39 +00:00
Doris Liu
a01fbf35de Infer value type for keyframes when it is undefined
Bug: 20140483

Change-Id: Idf6caea2a8eae803e33dd34b9c8f563ad12e1848
2015-04-22 14:50:17 -07:00
ztenghui
57c78290e4 Merge "Being extra careful, reset some more variables on ValueAnimator." 2015-04-21 22:13:03 +00:00
ztenghui
e1b5c2b48a Being extra careful, reset some more variables on ValueAnimator.
No real bug found related to these set of variables yet, just a clean up.

b/20457797

Change-Id: I8443718b1c289ccc87e6b227d417825838277361
2015-04-21 14:20:32 -07:00
ztenghui
fe7cca3d27 Merge "Reset the Node status when clone." 2015-04-21 21:03:12 +00:00
ztenghui
b1e80d826b Reset the Node status when clone.
b/20457797

Change-Id: I5f1b0e2238fdc4a69a9c09c1e6e0272f7ede3685
2015-04-21 13:00:09 -07:00
Doris Liu
7513aab4df Revert "Use real screen size to scale duration"
This reverts commit 5ed54c743c.

Reverting to avoid build breakage.

Change-Id: Ib73056bb5a11e718cbc82db5917946bdf8db06dc
2015-04-18 00:14:14 +00:00
Doris Liu
5ed54c743c Use real screen size to scale duration
Duration scale based on screen size was using the area of the screen
excluding system bars to compare with our reference device's screen
size. This caused the following issues:
1) On baseline device (i.e N5) a scaling factor that is not 1 will be
   applied to the duration.
2) Scaling on the same device will be different in landscape vs.
   portrait, as the system bars take different amounts of space in
   different orienations.

This CL fixes both of the above issues.

Bug: 20309042

Change-Id: I9d1d0a471d968bee1330b80f0f69a0066d6a1860
2015-04-17 16:25:01 -07:00
Doris Liu
a7e8cfe978 Fix duration scale attribute for AnimatorSet
Bug: 20160979
Change-Id: I876771a037d2c254fc53ad0bfa4880e69e427090
2015-04-13 11:29:19 -07:00
Doris Liu
02ecf04097 Merge "Distance based animation duration" 2015-04-10 21:47:25 +00:00