Add VR mode check for thermal notification

When in VR mode, don't show the high temp notification
since VR shows its own notification.

Test: manual
Bug: 30995038
Change-Id: I845480d968a9b0da9997f035875885bc261c577a
(cherry picked from commit 65d8a5fc73)
This commit is contained in:
Andrew Sapperstein
2016-12-19 14:36:33 -08:00
parent 67e97053c5
commit d51ac7322e

View File

@@ -240,23 +240,29 @@ public class PowerUI extends SystemUI {
}
private void updateTemperatureWarning() {
// TODO: Add VR mode check
float[] temps = mHardwarePropertiesManager.getDeviceTemperatures(
HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
HardwarePropertiesManager.TEMPERATURE_CURRENT);
boolean shouldShowTempWarning = false;
for (float temp : temps) {
if (temp >= mThrottlingTemp) {
shouldShowTempWarning = true;
break;
PhoneStatusBar phoneStatusBar = getComponent(PhoneStatusBar.class);
if (phoneStatusBar != null && phoneStatusBar.isDeviceInVrMode()) {
// ensure the warning isn't showing, since VR shows its own warning
mWarnings.dismissTemperatureWarning();
} else {
float[] temps = mHardwarePropertiesManager.getDeviceTemperatures(
HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
HardwarePropertiesManager.TEMPERATURE_CURRENT);
boolean shouldShowTempWarning = false;
for (float temp : temps) {
if (temp >= mThrottlingTemp) {
shouldShowTempWarning = true;
break;
}
}
if (shouldShowTempWarning) {
mWarnings.showTemperatureWarning();
} else {
mWarnings.dismissTemperatureWarning();
}
}
if (shouldShowTempWarning) {
mWarnings.showTemperatureWarning();
} else {
mWarnings.dismissTemperatureWarning();
}
// TODO: skip this when in VR mode since we already get a callback
mHandler.postDelayed(this::updateTemperatureWarning, TEMPERATURE_INTERVAL);
}