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

Commit 68c9e978 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by Android (Google) Code Review
Browse files

Merge "Fix more crashes during partial telephony stack boot" into main

parents 54584b9f 654b80b5
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -152,6 +152,7 @@ public class CarrierKeyDownloadManager extends Handler {
        CarrierConfigManager carrierConfigManager = mContext.getSystemService(
        CarrierConfigManager carrierConfigManager = mContext.getSystemService(
                CarrierConfigManager.class);
                CarrierConfigManager.class);
        // Callback which directly handle config change should be executed on handler thread
        // Callback which directly handle config change should be executed on handler thread
        if (carrierConfigManager != null) {
            carrierConfigManager.registerCarrierConfigChangeListener(this::post,
            carrierConfigManager.registerCarrierConfigChangeListener(this::post,
                (slotIndex, subId, carrierId, specificCarrierId) -> {
                (slotIndex, subId, carrierId, specificCarrierId) -> {
                    if (Flags.imsiKeyRetryDownloadOnPhoneUnlock()) {
                    if (Flags.imsiKeyRetryDownloadOnPhoneUnlock()) {
@@ -187,6 +188,7 @@ public class CarrierKeyDownloadManager extends Handler {
                        }
                        }
                    }
                    }
                });
                });
        }
        mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
        mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
    }
    }


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


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


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