From d004a96c5be10e660f0afc8f77a38211945af613 Mon Sep 17 00:00:00 2001 From: Eugene Susla Date: Wed, 2 Aug 2017 15:05:03 -0700 Subject: [PATCH] [Companion] Make notification dialog non-cancelable Bug: 63405718 Test: Ensute that the notification access dialog is not dismissable with either back button or touch outside Change-Id: I613da247a2adc0571478f649a2191cd5840359f0 --- .../notification/NotificationAccessConfirmationActivity.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java b/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java index 6a13282285..66e7c44e8b 100644 --- a/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java +++ b/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java @@ -82,6 +82,9 @@ public class NotificationAccessConfirmationActivity extends Activity AlertController .create(this, this, getWindow()) .installContent(p); + // Consistent with the permission dialog + // Used instead of p.mCancelable as that is only honored for AlertDialog + getWindow().setCloseOnTouchOutside(false); } private void onAllow() { @@ -109,6 +112,12 @@ public class NotificationAccessConfirmationActivity extends Activity } @Override + public void onBackPressed() { + // Suppress finishing the activity on back button press, + // consistently with the permission dialog behavior + } + + @Override public void cancel() { finish(); } -- 2.11.0