diff options
author | Jeevaka Badrappan <jeevaka.badrappan@intel.com> | 2013-01-16 17:56:55 -0600 |
---|---|---|
committer | invisiblek <dan.pasanen@gmail.com> | 2013-01-16 17:56:55 -0600 |
commit | e7fb25c88c04251f0b9d10d2caa1b51b799b7196 (patch) | |
tree | d864d9ca24e7d9657ac0696dff477917f5aa01ef | |
parent | 5fa827cc38511a4c673fcf08134a0dd2ab49cf6d (diff) | |
download | frameworks_opt_telephony-e7fb25c88c04251f0b9d10d2caa1b51b799b7196.zip frameworks_opt_telephony-e7fb25c88c04251f0b9d10d2caa1b51b799b7196.tar.gz frameworks_opt_telephony-e7fb25c88c04251f0b9d10d2caa1b51b799b7196.tar.bz2 |
Telephony: Start DataStallAlarm only on Data CONNECTED state
Telephony framework uses AlarmManager for recovery mechanism of data
stalled issue.
Framework configures the ELAPSED_REALTIME_WAKEUP alarm for every
6minutes irrespective of the data state. Due to this,quiet a few
wakeups are seen even when the device is not connected to Mobile
Data network.
Fix is to check the Data connection state before starting
this alarm.
Change-Id: I219bff9199e5ce70bbcd05c95d65731886215fe9
Author: Jeevaka Badrappan <jeevaka.badrappan@intel.com>
Signed-off-by: Jeevaka Badrappan <jeevaka.badrappan@intel.com>
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 28494
-rw-r--r-- | src/java/com/android/internal/telephony/DataConnectionTracker.java | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/java/com/android/internal/telephony/DataConnectionTracker.java b/src/java/com/android/internal/telephony/DataConnectionTracker.java index a2980be..c390321 100644 --- a/src/java/com/android/internal/telephony/DataConnectionTracker.java +++ b/src/java/com/android/internal/telephony/DataConnectionTracker.java @@ -1373,32 +1373,34 @@ public abstract class DataConnectionTracker extends Handler { int nextAction = getRecoveryAction(); int delayInMs; - // If screen is on or data stall is currently suspected, set the alarm - // with an aggresive timeout. - if (mIsScreenOn || suspectedStall || RecoveryAction.isAggressiveRecovery(nextAction)) { - delayInMs = Settings.Global.getInt(mResolver, - Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS, - DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS_DEFAULT); - } else { - delayInMs = Settings.Global.getInt(mResolver, - Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS, - DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS_DEFAULT); - } + if (getOverallState() == DctConstants.State.CONNECTED) { + // If screen is on or data stall is currently suspected, set the alarm + // with an aggresive timeout. + if (mIsScreenOn || suspectedStall || RecoveryAction.isAggressiveRecovery(nextAction)) { + delayInMs = Settings.Global.getInt(mResolver, + Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS, + DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS_DEFAULT); + } else { + delayInMs = Settings.Global.getInt(mResolver, + Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS, + DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS_DEFAULT); + } - mDataStallAlarmTag += 1; - if (VDBG) { - log("startDataStallAlarm: tag=" + mDataStallAlarmTag + - " delay=" + (delayInMs / 1000) + "s"); - } - AlarmManager am = - (AlarmManager) mPhone.getContext().getSystemService(Context.ALARM_SERVICE); + mDataStallAlarmTag += 1; + if (VDBG) { + log("startDataStallAlarm: tag=" + mDataStallAlarmTag + + " delay=" + (delayInMs / 1000) + "s"); + } + AlarmManager am = + (AlarmManager) mPhone.getContext().getSystemService(Context.ALARM_SERVICE); - Intent intent = new Intent(getActionIntentDataStallAlarm()); - intent.putExtra(DATA_STALL_ALARM_TAG_EXTRA, mDataStallAlarmTag); - mDataStallAlarmIntent = PendingIntent.getBroadcast(mPhone.getContext(), 0, intent, - PendingIntent.FLAG_UPDATE_CURRENT); - am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, - SystemClock.elapsedRealtime() + delayInMs, mDataStallAlarmIntent); + Intent intent = new Intent(getActionIntentDataStallAlarm()); + intent.putExtra(DATA_STALL_ALARM_TAG_EXTRA, mDataStallAlarmTag); + mDataStallAlarmIntent = PendingIntent.getBroadcast(mPhone.getContext(), 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT); + am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, + SystemClock.elapsedRealtime() + delayInMs, mDataStallAlarmIntent); + } } protected void stopDataStallAlarm() { |