implement feature for Supplementary Service over UT precautions.
Some carriers only support SS over UT via INTERNET PDN.
When mobile data is OFF or data roaming OFF during roaming,
we should block the supplementary service and notify the user
that the function only works if data is available.
Bug: 80404623
Test: manual - test case as below :
1.flag cf_precautions true ,turn off mobile data, enter CF ,show dialog
for blocking supplementary services.(PASS)
2.flag cf_precautions true ,turn on mobile data, enter CF ,do CF init.(PASS)
3.flag cb_precautions true ,turn off mobile data, enter CB ,show dialog
for blocking supplementary services.(PASS)
4.flag cb_precautions true ,turn on mobile data, enter CB ,do CB init.(PASS)
5.CW hide,flag clir_precautions true ,turn off mobile data, enter Additional
setting ,show dialog for blocking supplementary services.(PASS)
6.CW hide,flag clir_precautions true ,turn on mobile data, enter Additional
setting ,do CLIR init.(PASS)
7.CLIR hide,flag cw_precautions true ,turn off mobile data, enter Additional
setting ,show dialog for blocking supplementary services.(PASS)
8.CLIR hide,flag cw_precautions true ,turn on mobile data, enter
Additional setting ,do CW init.(PASS)
9.flag clir_precautions and cw_precautions true ,turn off mobile data, enter
Additional setting ,show dialog for blocking supplementary services.(PASS)
10.flag clir_precautions and cw_precautions true ,turn on mobile data,
enter Additional setting ,do CW init and CLIR init.(PASS)
11.flag clir_precautions false and cw_precautions true ,turn off mobile data,
enter Additional setting ,show dialog for blocking supplementary services
and do CW init.(PASS)
12.flag clir_precautions false and cw_precautions true ,turn on mobile data,
enter Additional setting ,do CW init and CLIR init.(PASS)
13.flag clir_precautions true and cw_precautions false ,turn off mobile data,
enter Additional setting ,show dialog for blocking supplementary services
and do CLIR init.(PASS)
14.flag clir_precautions false and cw_precautions true ,turn on mobile data,
enter Additional setting ,do CW init and CLIR init.(PASS)
15.flag clir_precautions and cw_precautions false ,turn on mobile data,
enter Additional setting ,do CW init and CLIR init.(PASS)
Change-Id: Iff828e57ef87ec6c97492b89e2b0fb5a9437f0d6
diff --git a/src/com/android/phone/GsmUmtsAdditionalCallOptions.java b/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
index b79cdd8..6e28922 100644
--- a/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
+++ b/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
@@ -1,6 +1,7 @@
package com.android.phone;
import android.app.ActionBar;
+import android.app.Dialog;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.preference.Preference;
@@ -10,6 +11,7 @@
import android.view.MenuItem;
import com.android.internal.telephony.Phone;
+import com.android.phone.settings.SuppServicesUiUtil;
import java.util.ArrayList;
@@ -17,8 +19,11 @@
private static final String LOG_TAG = "GsmUmtsAdditionalCallOptions";
private final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
- private static final String BUTTON_CLIR_KEY = "button_clir_key";
- private static final String BUTTON_CW_KEY = "button_cw_key";
+ public static final String BUTTON_CLIR_KEY = "button_clir_key";
+ public static final String BUTTON_CW_KEY = "button_cw_key";
+
+ private static final int CW_WARNING_DIALOG = 201;
+ private static final int CALLER_ID_WARNING_DIALOG = 202;
private CLIRListPreference mCLIRButton;
private CallWaitingSwitchPreference mCWButton;
@@ -28,8 +33,10 @@
private Phone mPhone;
private SubscriptionInfoHelper mSubscriptionInfoHelper;
- private boolean mShowCLIRButton;
- private boolean mShowCWButton;
+ private boolean mShowCLIRButton = true;
+ private boolean mShowCWButton = true;
+ private boolean mCLIROverUtPrecautions = false;
+ private boolean mCWOverUtPrecautions = false;
@Override
protected void onCreate(Bundle icicle) {
@@ -59,11 +66,25 @@
CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALLER_ID_VISIBILITY_BOOL);
mShowCWButton = b.getBoolean(
CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALL_WAITING_VISIBILITY_BOOL);
+ mCLIROverUtPrecautions = mShowCLIRButton && b.getBoolean(
+ CarrierConfigManager.KEY_CALLER_ID_OVER_UT_WARNING_BOOL);
+ mCWOverUtPrecautions = mShowCWButton && b.getBoolean(
+ CarrierConfigManager.KEY_CALL_WAITING_OVER_UT_WARNING_BOOL);
+ if (DBG) {
+ Log.d(LOG_TAG, "mCLIROverUtPrecautions:" + mCLIROverUtPrecautions
+ + ",mCWOverUtPrecautions:" + mCWOverUtPrecautions);
+ }
}
+ boolean isSsOverUtPrecautions = SuppServicesUiUtil.isSsOverUtPrecautions(this, mPhone);
+
if (mCLIRButton != null) {
if (mShowCLIRButton) {
- mPreferences.add(mCLIRButton);
+ if (mCLIROverUtPrecautions && isSsOverUtPrecautions) {
+ mCLIRButton.setEnabled(false);
+ } else {
+ mPreferences.add(mCLIRButton);
+ }
} else {
prefSet.removePreference(mCLIRButton);
}
@@ -71,7 +92,11 @@
if (mCWButton != null) {
if (mShowCWButton) {
- mPreferences.add(mCWButton);
+ if (mCWOverUtPrecautions && isSsOverUtPrecautions) {
+ mCWButton.setEnabled(false);
+ } else {
+ mPreferences.add(mCWButton);
+ }
} else {
prefSet.removePreference(mCWButton);
}
@@ -84,10 +109,10 @@
} else {
if (DBG) Log.d(LOG_TAG, "restore stored states");
mInitIndex = mPreferences.size();
- if (mShowCWButton) {
+ if (mShowCWButton && mCWButton != null && mCWButton.isEnabled()) {
mCWButton.init(this, true, mPhone);
}
- if (mShowCLIRButton) {
+ if (mShowCLIRButton && mCLIRButton != null && mCLIRButton.isEnabled()) {
mCLIRButton.init(this, true, mPhone);
int[] clirArray = icicle.getIntArray(mCLIRButton.getKey());
if (clirArray != null) {
@@ -111,6 +136,52 @@
}
@Override
+ public void onResume() {
+ super.onResume();
+ int indexOfStartInit = mPreferences.size();
+ boolean isPrecaution = SuppServicesUiUtil.isSsOverUtPrecautions(this, mPhone);
+ dismissWarningDialog();
+
+ if (mShowCLIRButton && mCLIROverUtPrecautions && mCLIRButton != null) {
+ if (isPrecaution) {
+ showWarningDialog(CW_WARNING_DIALOG);
+ if (mCLIRButton.isEnabled()) {
+ if (mPreferences.contains(mCLIRButton)) {
+ mPreferences.remove(mCLIRButton);
+ }
+ mCLIRButton.setEnabled(false);
+ }
+ } else {
+ if (!mPreferences.contains(mCLIRButton)) {
+ mCLIRButton.setEnabled(true);
+ mPreferences.add(mCLIRButton);
+ }
+ }
+ }
+ if (mShowCWButton && mCWOverUtPrecautions && mCWButton != null) {
+ if (isPrecaution) {
+ showWarningDialog(CALLER_ID_WARNING_DIALOG);
+ if (mCWButton.isEnabled()) {
+ if (mPreferences.contains(mCWButton)) {
+ mPreferences.remove(mCWButton);
+ }
+ mCWButton.setEnabled(false);
+ }
+ } else {
+ if (!mPreferences.contains(mCWButton)) {
+ mCWButton.setEnabled(true);
+ mPreferences.add(mCWButton);
+ }
+ }
+ }
+
+ if (indexOfStartInit < mPreferences.size()) {
+ mInitIndex = indexOfStartInit;
+ doPreferenceInit(indexOfStartInit);
+ }
+ }
+
+ @Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
@@ -139,7 +210,7 @@
}
private void doPreferenceInit(int index) {
- if (mPreferences.size() != 0) {
+ if (mPreferences.size() > index) {
Preference pref = mPreferences.get(index);
if (pref instanceof CallWaitingSwitchPreference) {
((CallWaitingSwitchPreference) pref).init(this, false, mPhone);
@@ -148,4 +219,23 @@
}
}
}
+
+ @Override
+ protected Dialog onCreateDialog(int id) {
+ if (id == CW_WARNING_DIALOG) {
+ return SuppServicesUiUtil.showBlockingSuppServicesDialog(this, mPhone, BUTTON_CW_KEY);
+ } else if (id == CALLER_ID_WARNING_DIALOG) {
+ return SuppServicesUiUtil.showBlockingSuppServicesDialog(this, mPhone, BUTTON_CLIR_KEY);
+ }
+ return super.onCreateDialog(id);
+ }
+
+ private void showWarningDialog(int id) {
+ showDialog(id);
+ }
+
+ private void dismissWarningDialog() {
+ dismissDialogSafely(CW_WARNING_DIALOG);
+ dismissDialogSafely(CALLER_ID_WARNING_DIALOG);
+ }
}