Merge "Hardcode a few Telecom constants"
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 88d8472..c22a8a4 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -7476,17 +7476,19 @@
*/
@Override
public boolean isDataRoamingEnabled(int subId) {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
- null /* message */);
+ try {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
+ null);
+ } catch (Exception e) {
+ TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
+ mApp, subId, "isDataRoamingEnabled");
+ }
boolean isEnabled = false;
final long identity = Binder.clearCallingIdentity();
try {
Phone phone = getPhone(subId);
isEnabled = phone != null ? phone.getDataRoamingEnabled() : false;
- } catch (Exception e) {
- TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
- mApp, subId, "isDataRoamingEnabled");
} finally {
Binder.restoreCallingIdentity(identity);
}
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 14d67cc..c3f2974 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -24,13 +24,14 @@
import android.os.RemoteException;
import android.provider.BlockedNumberContract;
import android.telephony.CarrierConfigManager;
-import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.feature.ImsFeature;
import android.util.Log;
import com.android.internal.telephony.ITelephony;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.util.TelephonyUtils;
@@ -739,17 +740,21 @@
try {
slotId = Integer.parseInt(slotString);
} catch (NumberFormatException e) {
+ getErrPrintWriter().println(tag + slotString + " is not a valid number for SLOT_ID.");
+ return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ }
+
+ if (!SubscriptionManager.isValidPhoneId(slotId)) {
getErrPrintWriter().println(tag + slotString + " is not a valid SLOT_ID.");
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
- SubscriptionInfo subInfo =
- mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(slotId);
- if (subInfo == null) {
+ Phone phone = PhoneFactory.getPhone(slotId);
+ if (phone == null) {
getErrPrintWriter().println(tag + "No subscription found in slot " + slotId + ".");
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
- return subInfo.getSubscriptionId();
+ return phone.getSubId();
}
private boolean checkShellUid() {
diff --git a/src/com/android/phone/settings/VoicemailSettingsActivity.java b/src/com/android/phone/settings/VoicemailSettingsActivity.java
index 66b1af9..2bd5306 100644
--- a/src/com/android/phone/settings/VoicemailSettingsActivity.java
+++ b/src/com/android/phone/settings/VoicemailSettingsActivity.java
@@ -238,6 +238,10 @@
mVoicemailNotificationPreference =
findPreference(getString(R.string.voicemail_notifications_key));
+ if (mSubMenuVoicemailSettings == null) {
+ mSubMenuVoicemailSettings =
+ (EditPhoneNumberPreference) findPreference(BUTTON_VOICEMAIL_KEY);
+ }
final Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_CHANNEL_ID,
NotificationChannelController.CHANNEL_ID_VOICE_MAIL);
@@ -250,12 +254,6 @@
super.onResume();
mForeground = true;
- PreferenceScreen prefSet = getPreferenceScreen();
-
- if (mSubMenuVoicemailSettings == null) {
- mSubMenuVoicemailSettings =
- (EditPhoneNumberPreference) findPreference(BUTTON_VOICEMAIL_KEY);
- }
if (mSubMenuVoicemailSettings != null) {
mSubMenuVoicemailSettings.setParentActivity(this, VOICEMAIL_PREF_ID, this);
mSubMenuVoicemailSettings.setDialogOnClosedListener(this);