Skip to content

Commit

Permalink
Change usage of LayoutInflater.from() to LayoutInflater.cloneInContex…
Browse files Browse the repository at this point in the history
…t(). This is more correct and removes the need for overriding getSystemService() in our ContextWrapper, however, since users may be depending on this if they used LayoutInflater.from() leaving in that getSystemService() override.

Fixes #3222.

RELNOTES=Fix #3222. Generated fragment code previously would cause a Lint issue around LayoutInflater.from().
PiperOrigin-RevId: 430493436
  • Loading branch information
Chang-Eric authored and Dagger Team committed Feb 28, 2022
1 parent 83119ea commit f391428
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -245,8 +245,7 @@ private MethodSpec inflatorMethod() {
"$T inflater = super.onGetLayoutInflater(savedInstanceState)",
AndroidClassNames.LAYOUT_INFLATER)
.addStatement(
"return $T.from($T.createContextWrapper(inflater, this))",
AndroidClassNames.LAYOUT_INFLATER,
"return inflater.cloneInContext($T.createContextWrapper(inflater, this))",
metadata.componentManager())
.build();
}
Expand Down

0 comments on commit f391428

Please sign in to comment.