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

Commit 2a21cb9d authored by Shuo Qian's avatar Shuo Qian Committed by sqian
Browse files

Replace isNetworkSupported with isDataCapable in Telephony

If one of the voice, sms, or data is enabled, then telephony should bind
 radio service.

Test: RILTest; Treehugger
Test: Manual boot up the device and confirmed device
      camped on network
Bug: 147017757
Merged-In: Iae462d9df21a69c8c7a3af54b7dfa34d1ae43752
Merged-In: I955a89f57d06901a4ebec06038e7f2b63a13106a
(cherry picked from commit 4fe816dd)

Change-Id: I0ab1bd057ef9b48ac34f922870b520816de01284
parent 9306fdac
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);