Prevent the session count from being compromised
Some ways are found to reduce the session count multiple times by
destroying only one session:
1) Call MediaSession#release() multiple times.
2) Call MediaSession#release() and make the process crash
This CL fixes this problem by checking whether the session is already
destroyed in the MediaSessionService.
Also, another hole was found that calling MediaSession2#close()
decrements the session count, although the count does not increase
when creating the MediaSession2. This can be badly used for creating
MediaSession above limit. This CL also fixes this problem.
Bug: 143672815
Test: atest MediaSessionTest
Change-Id: I65225acc98d4bb0ce5cbb7e692675dd05ead635c
4 files changed