Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ff29628 authored by Grace Jia's avatar Grace Jia Committed by Automerger Merge Worker
Browse files

Merge "Provide all active subscriptions when register default app providers."...

Merge "Provide all active subscriptions when register default app providers." am: 9ef59ac9 am: 825f59ad am: 1c653b47 am: 0f2aea79

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1694533

Change-Id: I7ddc1434f8f43ce6fac354003dc64aa006a4ca31
parents 59899be8 0f2aea79
Loading
Loading
Loading
Loading
+18 −4
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import android.telecom.DefaultDialerManager;
import android.telecom.PhoneAccountHandle;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.util.IntArray;
import android.util.IntArray;
import android.util.Slog;
import android.util.Slog;


@@ -44,6 +45,9 @@ import com.android.server.SystemService;
import com.android.server.pm.UserManagerService;
import com.android.server.pm.UserManagerService;
import com.android.server.pm.permission.LegacyPermissionManagerInternal;
import com.android.server.pm.permission.LegacyPermissionManagerInternal;


import java.util.ArrayList;
import java.util.List;

/**
/**
 * Starts the telecom component by binding to its ITelecomService implementation. Telecom is setup
 * 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.
 * 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;
                    return null;
                }
                }
            }
            }
            SubscriptionManager subscriptionManager =
                    mContext.getSystemService(SubscriptionManager.class);
            if (subscriptionManager == null) {
                return null;
            }
            TelecomManager telecomManager =
            TelecomManager telecomManager =
                    (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
                    (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
            PhoneAccountHandle phoneAccount = telecomManager.getSimCallManager(userId);
            List<String> packages = new ArrayList<>();
            int[] subIds = subscriptionManager.getActiveSubscriptionIdList();
            for (int subId : subIds) {
                PhoneAccountHandle phoneAccount =
                        telecomManager.getSimCallManagerForSubscription(subId);
                if (phoneAccount != null) {
                if (phoneAccount != null) {
                return new String[]{phoneAccount.getComponentName().getPackageName()};
                    packages.add(phoneAccount.getComponentName().getPackageName());
                }
                }
            return null;
            }
            return packages.toArray(new String[] {});
        });
        });
    }
    }