Merge "Store brightnessThrottlingDataId in DisplayInfo" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0782888551
@@ -360,6 +360,14 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
public SparseArray<SurfaceControl.RefreshRateRange> thermalRefreshRateThrottling =
|
public SparseArray<SurfaceControl.RefreshRateRange> thermalRefreshRateThrottling =
|
||||||
new SparseArray<>();
|
new SparseArray<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the brightness throttling data that should be used. This can change e.g. in
|
||||||
|
* concurrent displays mode in which a stricter brightness throttling policy might need to be
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public String thermalBrightnessThrottlingDataId;
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
|
public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public DisplayInfo createFromParcel(Parcel source) {
|
public DisplayInfo createFromParcel(Parcel source) {
|
||||||
@@ -437,7 +445,9 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
&& Objects.equals(displayShape, other.displayShape)
|
&& Objects.equals(displayShape, other.displayShape)
|
||||||
&& Objects.equals(layoutLimitedRefreshRate, other.layoutLimitedRefreshRate)
|
&& Objects.equals(layoutLimitedRefreshRate, other.layoutLimitedRefreshRate)
|
||||||
&& BrightnessSynchronizer.floatEquals(hdrSdrRatio, other.hdrSdrRatio)
|
&& BrightnessSynchronizer.floatEquals(hdrSdrRatio, other.hdrSdrRatio)
|
||||||
&& thermalRefreshRateThrottling.contentEquals(other.thermalRefreshRateThrottling);
|
&& thermalRefreshRateThrottling.contentEquals(other.thermalRefreshRateThrottling)
|
||||||
|
&& Objects.equals(
|
||||||
|
thermalBrightnessThrottlingDataId, other.thermalBrightnessThrottlingDataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -495,6 +505,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
layoutLimitedRefreshRate = other.layoutLimitedRefreshRate;
|
layoutLimitedRefreshRate = other.layoutLimitedRefreshRate;
|
||||||
hdrSdrRatio = other.hdrSdrRatio;
|
hdrSdrRatio = other.hdrSdrRatio;
|
||||||
thermalRefreshRateThrottling = other.thermalRefreshRateThrottling;
|
thermalRefreshRateThrottling = other.thermalRefreshRateThrottling;
|
||||||
|
thermalBrightnessThrottlingDataId = other.thermalBrightnessThrottlingDataId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromParcel(Parcel source) {
|
public void readFromParcel(Parcel source) {
|
||||||
@@ -559,6 +570,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
hdrSdrRatio = source.readFloat();
|
hdrSdrRatio = source.readFloat();
|
||||||
thermalRefreshRateThrottling = source.readSparseArray(null,
|
thermalRefreshRateThrottling = source.readSparseArray(null,
|
||||||
SurfaceControl.RefreshRateRange.class);
|
SurfaceControl.RefreshRateRange.class);
|
||||||
|
thermalBrightnessThrottlingDataId = source.readString8();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -620,6 +632,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
dest.writeTypedObject(layoutLimitedRefreshRate, flags);
|
dest.writeTypedObject(layoutLimitedRefreshRate, flags);
|
||||||
dest.writeFloat(hdrSdrRatio);
|
dest.writeFloat(hdrSdrRatio);
|
||||||
dest.writeSparseArray(thermalRefreshRateThrottling);
|
dest.writeSparseArray(thermalRefreshRateThrottling);
|
||||||
|
dest.writeString8(thermalBrightnessThrottlingDataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -889,6 +902,8 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
sb.append(", thermalRefreshRateThrottling ");
|
sb.append(", thermalRefreshRateThrottling ");
|
||||||
sb.append(thermalRefreshRateThrottling);
|
sb.append(thermalRefreshRateThrottling);
|
||||||
|
sb.append(", thermalBrightnessThrottlingDataId ");
|
||||||
|
sb.append(thermalBrightnessThrottlingDataId);
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceSettings;
|
|||||||
import com.android.server.policy.WindowManagerPolicy;
|
import com.android.server.policy.WindowManagerPolicy;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the power state of the display.
|
* Controls the power state of the display.
|
||||||
@@ -605,7 +606,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
mLastBrightnessEvent = new BrightnessEvent(mDisplayId);
|
mLastBrightnessEvent = new BrightnessEvent(mDisplayId);
|
||||||
mTempBrightnessEvent = new BrightnessEvent(mDisplayId);
|
mTempBrightnessEvent = new BrightnessEvent(mDisplayId);
|
||||||
mThermalBrightnessThrottlingDataId =
|
mThermalBrightnessThrottlingDataId =
|
||||||
logicalDisplay.getThermalBrightnessThrottlingDataIdLocked();
|
logicalDisplay.getDisplayInfoLocked().thermalBrightnessThrottlingDataId;
|
||||||
|
|
||||||
if (mDisplayId == Display.DEFAULT_DISPLAY) {
|
if (mDisplayId == Display.DEFAULT_DISPLAY) {
|
||||||
mBatteryStats = BatteryStatsService.getService();
|
mBatteryStats = BatteryStatsService.getService();
|
||||||
@@ -955,7 +956,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
&& mLogicalDisplay.getPrimaryDisplayDeviceLocked()
|
&& mLogicalDisplay.getPrimaryDisplayDeviceLocked()
|
||||||
.getDisplayDeviceInfoLocked().type == Display.TYPE_INTERNAL;
|
.getDisplayDeviceInfoLocked().type == Display.TYPE_INTERNAL;
|
||||||
final String thermalBrightnessThrottlingDataId =
|
final String thermalBrightnessThrottlingDataId =
|
||||||
mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked();
|
mLogicalDisplay.getDisplayInfoLocked().thermalBrightnessThrottlingDataId;
|
||||||
mHandler.postAtTime(() -> {
|
mHandler.postAtTime(() -> {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
if (mDisplayDevice != device) {
|
if (mDisplayDevice != device) {
|
||||||
@@ -972,8 +973,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
// last command that was sent to change it's state. Let's assume it is unknown so
|
// last command that was sent to change it's state. Let's assume it is unknown so
|
||||||
// that we trigger a change immediately.
|
// that we trigger a change immediately.
|
||||||
mPowerState.resetScreenState();
|
mPowerState.resetScreenState();
|
||||||
} else if (
|
} else if (!Objects.equals(mThermalBrightnessThrottlingDataId,
|
||||||
!mThermalBrightnessThrottlingDataId.equals(thermalBrightnessThrottlingDataId)) {
|
thermalBrightnessThrottlingDataId)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId;
|
mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId;
|
||||||
mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig(
|
mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig(
|
||||||
@@ -2189,7 +2190,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
() -> {
|
() -> {
|
||||||
sendUpdatePowerState();
|
sendUpdatePowerState();
|
||||||
postBrightnessChangeRunnable();
|
postBrightnessChangeRunnable();
|
||||||
}, mUniqueDisplayId, mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked(),
|
}, mUniqueDisplayId,
|
||||||
|
mLogicalDisplay.getDisplayInfoLocked().thermalBrightnessThrottlingDataId,
|
||||||
ddConfig.getThermalBrightnessThrottlingDataMapByThrottlingId());
|
ddConfig.getThermalBrightnessThrottlingDataMapByThrottlingId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceSettings;
|
|||||||
import com.android.server.policy.WindowManagerPolicy;
|
import com.android.server.policy.WindowManagerPolicy;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the power state of the display.
|
* Controls the power state of the display.
|
||||||
@@ -488,7 +489,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
|||||||
mAutomaticBrightnessStrategy = new AutomaticBrightnessStrategy(context, mDisplayId);
|
mAutomaticBrightnessStrategy = new AutomaticBrightnessStrategy(context, mDisplayId);
|
||||||
mTag = "DisplayPowerController2[" + mDisplayId + "]";
|
mTag = "DisplayPowerController2[" + mDisplayId + "]";
|
||||||
mThermalBrightnessThrottlingDataId =
|
mThermalBrightnessThrottlingDataId =
|
||||||
logicalDisplay.getThermalBrightnessThrottlingDataIdLocked();
|
logicalDisplay.getDisplayInfoLocked().thermalBrightnessThrottlingDataId;
|
||||||
|
|
||||||
mDisplayDevice = mLogicalDisplay.getPrimaryDisplayDeviceLocked();
|
mDisplayDevice = mLogicalDisplay.getPrimaryDisplayDeviceLocked();
|
||||||
mUniqueDisplayId = logicalDisplay.getPrimaryDisplayDeviceLocked().getUniqueId();
|
mUniqueDisplayId = logicalDisplay.getPrimaryDisplayDeviceLocked().getUniqueId();
|
||||||
@@ -760,7 +761,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
|||||||
&& mLogicalDisplay.getPrimaryDisplayDeviceLocked()
|
&& mLogicalDisplay.getPrimaryDisplayDeviceLocked()
|
||||||
.getDisplayDeviceInfoLocked().type == Display.TYPE_INTERNAL;
|
.getDisplayDeviceInfoLocked().type == Display.TYPE_INTERNAL;
|
||||||
final String thermalBrightnessThrottlingDataId =
|
final String thermalBrightnessThrottlingDataId =
|
||||||
mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked();
|
mLogicalDisplay.getDisplayInfoLocked().thermalBrightnessThrottlingDataId;
|
||||||
|
|
||||||
mHandler.postAtTime(() -> {
|
mHandler.postAtTime(() -> {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
@@ -778,8 +779,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
|||||||
// last command that was sent to change it's state. Let's assume it is unknown so
|
// last command that was sent to change it's state. Let's assume it is unknown so
|
||||||
// that we trigger a change immediately.
|
// that we trigger a change immediately.
|
||||||
mPowerState.resetScreenState();
|
mPowerState.resetScreenState();
|
||||||
} else if (
|
} else if (!Objects.equals(mThermalBrightnessThrottlingDataId,
|
||||||
!mThermalBrightnessThrottlingDataId.equals(thermalBrightnessThrottlingDataId)) {
|
thermalBrightnessThrottlingDataId)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId;
|
mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId;
|
||||||
mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig(
|
mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig(
|
||||||
@@ -1820,7 +1821,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
|||||||
() -> {
|
() -> {
|
||||||
sendUpdatePowerState();
|
sendUpdatePowerState();
|
||||||
postBrightnessChangeRunnable();
|
postBrightnessChangeRunnable();
|
||||||
}, mUniqueDisplayId, mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked(),
|
}, mUniqueDisplayId,
|
||||||
|
mLogicalDisplay.getDisplayInfoLocked().thermalBrightnessThrottlingDataId,
|
||||||
ddConfig.getThermalBrightnessThrottlingDataMapByThrottlingId());
|
ddConfig.getThermalBrightnessThrottlingDataMapByThrottlingId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ final class LogicalDisplay {
|
|||||||
mIsEnabled = true;
|
mIsEnabled = true;
|
||||||
mIsInTransition = false;
|
mIsInTransition = false;
|
||||||
mThermalBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_ID;
|
mThermalBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_ID;
|
||||||
|
mBaseDisplayInfo.thermalBrightnessThrottlingDataId = mThermalBrightnessThrottlingDataId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDevicePositionLocked(int position) {
|
public void setDevicePositionLocked(int position) {
|
||||||
@@ -514,6 +515,7 @@ final class LogicalDisplay {
|
|||||||
|
|
||||||
mBaseDisplayInfo.layoutLimitedRefreshRate = mLayoutLimitedRefreshRate;
|
mBaseDisplayInfo.layoutLimitedRefreshRate = mLayoutLimitedRefreshRate;
|
||||||
mBaseDisplayInfo.thermalRefreshRateThrottling = mThermalRefreshRateThrottling;
|
mBaseDisplayInfo.thermalRefreshRateThrottling = mThermalRefreshRateThrottling;
|
||||||
|
mBaseDisplayInfo.thermalBrightnessThrottlingDataId = mThermalBrightnessThrottlingDataId;
|
||||||
|
|
||||||
mPrimaryDisplayDeviceInfo = deviceInfo;
|
mPrimaryDisplayDeviceInfo = deviceInfo;
|
||||||
mInfo.set(null);
|
mInfo.set(null);
|
||||||
@@ -885,20 +887,15 @@ final class LogicalDisplay {
|
|||||||
mIsInTransition = isInTransition;
|
mIsInTransition = isInTransition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The ID of the brightness throttling data that this display should use.
|
|
||||||
*/
|
|
||||||
public String getThermalBrightnessThrottlingDataIdLocked() {
|
|
||||||
return mThermalBrightnessThrottlingDataId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param brightnessThrottlingDataId The ID of the brightness throttling data that this
|
* @param brightnessThrottlingDataId The ID of the brightness throttling data that this
|
||||||
* display should use.
|
* display should use.
|
||||||
*/
|
*/
|
||||||
public void setThermalBrightnessThrottlingDataIdLocked(String brightnessThrottlingDataId) {
|
public void setThermalBrightnessThrottlingDataIdLocked(String brightnessThrottlingDataId) {
|
||||||
mThermalBrightnessThrottlingDataId =
|
if (!Objects.equals(brightnessThrottlingDataId, mThermalBrightnessThrottlingDataId)) {
|
||||||
brightnessThrottlingDataId;
|
mThermalBrightnessThrottlingDataId = brightnessThrottlingDataId;
|
||||||
|
mDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -596,17 +596,17 @@ public final class DisplayPowerController2Test {
|
|||||||
// We should still set screen state for the default display
|
// We should still set screen state for the default display
|
||||||
DisplayPowerRequest dpr = new DisplayPowerRequest();
|
DisplayPowerRequest dpr = new DisplayPowerRequest();
|
||||||
mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
|
mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
|
||||||
advanceTime(1);
|
advanceTime(1); // Run updatePowerState
|
||||||
verify(mHolder.displayPowerState, times(2)).setScreenState(anyInt());
|
verify(mHolder.displayPowerState, times(2)).setScreenState(anyInt());
|
||||||
|
|
||||||
mHolder = createDisplayPowerController(42, UNIQUE_ID);
|
mHolder = createDisplayPowerController(42, UNIQUE_ID);
|
||||||
|
|
||||||
mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
|
mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
|
||||||
advanceTime(1);
|
advanceTime(1); // Run updatePowerState
|
||||||
verify(mHolder.displayPowerState, never()).setScreenState(anyInt());
|
verify(mHolder.displayPowerState, never()).setScreenState(anyInt());
|
||||||
|
|
||||||
mHolder.dpc.onBootCompleted();
|
mHolder.dpc.onBootCompleted();
|
||||||
advanceTime(1);
|
advanceTime(1); // Run updatePowerState
|
||||||
verify(mHolder.displayPowerState).setScreenState(anyInt());
|
verify(mHolder.displayPowerState).setScreenState(anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,6 +822,21 @@ public final class DisplayPowerController2Test {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateBrightnessThrottlingDataId() {
|
||||||
|
mHolder.display.getDisplayInfoLocked().thermalBrightnessThrottlingDataId =
|
||||||
|
"throttling-data-id";
|
||||||
|
clearInvocations(mHolder.display.getPrimaryDisplayDeviceLocked().getDisplayDeviceConfig());
|
||||||
|
|
||||||
|
mHolder.dpc.onDisplayChanged(mHolder.hbmMetadata, Layout.NO_LEAD_DISPLAY);
|
||||||
|
DisplayPowerRequest dpr = new DisplayPowerRequest();
|
||||||
|
mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
|
||||||
|
advanceTime(1); // Run updatePowerState
|
||||||
|
|
||||||
|
verify(mHolder.display.getPrimaryDisplayDeviceLocked().getDisplayDeviceConfig())
|
||||||
|
.getThermalBrightnessThrottlingDataMapByThrottlingId();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a mock and registers it to {@link LocalServices}.
|
* Creates a mock and registers it to {@link LocalServices}.
|
||||||
*/
|
*/
|
||||||
@@ -862,8 +877,6 @@ public final class DisplayPowerController2Test {
|
|||||||
when(logicalDisplayMock.getDisplayInfoLocked()).thenReturn(info);
|
when(logicalDisplayMock.getDisplayInfoLocked()).thenReturn(info);
|
||||||
when(logicalDisplayMock.isEnabledLocked()).thenReturn(isEnabled);
|
when(logicalDisplayMock.isEnabledLocked()).thenReturn(isEnabled);
|
||||||
when(logicalDisplayMock.isInTransitionLocked()).thenReturn(false);
|
when(logicalDisplayMock.isInTransitionLocked()).thenReturn(false);
|
||||||
when(logicalDisplayMock.getThermalBrightnessThrottlingDataIdLocked()).thenReturn(
|
|
||||||
DisplayDeviceConfig.DEFAULT_ID);
|
|
||||||
when(displayDeviceMock.getDisplayDeviceInfoLocked()).thenReturn(deviceInfo);
|
when(displayDeviceMock.getDisplayDeviceInfoLocked()).thenReturn(deviceInfo);
|
||||||
when(displayDeviceMock.getUniqueId()).thenReturn(uniqueId);
|
when(displayDeviceMock.getUniqueId()).thenReturn(uniqueId);
|
||||||
when(displayDeviceMock.getDisplayDeviceConfig()).thenReturn(displayDeviceConfigMock);
|
when(displayDeviceMock.getDisplayDeviceConfig()).thenReturn(displayDeviceConfigMock);
|
||||||
|
|||||||
@@ -829,6 +829,21 @@ public final class DisplayPowerControllerTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateBrightnessThrottlingDataId() {
|
||||||
|
mHolder.display.getDisplayInfoLocked().thermalBrightnessThrottlingDataId =
|
||||||
|
"throttling-data-id";
|
||||||
|
clearInvocations(mHolder.display.getPrimaryDisplayDeviceLocked().getDisplayDeviceConfig());
|
||||||
|
|
||||||
|
mHolder.dpc.onDisplayChanged(mHolder.hbmMetadata, Layout.NO_LEAD_DISPLAY);
|
||||||
|
DisplayPowerRequest dpr = new DisplayPowerRequest();
|
||||||
|
mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
|
||||||
|
advanceTime(1); // Run updatePowerState
|
||||||
|
|
||||||
|
verify(mHolder.display.getPrimaryDisplayDeviceLocked().getDisplayDeviceConfig())
|
||||||
|
.getThermalBrightnessThrottlingDataMapByThrottlingId();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a mock and registers it to {@link LocalServices}.
|
* Creates a mock and registers it to {@link LocalServices}.
|
||||||
*/
|
*/
|
||||||
@@ -869,8 +884,6 @@ public final class DisplayPowerControllerTest {
|
|||||||
when(logicalDisplayMock.getDisplayInfoLocked()).thenReturn(info);
|
when(logicalDisplayMock.getDisplayInfoLocked()).thenReturn(info);
|
||||||
when(logicalDisplayMock.isEnabledLocked()).thenReturn(isEnabled);
|
when(logicalDisplayMock.isEnabledLocked()).thenReturn(isEnabled);
|
||||||
when(logicalDisplayMock.isInTransitionLocked()).thenReturn(false);
|
when(logicalDisplayMock.isInTransitionLocked()).thenReturn(false);
|
||||||
when(logicalDisplayMock.getThermalBrightnessThrottlingDataIdLocked()).thenReturn(
|
|
||||||
DisplayDeviceConfig.DEFAULT_ID);
|
|
||||||
when(displayDeviceMock.getDisplayDeviceInfoLocked()).thenReturn(deviceInfo);
|
when(displayDeviceMock.getDisplayDeviceInfoLocked()).thenReturn(deviceInfo);
|
||||||
when(displayDeviceMock.getUniqueId()).thenReturn(uniqueId);
|
when(displayDeviceMock.getUniqueId()).thenReturn(uniqueId);
|
||||||
when(displayDeviceMock.getDisplayDeviceConfig()).thenReturn(displayDeviceConfigMock);
|
when(displayDeviceMock.getDisplayDeviceConfig()).thenReturn(displayDeviceConfigMock);
|
||||||
|
|||||||
@@ -649,9 +649,9 @@ public class LogicalDisplayMapperTest {
|
|||||||
assertEquals(0, mLogicalDisplayMapper.getDisplayLocked(device2)
|
assertEquals(0, mLogicalDisplayMapper.getDisplayLocked(device2)
|
||||||
.getLeadDisplayIdLocked());
|
.getLeadDisplayIdLocked());
|
||||||
assertEquals("concurrent", mLogicalDisplayMapper.getDisplayLocked(device1)
|
assertEquals("concurrent", mLogicalDisplayMapper.getDisplayLocked(device1)
|
||||||
.getThermalBrightnessThrottlingDataIdLocked());
|
.getDisplayInfoLocked().thermalBrightnessThrottlingDataId);
|
||||||
assertEquals("concurrent", mLogicalDisplayMapper.getDisplayLocked(device2)
|
assertEquals("concurrent", mLogicalDisplayMapper.getDisplayLocked(device2)
|
||||||
.getThermalBrightnessThrottlingDataIdLocked());
|
.getDisplayInfoLocked().thermalBrightnessThrottlingDataId);
|
||||||
|
|
||||||
mLogicalDisplayMapper.setDeviceStateLocked(1, false);
|
mLogicalDisplayMapper.setDeviceStateLocked(1, false);
|
||||||
advanceTime(1000);
|
advanceTime(1000);
|
||||||
@@ -661,10 +661,10 @@ public class LogicalDisplayMapperTest {
|
|||||||
assertFalse(mLogicalDisplayMapper.getDisplayLocked(device2).isInTransitionLocked());
|
assertFalse(mLogicalDisplayMapper.getDisplayLocked(device2).isInTransitionLocked());
|
||||||
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
||||||
mLogicalDisplayMapper.getDisplayLocked(device1)
|
mLogicalDisplayMapper.getDisplayLocked(device1)
|
||||||
.getThermalBrightnessThrottlingDataIdLocked());
|
.getDisplayInfoLocked().thermalBrightnessThrottlingDataId);
|
||||||
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
||||||
mLogicalDisplayMapper.getDisplayLocked(device2)
|
mLogicalDisplayMapper.getDisplayLocked(device2)
|
||||||
.getThermalBrightnessThrottlingDataIdLocked());
|
.getDisplayInfoLocked().thermalBrightnessThrottlingDataId);
|
||||||
|
|
||||||
mLogicalDisplayMapper.setDeviceStateLocked(2, false);
|
mLogicalDisplayMapper.setDeviceStateLocked(2, false);
|
||||||
advanceTime(1000);
|
advanceTime(1000);
|
||||||
@@ -674,10 +674,10 @@ public class LogicalDisplayMapperTest {
|
|||||||
assertFalse(mLogicalDisplayMapper.getDisplayLocked(device2).isInTransitionLocked());
|
assertFalse(mLogicalDisplayMapper.getDisplayLocked(device2).isInTransitionLocked());
|
||||||
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
||||||
mLogicalDisplayMapper.getDisplayLocked(device1)
|
mLogicalDisplayMapper.getDisplayLocked(device1)
|
||||||
.getThermalBrightnessThrottlingDataIdLocked());
|
.getDisplayInfoLocked().thermalBrightnessThrottlingDataId);
|
||||||
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
assertEquals(DisplayDeviceConfig.DEFAULT_ID,
|
||||||
mLogicalDisplayMapper.getDisplayLocked(device2)
|
mLogicalDisplayMapper.getDisplayLocked(device2)
|
||||||
.getThermalBrightnessThrottlingDataIdLocked());
|
.getDisplayInfoLocked().thermalBrightnessThrottlingDataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -205,4 +205,19 @@ public class LogicalDisplayTest {
|
|||||||
assertNotEquals(info3, info2);
|
assertNotEquals(info3, info2);
|
||||||
assertTrue(refreshRanges.contentEquals(info3.thermalRefreshRateThrottling));
|
assertTrue(refreshRanges.contentEquals(info3.thermalRefreshRateThrottling));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetThermalBrightnessThrottlingDataId() {
|
||||||
|
String brightnessThrottlingDataId = "throttling_data_id";
|
||||||
|
DisplayInfo info1 = mLogicalDisplay.getDisplayInfoLocked();
|
||||||
|
mLogicalDisplay.setThermalBrightnessThrottlingDataIdLocked(brightnessThrottlingDataId);
|
||||||
|
DisplayInfo info2 = mLogicalDisplay.getDisplayInfoLocked();
|
||||||
|
// Display info should only be updated when updateLocked is called
|
||||||
|
assertEquals(info2, info1);
|
||||||
|
|
||||||
|
mLogicalDisplay.updateLocked(mDeviceRepo);
|
||||||
|
DisplayInfo info3 = mLogicalDisplay.getDisplayInfoLocked();
|
||||||
|
assertNotEquals(info3, info2);
|
||||||
|
assertEquals(brightnessThrottlingDataId, info3.thermalBrightnessThrottlingDataId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user