[2/2] Telephony: Non-intrusive InCall UI switch

Change-Id: I545121334ffb2925a05a8c7685b84bb5df37c205

Conflicts:
	res/values/custom_strings.xml
	res/xml/call_feature_setting.xml
	src/com/android/phone/CallFeaturesSetting.java
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index a284cbd..1ec9dff 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -92,4 +92,7 @@
     <string name="summary_mute_ringer">mute the ringer</string>
     <string name="summary_dismiss_call">dismiss the call</string>
 
+    <!-- Title for the option managing whether or not to use non-intrusive incall UI. -->
+    <string name="use_non_intrusive_call_title">Non-intrusive incoming calls</string>
+
 </resources>
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 7e1118a..2e4774f 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -158,6 +158,11 @@
         android:entryValues="@array/flip_action_setting_values"
         android:persistent="false" />
 
+    <SwitchPreference
+        android:key="use_non_intrusive_call"
+        android:title="@string/use_non_intrusive_call_title"
+        android:persistent="false" />
+
     <PreferenceCategory
             android:key="category_prox_auto_speaker"
             android:title="@string/display_category_prox_auto_speaker_title" >
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 9f75929..0fdef3f 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -197,9 +197,8 @@
 
     private static final String BUTTON_SELECT_SUB_KEY  = "button_call_independent_serv";
     private static final String BUTTON_XDIVERT_KEY = "button_xdivert";
-
     private static final String FLIP_ACTION_KEY = "flip_action";
-
+    private static final String USE_NON_INTRUSIVE_CALL_KEY = "use_non_intrusive_call";
     private Intent mContactListIntent;
 
     /** Event for Async voicemail change call */
@@ -281,6 +280,7 @@
     private AccountSelectionPreference mDefaultOutgoingAccount;
     private boolean isSpeedDialListStarted = false;
     private PreferenceScreen mButtonBlacklist;
+    private SwitchPreference mUseNonIntrusiveCall;
 
 
     private ListPreference mFlipAction;
@@ -628,6 +628,10 @@
             Settings.System.putInt(getContentResolver(),
                 Settings.System.CALL_FLIP_ACTION_KEY, index);
             updateFlipActionSummary(index);
+        } else if (preference == mUseNonIntrusiveCall) {
+            final boolean val = (Boolean) objValue;
+            Settings.System.putInt(getContentResolver(),
+                    Settings.System.USE_NON_INTRUSIVE_CALL, val ? 1 : 0);
         }
         // always let the preference setting proceed.
         return true;
@@ -1664,6 +1668,10 @@
             mProxSpeakerDelay.multiplyValue(100);
             mProxSpeakerDelay.setOnPreferenceChangeListener(this);
         }
+        mUseNonIntrusiveCall = (SwitchPreference) findPreference(USE_NON_INTRUSIVE_CALL_KEY);
+        if (mUseNonIntrusiveCall != null) {
+            mUseNonIntrusiveCall.setOnPreferenceChangeListener(this);
+        }
 
         if (mButtonDTMF != null) {
             if (getResources().getBoolean(R.bool.dtmf_type_enabled)) {
@@ -1850,6 +1858,11 @@
                     Settings.System.CALL_FLIP_ACTION_KEY, 2);
             mFlipAction.setValue(String.valueOf(flipAction));
             updateFlipActionSummary(flipAction);
+		}
+
+        if (mUseNonIntrusiveCall != null) {
+            mUseNonIntrusiveCall.setChecked(Settings.System.getInt(getContentResolver(),
+                Settings.System.USE_NON_INTRUSIVE_CALL, 1) != 0);
         }
 
         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(