Merge "Cleanup Telecom API usage in Telephony for mainline support."
diff --git a/ecc/conversion_toolset_v1/gen_eccdata.sh b/ecc/conversion_toolset_v1/gen_eccdata.sh
index 1efac37..803f39b 100644
--- a/ecc/conversion_toolset_v1/gen_eccdata.sh
+++ b/ecc/conversion_toolset_v1/gen_eccdata.sh
@@ -19,7 +19,7 @@
source "${LOCAL_TOOLSET_DIR}/env.sh"
echo "Converting eccdata..."
-${ANDROID_BUILD_TOP}/prebuilts/tools/linux-x86_64/protoc/bin/protoc \
+${ANDROID_BUILD_TOP}/prebuilts/misc/${KERNEL}-x86/protobuf/aprotoc \
--encode=ecc.AllInfo proto/protobuf_ecc_data.proto \
< "${INPUT_DATA}" > "${RAW_DATA}"
diff --git a/ecc/gen_eccdata.sh b/ecc/gen_eccdata.sh
index e4dd745..4c1f616 100755
--- a/ecc/gen_eccdata.sh
+++ b/ecc/gen_eccdata.sh
@@ -34,7 +34,7 @@
esac
read -d "" PROTOC_COMMAND << END || :
-${ANDROID_BUILD_TOP}/prebuilts/tools/${KERNEL}-x86_64/protoc/bin/protoc
+${ANDROID_BUILD_TOP}/prebuilts/misc/${KERNEL}-x86/protobuf/aprotoc
END
if ! [ -x "${PROTOC_COMMAND}" ] ; then
echo "Missing ${PROTOC_COMMAND}." 1>&2
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index ad7a2b2..33b16ba 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -107,7 +107,7 @@
private final BroadcastReceiver mBootReceiver = new ConfigLoaderBroadcastReceiver();
// Broadcast receiver for SIM and pkg intents, register intent filter in constructor.
private final BroadcastReceiver mPackageReceiver = new ConfigLoaderBroadcastReceiver();
- private final LocalLog mCarrierConfigLoadingLog = new LocalLog(50);
+ private final LocalLog mCarrierConfigLoadingLog = new LocalLog(100);
// Message codes; see mHandler below.
@@ -200,6 +200,7 @@
// have sent it before unlock. This will avoid we try to load carrier config
// when SIM is still loading when unlock happens.
if (mHasSentConfigChange[i]) {
+ logWithLocalLog("System unlocked");
updateConfigForPhoneId(i);
}
}
@@ -215,6 +216,8 @@
int numPhones = TelephonyManager.from(mContext)
.getSupportedModemCount();
for (int i = 0; i < numPhones; ++i) {
+ logWithLocalLog("Package changed: " + carrierPackageName
+ + ", phone=" + i);
updateConfigForPhoneId(i);
}
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 63d85a6..28646b9 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -18,6 +18,7 @@
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+import static com.android.internal.telephony.PhoneConstants.PHONE_TYPE_IMS;
import static com.android.internal.telephony.PhoneConstants.SUBSCRIPTION_KEY;
import android.Manifest.permission;
@@ -151,6 +152,8 @@
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.euicc.EuiccConnector;
import com.android.internal.telephony.ims.ImsResolver;
+import com.android.internal.telephony.imsphone.ImsPhone;
+import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccIoResult;
@@ -2776,7 +2779,7 @@
if (phone != null) {
phone.setDataActivationState(activationState);
} else {
- loge("setVoiceActivationState fails with invalid subId: " + subId);
+ loge("setDataActivationState fails with invalid subId: " + subId);
}
} finally {
Binder.restoreCallingIdentity(identity);
@@ -4958,13 +4961,13 @@
public int getCarrierPrivilegeStatusForUid(int subId, int uid) {
final Phone phone = getPhone(subId);
if (phone == null) {
- loge("getCarrierPrivilegeStatus: Invalid subId");
+ loge("getCarrierPrivilegeStatusForUid: Invalid subId");
return TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
}
UiccProfile profile =
UiccController.getInstance().getUiccProfileForPhone(phone.getPhoneId());
if (profile == null) {
- loge("getCarrierPrivilegeStatus: No UICC");
+ loge("getCarrierPrivilegeStatusForUid: No UICC");
return TelephonyManager.CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED;
}
return getCarrierPrivilegeStatusFromCarrierConfigRules(
@@ -5020,7 +5023,7 @@
}
UiccCard card = UiccController.getInstance().getUiccCard(phoneId);
if (card == null) {
- loge("getCarrierPackageNamesForIntent: No UICC");
+ loge("getCarrierPackageNamesForIntentAndPhone: No UICC");
return null ;
}
return card.getCarrierPackageNamesForIntent(mApp.getPackageManager(), intent);
@@ -7416,4 +7419,32 @@
Binder.restoreCallingIdentity(identity);
}
}
+
+ /**
+ * Updates whether conference event pacakge handling is enabled.
+ * @param isCepEnabled {@code true} if CEP handling is enabled (default), or {@code false}
+ * otherwise.
+ */
+ @Override
+ public void setCepEnabled(boolean isCepEnabled) {
+ TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(), "setCepEnabled");
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ Rlog.i(LOG_TAG, "setCepEnabled isCepEnabled=" + isCepEnabled);
+ for (Phone phone : PhoneFactory.getPhones()) {
+ Phone defaultPhone = phone.getImsPhone();
+ if (defaultPhone != null && defaultPhone.getPhoneType() == PHONE_TYPE_IMS) {
+ ImsPhone imsPhone = (ImsPhone) defaultPhone;
+ ImsPhoneCallTracker imsPhoneCallTracker =
+ (ImsPhoneCallTracker) imsPhone.getCallTracker();
+ imsPhoneCallTracker.setConferenceEventPackageEnabled(isCepEnabled);
+ Rlog.i(LOG_TAG, "setCepEnabled isCepEnabled=" + isCepEnabled + ", for imsPhone "
+ + imsPhone.getMsisdn());
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
}
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index a59c9c4..a34abc0 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -53,6 +53,10 @@
private static final String IMS_GET_CARRIER_SERVICE = "get-ims-service";
private static final String IMS_ENABLE = "enable";
private static final String IMS_DISABLE = "disable";
+ // Used to disable or enable processing of conference event package data from the network.
+ // This is handy for testing scenarios where CEP data does not exist on a network which does
+ // support CEP data.
+ private static final String IMS_CEP = "conference-event-package";
private static final String SMS_GET_APPS = "get-apps";
private static final String SMS_GET_DEFAULT_APP = "get-default-app";
@@ -131,6 +135,8 @@
pw.println(" ims disable [-s SLOT_ID]");
pw.println(" disables IMS for the SIM slot specified, or for the default voice SIM");
pw.println(" slot if none is specified.");
+ pw.println(" ims conference-event-package [enable/disable]");
+ pw.println(" enables or disables handling or network conference event package data.");
}
private void onHelpSms() {
@@ -190,6 +196,9 @@
case IMS_DISABLE: {
return handleDisableIms();
}
+ case IMS_CEP: {
+ return handleCepChange();
+ }
}
return -1;
@@ -466,6 +475,22 @@
return 0;
}
+ private int handleCepChange() {
+ Log.i(LOG_TAG, "handleCepChange");
+ String opt = getNextArg();
+ if (opt == null) {
+ return -1;
+ }
+ boolean isCepEnabled = opt.equals("enable");
+
+ try {
+ mInterface.setCepEnabled(isCepEnabled);
+ } catch (RemoteException e) {
+ return -1;
+ }
+ return 0;
+ }
+
private int getDefaultSlot() {
int slotId = SubscriptionManager.getDefaultVoicePhoneId();
if (slotId <= SubscriptionManager.INVALID_SIM_SLOT_INDEX
diff --git a/src/com/android/services/telephony/DisconnectCauseUtil.java b/src/com/android/services/telephony/DisconnectCauseUtil.java
index 5227e8b..4a5fb4a 100644
--- a/src/com/android/services/telephony/DisconnectCauseUtil.java
+++ b/src/com/android/services/telephony/DisconnectCauseUtil.java
@@ -18,10 +18,14 @@
import android.content.Context;
import android.media.ToneGenerator;
+import android.os.PersistableBundle;
import android.telecom.DisconnectCause;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import com.android.internal.telephony.CallFailCause;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
import com.android.phone.ImsUtil;
import com.android.phone.PhoneGlobals;
import com.android.phone.common.R;
@@ -102,7 +106,7 @@
telephonyPerciseDisconnectCause),
toTelecomDisconnectCauseDescription(context, telephonyDisconnectCause, phoneId),
toTelecomDisconnectReason(context,telephonyDisconnectCause, reason, phoneId),
- toTelecomDisconnectCauseTone(telephonyDisconnectCause));
+ toTelecomDisconnectCauseTone(telephonyDisconnectCause, phoneId));
}
/**
@@ -807,11 +811,22 @@
/**
* Returns the tone to play for the disconnect cause, or UNKNOWN if none should be played.
*/
- private static int toTelecomDisconnectCauseTone(int telephonyDisconnectCause) {
- switch (telephonyDisconnectCause) {
- case android.telephony.DisconnectCause.BUSY:
+ private static int toTelecomDisconnectCauseTone(int telephonyDisconnectCause, int phoneId) {
+ Phone phone = PhoneFactory.getPhone(phoneId);
+ PersistableBundle config;
+ if (phone != null) {
+ config = PhoneGlobals.getInstance().getCarrierConfigForSubId(phone.getSubId());
+ } else {
+ config = PhoneGlobals.getInstance().getCarrierConfig();
+ }
+ int[] busyToneArray = config.getIntArray(
+ CarrierConfigManager.KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY);
+ for (int busyTone : busyToneArray) {
+ if (busyTone == telephonyDisconnectCause) {
return ToneGenerator.TONE_SUP_BUSY;
-
+ }
+ }
+ switch (telephonyDisconnectCause) {
case android.telephony.DisconnectCause.CONGESTION:
return ToneGenerator.TONE_SUP_CONGESTION;