From 97bfa0f17d8f16d487ea8b775e95ba6b718848fd Mon Sep 17 00:00:00 2001 From: Andrew Sapperstein Date: Tue, 24 Jan 2017 16:38:50 -0800 Subject: [PATCH] Decrease frequency of high temp warnings Instead of showing any time the temp is above throttling temp, if the user has dismissed the notification (or clicked it), the notification will not reshow until the temperature has gone below the throttling temp and come back. Test: manual Change-Id: I4cef9144dfcff03a5e70ccd5b12efaab1e74d15b Fixes: 34346625 --- .../power/PowerNotificationWarnings.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java index a8ed7a1fe5e7a..367c51c21a91c 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java @@ -215,8 +215,16 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { return; } mTempWarning = false; - mNoMan.cancelAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, - UserHandle.ALL); + dismissTemperatureWarningInternal(); + } + + /** + * Internal only version of {@link #dismissTemperatureWarning()} that simply dismisses + * the notification. As such, the notification will not show again until + * {@link #dismissTemperatureWarning()} is called. + */ + private void dismissTemperatureWarningInternal() { + mNoMan.cancelAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, UserHandle.ALL); } @Override @@ -388,10 +396,10 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { } else if (action.equals(ACTION_DISMISSED_WARNING)) { dismissLowBatteryWarning(); } else if (ACTION_CLICKED_TEMP_WARNING.equals(action)) { - dismissTemperatureWarning(); + dismissTemperatureWarningInternal(); showTemperatureDialog(); } else if (ACTION_DISMISSED_TEMP_WARNING.equals(action)) { - dismissTemperatureWarning(); + dismissTemperatureWarningInternal(); } } }