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

Commit 7d40c4ab authored by Gary Jian's avatar Gary Jian Committed by Gerrit Code Review
Browse files

Merge "Check the build type and property when calling setModemService"

parents 9a9f83ec eb8f55d7
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;
        }
    }

     /**