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

Commit b3c408f7 authored by Biswarup Pal's avatar Biswarup Pal
Browse files

Avoid binder call during ContextImple#updateResourceOverlayConstraints

ContextImpl#updateResourceOverlayConstraints requires displayId and
deviceId. We were fetching displayId using ContextImpl#getDisplay,
which makes a binder call into DisplayManagerService if the relevant
DisplayInfo is not cached in DisplayManagerGlobal. This change avoids
calling ContextImpl#getDisplay and calculates the displayId using
mDisplay member directly.

Test: atest OverlayConstraintsTests
Fixes: 398926802
Flag: EXEMPT bugfix
Change-Id: I269bacc5050c018da5da7b6eb979c4687645efd9
parent d9b9b084
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2981,7 +2981,11 @@ class ContextImpl extends Context {

    private void updateResourceOverlayConstraints() {
        if (mResources != null) {
            mResources.getAssets().setOverlayConstraints(getDisplayId(), getDeviceId());
            // Avoid calling getDisplay() here, as it makes a binder call into
            // DisplayManagerService if the relevant DisplayInfo is not cached in
            // DisplayManagerGlobal.
            int displayId = mDisplay != null ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY;
            mResources.getAssets().setOverlayConstraints(displayId, getDeviceId());
        }
    }