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

Commit d69d5a6d authored by Nazanin Bakhshi's avatar Nazanin Bakhshi Committed by Gerrit Code Review
Browse files

Merge "Add a method to determine if a reboot is required to alter the modem config"

parents 28e00762 be237d97
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -197,6 +197,16 @@ public class PhoneConfigurationManager {
        return numOfSims;
    }

    /**
     * Get whether reboot is required or not after making changes to modem configurations.
     * Return value defaults to false
     */
    public boolean isRebootRequiredForModemConfigChange() {
        String rebootRequired = SystemProperties.get(
                TelephonyProperties.PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE);
        return rebootRequired.equals("true");
    }

    /**
     * Helper method to set system properties for setting multi sim configs,
     * as well as doing the phone reboot
@@ -217,11 +227,13 @@ public class PhoneConfigurationManager {
        }

        SystemProperties.set(TelephonyProperties.PROPERTY_MULTI_SIM_CONFIG, finalMultiSimConfig);
        if (isRebootRequiredForModemConfigChange()) {
            log("setMultiSimProperties: Rebooting due to switching multi-sim config to "
                    + finalMultiSimConfig);
            PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
            pm.reboot("Switching to " + finalMultiSimConfig);
        }
    }

    private static void log(String s) {
        Rlog.d(LOG_TAG, s);