From d51ac7322e721455f6a216e36d6740fc9e345f17 Mon Sep 17 00:00:00 2001 From: Andrew Sapperstein Date: Mon, 19 Dec 2016 14:36:33 -0800 Subject: [PATCH] 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 65d8a5fc73aac05633d42d7161ca38151aa5f675) --- .../com/android/systemui/power/PowerUI.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java index a7598685c6282..bdb22951a9b2d 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java @@ -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); }