From 6a26e93c750623ab5e8d3f16a21a3d5725d1bf5b Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Tue, 26 Sep 2017 09:01:59 -0700 Subject: [PATCH] Re-add callback to onCancel() when screen is touched outside Save UI. That callback was accidentally removed because it should not trigger the negative listener, but the right approach was to pass a null listener. Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases Bug: 66235266 Fixes: 66944844 Change-Id: I5b71d3d03335d952e3b47078d1373f9783366437 --- .../autofill/java/com/android/server/autofill/ui/SaveUi.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java index cd9bdb7205b19..d48f23caedaaf 100644 --- a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java +++ b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java @@ -271,6 +271,10 @@ final class SaveUi { mDialog = new Dialog(context, R.style.Theme_DeviceDefault_Light_Panel); mDialog.setContentView(view); + // Dialog can be dismissed when touched outside, but the negative listener should not be + // notified (hence the null argument). + mDialog.setOnDismissListener((d) -> mListener.onCancel(null)); + final Window window = mDialog.getWindow(); window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY); window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE