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

Commit a3909a93 authored by Jeff Brown's avatar Jeff Brown
Browse files

Work around crash when display is removed.

After a display is removed, there may be a brief time
when a Context still exists that is bound to it.
We need to provide metrics in this case.

Bug: 7131637
Change-Id: I11b264a000653adbf0f3da399eaab66c4b40fb2a
parent e168edb5
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1586,7 +1586,15 @@ public final class ActivityThread {
        CompatibilityInfoHolder cih = new CompatibilityInfoHolder();
        cih.set(ci);
        Display d = displayManager.getCompatibleDisplay(displayId, cih);
        if (d != null) {
            d.getMetrics(dm);
        } else {
            // Display no longer exists
            // FIXME: This would not be a problem if we kept the Display object around
            // instead of using the raw display id everywhere.  The Display object caches
            // its information even after the display has been removed.
            dm.setToDefaults();
        }
        //Slog.i("foo", "New metrics: w=" + metrics.widthPixels + " h="
        //        + metrics.heightPixels + " den=" + metrics.density
        //        + " xdpi=" + metrics.xdpi + " ydpi=" + metrics.ydpi);