use of android.util.LocalLog in project android_frameworks_opt_telephony by LineageOS.
the class DcTrackerTest method testDDSResetAutoAttach.
// Test the default data switch scenario.
@Test
@MediumTest
public void testDDSResetAutoAttach() throws Exception {
mDct.setDataEnabled(true);
mContextFixture.putBooleanResource(com.android.internal.R.bool.config_auto_attach_data_on_creation, true);
mSimulatedCommands.setDataCallResponse(true, createDataCallResponse());
DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
boolean allowed = isDataAllowed(dataConnectionReasons);
assertFalse(dataConnectionReasons.toString(), allowed);
ArgumentCaptor<Integer> intArgumentCaptor = ArgumentCaptor.forClass(Integer.class);
verify(mUiccController, times(1)).registerForIccChanged(eq(mDct), intArgumentCaptor.capture(), eq(null));
// Ideally this should send EVENT_ICC_CHANGED.
mDct.sendMessage(mDct.obtainMessage(intArgumentCaptor.getValue(), null));
waitForMs(100);
verify(mSimRecords, times(1)).registerForRecordsLoaded(eq(mDct), intArgumentCaptor.capture(), eq(null));
// Ideally this should send EVENT_RECORDS_LOADED.
mDct.sendMessage(mDct.obtainMessage(intArgumentCaptor.getValue(), null));
waitForMs(100);
verify(mSST, times(1)).registerForDataConnectionAttached(eq(mDct), intArgumentCaptor.capture(), eq(null));
// Ideally this should send EVENT_DATA_CONNECTION_ATTACHED");
mDct.sendMessage(mDct.obtainMessage(intArgumentCaptor.getValue(), null));
waitForMs(200);
NetworkRequest nr = new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build();
LocalLog l = new LocalLog(100);
mDct.requestNetwork(nr, l);
waitForMs(200);
verifyDataConnected(FAKE_APN1);
assertTrue(mDct.getAutoAttachOnCreation());
mDct.update();
// The auto attach flag should be reset after update
assertFalse(mDct.getAutoAttachOnCreation());
verify(mSST, times(1)).registerForDataConnectionDetached(eq(mDct), intArgumentCaptor.capture(), eq(null));
// Ideally this should send EVENT_DATA_CONNECTION_DETACHED
mDct.sendMessage(mDct.obtainMessage(intArgumentCaptor.getValue(), null));
waitForMs(200);
// Data should not be allowed since auto attach flag has been reset.
dataConnectionReasons = new DataConnectionReasons();
allowed = isDataAllowed(dataConnectionReasons);
assertFalse(dataConnectionReasons.toString(), allowed);
}
use of android.util.LocalLog in project android_frameworks_opt_telephony by LineageOS.
the class ApnContextTest method testNetworkRequest.
@Test
@SmallTest
public void testNetworkRequest() throws Exception {
LocalLog log = new LocalLog(3);
NetworkRequest nr = new NetworkRequest.Builder().build();
mApnContext.requestNetwork(nr, log);
verify(mDcTracker, times(1)).setEnabled(eq(DctConstants.APN_DEFAULT_ID), eq(true));
mApnContext.requestNetwork(nr, log);
verify(mDcTracker, times(1)).setEnabled(eq(DctConstants.APN_DEFAULT_ID), eq(true));
mApnContext.releaseNetwork(nr, log);
verify(mDcTracker, times(1)).setEnabled(eq(DctConstants.APN_DEFAULT_ID), eq(false));
mApnContext.releaseNetwork(nr, log);
verify(mDcTracker, times(1)).setEnabled(eq(DctConstants.APN_DEFAULT_ID), eq(false));
}
use of android.util.LocalLog in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyNetworkFactory method applyRequests.
private void applyRequests(HashMap<NetworkRequest, LocalLog> requestMap, boolean action, String logStr) {
for (NetworkRequest networkRequest : requestMap.keySet()) {
LocalLog localLog = requestMap.get(networkRequest);
localLog.log(logStr);
if (action == REQUEST) {
mDcTracker.requestNetwork(networkRequest, localLog);
} else {
mDcTracker.releaseNetwork(networkRequest, localLog);
}
}
}
Aggregations