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

Commit 6138a64a authored by Sakajiri Hayato's avatar Sakajiri Hayato Committed by android-build-merger
Browse files

Merge "Prevent sending CLIR activation and deactivation code only"

am: 9c69809a

Change-Id: If52fb191e171958ccf56b7d035daadc4b9743b2f
parents dc6a7ba8 9c69809a
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -641,6 +641,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
@@ -870,14 +870,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));