Revert "Fixed that OK button is not localized"
This reverts commit 52b754d270b5fad05e5c0946f85bae1b2067250c.
Reason for revert: b/271012759
Change-Id: I1b784a966acaca7a7339c739ca879acf4e95ab57
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index c567806..20a818e 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -87,6 +87,7 @@
private static final int THEME = com.android.internal.R.style.Theme_DeviceDefault_Dialog_Alert;
/** USSD information used to aggregate all USSD messages */
+ private static AlertDialog sUssdDialog = null;
private static StringBuilder sUssdMsg = new StringBuilder();
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
@@ -523,36 +524,39 @@
// displaying system alert dialog on the screen instead of
// using another activity to display the message. This
// places the message at the forefront of the UI.
- AlertDialog ussdDialog = new AlertDialog.Builder(context, THEME)
- .setPositiveButton(R.string.ok, null)
- .setCancelable(true)
- .setOnDismissListener(new DialogInterface.OnDismissListener() {
- @Override
- public void onDismiss(DialogInterface dialog) {
- sUssdMsg.setLength(0);
- }
- })
- .create();
- ussdDialog.getWindow().setType(windowType);
- ussdDialog.getWindow().addFlags(
- WindowManager.LayoutParams.FLAG_DIM_BEHIND);
+ if (sUssdDialog == null) {
+ sUssdDialog = new AlertDialog.Builder(context, THEME)
+ .setPositiveButton(R.string.ok, null)
+ .setCancelable(true)
+ .setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ sUssdMsg.setLength(0);
+ }
+ })
+ .create();
+ sUssdDialog.getWindow().setType(windowType);
+ sUssdDialog.getWindow().addFlags(
+ WindowManager.LayoutParams.FLAG_DIM_BEHIND);
+ }
if (sUssdMsg.length() != 0) {
- sUssdMsg.insert(0, "\n")
+ sUssdMsg
+ .insert(0, "\n")
.insert(0, app.getResources().getString(R.string.ussd_dialog_sep))
.insert(0, "\n");
}
if (phone != null && phone.getCarrierName() != null) {
- ussdDialog.setTitle(app.getResources().getString(R.string.carrier_mmi_msg_title,
+ sUssdDialog.setTitle(app.getResources().getString(R.string.carrier_mmi_msg_title,
phone.getCarrierName()));
} else {
- ussdDialog
+ sUssdDialog
.setTitle(app.getResources().getString(R.string.default_carrier_mmi_msg_title));
}
sUssdMsg.insert(0, text);
- ussdDialog.setMessage(sUssdMsg.toString());
- ussdDialog.show();
+ sUssdDialog.setMessage(sUssdMsg.toString());
+ sUssdDialog.show();
}
/**