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

Commit 06b47e58 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Fix a crash in TrustedOverlayHost" into main

parents 4f2db854 600eb031
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -113,7 +113,12 @@ class TrustedOverlayHost {


        for (int i = mOverlays.size() - 1; i >= 0; i--) {
        for (int i = mOverlays.size() - 1; i >= 0; i--) {
            SurfaceControlViewHost.SurfacePackage l = mOverlays.get(i);
            SurfaceControlViewHost.SurfacePackage l = mOverlays.get(i);
           if (l.getSurfaceControl().isSameSurface(p.getSurfaceControl())) {
            SurfaceControl overlaySurfaceControl = l.getSurfaceControl();
            if (overlaySurfaceControl == null) {
                // Remove the overlay if the surfacepackage was released. Ownership
                // is shared, so this may happen.
                mOverlays.remove(i);
            } else if (overlaySurfaceControl.isSameSurface(p.getSurfaceControl())) {
                mOverlays.remove(i);
                mOverlays.remove(i);
                t.reparent(l.getSurfaceControl(), null);
                t.reparent(l.getSurfaceControl(), null);
                l.release();
                l.release();