summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrace Jia <xiaotonj@google.com>2021-05-04 04:13:34 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-04 04:13:34 +0000
commit1c653b476858a2877a662f09cf9a3a5015957220 (patch)
tree8459a452bb81ba87f61a09c33207fd591de388bb
parent71de23564da289ba940388be7135e4b121c05eb7 (diff)
parent825f59adfeadb44042ad94bb430855a7e391ff76 (diff)
Merge "Provide all active subscriptions when register default app providers." am: 9ef59ac901 am: 825f59adfe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1694533 Change-Id: I2bf871f8c72c12acca809101665545cb16f205b2
-rw-r--r--services/core/java/com/android/server/telecom/TelecomLoaderService.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/telecom/TelecomLoaderService.java b/services/core/java/com/android/server/telecom/TelecomLoaderService.java
index 52ad893a9ace..823683655b81 100644
--- a/services/core/java/com/android/server/telecom/TelecomLoaderService.java
+++ b/services/core/java/com/android/server/telecom/TelecomLoaderService.java
@@ -31,6 +31,7 @@ import android.telecom.DefaultDialerManager;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionManager;
import android.util.IntArray;
import android.util.Slog;
@@ -44,6 +45,9 @@ import com.android.server.SystemService;
import com.android.server.pm.UserManagerService;
import com.android.server.pm.permission.PermissionManagerServiceInternal;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Starts the telecom component by binding to its ITelecomService implementation. Telecom is setup
* to run in the system-server process so once it is loaded into memory it will stay running.
@@ -208,13 +212,23 @@ public class TelecomLoaderService extends SystemService {
return null;
}
}
+ SubscriptionManager subscriptionManager =
+ mContext.getSystemService(SubscriptionManager.class);
+ if (subscriptionManager == null) {
+ return null;
+ }
TelecomManager telecomManager =
(TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
- PhoneAccountHandle phoneAccount = telecomManager.getSimCallManager(userId);
- if (phoneAccount != null) {
- return new String[]{phoneAccount.getComponentName().getPackageName()};
+ List<String> packages = new ArrayList<>();
+ int[] subIds = subscriptionManager.getActiveSubscriptionIdList();
+ for (int subId : subIds) {
+ PhoneAccountHandle phoneAccount =
+ telecomManager.getSimCallManagerForSubscription(subId);
+ if (phoneAccount != null) {
+ packages.add(phoneAccount.getComponentName().getPackageName());
+ }
}
- return null;
+ return packages.toArray(new String[] {});
});
}