Commit Graph

229 Commits

Author SHA1 Message Date
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
Doris Liu
0084e37095 Distance based animation duration
In order to preserve the same look and feel of an animation across different
devices, we need to maintain the same angular velocity for the animation in
users' field of view. Since the animation path may span different angles on
different devices, we need to therefore adjust the duration accordingly.

Change-Id: Ia37f213e5a894a046edbb1a45a4ced04e406d85d
2015-04-10 14:09:30 -07:00
ztenghui
4e1e6af476 Merge "The ValueAnimator's state need to be totally reset during clone." 2015-04-10 20:49:00 +00:00
ztenghui
26e9a19900 The ValueAnimator's state need to be totally reset during clone.
b/20119270

Change-Id: I26365b38e4a9712227aaec6f08f32025dab82ac7
2015-04-10 13:33:13 -07:00
Doris Liu
fe928dac69 Merge "Add a check for color type in property values holder" 2015-04-10 17:19:43 +00:00
Doris Liu
9032fa5808 Add a check for color type in property values holder
Bug: 20140483
Change-Id: Ic6cc72388811a450e29a346625c785456834452b
2015-04-09 20:11:22 -07:00
Jeff Brown
c42b28dda4 Fix animation start jank due to expensive layout operations.
The Choreographer carefully schedules animation updates to occur
after input but before traversals occur.  This ensures that the
effects of animations are perceived immediately in the next frame.
The start time of animation is usually set the moment the animator
first runs.  The start time serves as a reference for timing the
remainder of the animation.

Setting the start time during the animation callback works well except
when traversals take a long time to complete.  In that case, we may
end up drawing the initial frame of the animation then skipping several
following frames (because a lot of time has already passed since the
animation start time was set), effectively shortening the duration
of the animation.

To resolve this issue, we introduce a new COMMIT phase within the
Choreographer.  The COMMIT callback runs after traversals complete
and may provide an updated frame time that more accurately reflects
the time when the frame finished drawing.

In the case where an animation is just starting, we note the fact
that its initial start time has not yet been committed (the user
hasn't actually seen anything on screen yet).  Then, during the
COMMIT phase, we adjust the animation start time to better reflect
the time when the animation's first frame was drawn, effectively
causing the animation actually start after the expensive traversal
operations occurred such that no frames will be skipped.

Bug: 17258911
Change-Id: I279603d01fd4ed1de8f51a77c62f4fec5e9b746a
2015-04-07 12:27:17 -07:00
Doris Liu
6aac06ab94 Add per-interval interpolation support for keyframe in xml resources
Bug: 19913234
Change-Id: Ie46af02b2db3dad6ace667480aa556e0f645d278
2015-04-02 16:28:40 -07:00
Doris Liu
6df99053eb Fix per-keyframe interpolators
Support different interpolators on every keyframe by running
interpolators on proportional duration instead of raw fraction.

Bug: 19928396

Change-Id: Ifb8c3a3b56785582cd6b0121d7bfb44534866300
2015-03-30 16:11:53 -07:00
Tor Norbye
c615c6fc9c Annotate methods to be called from overrides with @CallSuper
Change-Id: Ibc587c2aaee9f3e7f448079f72a75459fe4e15e7
2015-03-07 20:49:18 -08:00
John Spurlock
08c7116ab9 Remove unused imports in frameworks/base.
Change-Id: I031443de83f93eb57a98863001826671b18f3b17
2015-02-28 14:47:49 -05:00
Tor Norbye
7b9c912f53 Add @ResourceInt annotations on APIs
Change-Id: I119cc059c2f8bd98fd585fc84ac2b1b7d5892a08
2015-02-18 07:49:03 -08:00
Chet Haase
34efbcedac am af8c621d: Merge "Allow infinite-repeat zero-duration animators to continue repeating" into lmp-mr1-dev automerge: 458cc6a
automerge: f647cde

* commit 'f647cde899c4462b465721cd705f234da7e82730':
  Allow infinite-repeat zero-duration animators to continue repeating
2015-01-23 18:11:51 +00:00
Chet Haase
d15e94f030 Allow infinite-repeat zero-duration animators to continue repeating
A recent change to ValueAnimator caused infinitely repeating animators with
duration 0 to be ended immediately. BatterySaver mode can cause animators
to have 0 duration, which means that apps depending on animator update events
no longer receive those events due to this behavior change.

The fix is to restore the previous behavior of allowing repeating animators
to continue, regardless of duration.

Issue #19113776 Fix infinite-repeating, zero-duration animator behavior

Change-Id: I4d1c7afb6d06ca45ef41db73c160f6a6d5754e24
2015-01-23 02:07:00 +00:00
Chet Haase
d430753cba Add resource attributes for Keyframes and PropertyValuesHolders
Issue #17939329 Expose multi-property and multi-keyframe capabilities in animation resources

Change-Id: I14822ced47665fa6cde4996f74d3078da2ada38a
2015-01-15 07:21:54 -08:00
Eino-Ville Talvala
5a5afe010d Fix docs build
Change-Id: I9947d53aeb155d98f5194c9789f19aba1f01e4be
2014-12-05 11:11:55 -08:00
Chet Haase
f4e3bab925 Fix seeking behavior
A recent fix to seeking behavior injected a couple of issues that need
to be addressed:
- the start time should be updated when seeking so that future calculations
that depend on it (such as the next animation frame) will use the updated
start time based on this seek request. This allows, for example, seeking
into a running animator so that that animator will update its current fraction
to the new seeked value.
- calling reverse() on an unstarted animation would incorrectly set the initial
frame of the animation to the end value for one frame before the reverse animation
actually began.

Issue #18567716 No icons in folders in battery saving mode
Issue #18511989 Search bar flashes when icon is picked up and dropped

Change-Id: Ie30b7e797468c6ccb3d17d4fb3aba6b9849436b0
2014-12-04 15:09:01 -08:00
Chet Haase
5a25e5bae2 Zero duration animations snap to end value when started
A recent change to seeking behavior altered the logic of
setCurrentPlayTime() (which is called when animations are first
started) to set the current animated fraction to 0 for 0-duration
animations. This fix ensures that 0-duration animations snap to
their end value (fraction == 1) instead, matching the behavior
prior to the seeking fix.

Issue #18542543 Animations with 0 duration stay in initial state when calling setCurrentPlayTime(0)

Change-Id: I9916d962cf46453a9e3e1207f58baf16f4a5830a
2014-12-01 06:57:15 -08:00
Chet Haase
0d1c27a713 Fix seeking and scaled duration behavior
The animation scaled was not being factored in early enough in the
activity lifecycle. Also, setCurrentPlaytTime() was not accounting for
the scaled duration correctly. Finally, added setCurrentFraction() as
a more general-purpose seeking facility.

Issue #18222006 Animator duration scale ignored in some situations
Issue #17951668 add ability to seek fraction, not just time

Change-Id: Idad401f5ff5026d7046c36eee09d78a4793215dc
2014-11-19 15:29:47 -08:00
George Mount
691487d2c3 Remove unnecessary reflection lookup in Animators.
Bug 17978210

When Properties are used with PropertyValuesHolders or
ObjectAnimators, the reflection lookup for getters and
setters is unnecessary.

Fixed problem in which static maps were being protected
by instance locks.

Fixed problem where we were repeatedly doing a
reflection lookup on methods that don't exist.

Change-Id: Ic0a1b62357f3aaaa4c900fef6087583ad0e964b6
2014-11-11 08:51:53 -08:00
George Mount
e48ef2a3ef Cancel animation when target changes.
Bug 18201083

Change-Id: I2ea15063b18881c4b31ae6cdc287649dbc4a61f7
2014-11-04 07:55:03 -08:00
Yigit Boyar
d422dc358f Added a generic configuration and theme based cache
For now, only animators use it but we can consider migrating
drawable cache to it as well.

Bug: 17456416
Change-Id: I571b96856805edb171f0fc52e6bff5a365f46b70
2014-10-23 11:46:01 -07:00
Jeff Brown
7a08fe0e09 Reapply animation duration scale each time it is started.
When Battery Saver mode is enabled, we set the animation duration
scale factor to 0 to effectively disable all animations.  Later
when it is disabled, we reset the animation duration scale
factor to 1.

This change ensures that we reapply the duration scale factor
whenever the animation is started instead of only applying it
once when the duration is set (usually when the animation is
created).  This ensures that the correct scale factor is applied
even when it changes after the animation has been initialized.

Previously, certain animations would continue to be suppressed
even after Battery Saver mode was disengaged.  This wasn't much
of an issue when the duration scale was initially implemented as
a developer setting but now that it is exposed via Battery Saver
the artifacts caused by this bug have become visible to users.

Bug: 17887431
Change-Id: I91ba5ca0505d02ac389a31d067e38886112fa0c8
2014-10-07 15:55:35 -07:00
George Mount
bc68f5adc2 Allow Path Animations to support overshooting.
Bug 17458698

Change-Id: I7a29fc8932a28121d7db8b3bf695d91a55ef059b
2014-09-12 15:46:02 -07:00
Chet Haase
6f6578e81c Use constant state in AnimatedVectorDrawable
Complex animated vector drawables can be expensive to load due to
sub-optimal parsing of the String-based pathData. Suffering that penalty
every time the same drawable is loaded (such as material-themed
ProgressBars) is painful.

The new approach caches constant state of both the VectorDrawable (including
the pathData geometry) and the animators (which includes potentially expensive
path-based interpolators).

issue #17366831 Material ProgressBar taking 200+ms to inflate

Change-Id: Iba3b541e24cfce8c07f5aa9fe6aa7d7b92b2fe1c
2014-09-10 21:21:53 +00:00
George Mount
fd3c4744f2 Use intrinsic size for path animation in AnimatedVectorDrawable
Bug 16984007

Animated Vector Drawables were using the viewport dimensions for
calculating the allowable animation error. Instead of using viewport
dimensions, it is better to use the intrinsic dimensions. Using
the viewport dimensions meant that a small viewport (e.g. 1x1)
would mean that animation paths within would only have an accuracy
of 50% of the dimensions of the drawable.

Change-Id: Id0152eabb4effd1e50c644eea7a371b38baeb7c1
2014-09-09 17:09:57 -07:00
John Reck
f5945a0c8b Disable RT-anim for AnimatorSet
Bug: 17317184

 Unfortunately this will disable *all* RT animations in a scene,
 but we don't have more selective targetting currently

Change-Id: I57e1c0ae43957f45229473bdcdaf34c05825fab7
2014-09-05 15:58:26 -07:00
George Mount
984011f685 Use optimized Keyframes for Path animations.
Bug 17005728

Change-Id: I2e109ed1a3e768e1e0286fc3950516f16509e591
2014-08-29 16:02:28 -07:00
John Reck
291161ac38 Run RevealAnimator on RT
Bug: 16894195

Change-Id: I9acffa7aecc04c68b60c67f8f8a20aa225075a42
2014-08-19 16:32:43 -07:00
Craig Stout
7f9988f0f5 Fix NPEs when inflating a ValueAnimator.
Change-Id: I4489b9e80635053792668a2f8032635893fb4afd
2014-08-08 11:17:50 -07:00
Chris Craik
af4d04cab6 Use RoundRect clipping for circle reveal animation
bug:16630975

Also, remove inverse clipping feature from reveal animator.

Change-Id: I770a4eb48cd123b0ca0f39d16a0f3eefd1be3653
2014-07-30 17:15:50 +00:00
John Reck
c01bd1167a Return Animator instead of ValueAnimator
Change-Id: I29a7cfdc7ffbb3a4d33f9e64f9d7ca791f5c947c
2014-07-19 02:00:15 +00:00
John Reck
d3de42cae8 Add RT-enabled reveal animator
Bug: 16161431

 Also re-writes RevealAnimator to avoid using any listeners internally,
 removing the logic around shadowing the update listeners.

Change-Id: I6ed8126398eed971a87f20bccb7584c9acafbb6c
2014-07-18 22:10:22 +00:00
Yigit Boyar
dd223e612c Merge "Change Animators to reset values when restarted if their target changes" into lmp-dev 2014-07-16 16:25:13 +00:00
Yigit Boyar
8619f48fb3 Change Animators to reset values when restarted if their target changes
Bug: 15710503
Change-Id: Ib39bf0e13199978ffb389111c225beb30312c965
2014-07-16 14:39:25 -07:00