Reduce binder call when determing whether or not to use CDMA format for
MO SMS

Only checking whether or not to use CDMA format for MO SMS one time for
the whole message body.

Bug: 19283927
Change-Id: I0e629f68d77cae17d18a80b1f8fa343e0afa8c00
diff --git a/src/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java b/src/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
index 6cb1f14..439eaea 100644
--- a/src/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
+++ b/src/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
@@ -80,8 +80,9 @@
                 (mTranslationTableGSM != null && mTranslationTableGSM.size() > 0) ||
                 (mTranslationTableCDMA != null && mTranslationTableCDMA.size() > 0)) {
             char[] output = new char[size];
+            boolean isCdmaFormat = useCdmaFormatForMoSms();
             for (int i = 0; i < size; i++) {
-                output[i] = translateIfNeeded(message.charAt(i));
+                output[i] = translateIfNeeded(message.charAt(i), isCdmaFormat);
             }
 
             return String.valueOf(output);
@@ -101,8 +102,8 @@
      *         space, if no mapping is found in the translation table for such
      *         character
      */
-    private static char translateIfNeeded(char c) {
-        if (noTranslationNeeded(c)) {
+    private static char translateIfNeeded(char c, boolean isCdmaFormat) {
+        if (noTranslationNeeded(c, isCdmaFormat)) {
             if (DBG) {
                 Rlog.v(TAG, "No translation needed for " + Integer.toHexString(c));
             }
@@ -123,7 +124,7 @@
         }
 
         if (translation == -1) {
-            if (useCdmaFormatForMoSms()) {
+            if (isCdmaFormat) {
                 if (mTranslationTableCDMA != null) {
                     translation = mTranslationTableCDMA.get(c, -1);
                 }
@@ -149,8 +150,8 @@
         }
     }
 
-    private static boolean noTranslationNeeded(char c) {
-        if (useCdmaFormatForMoSms()) {
+    private static boolean noTranslationNeeded(char c, boolean isCdmaFormat) {
+        if (isCdmaFormat) {
             return GsmAlphabet.isGsmSeptets(c) && UserData.charToAscii.get(c, -1) != -1;
         }
         else {