Fix NPE when store brightness and displayDevice is null
This issue can cause a phone reboot, we have to make sure displayDevice is not null before getting its unique id. Bug: 249782095 Test: manual Change-Id: Iec57f44798820ac741bd2e6843874fb2b1aaef12
This commit is contained in:
@@ -300,8 +300,11 @@ final class PersistentDataStore {
|
||||
}
|
||||
|
||||
public boolean setBrightness(DisplayDevice displayDevice, float brightness) {
|
||||
if (displayDevice == null || !displayDevice.hasStableUniqueId()) {
|
||||
return false;
|
||||
}
|
||||
final String displayDeviceUniqueId = displayDevice.getUniqueId();
|
||||
if (!displayDevice.hasStableUniqueId() || displayDeviceUniqueId == null) {
|
||||
if (displayDeviceUniqueId == null) {
|
||||
return false;
|
||||
}
|
||||
final DisplayState state = getDisplayState(displayDeviceUniqueId, true);
|
||||
|
||||
Reference in New Issue
Block a user