Merge "Fix multiple substitutions specified in non-positional format."
diff --git a/res/xml/telephony_injection.xml b/res/xml/telephony_injection.xml
new file mode 100644
index 0000000..2af425c
--- /dev/null
+++ b/res/xml/telephony_injection.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License"" />
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- package: customized component factory to inject,
+ e.g. "example.package.exampleTelephonyComponentFactory"
+ jar: jar path to customized jar which contains exampleTelephonyComponentFactory to inject, and
+ "/system/framework/" should be the target directory.
+ e.g. "/system/framework/eg-telephony-common.jar"
+-->
+<injection package=""
+ jar="">
+ <components>
+ <!-- Components use injected component factory,
+ e.g. com.android.internal.telephony.ServiceStateTracker
+ -->
+ <!--<component>com.example.componentA</component>-->
+ <!--<component>com.example.componentB</component>-->
+ </components>
+</injection>
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 5009bfe..2cefd52 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -25,6 +25,7 @@
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.XmlResourceParser;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.Uri;
@@ -59,6 +60,7 @@
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SettingsObserver;
import com.android.internal.telephony.TelephonyCapabilities;
+import com.android.internal.telephony.TelephonyComponentFactory;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.dataconnection.DataConnectionReasons;
import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataDisallowedReasonType;
@@ -281,6 +283,9 @@
// getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_VOICE_CALLS);
if (mCM == null) {
+ // Inject telephony component factory if configured using other jars.
+ XmlResourceParser parser = getResources().getXml(R.xml.telephony_injection);
+ TelephonyComponentFactory.getInstance().injectTheComponentFactory(parser);
// Initialize the telephony framework
PhoneFactory.makeDefaultPhones(this);