Merge "Revert "create getModemEnabled function in PhoneConfigurationManager""
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f79b432..8e7d087 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1761,6 +1761,9 @@
<string name="call_barring_settings">Call barring settings</string>
<!-- Call barring settings screen, deactivate all call barring settings -->
<string name="call_barring_deactivate_all_no_password">Deactivate all call barring settings?</string>
+ <!-- In-call screen: error message shown when the user attempts to place a call, but the network
+ does not have enough resources (e.g. it is busy) and the call cannot be placed. -->
+ <string name="callFailed_NetworkBusy">Network is busy. Please try your call again later.</string>
<!-- Message displayed to the user when an outgoing call is deflected. This means that the
party the user is calling has chosen to send the call to another phone number. -->
<string name="supp_service_notification_call_deflected">Call deflected.</string>
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index e31577d..c9fd205 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -37,6 +37,7 @@
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.ims.ProvisioningManager;
import android.telephony.ims.feature.ImsFeature;
@@ -418,6 +419,10 @@
} else if (!mImsMgr.isWfcEnabledByPlatform() || !mImsMgr.isWfcProvisionedOnDevice()) {
prefSet.removePreference(mButtonWifiCalling);
} else {
+ String title = SubscriptionManager.getResourcesForSubId(mPhone.getContext(),
+ mPhone.getSubId()).getString(R.string.wifi_calling);
+ mButtonWifiCalling.setTitle(title);
+
int resId = com.android.internal.R.string.wifi_calling_off_summary;
if (mImsMgr.isWfcEnabledByUser()) {
boolean isRoaming = telephonyManager.isNetworkRoaming();
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 65edcf9..9e40ffe 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -111,13 +111,6 @@
EmergencyInfoGroup.OnConfirmClickListener {
private class MetricsWriter {
- // Metrics constants indicating the entry type that user opened emergency dialer.
- // This info is sent from system UI with EXTRA_ENTRY_TYPE. Please make them being
- // in sync with those in com.android.systemui.util.EmergencyDialerConstants.
- public static final int ENTRY_TYPE_UNKNOWN = 0;
- public static final int ENTRY_TYPE_LOCKSCREEN_BUTTON = 1;
- public static final int ENTRY_TYPE_POWER_MENU = 2;
-
// Metrics constants indicating the UI that user made phone call.
public static final int CALL_SOURCE_DIALPAD = 0;
public static final int CALL_SOURCE_SHORTCUT = 1;
@@ -140,11 +133,10 @@
return;
}
- int entryType = getIntent().getIntExtra(EXTRA_ENTRY_TYPE, ENTRY_TYPE_UNKNOWN);
KeyguardManager keyguard = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
mMetricsLogger.write(new LogMaker(MetricsEvent.EMERGENCY_DIALER)
.setType(MetricsEvent.TYPE_OPEN)
- .setSubtype(entryType)
+ .setSubtype(mEntryType)
.addTaggedData(MetricsEvent.FIELD_EMERGENCY_DIALER_IS_SCREEN_LOCKED,
keyguard.isKeyguardLocked() ? 1 : 0));
}
@@ -154,11 +146,10 @@
return;
}
- int entryType = getIntent().getIntExtra(EXTRA_ENTRY_TYPE, ENTRY_TYPE_UNKNOWN);
long userStayDuration = SystemClock.elapsedRealtime() - mUserEnterTimeMillis;
mMetricsLogger.write(new LogMaker(MetricsEvent.EMERGENCY_DIALER)
.setType(MetricsEvent.TYPE_CLOSE)
- .setSubtype(entryType)
+ .setSubtype(mEntryType)
.addTaggedData(MetricsEvent.FIELD_EMERGENCY_DIALER_USER_ACTIONS, mUserActions)
.addTaggedData(
MetricsEvent.FIELD_EMERGENCY_DIALER_DURATION_MS, userStayDuration));
@@ -195,6 +186,13 @@
public static final String EXTRA_ENTRY_TYPE =
"com.android.phone.EmergencyDialer.extra.ENTRY_TYPE";
+ // Constants indicating the entry type that user opened emergency dialer.
+ // This info is sent from system UI with EXTRA_ENTRY_TYPE. Please make them being
+ // in sync with those in com.android.systemui.util.EmergencyDialerConstants.
+ public static final int ENTRY_TYPE_UNKNOWN = 0;
+ public static final int ENTRY_TYPE_LOCKSCREEN_BUTTON = 1;
+ public static final int ENTRY_TYPE_POWER_MENU = 2;
+
// List of dialer button IDs.
private static final int[] DIALER_KEYS = new int[]{
R.id.one, R.id.two, R.id.three,
@@ -292,6 +290,7 @@
private boolean mIsWfcEmergencyCallingWarningEnabled;
private float mDefaultDigitsTextSize;
+ private int mEntryType;
private boolean mIsShortcutViewEnabled;
private MetricsWriter mMetricsWriter;
@@ -344,6 +343,9 @@
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ mEntryType = getIntent().getIntExtra(EXTRA_ENTRY_TYPE, ENTRY_TYPE_UNKNOWN);
+ Log.d(LOG_TAG, "Launched from " + entryTypeToString(mEntryType));
+
mMetricsWriter = new MetricsWriter();
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
if (mSensorManager != null) {
@@ -810,6 +812,10 @@
}
private boolean canEnableShortcutView(PersistableBundle carrierConfig) {
+ if (mEntryType != ENTRY_TYPE_POWER_MENU) {
+ Log.d(LOG_TAG, "Disables shortcut view since it's not launched from power menu");
+ return false;
+ }
if (!carrierConfig.getBoolean(
CarrierConfigManager.KEY_SUPPORT_EMERGENCY_DIALER_SHORTCUT_BOOL)) {
Log.d(LOG_TAG, "Disables shortcut view by carrier requirement");
@@ -903,6 +909,9 @@
}
private void placeCall(String number, int callSource, ShortcutViewUtils.PhoneInfo phone) {
+ Log.d(LOG_TAG, "Place emergency call from " + callSourceToString(callSource)
+ + ", entry = " + entryTypeToString(mEntryType));
+
Bundle extras = new Bundle();
extras.putInt(TelecomManager.EXTRA_CALL_SOURCE, callSource);
/**
@@ -1338,4 +1347,26 @@
}
return isShortcut;
}
+
+ private String entryTypeToString(int entryType) {
+ switch (entryType) {
+ case ENTRY_TYPE_LOCKSCREEN_BUTTON:
+ return "LockScreen";
+ case ENTRY_TYPE_POWER_MENU:
+ return "PowerMenu";
+ default:
+ return "Unknown-" + entryType;
+ }
+ }
+
+ private String callSourceToString(int callSource) {
+ switch (callSource) {
+ case ParcelableCallAnalytics.CALL_SOURCE_EMERGENCY_DIALPAD:
+ return "DialPad";
+ case ParcelableCallAnalytics.CALL_SOURCE_EMERGENCY_SHORTCUT:
+ return "Shortcut";
+ default:
+ return "Unknown-" + callSource;
+ }
+ }
}
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 73decd1..7ffa5cf 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -1920,6 +1920,10 @@
mWiFiCallingPref.setSummary(null);
mWiFiCallingPref.setIntent(intent);
} else {
+ String title = SubscriptionManager.getResourcesForSubId(getContext(), mSubId)
+ .getString(R.string.wifi_calling_settings_title);
+ mWiFiCallingPref.setTitle(title);
+
int resId = com.android.internal.R.string.wifi_calling_off_summary;
if (mImsMgr.isWfcEnabledByUser()) {
boolean isRoaming = mTelephonyManager.isNetworkRoaming();
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index d319f2a..62726b1 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -69,6 +69,7 @@
import android.telephony.ModemActivityInfo;
import android.telephony.NeighboringCellInfo;
import android.telephony.NetworkScanRequest;
+import android.telephony.PhoneCapability;
import android.telephony.PhoneNumberRange;
import android.telephony.RadioAccessFamily;
import android.telephony.Rlog;
@@ -2017,6 +2018,7 @@
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("getAllCellInfo")
+ .setMinSdkVersionForCoarse(Build.VERSION_CODES.BASE)
.setMinSdkVersionForFine(Build.VERSION_CODES.Q)
.build());
switch (locationResult) {
@@ -6178,7 +6180,8 @@
cardId,
cardState,
slot.getPhoneId(),
- slot.isExtendedApduSupported());
+ slot.isExtendedApduSupported(),
+ slot.isRemovable());
}
return infos;
} finally {
@@ -6599,20 +6602,38 @@
}
@Override
- public boolean isMultisimCarrierRestricted() {
- enforceReadPrivilegedPermission("isMultisimCarrierRestricted");
+ public boolean isMultisimSupported(String callingPackage) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp,
+ getDefaultPhone().getSubId(), callingPackage, "isMultisimSupported")) {
+ return false;
+ }
final long identity = Binder.clearCallingIdentity();
try {
// If the device has less than 2 SIM cards, indicate that multisim is restricted.
int numPhysicalSlots = UiccController.getInstance().getUiccSlots().length;
if (numPhysicalSlots < 2) {
- loge("isMultisimCarrierRestricted: requires at least 2 cards");
- return true;
+ loge("isMultisimSupported: requires at least 2 cards");
+ return false;
+ }
+ // Check if the hardware supports multisim functionality. If usage of multisim is not
+ // supported by the modem, indicate that it is restricted.
+ PhoneCapability staticCapability =
+ mPhoneConfigurationManager.getStaticPhoneCapability();
+ if (staticCapability == null) {
+ loge("isMultisimSupported: no static configuration available");
+ return false;
+ }
+ if (staticCapability.logicalModemList.size() < 2) {
+ loge("isMultisimSupported: maximum number of modem is < 2");
+ return false;
+ }
+ // Check if support of multiple SIMs is restricted by carrier
+ if (mTelephonySharedPreferences.getBoolean(PREF_MULTI_SIM_RESTRICTED, false)) {
+ return false;
}
- // Default value is false. Multi SIM is allowed unless explicitly restricted.
- return mTelephonySharedPreferences.getBoolean(PREF_MULTI_SIM_RESTRICTED, false);
+ return true;
} finally {
Binder.restoreCallingIdentity(identity);
}
diff --git a/src/com/android/services/telephony/DisconnectCauseUtil.java b/src/com/android/services/telephony/DisconnectCauseUtil.java
index a92dea7..8ef9565 100644
--- a/src/com/android/services/telephony/DisconnectCauseUtil.java
+++ b/src/com/android/services/telephony/DisconnectCauseUtil.java
@@ -249,6 +249,10 @@
resourceId = R.string.callFailed_userBusy;
break;
+ case android.telephony.DisconnectCause.CDMA_REORDER:
+ resourceId = R.string.callFailed_NetworkBusy;
+ break;
+
case android.telephony.DisconnectCause.CONGESTION:
resourceId = R.string.callFailed_congestion;
break;
@@ -557,6 +561,10 @@
resourceId = R.string.callFailed_cdma_activation;
break;
+ case android.telephony.DisconnectCause.CDMA_REORDER:
+ resourceId = R.string.callFailed_NetworkBusy;
+ break;
+
case android.telephony.DisconnectCause.FDN_BLOCKED:
resourceId = R.string.callFailed_fdn_only;
break;
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 85f0d48..7c09320 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -46,7 +46,6 @@
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallFailCause;
import com.android.internal.telephony.CallStateException;
-import com.android.internal.telephony.Call.HoldingRequestState;
import com.android.internal.telephony.Connection.Capability;
import com.android.internal.telephony.Connection.PostDialListener;
import com.android.internal.telephony.Phone;
@@ -953,7 +952,6 @@
// instead of actually putting it on hold.
if (ringingCall.getState() != Call.State.WAITING) {
phone.switchHoldingAndActive();
- mOriginalConnection.getCall().updateHoldingRequestState(HoldingRequestState.STARTED);
}
// TODO: Cdma calls are slightly different.