IMS: Avoid to set CLIR after click cancel
Fixes: 131474029
Change-Id: I55aa18685746145fc478a5b03d8b887cfbc1281d
diff --git a/src/com/android/phone/CLIRListPreference.java b/src/com/android/phone/CLIRListPreference.java
index 5c6132b..d8a9041 100755
--- a/src/com/android/phone/CLIRListPreference.java
+++ b/src/com/android/phone/CLIRListPreference.java
@@ -47,10 +47,15 @@
     protected void onDialogClosed(boolean positiveResult) {
         super.onDialogClosed(positiveResult);
 
-        mPhone.setOutgoingCallerIdDisplay(convertValueToCLIRMode(getValue()),
-                mHandler.obtainMessage(MyHandler.MESSAGE_SET_CLIR));
-        if (mTcpListener != null) {
-            mTcpListener.onStarted(this, false);
+        if (positiveResult && (getValue() != null)) {
+            mPhone.setOutgoingCallerIdDisplay(convertValueToCLIRMode(getValue()),
+                    mHandler.obtainMessage(MyHandler.MESSAGE_SET_CLIR));
+            if (mTcpListener != null) {
+                mTcpListener.onStarted(this, false);
+            }
+        } else {
+            Log.d(LOG_TAG, String.format("onDialogClosed: positiveResult=%b value=%s -- do nothing",
+                        positiveResult, getValue()));
         }
     }