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

Commit 50b81622 authored by Dake Gu's avatar Dake Gu
Browse files

TvInputManager: fix leaking Context when failed create Session

If TvInputManagerService fails and returns null token, TvInputManager
does not create a Session object, so the onSessionReleased() will not
be executed. mSessionCallbackRecordMap does not clear the entry
in this case.

Bug: 110959874
Test: Create a TVView, call tune() with invalid id, run adb shell
      dumpsys meminfo and check activity count is not leaking.
Change-Id: Id0c81a99cb222bac98778e5d494ebd8665cf950f
parent 69a144a8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -888,6 +888,8 @@ public final class TvInputManager {
                    if (token != null) {
                        session = new Session(token, channel, mService, mUserId, seq,
                                mSessionCallbackRecordMap);
                    } else {
                        mSessionCallbackRecordMap.delete(seq);
                    }
                    record.postSessionCreated(session);
                }
@@ -2487,7 +2489,7 @@ public final class TvInputManager {
                }
            }
            synchronized (mSessionCallbackRecordMap) {
                mSessionCallbackRecordMap.remove(mSeq);
                mSessionCallbackRecordMap.delete(mSeq);
            }
        }