Rollback telephony resources on telephony service

Bug: 149776042
Test: TeleServiceTests
Change-Id: I8f08a553e4fe42389bbcb8d13893985b40c159eb
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index a609f98..5b14591 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -43,7 +43,6 @@
 import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaDisplayInfoRec;
 import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaSignalInfoRec;
 import com.android.internal.telephony.cdma.SignalToneUtil;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -653,16 +652,16 @@
         int resId = 0;
         switch (((Integer)r.result).intValue()) {
             case TelecomManager.TTY_MODE_FULL:
-                resId = com.android.telephony.resources.R.string.peerTtyModeFull;
+                resId = com.android.internal.R.string.peerTtyModeFull;
                 break;
             case TelecomManager.TTY_MODE_HCO:
-                resId = com.android.telephony.resources.R.string.peerTtyModeHco;
+                resId = com.android.internal.R.string.peerTtyModeHco;
                 break;
             case TelecomManager.TTY_MODE_VCO:
-                resId = com.android.telephony.resources.R.string.peerTtyModeVco;
+                resId = com.android.internal.R.string.peerTtyModeVco;
                 break;
             case TelecomManager.TTY_MODE_OFF:
-                resId = com.android.telephony.resources.R.string.peerTtyModeOff;
+                resId = com.android.internal.R.string.peerTtyModeOff;
                 break;
             default:
                 Log.e(LOG_TAG, "Unsupported TTY mode: " + r.result);
@@ -670,7 +669,7 @@
         }
         if (resId != 0) {
             PhoneDisplayMessage.displayNetworkMessage(mApplication,
-                    TelephonyResourceUtils.getTelephonyResources(mApplication).getString(resId));
+                    mApplication.getResources().getString(resId));
 
             // start a timer that kills the dialog
             sendEmptyMessageDelayed(INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE,
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 19ce2f1..6f7022f 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -60,7 +60,6 @@
 import com.android.internal.telephony.PhoneFactory;
 import com.android.internal.telephony.TelephonyCapabilities;
 import com.android.internal.telephony.util.NotificationChannelController;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.phone.settings.VoicemailSettingsActivity;
 
 import java.util.ArrayList;
@@ -818,10 +817,8 @@
                 boolean isManualSelection;
                 // if restoring manual selection is controlled by framework, then get network
                 // selection from shared preference, otherwise get from real network indicators.
-                boolean restoreSelection = !TelephonyResourceUtils.getTelephonyResources(mContext)
-                        .getBoolean(
-                            com.android.telephony.resources.R.bool
-                                .skip_restoring_network_selection);
+                boolean restoreSelection = !mContext.getResources().getBoolean(
+                        com.android.internal.R.bool.skip_restoring_network_selection);
                 if (restoreSelection) {
                     isManualSelection = !TextUtils.isEmpty(selectedNetworkOperatorName);
                 } else {
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 43613d0..2cd2f05 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -171,7 +171,6 @@
 import com.android.internal.telephony.uicc.UiccProfile;
 import com.android.internal.telephony.uicc.UiccSlot;
 import com.android.internal.telephony.util.LocaleUtils;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.internal.telephony.util.VoicemailNotificationSettingsUtil;
 import com.android.internal.util.HexDump;
 import com.android.phone.settings.PickSmsSubscriptionActivity;
@@ -8308,10 +8307,8 @@
         //TODO investigate if this API should require proper permission check in R b/133791609
         final long identity = Binder.clearCallingIdentity();
         try {
-            return TelephonyResourceUtils
-                    .getResourcesForSubId(getDefaultPhone().getContext(), subId)
-                    .getString(com.android.telephony.resources.R.string
-                            .config_mms_user_agent_profile_url);
+            return SubscriptionManager.getResourcesForSubId(getDefaultPhone().getContext(), subId)
+                    .getString(com.android.internal.R.string.config_mms_user_agent_profile_url);
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
@@ -8322,9 +8319,8 @@
         //TODO investigate if this API should require proper permission check in R b/133791609
         final long identity = Binder.clearCallingIdentity();
         try {
-            return TelephonyResourceUtils
-                    .getResourcesForSubId(getDefaultPhone().getContext(), subId)
-                    .getString(com.android.telephony.resources.R.string.config_mms_user_agent);
+            return SubscriptionManager.getResourcesForSubId(getDefaultPhone().getContext(), subId)
+                    .getString(com.android.internal.R.string.config_mms_user_agent);
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index ef49ca3..3e36644 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -51,7 +51,6 @@
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneFactory;
 import com.android.internal.telephony.TelephonyCapabilities;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.phone.settings.SuppServicesUiUtil;
 import com.android.telephony.Rlog;
 
@@ -297,7 +296,7 @@
             AlertDialog previousAlert) {
         final PhoneGlobals app = PhoneGlobals.getInstance();
         CharSequence text;
-        CharSequence title = "";  // title for the progress dialog, if needed.
+        int title = 0;  // title for the progress dialog, if needed.
         MmiCode.State state = mmiCode.getState();
 
         log("displayMMIComplete: state=" + state);
@@ -331,8 +330,7 @@
                 if (app.getPUKEntryActivity() != null) {
                     // if an attempt to unPUK the device was made, we specify
                     // the title and the message here.
-                    title = TelephonyResourceUtils.getTelephonyResources(context)
-                            .getText(com.android.telephony.resources.R.string.PinMmi);
+                    title = com.android.internal.R.string.PinMmi;
                     text = context.getText(R.string.puk_unlocked);
                     break;
                 }
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index 748c9fb..77f1135 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -89,7 +89,6 @@
 import com.android.ims.ImsManager;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.phone.R;
 
 import java.io.IOException;
@@ -1709,8 +1708,8 @@
     };
 
     boolean isCbrsSupported() {
-        return TelephonyResourceUtils.getTelephonyResources(mPhone.getContext())
-              .getBoolean(com.android.telephony.resources.R.bool.config_cbrs_supported);
+        return getResources().getBoolean(
+              com.android.internal.R.bool.config_cbrs_supported);
     }
 
     void updateCbrsDataState(boolean state) {
diff --git a/src/com/android/phone/settings/SuppServicesUiUtil.java b/src/com/android/phone/settings/SuppServicesUiUtil.java
index dbc2054..4e9841f 100644
--- a/src/com/android/phone/settings/SuppServicesUiUtil.java
+++ b/src/com/android/phone/settings/SuppServicesUiUtil.java
@@ -29,7 +29,6 @@
 
 import com.android.internal.telephony.MmiCode;
 import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.phone.CarrierXmlParser;
 import com.android.phone.GsmUmtsAdditionalCallOptions;
 import com.android.phone.GsmUmtsCallOptions;
@@ -238,8 +237,8 @@
 
             return "";
         } else {
-            return TelephonyResourceUtils.getTelephonyResources(context).getText(
-                    com.android.telephony.resources.R.string.mmiError);
+            return context.getText(
+                    com.android.internal.R.string.mmiError);
         }
     }
 }
diff --git a/src/com/android/services/telephony/DisconnectCauseUtil.java b/src/com/android/services/telephony/DisconnectCauseUtil.java
index e8dad8c..d46c715 100644
--- a/src/com/android/services/telephony/DisconnectCauseUtil.java
+++ b/src/com/android/services/telephony/DisconnectCauseUtil.java
@@ -26,7 +26,6 @@
 import com.android.internal.telephony.CallFailCause;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.phone.ImsUtil;
 import com.android.phone.PhoneGlobals;
 import com.android.phone.common.R;
@@ -731,8 +730,8 @@
                 resourceId = R.string.callFailed_data_limit_reached_description;
                 break;
             case android.telephony.DisconnectCause.DIALED_CALL_FORWARDING_WHILE_ROAMING:
-                return TelephonyResourceUtils.getTelephonyResources(context).getString(
-                        com.android.telephony.resources.R.string.mmiErrorWhileRoaming);
+                resourceId = com.android.internal.R.string.mmiErrorWhileRoaming;
+                break;
 
             case android.telephony.DisconnectCause.IMEI_NOT_ACCEPTED:
                 resourceId = R.string.callFailed_imei_not_accepted;
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 453f01f..2f8ac24 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -66,7 +66,6 @@
 import com.android.internal.telephony.imsphone.ImsPhoneCall;
 import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
 import com.android.internal.telephony.imsphone.ImsPhoneConnection;
-import com.android.internal.telephony.util.TelephonyResourceUtils;
 import com.android.phone.ImsUtil;
 import com.android.phone.PhoneGlobals;
 import com.android.phone.PhoneUtils;
@@ -1714,8 +1713,8 @@
         if (phone == null) {
             return true;
         }
-        return TelephonyResourceUtils.getTelephonyResources(phone.getContext()).getBoolean(
-            com.android.telephony.resources.R.bool.config_device_respects_hold_carrier_config);
+        return phone.getContext().getResources().getBoolean(
+                com.android.internal.R.bool.config_device_respects_hold_carrier_config);
     }
 
     /**