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

Commit 0fb93c40 authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

Update mHavePendingChanges when there are changes

Currently mHavePendingChanges is set manually from
updateDisplayConfigsLocked and updateColorModesLocked
but not from updateHdrCapabilitiesLocked, so if only
HDR capabilities change we dont invalidate mInfo.

This CL ensures mHavePendingChanges=true when
there were changes in updateDisplayProperties.

Bug: 159721029
Test: m services
Test: verify that b/159721029 doesn't reproduce
Change-Id: I387d983e0f8ca849d9ee2bfc7f0e721697f85336
parent 7b91784c
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                        hdrCapabilities, isDefaultDisplay);
                mDevices.put(physicalDisplayId, device);
                sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_ADDED);
            } else if (device.updateDisplayProperties(configs, activeConfig,
            } else if (device.updateDisplayPropertiesLocked(configs, activeConfig,
                    configSpecs, colorModes, activeColorMode, hdrCapabilities)) {
                sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED);
            }
@@ -213,7 +213,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
            mPhysicalDisplayId = physicalDisplayId;
            mIsDefaultDisplay = isDefaultDisplay;
            mDisplayInfo = info;
            updateDisplayProperties(configs, activeConfigId, configSpecs, colorModes,
            updateDisplayPropertiesLocked(configs, activeConfigId, configSpecs, colorModes,
                    activeColorMode, hdrCapabilities);
            mSidekickInternal = LocalServices.getService(SidekickInternal.class);
            if (mIsDefaultDisplay) {
@@ -238,12 +238,15 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        /**
         * Returns true if there is a change.
         **/
        public boolean updateDisplayProperties(SurfaceControl.DisplayConfig[] configs,
        public boolean updateDisplayPropertiesLocked(SurfaceControl.DisplayConfig[] configs,
                int activeConfigId, SurfaceControl.DesiredDisplayConfigSpecs configSpecs,
                int[] colorModes, int activeColorMode, Display.HdrCapabilities hdrCapabilities) {
            boolean changed = updateDisplayConfigsLocked(configs, activeConfigId, configSpecs);
            changed |= updateColorModesLocked(colorModes, activeColorMode);
            changed |= updateHdrCapabilitiesLocked(hdrCapabilities);
            if (changed) {
                mHavePendingChanges = true;
            }
            return changed;
        }

@@ -327,8 +330,6 @@ final class LocalDisplayAdapter extends DisplayAdapter {
            if (!recordsChanged) {
                return false;
            }
            // Update the index of modes.
            mHavePendingChanges = true;

            mSupportedModes.clear();
            for (DisplayModeRecord record : records) {
@@ -443,8 +444,6 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                return false;
            }

            mHavePendingChanges = true;

            mSupportedColorModes.clear();
            mSupportedColorModes.addAll(pendingColorModes);
            Collections.sort(mSupportedColorModes);