callforwarding: Fix duplicated error popup
When call forward setting fails and qeurying also responds invalid
then a duplicate popup is shown to the user.
This CL removes resetting preference before calling onError
which already reset preference.
Bug: 146532585
Change-Id: Ida6baff95d5eae52501dc07f1cb891e9238f2e17
Signed-off-by: Jang Hayeong <hayeong.jang@samsung.com>
diff --git a/src/com/android/phone/CallForwardEditPreference.java b/src/com/android/phone/CallForwardEditPreference.java
index fc2d5e8..e8cf0d1 100644
--- a/src/com/android/phone/CallForwardEditPreference.java
+++ b/src/com/android/phone/CallForwardEditPreference.java
@@ -362,7 +362,6 @@
CallForwardInfo cfInfoArray[] = (CallForwardInfo[]) ar.result;
if (cfInfoArray == null || cfInfoArray.length == 0) {
Log.d(LOG_TAG, "handleGetCFResponse: cfInfoArray.length==0");
- setEnabled(false);
mTcpListener.onError(CallForwardEditPreference.this, RESPONSE_ERROR);
} else {
for (int i = 0, length = cfInfoArray.length; i < length; i++) {
@@ -373,6 +372,11 @@
CallForwardInfo info = cfInfoArray[i];
handleCallForwardResult(info);
+ if (ar.userObj instanceof Throwable) {
+ Log.d(LOG_TAG, "Skipped duplicated error dialog");
+ continue;
+ }
+
// Show an alert if we got a success response but
// with unexpected values.
// Currently only handle the fail-to-disable case
diff --git a/src/com/android/phone/TimeConsumingPreferenceActivity.java b/src/com/android/phone/TimeConsumingPreferenceActivity.java
index 8c5ae6d..3b5fe21 100644
--- a/src/com/android/phone/TimeConsumingPreferenceActivity.java
+++ b/src/com/android/phone/TimeConsumingPreferenceActivity.java
@@ -187,6 +187,11 @@
@Override
public void onError(Preference preference, int error) {
if (DBG) dumpState();
+ if (!preference.isEnabled()) {
+ Log.i(LOG_TAG, "onError, skipped duplicated error popup");
+ return;
+ }
+
Log.i(LOG_TAG, "onError, preference=" + preference.getKey() + ", error=" + error);
if (mIsForeground) {