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

Commit 99364678 authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "Fix NPEs for virtual displays" into sc-dev

parents bc9e66e1 c6451f27
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -1070,6 +1070,11 @@ public final class Display {
            if (mDisplayInfo.userDisabledHdrTypes.length == 0) {
                return mDisplayInfo.hdrCapabilities;
            }

            if (mDisplayInfo.hdrCapabilities == null) {
                return null;
            }

            ArraySet<Integer> enabledTypesSet = new ArraySet<>();
            for (int supportedType : mDisplayInfo.hdrCapabilities.getSupportedHdrTypes()) {
                boolean typeDisabled = false;
@@ -1083,6 +1088,7 @@ public final class Display {
                    enabledTypesSet.add(supportedType);
                }
            }

            int[] enabledTypes = new int[enabledTypesSet.size()];
            int index = 0;
            for (int enabledType : enabledTypesSet) {
@@ -1107,6 +1113,9 @@ public final class Display {
    public int[] getReportedHdrTypes() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            if (mDisplayInfo.hdrCapabilities == null) {
                return new int[0];
            }
            return mDisplayInfo.hdrCapabilities.getSupportedHdrTypes();
        }
    }
@@ -1120,7 +1129,11 @@ public final class Display {
    public boolean isHdr() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            return !(getHdrCapabilities().getSupportedHdrTypes().length == 0);
            HdrCapabilities hdrCapabilities = getHdrCapabilities();
            if (hdrCapabilities == null) {
                return false;
            }
            return !(hdrCapabilities.getSupportedHdrTypes().length == 0);
        }
    }