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

Commit be237d97 authored by Nazanin Bakhshi's avatar Nazanin Bakhshi
Browse files

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

Bug: 123101701
Test: sanity
Change-Id: I87fad92cdbf4483ae8c9f06b9393d2b6a8f8d588
Merged-In: I87fad92cdbf4483ae8c9f06b9393d2b6a8f8d588
(cherry picked from commit 2a88473e)
parent 28e00762
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);