13 Commits

Author SHA1 Message Date
Jorim Jaggi
33a2183d4b Revert "Revert "Defer updating InsetsSource.mFrame while animating""
This reverts commit 8c56ac6b945e4050d56968e2adac673e052b772d.

Underlying issue has been fixed:

Test: InsetsControllerTest
Bug: 152071027
Change-Id: I2b80de7067bf688a6b36233b9a1e92e2cf31c148
2020-04-06 14:28:59 +02:00
Jorim Jaggi
8c56ac6b94 Revert "Defer updating InsetsSource.mFrame while animating"
This reverts commit 2751c29414d17650b1737e19c250ffbe4f266b82.

Reason: Broken logic

Test: Open IME in Messages
Fixes: 152695319
Change-Id: I6a63f20c6342d4284a5da99e39e8f835028a5b6b
2020-03-30 19:22:37 +02:00
Jorim Jaggi
2751c29414 Defer updating InsetsSource.mFrame while animating
...otherwise developer will get onApplyWindowInsets which don't
match end value of animation. Super confusing

Test: InsetsControllerTest
Bug: 152071027
Change-Id: Ic1819512a5ce78843433bf7c231d062e12de0e7b
2020-03-24 21:25:46 +01:00
Adrian Roos
5d557edb44 WindowInsetsAnimationController: Add state callback and getters
Adds more comprehensive callbacks and getters for the WindowInsetsAnimationController,
to make it more straight forward to properly use.

Test: atest InsetsControllerTest PendingInsetsControllerTest
Fixes: 151707442
Change-Id: Ida55f609112396c0f6de4c5c4431e0793c2e315e
2020-03-18 12:17:19 +01:00
Adrian Roos
5ad8cd2586 Revert "Revert "WindowInsetsController: Address API feedback""
This reverts commit 5e7097b21ea3841550044b933238f273be7cf2b6
and relands Id4cb53fddcecac17b7926068046760df5130dc39

Change-Id: I348141f27efcf7c22736778fbcdde4a110e95982
Fixes: 150472709
Test: atest InsetsControllerTest
2020-03-13 19:40:34 +00:00
Jaineel Mehta
5e7097b21e Revert "WindowInsetsController: Address API feedback"
This reverts commit c549e19c5efd37494dac75e4b372d126f1d2bf19.

Reason for revert: Droidcop: Potential culprit for Bug X - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I2ab42d96d2599dfcc946fa48b3940e2bd92b22b0
2020-03-12 17:46:17 +00:00
Adrian Roos
c549e19c5e WindowInsetsController: Address API feedback
Change CancellationSignal to parameter instead of return value.

Fixes: 150472709
Test: atest InsetsControllerTest
Change-Id: Id4cb53fddcecac17b7926068046760df5130dc39
2020-03-11 17:23:31 +01:00
Jorim Jaggi
ed35b1779b Add OnControllableInsetsChangedListener
It's useful for apps to know which inset types they can currently
control, as otherwise they have to poll by calling
controlInsetsAnimation repeatedly.

This can be used when apps want to apply a custom animation
immediately during startup as soon as possible.

Fixes: 150780468
Test: InsetsControllerTest
Test: CTS will be added soon
Test: WindowInsetsActivity
Change-Id: Ic0388c11d759843d3ac9edd8ef23904c9ce05c46
2020-03-10 12:23:58 +00:00
Adrian Roos
2345831a0a WindowInsetsTests: More compelling IME transition sample
Test: make WindowInsetsTests && adb install ...
Change-Id: I4320871bdc8184fac38921616e1a1322f8dbc804
2020-02-18 14:11:37 +00:00
Adrian Roos
db5b0c2321 WindowInsetsAnimation: Clean up API
Fixes issues the app developers have raised with
the WindowInsetsAnimation API:

- it really makes more sense to have the Animation
  as the outer class, and the Callback nested within
- it was not obvious previously that multiple animations
  could be running at the same time. A new argument to
  onProgress now makes this abundantly clear by passing
  in the list of running animations.
- The dispatch mode really fits better as a final
  property on the callback, rather than it being
  queried once from a getter.

Also fixes lint warnings.

Fixes: 143556682
Test: make checkapi; atest WindowInsetsControllerTests
Change-Id: I8cd8faac70dd5a15d779d2c983f0a0ea5d6bbd8e
2020-02-17 14:30:25 +01:00
Jorim Jaggi
dd3304ec3b Fix fraction, and other cleanup
Fraction is now from animation start to end state. This makes it
more in line with other animation fraction meaning. Also, the app
can figure out the animation direction on its own by inspecting
the visibility state when the animation gets prepared.

Also fix some other stuff in WindowInsetsAnimationCallback.

Test: CTS coming soon
Bug: 118118435
Change-Id: I81d36159817719a9b0ee25bb78cfbfddc2029270
2020-01-23 00:36:28 +01:00
Jorim Jaggi
6d13bf4a54 Fix up new insets dispatch behavior
- Fix up target SDK check
- Keep WindowInsets.CONSUMED concept to stop dispatch for
performance optimization. If the insets are handled at some point
in the hierarchy, we really don't need to dispatch it to all the
children. However, deprecate all the individual consuming methods
instead.

Bug: 118118435
Test: ViewGroupTest
Change-Id: I6b6627fb9c0a43444ee3f9dbeb978109f9138fbd
2020-01-21 17:03:04 +01:00
Jorim Jaggi
a31ca7caed Add test app for new Inset API's
Bug: 118118435
Change-Id: I53f09522a7859f15364dd2b71fa495256a830235
2020-01-16 12:27:46 +00:00