Fix bug 4887033 - android.app.cts.AlertDialog_BuilderTest#testDisableCancelable
Change-Id: I659201124c4c6730046be55a918c64ca57a9f4db
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index 7a465c1..491fcfe 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -890,7 +890,10 @@
public AlertDialog create() {
final AlertDialog dialog = new AlertDialog(P.mContext, mTheme, false);
P.apply(dialog.mAlert);
- dialog.setCanceledOnTouchOutside(P.mCancelable);
+ dialog.setCancelable(P.mCancelable);
+ if (P.mCancelable) {
+ dialog.setCanceledOnTouchOutside(true);
+ }
dialog.setOnCancelListener(P.mOnCancelListener);
if (P.mOnKeyListener != null) {
dialog.setOnKeyListener(P.mOnKeyListener);