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

Commit f824e6ff 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 am: 6138a64a

am: 1eb68414

Change-Id: I6391b2676f7b645d508c8ab63eae5b0177e6cafc
parents 2e2a43b1 1eb68414
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -640,6 +640,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
@@ -921,10 +921,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));