Add reject via text capability to calls

* Add REJECT_VIA_TEXT capability to calls
* Move allowRespondViaSmsForCall to RejectWithTextManager

Bug: 10424370

Change-Id: I059550d82e3b44cc4cc42d5eb06e40551497f063
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 393e054..9c7b9dd 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -16,13 +16,7 @@
 
 package com.android.phone;
 
-import com.google.android.collect.Lists;
-import com.google.android.collect.Maps;
-import com.google.android.collect.Sets;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSortedSet;
-
+import android.content.Context;
 import android.os.AsyncResult;
 import android.os.Handler;
 import android.os.Message;
@@ -40,11 +34,16 @@
 import com.android.services.telephony.common.Call.Capabilities;
 import com.android.services.telephony.common.Call.State;
 
+import com.google.android.collect.Lists;
+import com.google.android.collect.Maps;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSortedSet;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map.Entry;
-import java.util.SortedSet;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
@@ -469,6 +468,7 @@
         boolean canAddCall = false;
         boolean canMergeCall = false;
         boolean canSwapCall = false;
+        boolean canRespondViaText = false;
 
         // only applies to active calls
         if (callIsActive) {
@@ -477,6 +477,9 @@
             canSwapCall = PhoneUtils.okToSwapCalls(mCallManager);
         }
 
+        canRespondViaText = RejectWithTextMessageManager.allowRespondViaSmsForCall(call,
+                connection);
+
         // special rules section!
         // CDMA always has Add
         if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
@@ -500,6 +503,10 @@
             retval |= Capabilities.SWAP_CALLS;
         }
 
+        if (canRespondViaText) {
+            retval |= Capabilities.RESPOND_VIA_TEXT;
+        }
+
         return retval;
     }