| Code-Review | +1 |
.addMenuProvider(new AutofillHelpMenuProvider(this), this, Lifecycle.State.RESUMED);Curious: How this fixes the back button?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
.addMenuProvider(new AutofillHelpMenuProvider(this), this, Lifecycle.State.RESUMED);Curious: How this fixes the back button?
The bug has to do with the setHasOptionsMenu(true).
By looking at the [source code](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java;l=1333;drc=c6e699ed89869035210a281f78b1065a51d5a0b8), this method sets the `mHasMenu` member variable.
When the menu is clicked and the click is handled, the `onOptionsItemSelected` is [invoked](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java;l=3264;drc=c6e699ed89869035210a281f78b1065a51d5a0b8). I haven't figured out the exact reason why it breaks the back button navigation, because calling `onOptionsItemSelected` for the back button should return `false`, the `AutofillOptionsFragment` doesn't [handle](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/autofill/android/java/src/org/chromium/chrome/browser/autofill/settings/options/AutofillOptionsFragment.java;l=188-196;drc=25829d5b45397a4ae3d243ff77c468981493c39a) this item.
.addMenuProvider(new AutofillHelpMenuProvider(this), this, Lifecycle.State.RESUMED);Timofey ChudakovCurious: How this fixes the back button?
The bug has to do with the setHasOptionsMenu(true).
By looking at the [source code](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java;l=1333;drc=c6e699ed89869035210a281f78b1065a51d5a0b8), this method sets the `mHasMenu` member variable.
When the menu is clicked and the click is handled, the `onOptionsItemSelected` is [invoked](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java;l=3264;drc=c6e699ed89869035210a281f78b1065a51d5a0b8). I haven't figured out the exact reason why it breaks the back button navigation, because calling `onOptionsItemSelected` for the back button should return `false`, the `AutofillOptionsFragment` doesn't [handle](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/autofill/android/java/src/org/chromium/chrome/browser/autofill/settings/options/AutofillOptionsFragment.java;l=188-196;drc=25829d5b45397a4ae3d243ff77c468981493c39a) this item.
Ok, thanks for checking, explaining and fixing the bug at the first place! 😊
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[AutofillAi][HoT] Fix back button navigation in 2 fragments.
This CL fixes a bug where the back button was a no-op in the
AutofillOptionsFragment and AutofillPersonalContextFragment.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |