OSDN Git Service

[Companion] Make notification dialog non-cancelable
authorEugene Susla <eugenesusla@google.com>
Wed, 2 Aug 2017 22:05:03 +0000 (15:05 -0700)
committerEugene Susla <eugenesusla@google.com>
Thu, 3 Aug 2017 03:06:50 +0000 (20:06 -0700)
Bug: 63405718
Test: Ensute that the notification access dialog is not dismissable with
either back button or touch outside
Change-Id: I613da247a2adc0571478f649a2191cd5840359f0

src/com/android/settings/notification/NotificationAccessConfirmationActivity.java

index 6a13282..66e7c44 100644 (file)
@@ -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();
     }