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

Commit a0092e5f authored by Gary Jian's avatar Gary Jian Committed by Automerger Merge Worker
Browse files

Merge "Check the build type and property when calling setModemService" am:...

Merge "Check the build type and property when calling setModemService" am: 7d40c4ab am: 21c457f3 am: 25693fd4 am: 516fd52e

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/2026163

Change-Id: I73f080254f5bd44261ddc6571a3bcd27e00224f0
parents 5993ceaa 516fd52e
Loading
Loading
Loading
Loading
+26 −16
Original line number Diff line number Diff line
@@ -22,10 +22,12 @@ import static android.telephony.TelephonyManager.EXTRA_ACTIVE_SIM_SUPPORTED_COUN
import android.content.Context;
import android.content.Intent;
import android.os.AsyncResult;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.RegistrantList;
import android.os.SystemProperties;
import android.os.storage.StorageManager;
import android.sysprop.TelephonyProperties;
import android.telephony.PhoneCapability;
@@ -70,7 +72,8 @@ public class PhoneConfigurationManager {
    private MockableInterface mMi = new MockableInterface();
    private TelephonyManager mTelephonyManager;
    private static final RegistrantList sMultiSimConfigChangeRegistrants = new RegistrantList();

    private static final String ALLOW_MOCK_MODEM_PROPERTY = "persist.radio.allow_mock_modem";
    private static final boolean DEBUG = !"user".equals(Build.TYPE);
    /**
     * Init method to instantiate the object
     * Should only be called once.
@@ -457,7 +460,10 @@ public class PhoneConfigurationManager {
        log("setModemService: " + serviceName);
        boolean statusRadioConfig = false;
        boolean statusRil = false;
        final boolean isAllowed = SystemProperties.getBoolean(ALLOW_MOCK_MODEM_PROPERTY, false);

        // Check for ALLOW_MOCK_MODEM_PROPERTY on user builds
        if (isAllowed || DEBUG) {
            if (serviceName != null) {
                // Only CTS mock modem service is allowed to swith.
                if (!serviceName.equals(CTS_MOCK_MODEM_SERVICE)) {
@@ -477,6 +483,10 @@ public class PhoneConfigurationManager {
            }

            return statusRadioConfig && statusRil;
        } else {
            loge("setModemService is not allowed");
            return false;
        }
    }

     /**