Search in sources :

Example 1 with RIL_REQUEST_START_NETWORK_SCAN

use of com.android.internal.telephony.RILConstants.RIL_REQUEST_START_NETWORK_SCAN in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testStartNetworkScanWithUnsupportedResponse.

@FlakyTest
@Test
public void testStartNetworkScanWithUnsupportedResponse() throws Exception {
    // Use Radio HAL v1.5
    try {
        replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV15);
    } catch (Exception e) {
    }
    NetworkScanRequest nsr = getNetworkScanRequestForTesting();
    mRILUnderTest.startNetworkScan(nsr, obtainMessage());
    // Verify the v1.5 HAL methed is called firstly
    verify(mRadioProxy).startNetworkScan_1_5(mSerialNumberCaptor.capture(), any());
    // Before we find a way to trigger real RadioResponse method, emulate the behaivor.
    Consumer<RILRequest> unsupportedResponseEmulator = rr -> {
        mRILUnderTest.setCompatVersion(rr.getRequest(), RIL.RADIO_HAL_VERSION_1_4);
        mRILUnderTest.startNetworkScan(nsr, Message.obtain(rr.getResult()));
    };
    verifyRILUnsupportedResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_START_NETWORK_SCAN, unsupportedResponseEmulator);
    // Verify the fallback method is invoked
    verify(mRadioProxy).startNetworkScan_1_4(eq(mSerialNumberCaptor.getValue() + 1), any());
}
Also used : RIL_REQUEST_SIM_CLOSE_CHANNEL(com.android.internal.telephony.RILConstants.RIL_REQUEST_SIM_CLOSE_CHANNEL) RIL_REQUEST_GET_CURRENT_CALLS(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_CURRENT_CALLS) FlakyTest(androidx.test.filters.FlakyTest) Arrays(java.util.Arrays) RIL_REQUEST_SIM_AUTHENTICATION(com.android.internal.telephony.RILConstants.RIL_REQUEST_SIM_AUTHENTICATION) RIL_REQUEST_START_LCE(com.android.internal.telephony.RILConstants.RIL_REQUEST_START_LCE) CellInfoNr(android.telephony.CellInfoNr) RadioError(android.hardware.radio.V1_0.RadioError) SmsManager(android.telephony.SmsManager) DataProfile(android.telephony.data.DataProfile) InetAddresses(android.net.InetAddresses) RIL_REQUEST_GET_HARDWARE_CONFIG(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_HARDWARE_CONFIG) RIL_REQUEST_SET_INITIAL_ATTACH_APN(com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_INITIAL_ATTACH_APN) CellInfo(android.telephony.CellInfo) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND(com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND) RIL_REQUEST_SETUP_DATA_CALL(com.android.internal.telephony.RILConstants.RIL_REQUEST_SETUP_DATA_CALL) RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND(com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND) DataProfileInfo(android.hardware.radio.V1_0.DataProfileInfo) IPowerManager(android.os.IPowerManager) RadioResponseType(android.hardware.radio.V1_0.RadioResponseType) Handler(android.os.Handler) Looper(android.os.Looper) RIL_REQUEST_GET_IMSI(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMSI) CarrierIdentifier(android.service.carrier.CarrierIdentifier) Mockito.doReturn(org.mockito.Mockito.doReturn) ConnectivityManager(android.net.ConnectivityManager) NvWriteItem(android.hardware.radio.V1_0.NvWriteItem) RIL_REQUEST_REPORT_SMS_MEMORY_STATUS(com.android.internal.telephony.RILConstants.RIL_REQUEST_REPORT_SMS_MEMORY_STATUS) RIL_REQUEST_START_NETWORK_SCAN(com.android.internal.telephony.RILConstants.RIL_REQUEST_START_NETWORK_SCAN) RIL_REQUEST_SIGNAL_STRENGTH(com.android.internal.telephony.RILConstants.RIL_REQUEST_SIGNAL_STRENGTH) Set(java.util.Set) RIL_REQUEST_SHUTDOWN(com.android.internal.telephony.RILConstants.RIL_REQUEST_SHUTDOWN) IRadio(android.hardware.radio.V1_5.IRadio) CellIdentityWcdma(android.telephony.CellIdentityWcdma) RIL_REQUEST_OPERATOR(com.android.internal.telephony.RILConstants.RIL_REQUEST_OPERATOR) Matchers.any(org.mockito.Matchers.any) RIL_REQUEST_VOICE_RADIO_TECH(com.android.internal.telephony.RILConstants.RIL_REQUEST_VOICE_RADIO_TECH) Message(android.os.Message) RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE(com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE) RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE(com.android.internal.telephony.RILConstants.RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE) Mockito.mock(org.mockito.Mockito.mock) RadioAccessSpecifier(android.telephony.RadioAccessSpecifier) Assert.assertEquals(junit.framework.Assert.assertEquals) ApnSetting(android.telephony.data.ApnSetting) RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER(com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER) RIL_REQUEST_GET_CELL_INFO_LIST(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_CELL_INFO_LIST) RIL_REQUEST_ALLOW_DATA(com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOW_DATA) Mock(org.mockito.Mock) RIL_REQUEST_RADIO_POWER(com.android.internal.telephony.RILConstants.RIL_REQUEST_RADIO_POWER) RunWith(org.junit.runner.RunWith) RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE(com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE) RIL_REQUEST_ENTER_SIM_PUK2(com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PUK2) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) Mockito.spy(org.mockito.Mockito.spy) RIL_REQUEST_GET_BARRING_INFO(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_BARRING_INFO) ArrayList(java.util.ArrayList) Assert.assertTrue(junit.framework.Assert.assertTrue) RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU(com.android.internal.telephony.RILConstants.RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU) DataCallResponse(android.telephony.data.DataCallResponse) Carrier(android.hardware.radio.V1_0.Carrier) CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) RIL_REQUEST_SEND_SMS(com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS) Assert.assertNull(junit.framework.Assert.assertNull) RIL_REQUEST_UDUB(com.android.internal.telephony.RILConstants.RIL_REQUEST_UDUB) Before(org.junit.Before) RIL_REQUEST_NV_RESET_CONFIG(com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_RESET_CONFIG) Mockito.times(org.mockito.Mockito.times) IOemHook(android.hardware.radio.deprecated.V1_0.IOemHook) Test(org.junit.Test) WorkSource(android.os.WorkSource) CdmaSmsMessage(android.hardware.radio.V1_0.CdmaSmsMessage) Mockito.never(org.mockito.Mockito.never) SignalStrength(android.telephony.SignalStrength) CellIdentityNr(android.telephony.CellIdentityNr) ImsSmsMessage(android.hardware.radio.V1_0.ImsSmsMessage) RIL_REQUEST_ENTER_SIM_PIN(com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PIN) CellInfoLte(android.telephony.CellInfoLte) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) RIL_REQUEST_DATA_REGISTRATION_STATE(com.android.internal.telephony.RILConstants.RIL_REQUEST_DATA_REGISTRATION_STATE) RIL_REQUEST_SEND_SMS_EXPECT_MORE(com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS_EXPECT_MORE) RIL_REQUEST_IMS_SEND_SMS(com.android.internal.telephony.RILConstants.RIL_REQUEST_IMS_SEND_SMS) RIL_REQUEST_SET_SMSC_ADDRESS(com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SMSC_ADDRESS) PowerManager(android.os.PowerManager) RIL_REQUEST_DTMF(com.android.internal.telephony.RILConstants.RIL_REQUEST_DTMF) Assert.assertNotNull(junit.framework.Assert.assertNotNull) Matchers.eq(org.mockito.Matchers.eq) RadioResponseInfo(android.hardware.radio.V1_0.RadioResponseInfo) After(org.junit.After) RIL_REQUEST_GET_RADIO_CAPABILITY(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_RADIO_CAPABILITY) Mockito.atLeast(org.mockito.Mockito.atLeast) RIL_REQUEST_GET_ACTIVITY_INFO(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_ACTIVITY_INFO) SmsWriteArgs(android.hardware.radio.V1_0.SmsWriteArgs) RIL_REQUEST_ENTER_SIM_PIN2(com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PIN2) RIL_REQUEST_HANGUP(com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP) RIL_REQUEST_IMS_REGISTRATION_STATE(com.android.internal.telephony.RILConstants.RIL_REQUEST_IMS_REGISTRATION_STATE) RIL_REQUEST_STOP_LCE(com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_LCE) CellInfoCdma(android.telephony.CellInfoCdma) CellInfoGsm(android.telephony.CellInfoGsm) ServiceState(android.telephony.ServiceState) RIL_REQUEST_NV_WRITE_ITEM(com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_WRITE_ITEM) CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) AndroidTestingRunner(android.testing.AndroidTestingRunner) RIL_REQUEST_WRITE_SMS_TO_SIM(com.android.internal.telephony.RILConstants.RIL_REQUEST_WRITE_SMS_TO_SIM) CellIdentityCdma(android.telephony.CellIdentityCdma) RIL_REQUEST_ENABLE_UICC_APPLICATIONS(com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_UICC_APPLICATIONS) List(java.util.List) RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING(com.android.internal.telephony.RILConstants.RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING) ApplicationInfo(android.content.pm.ApplicationInfo) Context(android.content.Context) RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM(com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM) AccessNetworkConstants(android.telephony.AccessNetworkConstants) RIL_REQUEST_CHANGE_SIM_PIN2(com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM_PIN2) RIL_REQUEST_DELETE_SMS_ON_SIM(com.android.internal.telephony.RILConstants.RIL_REQUEST_DELETE_SMS_ON_SIM) RIL_REQUEST_CHANGE_SIM_PIN(com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM_PIN) RIL_REQUEST_VOICE_REGISTRATION_STATE(com.android.internal.telephony.RILConstants.RIL_REQUEST_VOICE_REGISTRATION_STATE) CellInfoWcdma(android.telephony.CellInfoWcdma) RIL_REQUEST_SEND_DEVICE_STATE(com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_DEVICE_STATE) HashSet(java.util.HashSet) IThermalService(android.os.IThermalService) ArgumentCaptor(org.mockito.ArgumentCaptor) RIL_REQUEST_GET_SIM_STATUS(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_STATUS) TelephonyManager(android.telephony.TelephonyManager) RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT) RIL_REQUEST_NV_READ_ITEM(com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_READ_ITEM) CellIdentityGsm(android.telephony.CellIdentityGsm) RIL_REQUEST_CONFERENCE(com.android.internal.telephony.RILConstants.RIL_REQUEST_CONFERENCE) RIL_REQUEST_GET_SMSC_ADDRESS(com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SMSC_ADDRESS) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) RIL_REQUEST_PULL_LCEDATA(com.android.internal.telephony.RILConstants.RIL_REQUEST_PULL_LCEDATA) RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE(com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE) CellInfoTdscdma(android.telephony.CellInfoTdscdma) DcTracker(com.android.internal.telephony.dataconnection.DcTracker) RIL_REQUEST_LAST_CALL_FAIL_CAUSE(com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_CALL_FAIL_CAUSE) TestableLooper(android.testing.TestableLooper) RIL_REQUEST_ENTER_SIM_PUK(com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PUK) NetworkScanRequest(android.telephony.NetworkScanRequest) RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION(com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION) RIL_REQUEST_SIM_OPEN_CHANNEL(com.android.internal.telephony.RILConstants.RIL_REQUEST_SIM_OPEN_CHANNEL) LinkAddress(android.net.LinkAddress) RIL_REQUEST_DEVICE_IDENTITY(com.android.internal.telephony.RILConstants.RIL_REQUEST_DEVICE_IDENTITY) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) RIL_REQUEST_SET_SIM_CARD_POWER(com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIM_CARD_POWER) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellIdentityLte(android.telephony.CellIdentityLte) Collections(java.util.Collections) Assert.assertFalse(junit.framework.Assert.assertFalse) NetworkScanRequest(android.telephony.NetworkScanRequest) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Aggregations

Context (android.content.Context)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 Carrier (android.hardware.radio.V1_0.Carrier)1 CdmaSmsMessage (android.hardware.radio.V1_0.CdmaSmsMessage)1 DataProfileInfo (android.hardware.radio.V1_0.DataProfileInfo)1 GsmSmsMessage (android.hardware.radio.V1_0.GsmSmsMessage)1 ImsSmsMessage (android.hardware.radio.V1_0.ImsSmsMessage)1 NvWriteItem (android.hardware.radio.V1_0.NvWriteItem)1 RadioError (android.hardware.radio.V1_0.RadioError)1 RadioResponseInfo (android.hardware.radio.V1_0.RadioResponseInfo)1 RadioResponseType (android.hardware.radio.V1_0.RadioResponseType)1 SmsWriteArgs (android.hardware.radio.V1_0.SmsWriteArgs)1 IRadio (android.hardware.radio.V1_5.IRadio)1 IOemHook (android.hardware.radio.deprecated.V1_0.IOemHook)1 ConnectivityManager (android.net.ConnectivityManager)1 InetAddresses (android.net.InetAddresses)1 LinkAddress (android.net.LinkAddress)1 Handler (android.os.Handler)1 IPowerManager (android.os.IPowerManager)1 IThermalService (android.os.IThermalService)1