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

Commit ec344c60 authored by Bonian Chen's avatar Bonian Chen
Browse files

[Settings] Remove null checking for TelephonyManager

1. TelephonyManager#createForSubscriptionId(int) never returns null
   Remove null checking.
2. Adopting context#getSystemService(SubscriptionManager.class)

Bug: None
Test: make
Change-Id: Ie36dea80a4dfabbc34d9d25c50e60e4928b2f936
parent 65b29905
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -174,9 +174,6 @@ public class ApnSettings extends RestrictedSettingsFragment

        final TelephonyManager updatedTelephonyManager =
                mTelephonyManager.createForSubscriptionId(subId);
        if (updatedTelephonyManager == null) {
            return;
        }

        // restart monitoring when subscription has been changed
        mTelephonyManager.listen(mPhoneStateListener,
+2 −3
Original line number Diff line number Diff line
@@ -278,12 +278,11 @@ public class SubscriptionUtil {
     * Get phoneId or logical slot index for a subId if active, or INVALID_PHONE_INDEX if inactive.
     */
    public static int getPhoneId(Context context, int subId) {
        SubscriptionManager subManager = (SubscriptionManager)
                context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
        final SubscriptionManager subManager = context.getSystemService(SubscriptionManager.class);
        if (subManager == null) {
            return INVALID_SIM_SLOT_INDEX;
        }
        SubscriptionInfo info = subManager.getActiveSubscriptionInfo(subId);
        final SubscriptionInfo info = subManager.getActiveSubscriptionInfo(subId);
        if (info == null) {
            return INVALID_SIM_SLOT_INDEX;
        }