summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Shelnutt <shelnutt2@gmail.com>2013-07-03 19:44:47 -0400
committerSeth Shelnutt <shelnutt2@gmail.com>2013-07-03 19:52:17 -0400
commit57f67b4244ea8953296f6e4905286e951c3b2918 (patch)
tree521832692d7af277fd077252458633041258c827
parent06dcba0815889f23e2021d788fe6ad00b78d6d4d (diff)
downloadframeworks_opt_telephony-57f67b4244ea8953296f6e4905286e951c3b2918.zip
frameworks_opt_telephony-57f67b4244ea8953296f6e4905286e951c3b2918.tar.gz
frameworks_opt_telephony-57f67b4244ea8953296f6e4905286e951c3b2918.tar.bz2
CallTracker: Add delay to reduce cpu load
A delay is introduced to avoid rapid repeated polling which leads to high cpu usage and spamming of the modem and logcat. Change-Id: I6eb12babb723b5f5164ef43493c971f607746484
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java5
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmCallTracker.java5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 196e795..a48c13e 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -502,6 +502,11 @@ public final class CdmaCallTracker extends CallTracker {
if (slow_modem) {
if (polledCalls.size() == 0 && !hangupPendingMO){
+ try {
+ Thread.sleep(250);
+ } catch(InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
cm.getCurrentCalls(lastRelevantPoll);
return;
diff --git a/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java b/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
index c2d1640..822626e 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
@@ -437,6 +437,11 @@ public final class GsmCallTracker extends CallTracker {
if (slow_modem) {
if (polledCalls.size() == 0 && !hangupPendingMO){
+ try {
+ Thread.sleep(250);
+ } catch(InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
cm.getCurrentCalls(lastRelevantPoll);
return;