Loading src/java/com/android/internal/telephony/DeviceStateMonitor.java +7 −4 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class DeviceStateMonitor extends Handler { private static final int EVENT_POWER_SAVE_MODE_CHANGED = 3; private static final int EVENT_CHARGING_STATE_CHANGED = 4; private static final int EVENT_TETHERING_STATE_CHANGED = 5; private static final int EVENT_RADIO_AVAILABLE = 6; // TODO(b/74006656) load hysteresis values from a property when DeviceStateMonitor starts private static final int HYSTERESIS_KBPS = 50; Loading Loading @@ -200,6 +201,7 @@ public class DeviceStateMonitor extends Handler { mPhone.getContext().registerReceiver(mBroadcastReceiver, filter, null, mPhone); mPhone.mCi.registerForRilConnected(this, EVENT_RIL_CONNECTED, null); mPhone.mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); } /** Loading Loading @@ -344,7 +346,8 @@ public class DeviceStateMonitor extends Handler { log("handleMessage msg=" + msg, false); switch (msg.what) { case EVENT_RIL_CONNECTED: onRilConnected(); case EVENT_RADIO_AVAILABLE: onReset(); break; case EVENT_UPDATE_MODE_CHANGED: onSetIndicationUpdateMode(msg.arg1, msg.arg2); Loading Loading @@ -420,14 +423,14 @@ public class DeviceStateMonitor extends Handler { } /** * Called when RIL is connected during boot up or reconnected after modem restart. * Called when RIL is connected during boot up or radio becomes available after modem restart. * * When modem crashes, if the user turns the screen off before RIL reconnects, device * state and filter cannot be sent to modem. Resend the state here so that modem * has the correct state (to stop signal strength reporting, etc). */ private void onRilConnected() { log("RIL connected.", true); private void onReset() { log("onReset.", true); sendDeviceState(CHARGING_STATE, mIsCharging); sendDeviceState(LOW_DATA_EXPECTED, mIsLowDataExpected); sendDeviceState(POWER_SAVE_MODE, mIsPowerSaveOn); Loading tests/telephonytests/src/com/android/internal/telephony/DeviceStateMonitorTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -124,4 +124,12 @@ public class DeviceStateMonitorTest extends TelephonyTest { verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(CHARGING_STATE), eq(false), nullable(Message.class)); } @FlakyTest public void testReset() throws Exception { mDSM.obtainMessage(6).sendToTarget(); verify(mSimulatedCommandsVerifier, times(1)).setUnsolResponseFilter(eq(-1), nullable(Message.class)); } } Loading
src/java/com/android/internal/telephony/DeviceStateMonitor.java +7 −4 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class DeviceStateMonitor extends Handler { private static final int EVENT_POWER_SAVE_MODE_CHANGED = 3; private static final int EVENT_CHARGING_STATE_CHANGED = 4; private static final int EVENT_TETHERING_STATE_CHANGED = 5; private static final int EVENT_RADIO_AVAILABLE = 6; // TODO(b/74006656) load hysteresis values from a property when DeviceStateMonitor starts private static final int HYSTERESIS_KBPS = 50; Loading Loading @@ -200,6 +201,7 @@ public class DeviceStateMonitor extends Handler { mPhone.getContext().registerReceiver(mBroadcastReceiver, filter, null, mPhone); mPhone.mCi.registerForRilConnected(this, EVENT_RIL_CONNECTED, null); mPhone.mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); } /** Loading Loading @@ -344,7 +346,8 @@ public class DeviceStateMonitor extends Handler { log("handleMessage msg=" + msg, false); switch (msg.what) { case EVENT_RIL_CONNECTED: onRilConnected(); case EVENT_RADIO_AVAILABLE: onReset(); break; case EVENT_UPDATE_MODE_CHANGED: onSetIndicationUpdateMode(msg.arg1, msg.arg2); Loading Loading @@ -420,14 +423,14 @@ public class DeviceStateMonitor extends Handler { } /** * Called when RIL is connected during boot up or reconnected after modem restart. * Called when RIL is connected during boot up or radio becomes available after modem restart. * * When modem crashes, if the user turns the screen off before RIL reconnects, device * state and filter cannot be sent to modem. Resend the state here so that modem * has the correct state (to stop signal strength reporting, etc). */ private void onRilConnected() { log("RIL connected.", true); private void onReset() { log("onReset.", true); sendDeviceState(CHARGING_STATE, mIsCharging); sendDeviceState(LOW_DATA_EXPECTED, mIsLowDataExpected); sendDeviceState(POWER_SAVE_MODE, mIsPowerSaveOn); Loading
tests/telephonytests/src/com/android/internal/telephony/DeviceStateMonitorTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -124,4 +124,12 @@ public class DeviceStateMonitorTest extends TelephonyTest { verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(CHARGING_STATE), eq(false), nullable(Message.class)); } @FlakyTest public void testReset() throws Exception { mDSM.obtainMessage(6).sendToTarget(); verify(mSimulatedCommandsVerifier, times(1)).setUnsolResponseFilter(eq(-1), nullable(Message.class)); } }