From 57f67b4244ea8953296f6e4905286e951c3b2918 Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Wed, 3 Jul 2013 19:44:47 -0400 Subject: 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 --- src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java | 5 +++++ src/java/com/android/internal/telephony/gsm/GsmCallTracker.java | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src') 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; -- cgit v1.1