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

Commit a40d2741 authored by Pengquan Meng's avatar Pengquan Meng
Browse files

Disable 'Enable DSDS' switch for always dsds mode

Disable the switch in RadioInfo when the ro.boot.hardware.dsds is set.

Bug: 131440879
Test: manual
Change-Id: Ib4d3111fc639f44295a82b8790a0b780293b1aa8
parent c7564be5
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
import android.telephony.CellIdentityCdma;
@@ -130,6 +131,13 @@ public class RadioInfo extends Activity {
    private static final int CELL_INFO_LIST_RATE_DISABLED = Integer.MAX_VALUE;
    private static final int CELL_INFO_LIST_RATE_MAX = 0;

    private static final String DSDS_MODE_PROPERTY = "ro.boot.hardware.dsds";

    /**
     * A value indicates the device is always on dsds mode.
     * @see {@link #DSDS_MODE_PROPERTY}
     */
    private static final int ALWAYS_ON_DSDS_MODE = 1;

    private static final int IMS_VOLTE_PROVISIONED_CONFIG_ID =
        ImsConfig.ConfigConstants.VLT_SETTING_ENABLED;
@@ -497,7 +505,7 @@ public class RadioInfo extends Activity {
        cbrsDataSwitch.setVisibility(isCbrsSupported() ? View.VISIBLE : View.GONE);

        dsdsSwitch = findViewById(R.id.dsds_switch);
        if (isDsdsSupported()) {
        if (isDsdsSupported() && !dsdsModeOnly()) {
            dsdsSwitch.setVisibility(View.VISIBLE);
            dsdsSwitch.setOnClickListener(v -> {
                if (mTelephonyManager.doesSwitchMultiSimConfigTriggerReboot()) {
@@ -1694,6 +1702,14 @@ public class RadioInfo extends Activity {
        mTelephonyManager.switchMultiSimConfig(dsdsSwitch.isChecked() ? 2 : 1);
    }

    /**
     * @return {@code True} if the device is only supported dsds mode.
     */
    private boolean dsdsModeOnly() {
        String dsdsMode = SystemProperties.get(DSDS_MODE_PROPERTY);
        return !TextUtils.isEmpty(dsdsMode) && Integer.parseInt(dsdsMode) == ALWAYS_ON_DSDS_MODE;
    }

    DialogInterface.OnClickListener mOnDsdsDialogConfirmedListener =
            new DialogInterface.OnClickListener() {
        @Override