Show fullscreen incall page when hidding HUN turns on

The setting config should only gate the visibility of the HUN, but it
still needs to listen to state change so once it is answered, the
fullscreen ui can show.

Fixes: 171038107
Test: manually
Change-Id: Ic45a4ee457de6281debce659eda81c9fc2bad46e
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1232b60..7b74736 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -218,11 +218,11 @@
     <!-- Summary of no incoming call heads-up notification(HUN) setting -->
     <string name="pref_no_incoming_call_hun_summary">Only show call alerts in cluster</string>
 
-    <!-- Title of no full screen active call UI when answered UI setting-->
-    <string name="pref_no_fullscreen_active_call_ui_title">Active Call</string>
-    <string name="pref_no_fullscreen_active_call_ui_key" translatable="false">no_fullscreen_active_call_ui</string>
-    <!-- Summary of no full screen active call UI when answered UI setting -->
-    <string name="pref_no_fullscreen_active_call_ui_summary">Show active call view when answering call</string>
+    <!-- Title of showing full screen active call UI when answered UI setting-->
+    <string name="pref_show_fullscreen_active_call_ui_title">Active Call</string>
+    <string name="pref_show_fullscreen_active_call_ui_key" translatable="false">show_fullscreen_active_call_ui</string>
+    <!-- Summary of showing full screen active call UI when answered UI setting -->
+    <string name="pref_show_fullscreen_active_call_ui_summary">Show active call view when answering call</string>
 
     <!-- Keys and titles of the settings for sorting Contacts in different orders -->
     <!-- Key of given name -->
diff --git a/res/xml/settings_page.xml b/res/xml/settings_page.xml
index ce925d2..ca3b1d1 100644
--- a/res/xml/settings_page.xml
+++ b/res/xml/settings_page.xml
@@ -28,9 +28,9 @@
 
     <SwitchPreference
         android:defaultValue="@bool/config_show_fullscreen_incall_ui"
-        android:key="@string/pref_no_fullscreen_active_call_ui_key"
-        android:title="@string/pref_no_fullscreen_active_call_ui_title"
-        android:summary="@string/pref_no_fullscreen_active_call_ui_summary"
+        android:key="@string/pref_show_fullscreen_active_call_ui_key"
+        android:title="@string/pref_show_fullscreen_active_call_ui_title"
+        android:summary="@string/pref_show_fullscreen_active_call_ui_summary"
         app:isPreferenceVisible="@bool/config_should_show_active_call_setting"/>
 
     <SwitchPreference
diff --git a/src/com/android/car/dialer/telecom/InCallRouter.java b/src/com/android/car/dialer/telecom/InCallRouter.java
index 43619fd..7cb7d3e 100644
--- a/src/com/android/car/dialer/telecom/InCallRouter.java
+++ b/src/com/android/car/dialer/telecom/InCallRouter.java
@@ -80,9 +80,7 @@
 
         int state = call.getState();
         if (state == Call.STATE_RINGING) {
-            if (shouldShowIncomingCallHun()) {
-                routeToNotification(call);
-            }
+            routeToNotification(call);
             // Otherwise, no operations. Incoming call will be displayed outside of Dialer app
             // such as cluster.
         } else if (state != Call.STATE_DISCONNECTED) {
@@ -133,7 +131,9 @@
      * Presents the ringing call in HUN.
      */
     private void routeToNotification(Call call) {
-        mInCallNotificationController.showInCallNotification(call);
+        if (shouldShowIncomingCallHun()) {
+            mInCallNotificationController.showInCallNotification(call);
+        }
         call.registerCallback(new Call.Callback() {
             @Override
             public void onStateChanged(Call call, int state) {
@@ -175,7 +175,7 @@
         boolean shouldShowFullScreenUiByDefault =
                 mContext.getResources().getBoolean(R.bool.config_show_fullscreen_incall_ui);
         return PreferenceManager.getDefaultSharedPreferences(mContext)
-                .getBoolean(mContext.getString(R.string.pref_no_fullscreen_active_call_ui_key),
+                .getBoolean(mContext.getString(R.string.pref_show_fullscreen_active_call_ui_key),
                         shouldShowFullScreenUiByDefault);
     }
 }