In DcTracker when fetching APN setting, specify subId.
When fetching APN setting in DcTracker, we should use URL
carriers/filtered/# to specify subId otherwise it will always get
APN setting from the default subId.
Bug: 120570248
Test: manual
Change-Id: Ifd6de1f93577fef1d67df6ce5f2d48dcec7a5a91
Merged-In: Ifd6de1f93577fef1d67df6ce5f2d48dcec7a5a91
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
index 6dda4d9..1ee8dbd 100755
--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
@@ -3245,8 +3245,8 @@
// ORDER BY Telephony.Carriers._ID ("_id")
Cursor cursor = mPhone.getContext().getContentResolver().query(
- Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "filtered"),
- null, selection, null, Telephony.Carriers._ID);
+ Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "filtered/subId/"
+ + mPhone.getSubId()), null, selection, null, Telephony.Carriers._ID);
if (cursor != null) {
if (cursor.getCount() > 0) {
diff --git a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java
index 1645af9..ff0b19d 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java
@@ -208,8 +208,8 @@
logd(" sortOrder = " + sortOrder);
if (uri.compareTo(Telephony.Carriers.CONTENT_URI) == 0
- || uri.compareTo(Uri.withAppendedPath(
- Telephony.Carriers.CONTENT_URI, "filtered")) == 0) {
+ || uri.toString().startsWith(Uri.withAppendedPath(
+ Telephony.Carriers.CONTENT_URI, "filtered").toString())) {
if (projection == null && selectionArgs == null && selection != null) {
Pattern pattern = Pattern.compile("^numeric = '([0-9]*)'");