Status Update
Comments
er...@google.com <er...@google.com> #2
Branch: androidx-main
commit e1b42da3ee5bcb06756d8cb8377abf6116086e11
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue Sep 07 20:23:52 2021
Make nullable NavDeepLink arguments not required
Removing the inclusion of nullable NavDeepLink
arguments from the "required" argument checking.
RelNote: "Nullable `NavDeepLink` arguments no longer
require a default value."
Test: deepLinkNullableArgumentNotRequired test
Bug: 198689811
Change-Id: Ia14ef04bfe5b25942163688f40adacc30fa7e044
M navigation/navigation-common/src/androidTest/java/androidx/navigation/AddInDefaultArgsTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
va...@gmail.com <va...@gmail.com> #3
There's two issues here:
android:defaultValue="@null"
is actually treated as thedefaultValue
attribute not existing at all at runtime (we do still use it for Safe Args)- We enforced every argument without a default value to be present in the URI/route, even if it was nullable.
While we can't fix the first one, we have made the change in Navigation 2.4.0-alpha09
to only check for default values for non-nullable parameters. This should mean that
- Using
android:defaultValue="@null"
won't be a problem - Constructing a type in the Kotlin DSL via
navArgument("argument_name")
and making itnullable = true
without a default value won't be a problem.
py...@squareup.com <py...@squareup.com> #4
Unfortunately I still experience this bug with 2.4.0-alpha09 :(
java.lang.IllegalArgumentException: Deep link penny://app/offers can't be used to open destination Destination(de.penny.app.debug:id/offerListFragment) label=OfferListFragment class=de.penny.feature.offer.view.OfferListFragment.
Following required arguments are missing: [sectionIndexOrName, raffleId]
This is the excerpt from my navigation graph XML:
<argument
android:name="sectionIndexOrName"
android:defaultValue="@null"
app:argType="string"
app:nullable="true" />
<argument
android:name="raffleId"
android:defaultValue="@null"
app:argType="string"
app:nullable="true" />
<deepLink
android:id="@+id/offersDeeplink"
app:uri="penny://app/offers" />
As you can see both parameters are nullable and have a default value of null
.
ai...@gmail.com <ai...@gmail.com> #6
I'm sorry, I forgot to upgrade the Safe Args Gradle plugin as well. However when upgrading the plugin I now get
py...@squareup.com <py...@squareup.com> #7
So, this has been reopened for 5 months, can an engineer fix it now?
sh...@google.com <sh...@google.com> #8
Thanks again for reporting the issue. The functionality for Wakelocks has been moved from profiler to
aa...@google.com <aa...@google.com> #9
vanniktech
Can you clarify if you were using the Android Studio App Inspection tool when the leak was detected?
an...@google.com <an...@google.com> #10
In the future, if you encounter this or any other issue, please read
Thank you!
Description
I have a Foreground Service on which I use a wake lock. My use case is a meditation timer, where for the entire duration of your meditation I have foreground notification which counts down.
I have a wake lock property in my Service:
which I set here:
and clean up via:
Yesterday after my meditation, Leak Canary told me that my Service is leaking: