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

Commit c153eaaa authored by Jaewan Kim's avatar Jaewan Kim Committed by android-build-merger
Browse files

Merge "MediaSessionService: Prevent getActiveSessions() from growing...

Merge "MediaSessionService: Prevent getActiveSessions() from growing infinitely" into oc-mr1-dev am: 9bc71c49
am: 3fabcdb4

Change-Id: I84e5c9339250ed79e8cfdfefd9baddd2ceba3a78
parents 5b565429 3fabcdb4
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -205,9 +205,8 @@ public class MediaSessionService extends SystemService implements Monitor {
    }

    private List<MediaSessionRecord> getActiveSessionsLocked(int userId) {
        List<MediaSessionRecord> records;
        List<MediaSessionRecord> records = new ArrayList<>();
        if (userId == UserHandle.USER_ALL) {
            records = new ArrayList<>();
            int size = mUserRecords.size();
            for (int i = 0; i < size; i++) {
                records.addAll(mUserRecords.valueAt(i).mPriorityStack.getActiveSessions(userId));
@@ -216,9 +215,9 @@ public class MediaSessionService extends SystemService implements Monitor {
            FullUserRecord user = getFullUserRecordLocked(userId);
            if (user == null) {
                Log.w(TAG, "getSessions failed. Unknown user " + userId);
                return new ArrayList<>();
                return records;
            }
            records = user.mPriorityStack.getActiveSessions(userId);
            records.addAll(user.mPriorityStack.getActiveSessions(userId));
        }

        // Return global priority session at the first whenever it's asked.