Supplementary Services(SS) gray out when airplane mode on in Call Settings menu.
Call forward, Call Barring, Additional_settings gary out when airplane
mode on.
Bug: 141284019
Test: when airplane mode on, all of SS UIs are gray out.
Change-Id: I8f75dd0f3b8d63f9ce787921cc3e739f82528167
Merged-In: I8f75dd0f3b8d63f9ce787921cc3e739f82528167
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index e5e02fa..3f57cae 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -19,10 +19,12 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
@@ -110,6 +112,50 @@
* Click Listeners, handle click based on objects attached to UI.
*/
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ log("onReceive: " + intent.getAction());
+
+ if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) {
+ log("ACTION_AIRPLANE_MODE_CHANGED");
+
+ boolean isAirplaneModeOn = intent.getBooleanExtra("state", false);
+ handleAirplaneModeChange(isAirplaneModeOn);
+ }
+ }
+ };
+
+ private void handleAirplaneModeChange(boolean isAirplaneModeOn) {
+ PersistableBundle b = null;
+ if (mSubscriptionInfoHelper.hasSubId()) {
+ b = PhoneGlobals.getInstance().getCarrierConfigForSubId(
+ mSubscriptionInfoHelper.getSubId());
+ } else {
+ b = PhoneGlobals.getInstance().getCarrierConfig();
+ }
+
+ if (b != null && b.getBoolean(
+ CarrierConfigManager.KEY_DISABLE_SUPPLEMENTARY_SERVICES_IN_AIRPLANE_MODE_BOOL)) {
+ PreferenceScreen preferenceScreen = getPreferenceScreen();
+ Preference callForwarding = preferenceScreen.findPreference(
+ GsmUmtsCallOptions.CALL_FORWARDING_KEY);
+ Preference callBarring = preferenceScreen.findPreference(
+ GsmUmtsCallOptions.CALL_BARRING_KEY);
+ Preference additional = preferenceScreen.findPreference(
+ GsmUmtsCallOptions.ADDITIONAL_GSM_SETTINGS_KEY);
+ if (callForwarding != null) {
+ callForwarding.setEnabled(!isAirplaneModeOn);
+ }
+ if (callBarring != null) {
+ callBarring.setEnabled(!isAirplaneModeOn);
+ }
+ if (additional != null) {
+ additional.setEnabled(!isAirplaneModeOn);
+ }
+ }
+ }
+
// Click listener for all toggle events
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
@@ -266,6 +312,7 @@
protected void onPause() {
super.onPause();
listenPhoneState(false);
+ unregisterReceiver(mReceiver);
// Remove callback for provisioning changes.
try {
@@ -378,6 +425,10 @@
} catch (ImsException e) {
Log.w(LOG_TAG, "onResume: Unable to register callback for provisioning changes.");
}
+
+ IntentFilter intentFilter =
+ new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ registerReceiver(mReceiver, intentFilter);
}
private void updateVtWfc() {