diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index 0a40a986f87ca..dc87aeb6353f0 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -277,7 +277,6 @@ public class AlertDialog extends Dialog implements DialogInterface {
public static class Builder {
private final AlertController.AlertParams P;
private int mTheme;
- private Context mWrappedContext;
/**
* Constructor using a context for this builder and the {@link AlertDialog} it creates.
@@ -291,7 +290,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
* the {@link AlertDialog} it creates.
*/
public Builder(Context context, int theme) {
- P = new AlertController.AlertParams(context);
+ P = new AlertController.AlertParams(new ContextThemeWrapper(context, theme));
mTheme = theme;
}
@@ -304,10 +303,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
* @return A Context for built Dialogs.
*/
public Context getContext() {
- if (mWrappedContext == null) {
- mWrappedContext = new ContextThemeWrapper(P.mContext, mTheme);
- }
- return mWrappedContext;
+ return P.mContext;
}
/**
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 0b223b39365c6..0031a01a76ce3 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1505,6 +1505,11 @@