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

Commit bb53f192 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Close AccountManagerService.session after timeout.

Bug: 303905130
Bug: 316893159
Test: manual
Merged-In: I3632c503097da771954aee460df49cbfab496a74
Change-Id: Ib4cebf1750fc6324dc1c8853e0d716ea5e8ec073
parent 2b9e13fb
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -182,6 +182,7 @@ public class AccountManagerService


    final MessageHandler mHandler;
    final MessageHandler mHandler;


    private static final int TIMEOUT_DELAY_MS = 1000 * 60 * 15;
    // Messages that can be sent on mHandler
    // Messages that can be sent on mHandler
    private static final int MESSAGE_TIMED_OUT = 3;
    private static final int MESSAGE_TIMED_OUT = 3;
    private static final int MESSAGE_COPY_SHARED_ACCOUNT = 4;
    private static final int MESSAGE_COPY_SHARED_ACCOUNT = 4;
@@ -4755,6 +4756,7 @@ public class AccountManagerService
            synchronized (mSessions) {
            synchronized (mSessions) {
                mSessions.put(toString(), this);
                mSessions.put(toString(), this);
            }
            }
            scheduleTimeout();
            if (response != null) {
            if (response != null) {
                try {
                try {
                    response.asBinder().linkToDeath(this, 0 /* flags */);
                    response.asBinder().linkToDeath(this, 0 /* flags */);
@@ -4921,6 +4923,11 @@ public class AccountManagerService
            }
            }
        }
        }


        private void scheduleTimeout() {
            mHandler.sendMessageDelayed(
                    mHandler.obtainMessage(MESSAGE_TIMED_OUT, this), TIMEOUT_DELAY_MS);
        }

        public void cancelTimeout() {
        public void cancelTimeout() {
            mHandler.removeMessages(MESSAGE_TIMED_OUT, this);
            mHandler.removeMessages(MESSAGE_TIMED_OUT, this);
        }
        }
@@ -4957,6 +4964,9 @@ public class AccountManagerService


        public void onTimedOut() {
        public void onTimedOut() {
            IAccountManagerResponse response = getResponseAndClose();
            IAccountManagerResponse response = getResponseAndClose();
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Session.onTimedOut");
            }
            if (response != null) {
            if (response != null) {
                try {
                try {
                    response.onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
                    response.onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,