Commit 253868eb authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

[TouchToFill][Android] Fix wrong onDismissed calls

By setting the bottom sheet observer whenever we bring up the sheet, the
closing signal will be captured reliably. This wasn't the case before
which caused the bottom sheet to be permanently dismissed.

Note: I removed the NOTIMPLEMENTED() call from onDismiss() since it
crashes but has no real reason to do so — the cleanup happens in the
destructor anyway. It might be late but it's not wrong.

Side effect: for some reason, this seems to fix the intermediate peek
state (see screenshot 1 in the linked bug). This is unexpected and since
it's a timing-related issue probably not a reliable fix. It will be
addresses and tested separately, later.

Bug: 1011856
Change-Id: I8e2321ef920bc5adab116278521f95b449d10565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847214Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Friedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703707}
parent e405945e
......@@ -55,8 +55,7 @@ class TouchToFillBridge implements TouchToFillComponent.Delegate {
@Override
public void onDismissed() {
TouchToFillBridgeJni.get().onDismiss(mNativeView);
mNativeView = 0; // The native view shouldn't be used after it's dismissed.
if (mNativeView != 0) TouchToFillBridgeJni.get().onDismiss(mNativeView);
}
@Override
......
......@@ -61,7 +61,6 @@ class TouchToFillView implements BottomSheet.BottomSheetContent {
*/
void setEventListener(TouchToFillProperties.ViewEventListener viewEventListener) {
mEventListener = viewEventListener;
mBottomSheetController.getBottomSheet().addObserver(mBottomSheetObserver);
}
/**
......@@ -70,6 +69,7 @@ class TouchToFillView implements BottomSheet.BottomSheetContent {
*/
void setVisible(boolean isVisible) {
if (isVisible) {
mBottomSheetController.getBottomSheet().addObserver(mBottomSheetObserver);
mBottomSheetController.requestShowContent(this, false);
// Even though isPeekStateEnabled always returns false, the sheet will peek by default.
// Calling expand forces it into Half-open state.
......
......@@ -81,7 +81,6 @@ void TouchToFillViewImpl::Show(
void TouchToFillViewImpl::OnDismiss() {
// TODO(crbug.com/957532): Implement.
NOTIMPLEMENTED();
}
void TouchToFillViewImpl::OnCredentialSelected(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment