Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
https://android-review.googlesource.com/1360099
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
th...@gmail.com <th...@gmail.com> #3
Thank you for quick response. Had a workaround, but this is a lot cleaner.
il...@google.com <il...@google.com> #4
There's nothing else we can do while Navigation still depends on the Support Library, but I'll leave this open for when we move to AndroidX and can use https://developer.android.com/reference/androidx/activity/OnBackPressedCallback to intercept the back button before Fragments and correctly call navController().popBackStack().
If you've already moved to AndroidX, the onBackPressed() solution above or the same thing with an OnBackPressedCallback if you're using Fragment 1.1.0-alpha01 or higher would work.
If you've already moved to AndroidX, the onBackPressed() solution above or the same thing with an OnBackPressedCallback if you're using Fragment 1.1.0-alpha01 or higher would work.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d0c85eb6e595cfd4383ef345e97e1b8d6acd0a44
Author: Ian Lake <ilake@google.com>
Date: Thu Apr 18 10:40:16 2019
Have each Fragment register its own back pressed callback
By splitting the OnBackPressedCallback apart at
a FragmentManager level, we can ensure that the
appropriate Lifecycle is used for each callback,
allowing developers to interleave the Fragment
back stack management with their own custom
callbacks.
Test: updated PrimaryNavFragmentTest tests
BUG: 111598096
Change-Id: I22cc38794c1ee20da370f1843d667b34a9529c22
M activity/api/1.0.0-alpha07.txt
M activity/api/current.txt
M activity/src/main/java/androidx/activity/ComponentActivity.java
A activity/src/main/java/androidx/activity/OnBackPressedDispatcherOwner.java
M fragment/src/androidTest/java/androidx/fragment/app/PrimaryNavFragmentTest.kt
M fragment/src/main/java/androidx/fragment/app/FragmentActivity.java
M fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
https://android-review.googlesource.com/947823
https://goto.google.com/android-sha1/d0c85eb6e595cfd4383ef345e97e1b8d6acd0a44
Branch: androidx-master-dev
commit d0c85eb6e595cfd4383ef345e97e1b8d6acd0a44
Author: Ian Lake <ilake@google.com>
Date: Thu Apr 18 10:40:16 2019
Have each Fragment register its own back pressed callback
By splitting the OnBackPressedCallback apart at
a FragmentManager level, we can ensure that the
appropriate Lifecycle is used for each callback,
allowing developers to interleave the Fragment
back stack management with their own custom
callbacks.
Test: updated PrimaryNavFragmentTest tests
BUG: 111598096
Change-Id: I22cc38794c1ee20da370f1843d667b34a9529c22
M activity/api/1.0.0-alpha07.txt
M activity/api/current.txt
M activity/src/main/java/androidx/activity/ComponentActivity.java
A activity/src/main/java/androidx/activity/OnBackPressedDispatcherOwner.java
M fragment/src/androidTest/java/androidx/fragment/app/PrimaryNavFragmentTest.kt
M fragment/src/main/java/androidx/fragment/app/FragmentActivity.java
M fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d5a1c250e6e3471297f64e116a46d1a3a5c9db6c
Author: Ian Lake <ilake@google.com>
Date: Wed Apr 24 15:37:02 2019
Use OnBackPressedCallback in NavController
Replace the brittle OnBackStackChangedListener
with an OnBackPressedCallback registered at the
NavController level which works on all Navigators.
It also helps fix a timing issue where the state
of the FragmentNavigator isn't updated after a Fragment
is popped off the stack, leading to a mismatch in
expected actions available if the newly visible Fragment
calls navigate() in a lifecycle method.
Test: updated tests, new OnBackPressedTest
BUG: 111598096
Change-Id: Id679ea6ac9b238240649656fc0796552d6191757
M navigation/common/api/restricted_2.1.0-alpha03.txt
M navigation/common/api/restricted_current.txt
M navigation/common/src/main/java/androidx/navigation/Navigator.java
M navigation/fragment/src/androidTest/AndroidManifest.xml
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
A navigation/fragment/src/androidTest/java/androidx/navigation/fragment/OnBackPressedTest.kt
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/test/EmptyFragment.kt
A navigation/fragment/src/androidTest/java/androidx/navigation/fragment/test/NavigationActivity.kt
A navigation/fragment/src/androidTest/res/navigation/nav_simple.xml
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
M navigation/fragment/src/main/java/androidx/navigation/fragment/NavHostFragment.java
M navigation/runtime/api/2.1.0-alpha03.txt
M navigation/runtime/api/current.txt
M navigation/runtime/build.gradle
M navigation/runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/runtime/src/main/java/androidx/navigation/NavController.java
M navigation/runtime/src/main/java/androidx/navigation/NavHost.java
https://android-review.googlesource.com/951629
https://goto.google.com/android-sha1/d5a1c250e6e3471297f64e116a46d1a3a5c9db6c
Branch: androidx-master-dev
commit d5a1c250e6e3471297f64e116a46d1a3a5c9db6c
Author: Ian Lake <ilake@google.com>
Date: Wed Apr 24 15:37:02 2019
Use OnBackPressedCallback in NavController
Replace the brittle OnBackStackChangedListener
with an OnBackPressedCallback registered at the
NavController level which works on all Navigators.
It also helps fix a timing issue where the state
of the FragmentNavigator isn't updated after a Fragment
is popped off the stack, leading to a mismatch in
expected actions available if the newly visible Fragment
calls navigate() in a lifecycle method.
Test: updated tests, new OnBackPressedTest
BUG: 111598096
Change-Id: Id679ea6ac9b238240649656fc0796552d6191757
M navigation/common/api/restricted_2.1.0-alpha03.txt
M navigation/common/api/restricted_current.txt
M navigation/common/src/main/java/androidx/navigation/Navigator.java
M navigation/fragment/src/androidTest/AndroidManifest.xml
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
A navigation/fragment/src/androidTest/java/androidx/navigation/fragment/OnBackPressedTest.kt
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/test/EmptyFragment.kt
A navigation/fragment/src/androidTest/java/androidx/navigation/fragment/test/NavigationActivity.kt
A navigation/fragment/src/androidTest/res/navigation/nav_simple.xml
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
M navigation/fragment/src/main/java/androidx/navigation/fragment/NavHostFragment.java
M navigation/runtime/api/2.1.0-alpha03.txt
M navigation/runtime/api/current.txt
M navigation/runtime/build.gradle
M navigation/runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/runtime/src/main/java/androidx/navigation/NavController.java
M navigation/runtime/src/main/java/androidx/navigation/NavHost.java
il...@google.com <il...@google.com> #7
NavController now offers new APIs to hook up to an OnBackPressedDispatcher: https://developer.android.com/guide/navigation/navigation-custom-back
Which allows NavController to intercept the back button before the FragmentManager, ensuring that we update our state before going through Lifecycle events and fixing this edge case.
This behavior is enabled by default if you're using NavHostFragment, but custom NavHosts can call through to this same API for their own Navigators and not try to intercept the back button themselves.
Which allows NavController to intercept the back button before the FragmentManager, ensuring that we update our state before going through Lifecycle events and fixing this edge case.
This behavior is enabled by default if you're using NavHostFragment, but custom NavHosts can call through to this same API for their own Navigators and not try to intercept the back button themselves.
il...@google.com <il...@google.com> #8
This will be available in Navigation 2.1.0-alpha03.
Description
Version used: 1.0.0-alpha03
Devices/Android versions reproduced on: All
Trying to navigate in onResume of a fragment is causing a crash if the fragment was popped to.
The attached project consists of three fragments: A, B, C.
A is the home fragment and has conditional navigation to B. The conditional navigation will be triggered when the app is started, and after fragment C has been shown.
When navigating to B from A at app start there are no issues. Going back to A, then tapping the button to navigate to C, and then going back will trigger the conditional navigation again and cause a crash.
Same problem exists in alpha02.