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

Commit 2b7d92aa authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Dispatch pending events outside a lock" into main

parents fb6f500a 94ee6d72
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -4382,7 +4382,7 @@ public final class DisplayManagerService extends SystemService {
        // would be unusual to do so.  The method returns true on success.
        // This is only used if {@link deferDisplayEventsWhenFrozen()} is true.
        public boolean dispatchPending() {
            try {
            Event[] pending;
            synchronized (mCallback) {
                if (mPendingEvents == null || mPendingEvents.isEmpty() || !mAlive) {
                    return true;
@@ -4390,8 +4390,13 @@ public final class DisplayManagerService extends SystemService {
                if (!isReadyLocked()) {
                    return false;
                }
                    for (int i = 0; i < mPendingEvents.size(); i++) {
                        Event displayEvent = mPendingEvents.get(i);
                pending = new Event[mPendingEvents.size()];
                pending = mPendingEvents.toArray(pending);
                mPendingEvents.clear();
            }
            try {
                for (int i = 0; i < pending.length; i++) {
                    Event displayEvent = pending[i];
                    if (DEBUG) {
                        Slog.d(TAG, "Send pending display event #" + i + " "
                                + displayEvent.displayId + "/"
@@ -4399,9 +4404,7 @@ public final class DisplayManagerService extends SystemService {
                    }
                    transmitDisplayEvent(displayEvent.displayId, displayEvent.event);
                }
                    mPendingEvents.clear();
                return true;
                }
            } catch (RemoteException ex) {
                Slog.w(TAG, "Failed to notify process "
                        + mPid + " that display topology changed, assuming it died.", ex);