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

Commit fdd08d9b authored by Sakajiri Hayato's avatar Sakajiri Hayato Committed by Masaya Nemoto
Browse files

Prevent sending CLIR activation and deactivation code only

Sending CLIR activation("*31#") and deactivation("#31#") code without
dialing number is not allowed by some operator. This patch prevents
sending "*31#" and "#31#" in case CarrierConfig
"prevent_clir_activation_and_deactivation_code_bool" is set to true.

Test: manual - Verified behavior about sending "*31#" and "#31#"
Bug: 140366917
Change-Id: Ibafdb6fd4cff18a15295f7ba21d04f2872f1e648
parent cee1ecba
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -657,6 +657,24 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        }
    }

    /**
     * Check if sending CLIR activation("*31#") and deactivation("#31#") code only without dialing
     * number is prevented.
     *
     * @return {@code true} when carrier config
     * "KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL" is set to {@code true}
     */
    public boolean isClirActivationAndDeactivationPrevented() {
        CarrierConfigManager configManager = (CarrierConfigManager)
                getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
        PersistableBundle b = configManager.getConfigForSubId(getSubId());
        if (b == null) {
            b = CarrierConfigManager.getDefaultConfig();
        }
        return b.getBoolean(
                CarrierConfigManager.KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL);
    }

    /**
     * When overridden the derived class needs to call
     * super.handleMessage(msg) so this method has a
+2 −2
Original line number Diff line number Diff line
@@ -894,10 +894,10 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                }
            } else if (mSc != null && mSc.equals(SC_CLIR)) {
                Rlog.d(LOG_TAG, "processCode: is CLIR");
                if (isActivate()) {
                if (isActivate() && !mPhone.isClirActivationAndDeactivationPrevented()) {
                    mPhone.mCi.setCLIR(CommandsInterface.CLIR_INVOCATION,
                        obtainMessage(EVENT_SET_COMPLETE, this));
                } else if (isDeactivate()) {
                } else if (isDeactivate() && !mPhone.isClirActivationAndDeactivationPrevented()) {
                    mPhone.mCi.setCLIR(CommandsInterface.CLIR_SUPPRESSION,
                        obtainMessage(EVENT_SET_COMPLETE, this));
                } else if (isInterrogate()) {
+4 −2
Original line number Diff line number Diff line
@@ -872,14 +872,16 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
                // NOTE: Since these supplementary services are accessed only
                //       via MMI codes, methods have not been added to ImsPhone.
                //       Only the UT interface handle is used.
                if (isActivate()) {
                if (isActivate()
                        && !mPhone.getDefaultPhone().isClirActivationAndDeactivationPrevented()) {
                    try {
                        mPhone.mCT.getUtInterface().updateCLIR(CommandsInterface.CLIR_INVOCATION,
                            obtainMessage(EVENT_SET_COMPLETE, this));
                    } catch (ImsException e) {
                        Rlog.d(LOG_TAG, "processCode: Could not get UT handle for updateCLIR.");
                    }
                } else if (isDeactivate()) {
                } else if (isDeactivate()
                        && !mPhone.getDefaultPhone().isClirActivationAndDeactivationPrevented()) {
                    try {
                        mPhone.mCT.getUtInterface().updateCLIR(CommandsInterface.CLIR_SUPPRESSION,
                            obtainMessage(EVENT_SET_COMPLETE, this));