Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60bb9c9a authored by Anshul Jain's avatar Anshul Jain
Browse files

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
parent 1d67fa5b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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();