Merge "Add IMS Registration Integration"
diff --git a/res/values/config.xml b/res/values/config.xml
index b3fc30a..1b612c9 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -237,7 +237,7 @@
<!-- Flag indicating whether a system app can use video calling fallback if carrier video
calling is not available. -->
- <bool name="config_support_video_calling_fallback">false</bool>
+ <bool name="config_support_video_calling_fallback">true</bool>
<!-- Whether the cellular radio is allowed to be power down when the Bluetooth can provide the data/call capabilities -->
<bool name="config_allowRadioPowerDownOnBluetooth">false</bool>
diff --git a/res/xml/network_setting_fragment.xml b/res/xml/network_setting_fragment.xml
index d334861..68fc701 100644
--- a/res/xml/network_setting_fragment.xml
+++ b/res/xml/network_setting_fragment.xml
@@ -36,6 +36,10 @@
android:key="data_usage_summary"
android:title="@string/data_usage_title" />
+ <Preference
+ android:key="carrier_settings_euicc_key"
+ android:title="@string/carrier_settings_euicc" />
+
<com.android.phone.AdvancedOptionsPreference
android:key="advanced_options"/>
@@ -61,10 +65,6 @@
android:entryValues="@array/enabled_networks_values"
android:dialogTitle="@string/preferred_network_mode_dialogtitle" />
- <Preference
- android:key="carrier_settings_euicc_key"
- android:title="@string/carrier_settings_euicc" />
-
<PreferenceCategory
android:key="calling"
android:title="@string/call_category">
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index fb7d71e..ebeaae0 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -811,6 +811,15 @@
prefSet.addPreference(mMobileDataPref);
prefSet.addPreference(mButtonDataRoam);
prefSet.addPreference(mDataUsagePref);
+ if (showEuiccSettings(getActivity())) {
+ prefSet.addPreference(mEuiccSettingsPref);
+ String spn = mTelephonyManager.getSimOperatorName();
+ if (TextUtils.isEmpty(spn)) {
+ mEuiccSettingsPref.setSummary(null);
+ } else {
+ mEuiccSettingsPref.setSummary(spn);
+ }
+ }
// Customized preferences needs to be initialized with subId.
mMobileDataPref.initialize(phoneSubId);
@@ -858,6 +867,7 @@
updateBodyAdvancedFields(activity, prefSet, phoneSubId, hasActiveSubscriptions);
} else {
prefSet.addPreference(mAdvancedOptions);
+ mAdvancedOptions.setEnabled(hasActiveSubscriptions);
}
}
@@ -873,16 +883,6 @@
prefSet.addPreference(mButtonEnabledNetworks);
prefSet.addPreference(mButton4glte);
- if (showEuiccSettings(getActivity())) {
- prefSet.addPreference(mEuiccSettingsPref);
- String spn = mTelephonyManager.getSimOperatorName();
- if (TextUtils.isEmpty(spn)) {
- mEuiccSettingsPref.setSummary(null);
- } else {
- mEuiccSettingsPref.setSummary(spn);
- }
- }
-
int settingsNetworkMode = android.provider.Settings.Global.getInt(
mPhone.getContext().getContentResolver(),
android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 31d4642..3dbdc84 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1638,7 +1638,7 @@
return null;
}
- WorkSource workSource = getWorkSource(null, Binder.getCallingUid());
+ WorkSource workSource = getWorkSource(Binder.getCallingUid());
phone.getCellLocation(workSource).fillInNotifierBundle(data);
return data;
}
@@ -1708,7 +1708,7 @@
ArrayList<NeighboringCellInfo> cells = null;
- WorkSource workSource = getWorkSource(null, Binder.getCallingUid());
+ WorkSource workSource = getWorkSource(Binder.getCallingUid());
try {
cells = (ArrayList<NeighboringCellInfo>) sendRequest(
CMD_HANDLE_NEIGHBORING_CELL, workSource,
@@ -1728,7 +1728,7 @@
}
if (DBG_LOC) log("getAllCellInfo: is active user");
- WorkSource workSource = getWorkSource(null, Binder.getCallingUid());
+ WorkSource workSource = getWorkSource(Binder.getCallingUid());
List<CellInfo> cellInfos = new ArrayList<CellInfo>();
for (Phone phone : PhoneFactory.getPhones()) {
final List<CellInfo> info = phone.getAllCellInfo(workSource);
@@ -1740,7 +1740,7 @@
@Override
public void setCellInfoListRate(int rateInMillis) {
enforceModifyPermission();
- WorkSource workSource = getWorkSource(null, Binder.getCallingUid());
+ WorkSource workSource = getWorkSource(Binder.getCallingUid());
mPhone.setCellInfoListRate(rateInMillis, workSource);
}
@@ -3872,14 +3872,9 @@
return null;
}
- private WorkSource getWorkSource(WorkSource workSource, int uid) {
- if (workSource != null) {
- return workSource;
- }
-
+ private WorkSource getWorkSource(int uid) {
String packageName = mPhone.getContext().getPackageManager().getNameForUid(uid);
- workSource = new WorkSource(uid, packageName);
- return workSource;
+ return new WorkSource(uid, packageName);
}
/**
diff --git a/src/com/android/phone/vvm/RemoteVvmTaskManager.java b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
index 4fc8c57..3a18c7e 100644
--- a/src/com/android/phone/vvm/RemoteVvmTaskManager.java
+++ b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
@@ -69,6 +69,8 @@
"com.android.phone.vvm.ACTION_VISUAL_VOICEMAIL_SERVICE_EVENT";
private static final String EXTRA_WHAT = "what";
+ private static final String EXTRA_TARGET_PACKAGE = "target_package";
+
// TODO(twyen): track task individually to have time outs.
private int mTaskReferenceCount;
@@ -79,7 +81,7 @@
*/
private Messenger mMessenger;
- public static void startCellServiceConnected(Context context,
+ static void startCellServiceConnected(Context context,
PhoneAccountHandle phoneAccountHandle) {
Intent intent = new Intent(ACTION_START_CELL_SERVICE_CONNECTED, null, context,
RemoteVvmTaskManager.class);
@@ -87,28 +89,46 @@
context.startService(intent);
}
- public static void startSmsReceived(Context context, VisualVoicemailSms sms) {
+ static void startSmsReceived(Context context, VisualVoicemailSms sms,
+ String targetPackage) {
Intent intent = new Intent(ACTION_START_SMS_RECEIVED, null, context,
RemoteVvmTaskManager.class);
intent.putExtra(VisualVoicemailService.DATA_PHONE_ACCOUNT_HANDLE,
sms.getPhoneAccountHandle());
intent.putExtra(VisualVoicemailService.DATA_SMS, sms);
+ intent.putExtra(EXTRA_TARGET_PACKAGE, targetPackage);
context.startService(intent);
}
- public static void startSimRemoved(Context context, PhoneAccountHandle phoneAccountHandle) {
+ static void startSimRemoved(Context context, PhoneAccountHandle phoneAccountHandle) {
Intent intent = new Intent(ACTION_START_SIM_REMOVED, null, context,
RemoteVvmTaskManager.class);
intent.putExtra(VisualVoicemailService.DATA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
context.startService(intent);
}
- public static boolean hasRemoteService(Context context, int subId) {
- return getRemotePackage(context, subId) != null;
+ static boolean hasRemoteService(Context context, int subId, String targetPackage) {
+ return getRemotePackage(context, subId, targetPackage) != null;
}
+ /**
+ * Return the {@link ComponentName} of the {@link VisualVoicemailService} which is active (the
+ * current default dialer), or {@code null} if no implementation is found.
+ */
@Nullable
public static ComponentName getRemotePackage(Context context, int subId) {
+ return getRemotePackage(context, subId, null);
+ }
+
+ /**
+ * Return the {@link ComponentName} of the {@link VisualVoicemailService} which is active (the
+ * current default dialer), or {@code null} if no implementation is found.
+ *
+ * @param targetPackage the package that should be the active VisualVociemailService
+ */
+ @Nullable
+ public static ComponentName getRemotePackage(Context context, int subId,
+ @Nullable String targetPackage) {
ComponentName broadcastPackage = getBroadcastPackage(context);
if (broadcastPackage != null) {
return broadcastPackage;
@@ -122,7 +142,8 @@
PersistableBundle carrierConfig = context
.getSystemService(CarrierConfigManager.class).getConfigForSubId(subId);
packages.add(
- carrierConfig.getString(CarrierConfigManager.KEY_CARRIER_VVM_PACKAGE_NAME_STRING));
+ carrierConfig
+ .getString(CarrierConfigManager.KEY_CARRIER_VVM_PACKAGE_NAME_STRING));
String[] vvmPackages = carrierConfig
.getStringArray(CarrierConfigManager.KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY);
if (vvmPackages != null && vvmPackages.length > 0) {
@@ -132,6 +153,7 @@
}
packages.add(context.getResources().getString(R.string.system_visual_voicemail_client));
packages.add(telecomManager.getSystemDialerPackage());
+
for (String packageName : packages) {
if (TextUtils.isEmpty(packageName)) {
continue;
@@ -153,7 +175,10 @@
+ " does not enforce BIND_VISUAL_VOICEMAIL_SERVICE, ignoring");
continue;
}
-
+ if (targetPackage != null && !TextUtils.equals(packageName, targetPackage)) {
+ VvmLog.w(TAG, "target package " + targetPackage
+ + " is no longer the active VisualVoicemailService, ignoring");
+ }
return info.getComponentInfo().getComponentName();
}
@@ -203,7 +228,8 @@
PhoneAccountHandle phoneAccountHandle = intent.getExtras()
.getParcelable(VisualVoicemailService.DATA_PHONE_ACCOUNT_HANDLE);
int subId = PhoneAccountHandleConverter.toSubId(phoneAccountHandle);
- ComponentName remotePackage = getRemotePackage(this, subId);
+ ComponentName remotePackage = getRemotePackage(this, subId,
+ intent.getStringExtra(EXTRA_TARGET_PACKAGE));
if (remotePackage == null) {
VvmLog.i(TAG, "No service to handle " + intent.getAction() + ", ignoring");
checkReference();
diff --git a/src/com/android/phone/vvm/VisualVoicemailSmsFilterConfig.java b/src/com/android/phone/vvm/VisualVoicemailSmsFilterConfig.java
index 058f18e..ecd1f0f 100644
--- a/src/com/android/phone/vvm/VisualVoicemailSmsFilterConfig.java
+++ b/src/com/android/phone/vvm/VisualVoicemailSmsFilterConfig.java
@@ -92,6 +92,7 @@
VisualVoicemailSmsFilterSettings.DEFAULT_ORIGINATING_NUMBERS))
.setDestinationPort(reader.getInt(DESTINATION_PORT_KEY,
VisualVoicemailSmsFilterSettings.DEFAULT_DESTINATION_PORT))
+ .setPackageName(packageName)
.build();
}
diff --git a/src/com/android/phone/vvm/VvmSmsReceiver.java b/src/com/android/phone/vvm/VvmSmsReceiver.java
index 4bffa97..8265e50 100644
--- a/src/com/android/phone/vvm/VvmSmsReceiver.java
+++ b/src/com/android/phone/vvm/VvmSmsReceiver.java
@@ -36,7 +36,6 @@
public void onReceive(Context context, Intent intent) {
VisualVoicemailSms sms = intent.getExtras()
.getParcelable(VoicemailContract.EXTRA_VOICEMAIL_SMS);
-
if (sms.getPhoneAccountHandle() == null) {
// This should never happen
VvmLog.e(TAG, "Received message for null phone account");
@@ -49,11 +48,12 @@
return;
}
- if (RemoteVvmTaskManager.hasRemoteService(context, subId)) {
+ String targetPackage = intent.getExtras().getString(VoicemailContract.EXTRA_TARGET_PACKAGE);
+ if (RemoteVvmTaskManager.hasRemoteService(context, subId, targetPackage)) {
VvmLog.i(TAG, "Sending SMS received event to remote service");
- RemoteVvmTaskManager.startSmsReceived(context, sms);
+ RemoteVvmTaskManager.startSmsReceived(context, sms, targetPackage);
} else {
- VvmLog.w(TAG, "Sending SMS received event to remote service");
- };
+ VvmLog.w(TAG, "No remote service to handle SMS received event");
+ }
}
}