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

Commit c806cce9 authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Prevent outofbounds exception when logging.

- Use foreach loop instead, which, with a CopyOnWriteArrayList, will
  prevent arrayindexoutofbounds exception, so we no longer need this in
the synchronised block.

Bug: 378672602
Flag: EXEMPT small bug fix only
Test: manual
Change-Id: I825afe2d5b479ad5e60de996b112a24b3303fc33
parent 495128ff
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -463,8 +463,8 @@ public final class DisplayManagerGlobal {
                mDisplayListeners.get(index).setEventsMask(internalEventFlagsMask);
            }
            updateCallbackIfNeededLocked();
            maybeLogAllDisplayListeners();
        }
        maybeLogAllDisplayListeners();
    }


@@ -511,8 +511,10 @@ public final class DisplayManagerGlobal {
        }

        Slog.i(TAG, "Currently Registered Display Listeners:");
        for (int i = 0; i < mDisplayListeners.size(); i++) {
            Slog.i(TAG, i + ": " + mDisplayListeners.get(i));
        int i = 0;
        for (DisplayListenerDelegate d : mDisplayListeners) {
            Slog.i(TAG, i + ": " + d);
            i++;
        }
    }

@@ -1453,8 +1455,8 @@ public final class DisplayManagerGlobal {
                registerCallbackIfNeededLocked();
                updateCallbackIfNeededLocked();
            }
            maybeLogAllTopologyListeners();
        }
        maybeLogAllTopologyListeners();
    }

    /**