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

Commit 654b80b5 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Fix more crashes during partial telephony stack boot

Bug: 331855229
Bug: 344261877
Flag: EXEMPT bugfix
Test: boot cf_x86_64_auto-trunk_staging-userdebug
Change-Id: I4fbd0778b7ae587d4510d1a329087aa9e7145a89
parent a111d5ed
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ public class CarrierKeyDownloadManager extends Handler {
        CarrierConfigManager carrierConfigManager = mContext.getSystemService(
                CarrierConfigManager.class);
        // Callback which directly handle config change should be executed on handler thread
        if (carrierConfigManager != null) {
            carrierConfigManager.registerCarrierConfigChangeListener(this::post,
                (slotIndex, subId, carrierId, specificCarrierId) -> {
                    if (Flags.imsiKeyRetryDownloadOnPhoneUnlock()) {
@@ -187,6 +188,7 @@ public class CarrierKeyDownloadManager extends Handler {
                        }
                    }
                });
        }
        mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
    }

+7 −4
Original line number Diff line number Diff line
@@ -346,9 +346,11 @@ public class CarrierPrivilegesTracker extends Handler {
        mCarrierConfigManager =
                (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        // Callback is executed in handler thread and directly handles carrier config update
        if (mCarrierConfigManager != null) {
            mCarrierConfigManager.registerCarrierConfigChangeListener(this::post,
                    (slotIndex, subId, carrierId, specificCarrierId) -> handleCarrierConfigUpdated(
                            subId, slotIndex));
        }
        mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
        mTelephonyRegistryManager =
                (TelephonyRegistryManager)
@@ -444,7 +446,8 @@ public class CarrierPrivilegesTracker extends Handler {
                CarrierConfigManager.getCarrierConfigSubset(
                        mContext, subId, KEY_CARRIER_CERTIFICATE_STRING_ARRAY);
        // CarrierConfigManager#isConfigForIdentifiedCarrier can handle null or empty bundle
        if (!mCarrierConfigManager.isConfigForIdentifiedCarrier(carrierConfigs)) {
        if (mCarrierConfigManager == null
                || !mCarrierConfigManager.isConfigForIdentifiedCarrier(carrierConfigs)) {
            return Collections.EMPTY_LIST;
        }

+3 −1
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ public class CarrierServiceStateTracker extends Handler {
        mTelephonyManager = mPhone.getContext().getSystemService(
                TelephonyManager.class).createForSubscriptionId(mPhone.getSubId());
        CarrierConfigManager ccm = mPhone.getContext().getSystemService(CarrierConfigManager.class);
        if (ccm != null) {
            ccm.registerCarrierConfigChangeListener(
                mPhone.getContext().getMainExecutor(),
                (slotIndex, subId, carrierId, specificCarrierId) -> {
@@ -143,6 +144,7 @@ public class CarrierServiceStateTracker extends Handler {
                    }
                    handleConfigChanges();
                });
        }

        // Listen for subscriber changes
        SubscriptionManager.from(mPhone.getContext()).addOnSubscriptionsChangedListener(
+9 −7
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ public class CarrierSignalAgent extends Handler {
        CarrierConfigManager carrierConfigManager = mPhone.getContext().getSystemService(
                CarrierConfigManager.class);
        loadCarrierConfig();
        if (carrierConfigManager != null) {
            carrierConfigManager.registerCarrierConfigChangeListener(
                    mPhone.getContext().getMainExecutor(),
                    (slotIndex, subId, carrierId, specificCarrierId) -> {
@@ -137,6 +138,7 @@ public class CarrierSignalAgent extends Handler {
                            loadCarrierConfig();
                        }
                    });
        }
        mPhone.getCarrierActionAgent().registerForCarrierAction(
                CarrierActionAgent.CARRIER_ACTION_REPORT_DEFAULT_NETWORK_STATUS, this,
                EVENT_REGISTER_DEFAULT_NETWORK_AVAIL, null, false);
+13 −10
Original line number Diff line number Diff line
@@ -87,23 +87,26 @@ public class DisplayInfoController extends Handler {
        mLogTag = "DIC-" + mPhone.getPhoneId();
        mServiceState = mPhone.getServiceStateTracker().getServiceState();
        mConfigs = new PersistableBundle();
        CarrierConfigManager ccm = mPhone.getContext().getSystemService(CarrierConfigManager.class);
        try {
            mConfigs = mPhone.getContext().getSystemService(CarrierConfigManager.class)
                    .getConfigForSubId(mPhone.getSubId(),
            if (ccm != null) {
                mConfigs = ccm.getConfigForSubId(mPhone.getSubId(),
                        CarrierConfigManager.KEY_SHOW_ROAMING_INDICATOR_BOOL);
            }
        } catch (Exception ignored) {
            // CarrierConfigLoader might not be available yet.
            // Once it's available, configs will be updated through the listener.
        }
        mPhone.getServiceStateTracker()
                .registerForServiceStateChanged(this, EVENT_SERVICE_STATE_CHANGED, null);
        mPhone.getContext().getSystemService(CarrierConfigManager.class)
                .registerCarrierConfigChangeListener(Runnable::run,
        if (ccm != null) {
            ccm.registerCarrierConfigChangeListener(Runnable::run,
                    (slotIndex, subId, carrierId, specificCarrierId) -> {
                        if (slotIndex == mPhone.getPhoneId()) {
                            obtainMessage(EVENT_CARRIER_CONFIG_CHANGED).sendToTarget();
                        }
                    });
        }
        mTelephonyDisplayInfo = new TelephonyDisplayInfo(
                TelephonyManager.NETWORK_TYPE_UNKNOWN,
                TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
Loading