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

Commit 81d664d1 authored by Chen Xu's avatar Chen Xu Committed by Gerrit Code Review
Browse files

Merge "send default sub change broadcast in multisim mode"

parents e251e475 0cbe18f3
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -2078,6 +2078,7 @@ public class SubscriptionController extends ISub.Stub {
        int previousSetting = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION,
                SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
        int previousDefaultSub = getDefaultSubId();

        Settings.Global.putInt(mContext.getContentResolver(),
                Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, subId);
@@ -2099,6 +2100,10 @@ public class SubscriptionController extends ISub.Stub {
                logd("[setDefaultVoiceSubId] default phone account not changed");
            }
        }

        if (previousDefaultSub != getDefaultSubId()) {
            sendDefaultChangedBroadcast(getDefaultSubId());
        }
    }

    /**
@@ -2182,10 +2187,14 @@ public class SubscriptionController extends ISub.Stub {
            // FIXME is this still needed?
            updateAllDataConnectionTrackers();

            int previousDefaultSub = getDefaultSubId();
            Settings.Global.putInt(mContext.getContentResolver(),
                    Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, subId);
            MultiSimSettingController.getInstance().onDefaultDataSettingChanged();
            broadcastDefaultDataSubIdChanged(subId);
            if (previousDefaultSub != getDefaultSubId()) {
                sendDefaultChangedBroadcast(getDefaultSubId());
            }
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
@@ -2227,6 +2236,7 @@ public class SubscriptionController extends ISub.Stub {
            logdl("[setDefaultFallbackSubId] subId=" + subId + ", subscriptionType="
                    + subscriptionType);
        }
        int previousDefaultSub = getDefaultSubId();
        if (isSubscriptionForRemoteSim(subscriptionType)) {
            mDefaultFallbackSubId = subId;
            return;
@@ -2240,7 +2250,6 @@ public class SubscriptionController extends ISub.Stub {
                // Update MCC MNC device configuration information
                String defaultMccMnc = mTelephonyManager.getSimOperatorNumericForPhone(phoneId);
                MccTable.updateMccMncConfiguration(mContext, defaultMccMnc);
                sendDefaultChangedBroadcast(phoneId, subId);
            } else {
                if (DBG) {
                    logdl("[setDefaultFallbackSubId] not set invalid phoneId=" + phoneId
@@ -2248,10 +2257,14 @@ public class SubscriptionController extends ISub.Stub {
                }
            }
        }
        if (previousDefaultSub != getDefaultSubId()) {
            sendDefaultChangedBroadcast(getDefaultSubId());
        }
    }

    private void sendDefaultChangedBroadcast(int phoneId, int subId) {
    public void sendDefaultChangedBroadcast(int subId) {
        // Broadcast an Intent for default sub change
        int phoneId = SubscriptionManager.getPhoneId(subId);
        Intent intent = new Intent(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED);
        intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
                | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
+3 −0
Original line number Diff line number Diff line
@@ -624,6 +624,9 @@ public class SubscriptionInfoUpdater extends Handler {
            }
            // update default subId
            MultiSimSettingController.getInstance().onAllSubscriptionsLoaded();
            // broadcast default subId
            SubscriptionController.getInstance().sendDefaultChangedBroadcast(
                    SubscriptionManager.getDefaultSubscriptionId());
        }

        SubscriptionController.getInstance().notifySubscriptionInfoChanged();