From 60bb9c9a81bcd766d3e79f765ac22c7c38492409 Mon Sep 17 00:00:00 2001 From: Anshul Jain Date: Mon, 22 Nov 2010 11:28:36 -0800 Subject: frameworks/base/telephony: Release wakelock on RIL request send error Android telephony does not release the partial wakelock right away if there is an error in sending the RIL request. The wake lock is released only after EVENT_WAKE_LOCK_TIMEOUT occurs that prevents the phone to go in power collpase. The change is to release the wake lock as soon as the error in send is detected. Also, change RIL#send not not send a request if there is no connection to vendor RIL, as the request will always fail. Change-Id: Ia39a4b9ac12f4064e301a65abfd26409d49babe1 --- telephony/java/com/android/internal/telephony/RIL.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'telephony/java') diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 2f7aa21..af483db 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -360,6 +360,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { rr.onError(GENERIC_FAILURE, null); rr.release(); } + } finally { + // Note: We are "Done" only if there are no outstanding + // requests or replies. Thus this code path will only release + // the wake lock on errors. + releaseWakeLockIfDone(); } if (!alreadySubtracted) { @@ -2044,6 +2049,12 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(RILRequest rr) { Message msg; + if (mSocket == null) { + rr.onError(RADIO_NOT_AVAILABLE, null); + rr.release(); + return; + } + msg = mSender.obtainMessage(EVENT_SEND, rr); acquireWakeLock(); -- cgit v1.1