Loading src/java/com/android/internal/telephony/DeviceStateMonitor.java +38 −32 Original line number Original line Diff line number Diff line Loading @@ -308,10 +308,11 @@ public class DeviceStateMonitor extends Handler { } } /** /** * @return True if signal strength update should be turned on. * @return True if signal strength update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::SIGNAL_STRENGTH. */ */ private boolean shouldTurnOnSignalStrength() { private boolean shouldEnableSignalStrengthReports() { // We should turn on signal strength update if one of the following condition is true. // We should enable signal strength update if one of the following condition is true. // 1. The device is charging. // 1. The device is charging. // 2. When the screen is on. // 2. When the screen is on. // 3. Any of system services is registrating to always listen to signal strength changes // 3. Any of system services is registrating to always listen to signal strength changes Loading @@ -319,49 +320,54 @@ public class DeviceStateMonitor extends Handler { } } /** /** * @return True if full network update should be turned on. When off, only significant changes * @return True if full network state update should be enabled. When off, only significant * will trigger the network update unsolicited response. * changes will trigger the network update unsolicited response. See details in * android.hardware.radio@1.2::IndicationFilter::FULL_NETWORK_STATE. */ */ private boolean shouldTurnOnFullNetworkUpdate() { private boolean shouldEnableFullNetworkStateReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if data dormancy status update should be turned on. * @return True if data call dormancy changed update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::DATA_CALL_DORMANCY_CHANGED. */ */ private boolean shouldTurnOnDormancyUpdate() { private boolean shouldEnableDataCallDormancyChangedReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if link capacity estimate update should be turned on. * @return True if link capacity estimate update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::LINK_CAPACITY_ESTIMATE. */ */ private boolean shouldTurnOnLinkCapacityEstimate() { private boolean shouldEnableLinkCapacityEstimateReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if physical channel config update should be turned on. * @return True if physical channel config update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::PHYSICAL_CHANNEL_CONFIG. */ */ private boolean shouldTurnOnPhysicalChannelConfig() { private boolean shouldEnablePhysicalChannelConfigReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if BarryingInfo update should be turned on. * @return True if barring info update should be enabled. See details in * android.hardware.radio@1.5::IndicationFilter::BARRING_INFO. */ */ private boolean shouldTurnOnBarringInfo() { private boolean shouldEnableBarringInfoReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * A common policy to determine if we should turn on necessary indications, * A common policy to determine if we should enable the necessary indications update, * for power consumption's sake. * for power consumption's sake. * * * @return True if the response filter update should be turned on. * @return True if the response update should be enabled. */ */ private boolean shouldTurnOnHighPowerConsumptionIndications() { private boolean shouldEnableHighPowerConsumptionIndications() { // We should turn on update if one of the following condition is true. // We should enable indications reports if one of the following condition is true. // 1. The device is charging. // 1. The device is charging. // 2. When the screen is on. // 2. When the screen is on. // 3. When the tethering is on. // 3. When the tethering is on. Loading Loading @@ -414,7 +420,7 @@ public class DeviceStateMonitor extends Handler { * @param state True if enabled/on, otherwise disabled/off. * @param state True if enabled/on, otherwise disabled/off. */ */ private void onUpdateDeviceState(int eventType, boolean state) { private void onUpdateDeviceState(int eventType, boolean state) { final boolean shouldTurnOnBarringInfoOld = shouldTurnOnBarringInfo(); final boolean shouldEnableBarringInfoReportsOld = shouldEnableBarringInfoReports(); switch (eventType) { switch (eventType) { case EVENT_SCREEN_STATE_CHANGED: case EVENT_SCREEN_STATE_CHANGED: if (mIsScreenOn == state) return; if (mIsScreenOn == state) return; Loading Loading @@ -459,35 +465,35 @@ public class DeviceStateMonitor extends Handler { } } int newFilter = 0; int newFilter = 0; if (shouldTurnOnSignalStrength()) { if (shouldEnableSignalStrengthReports()) { newFilter |= IndicationFilter.SIGNAL_STRENGTH; newFilter |= IndicationFilter.SIGNAL_STRENGTH; } } if (shouldTurnOnFullNetworkUpdate()) { if (shouldEnableFullNetworkStateReports()) { newFilter |= IndicationFilter.FULL_NETWORK_STATE; newFilter |= IndicationFilter.FULL_NETWORK_STATE; } } if (shouldTurnOnDormancyUpdate()) { if (shouldEnableDataCallDormancyChangedReports()) { newFilter |= IndicationFilter.DATA_CALL_DORMANCY_CHANGED; newFilter |= IndicationFilter.DATA_CALL_DORMANCY_CHANGED; } } if (shouldTurnOnLinkCapacityEstimate()) { if (shouldEnableLinkCapacityEstimateReports()) { newFilter |= IndicationFilter.LINK_CAPACITY_ESTIMATE; newFilter |= IndicationFilter.LINK_CAPACITY_ESTIMATE; } } if (shouldTurnOnPhysicalChannelConfig()) { if (shouldEnablePhysicalChannelConfigReports()) { newFilter |= IndicationFilter.PHYSICAL_CHANNEL_CONFIG; newFilter |= IndicationFilter.PHYSICAL_CHANNEL_CONFIG; } } final boolean shouldTurnOnBarringInfo = shouldTurnOnBarringInfo(); final boolean shouldEnableBarringInfoReports = shouldEnableBarringInfoReports(); if (shouldTurnOnBarringInfo) { if (shouldEnableBarringInfoReports) { newFilter |= IndicationFilter.BARRING_INFO; newFilter |= IndicationFilter.BARRING_INFO; } } setUnsolResponseFilter(newFilter, false); setUnsolResponseFilter(newFilter, false); // Pull barring info AFTER setting filter, the order matters // Pull barring info AFTER setting filter, the order matters if (shouldTurnOnBarringInfo && !shouldTurnOnBarringInfoOld) { if (shouldEnableBarringInfoReports && !shouldEnableBarringInfoReportsOld) { if (DBG) log("Manually pull barring info...", true); if (DBG) log("Manually pull barring info...", true); // use a null message since we don't care of receiving response // use a null message since we don't care of receiving response mPhone.mCi.getBarringInfo(null); mPhone.mCi.getBarringInfo(null); Loading Loading
src/java/com/android/internal/telephony/DeviceStateMonitor.java +38 −32 Original line number Original line Diff line number Diff line Loading @@ -308,10 +308,11 @@ public class DeviceStateMonitor extends Handler { } } /** /** * @return True if signal strength update should be turned on. * @return True if signal strength update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::SIGNAL_STRENGTH. */ */ private boolean shouldTurnOnSignalStrength() { private boolean shouldEnableSignalStrengthReports() { // We should turn on signal strength update if one of the following condition is true. // We should enable signal strength update if one of the following condition is true. // 1. The device is charging. // 1. The device is charging. // 2. When the screen is on. // 2. When the screen is on. // 3. Any of system services is registrating to always listen to signal strength changes // 3. Any of system services is registrating to always listen to signal strength changes Loading @@ -319,49 +320,54 @@ public class DeviceStateMonitor extends Handler { } } /** /** * @return True if full network update should be turned on. When off, only significant changes * @return True if full network state update should be enabled. When off, only significant * will trigger the network update unsolicited response. * changes will trigger the network update unsolicited response. See details in * android.hardware.radio@1.2::IndicationFilter::FULL_NETWORK_STATE. */ */ private boolean shouldTurnOnFullNetworkUpdate() { private boolean shouldEnableFullNetworkStateReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if data dormancy status update should be turned on. * @return True if data call dormancy changed update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::DATA_CALL_DORMANCY_CHANGED. */ */ private boolean shouldTurnOnDormancyUpdate() { private boolean shouldEnableDataCallDormancyChangedReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if link capacity estimate update should be turned on. * @return True if link capacity estimate update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::LINK_CAPACITY_ESTIMATE. */ */ private boolean shouldTurnOnLinkCapacityEstimate() { private boolean shouldEnableLinkCapacityEstimateReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if physical channel config update should be turned on. * @return True if physical channel config update should be enabled. See details in * android.hardware.radio@1.2::IndicationFilter::PHYSICAL_CHANNEL_CONFIG. */ */ private boolean shouldTurnOnPhysicalChannelConfig() { private boolean shouldEnablePhysicalChannelConfigReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * @return True if BarryingInfo update should be turned on. * @return True if barring info update should be enabled. See details in * android.hardware.radio@1.5::IndicationFilter::BARRING_INFO. */ */ private boolean shouldTurnOnBarringInfo() { private boolean shouldEnableBarringInfoReports() { return shouldTurnOnHighPowerConsumptionIndications(); return shouldEnableHighPowerConsumptionIndications(); } } /** /** * A common policy to determine if we should turn on necessary indications, * A common policy to determine if we should enable the necessary indications update, * for power consumption's sake. * for power consumption's sake. * * * @return True if the response filter update should be turned on. * @return True if the response update should be enabled. */ */ private boolean shouldTurnOnHighPowerConsumptionIndications() { private boolean shouldEnableHighPowerConsumptionIndications() { // We should turn on update if one of the following condition is true. // We should enable indications reports if one of the following condition is true. // 1. The device is charging. // 1. The device is charging. // 2. When the screen is on. // 2. When the screen is on. // 3. When the tethering is on. // 3. When the tethering is on. Loading Loading @@ -414,7 +420,7 @@ public class DeviceStateMonitor extends Handler { * @param state True if enabled/on, otherwise disabled/off. * @param state True if enabled/on, otherwise disabled/off. */ */ private void onUpdateDeviceState(int eventType, boolean state) { private void onUpdateDeviceState(int eventType, boolean state) { final boolean shouldTurnOnBarringInfoOld = shouldTurnOnBarringInfo(); final boolean shouldEnableBarringInfoReportsOld = shouldEnableBarringInfoReports(); switch (eventType) { switch (eventType) { case EVENT_SCREEN_STATE_CHANGED: case EVENT_SCREEN_STATE_CHANGED: if (mIsScreenOn == state) return; if (mIsScreenOn == state) return; Loading Loading @@ -459,35 +465,35 @@ public class DeviceStateMonitor extends Handler { } } int newFilter = 0; int newFilter = 0; if (shouldTurnOnSignalStrength()) { if (shouldEnableSignalStrengthReports()) { newFilter |= IndicationFilter.SIGNAL_STRENGTH; newFilter |= IndicationFilter.SIGNAL_STRENGTH; } } if (shouldTurnOnFullNetworkUpdate()) { if (shouldEnableFullNetworkStateReports()) { newFilter |= IndicationFilter.FULL_NETWORK_STATE; newFilter |= IndicationFilter.FULL_NETWORK_STATE; } } if (shouldTurnOnDormancyUpdate()) { if (shouldEnableDataCallDormancyChangedReports()) { newFilter |= IndicationFilter.DATA_CALL_DORMANCY_CHANGED; newFilter |= IndicationFilter.DATA_CALL_DORMANCY_CHANGED; } } if (shouldTurnOnLinkCapacityEstimate()) { if (shouldEnableLinkCapacityEstimateReports()) { newFilter |= IndicationFilter.LINK_CAPACITY_ESTIMATE; newFilter |= IndicationFilter.LINK_CAPACITY_ESTIMATE; } } if (shouldTurnOnPhysicalChannelConfig()) { if (shouldEnablePhysicalChannelConfigReports()) { newFilter |= IndicationFilter.PHYSICAL_CHANNEL_CONFIG; newFilter |= IndicationFilter.PHYSICAL_CHANNEL_CONFIG; } } final boolean shouldTurnOnBarringInfo = shouldTurnOnBarringInfo(); final boolean shouldEnableBarringInfoReports = shouldEnableBarringInfoReports(); if (shouldTurnOnBarringInfo) { if (shouldEnableBarringInfoReports) { newFilter |= IndicationFilter.BARRING_INFO; newFilter |= IndicationFilter.BARRING_INFO; } } setUnsolResponseFilter(newFilter, false); setUnsolResponseFilter(newFilter, false); // Pull barring info AFTER setting filter, the order matters // Pull barring info AFTER setting filter, the order matters if (shouldTurnOnBarringInfo && !shouldTurnOnBarringInfoOld) { if (shouldEnableBarringInfoReports && !shouldEnableBarringInfoReportsOld) { if (DBG) log("Manually pull barring info...", true); if (DBG) log("Manually pull barring info...", true); // use a null message since we don't care of receiving response // use a null message since we don't care of receiving response mPhone.mCi.getBarringInfo(null); mPhone.mCi.getBarringInfo(null); Loading