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

Commit 11cda4d9 authored by Shuo Qian's avatar Shuo Qian Committed by Gerrit Code Review
Browse files

Merge "Replace isNetworkSupported with isDataCapable in Telephony"

parents 798dedb3 2a21cb9d
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ import android.hardware.radio.V1_4.SimLockMultiSimPolicy;
import android.hardware.radio.V1_5.AccessNetwork;
import android.hardware.radio.V1_5.RadioAccessNetworks;
import android.hardware.radio.deprecated.V1_0.IOemHook;
import android.net.ConnectivityManager;
import android.net.InetAddresses;
import android.net.KeepalivePacketData;
import android.net.LinkAddress;
@@ -240,7 +239,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    /** Radio bug detector instance */
    private RadioBugDetector mRadioBugDetector = null;

    boolean mIsMobileNetworkSupported;
    boolean mIsCellularSupported;
    RadioResponse mRadioResponse;
    RadioIndication mRadioIndication;
    volatile IRadio mRadioProxy = null;
@@ -421,7 +420,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @VisibleForTesting
    public synchronized IRadio getRadioProxy(Message result) {
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return null;
        if (!mIsMobileNetworkSupported) {
        if (!mIsCellularSupported) {
            if (RILJ_LOGV) riljLog("getRadioProxy: Not calling getService(): wifi-only");
            if (result != null) {
                AsyncResult.forMessage(result, null,
@@ -535,7 +534,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @VisibleForTesting
    public synchronized IOemHook getOemHookProxy(Message result) {
        if (!SubscriptionManager.isValidPhoneId((mPhoneId))) return null;
        if (!mIsMobileNetworkSupported) {
        if (!mIsCellularSupported) {
            if (RILJ_LOGV) riljLog("getOemHookProxy: Not calling getService(): wifi-only");
            if (result != null) {
                AsyncResult.forMessage(result, null,
@@ -609,9 +608,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            mRadioBugDetector = new RadioBugDetector(context, mPhoneId);
        }

        ConnectivityManager cm = (ConnectivityManager)context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
        mIsMobileNetworkSupported = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
        TelephonyManager tm = (TelephonyManager) context.getSystemService(
                Context.TELEPHONY_SERVICE);
        mIsCellularSupported = tm.isVoiceCapable() || tm.isSmsCapable() || tm.isDataCapable();

        mRadioResponse = new RadioResponse(this);
        mRadioIndication = new RadioIndication(this);
+5 −0
Original line number Diff line number Diff line
@@ -179,6 +179,8 @@ public class RILTest extends TelephonyTest {
    @Mock
    private ConnectivityManager mConnectionManager;
    @Mock
    private TelephonyManager mTelephonyManager;
    @Mock
    private IRadio mRadioProxy;
    @Mock
    private IOemHook mOemHookProxy;
@@ -272,6 +274,9 @@ public class RILTest extends TelephonyTest {
            .isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
        doReturn(mConnectionManager).when(context)
            .getSystemService(Context.CONNECTIVITY_SERVICE);
        doReturn(mTelephonyManager).when(context)
                .getSystemService(Context.TELEPHONY_SERVICE);
        doReturn(true).when(mTelephonyManager).isDataCapable();
        PowerManager powerManager = new PowerManager(context, mock(IPowerManager.class),
                new Handler(Looper.myLooper()));
        doReturn(powerManager).when(context).getSystemService(Context.POWER_SERVICE);