summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/volume
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-07-15 10:22:02 -0400
committerJohn Spurlock <jspurlock@google.com>2014-07-16 06:54:35 -0400
commit50806fc4ceff4bb093a18bdecb506163e68b9cbb (patch)
treef52669047735e844834e77dd053e3a8ba882498d /packages/SystemUI/src/com/android/systemui/volume
parent1d935abdd579fbcc20ef5c501e8f587e1b07ddb5 (diff)
downloadframeworks_base-50806fc4ceff4bb093a18bdecb506163e68b9cbb.zip
frameworks_base-50806fc4ceff4bb093a18bdecb506163e68b9cbb.tar.gz
frameworks_base-50806fc4ceff4bb093a18bdecb506163e68b9cbb.tar.bz2
Zen: handle exit conditions across reboots.
- Use the persisted exit condition (and a new persisted exit component) to immediately resubscribe to the manual exit condition (if present) - Fire false immediately for old countdown conditions. - Add a new zen lens to noman dump, and a bit more info. - Refresh the current exit condition when reopening the panel. Bug:15844990 Bug:16212455 Change-Id: I8bfaf1b2a6cf3d8818002a9db5c527ad3aa4c05c
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/volume')
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
index 9c166ac..cf04219 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
@@ -32,7 +32,6 @@ import android.service.notification.Condition;
import android.service.notification.ZenModeConfig;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AnimationUtils;
@@ -54,8 +53,11 @@ public class ZenModePanel extends LinearLayout {
private static final String TAG = "ZenModePanel";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+ private static final int SECONDS_MS = 1000;
+ private static final int MINUTES_MS = 60 * SECONDS_MS;
+
private static final int[] MINUTE_BUCKETS = DEBUG
- ? new int[] { 1, 2, 5, 15, 30, 45, 60, 120, 180, 240, 480 }
+ ? new int[] { 0, 1, 2, 5, 15, 30, 45, 60, 120, 180, 240, 480 }
: new int[] { 15, 30, 45, 60, 120, 180, 240, 480 };
private static final int MIN_BUCKET_MINUTES = MINUTE_BUCKETS[0];
private static final int MAX_BUCKET_MINUTES = MINUTE_BUCKETS[MINUTE_BUCKETS.length - 1];
@@ -64,9 +66,7 @@ public class ZenModePanel extends LinearLayout {
private static final int TIME_CONDITION_INDEX = 1;
private static final int FIRST_CONDITION_INDEX = 2;
private static final float SILENT_HINT_PULSE_SCALE = 1.1f;
-
- private static final int SECONDS_MS = 1000;
- private static final int MINUTES_MS = 60 * SECONDS_MS;
+ private static final int ZERO_VALUE_MS = 20 * SECONDS_MS;
public static final Intent ZEN_SETTINGS = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
@@ -152,6 +152,7 @@ public class ZenModePanel extends LinearLayout {
if (DEBUG) Log.d(mTag, "onAttachedToWindow");
mAttachedZen = getSelectedZen(-1);
refreshExitConditionText();
+ updateWidgets();
}
@Override
@@ -292,7 +293,8 @@ public class ZenModePanel extends LinearLayout {
private Condition newTimeCondition(int minutesFromNow) {
final long now = System.currentTimeMillis();
- return timeCondition(now + minutesFromNow * MINUTES_MS, minutesFromNow);
+ final long millis = minutesFromNow == 0 ? ZERO_VALUE_MS : minutesFromNow * MINUTES_MS;
+ return timeCondition(now + millis, minutesFromNow);
}
private Condition timeCondition(long time, int minutes) {
@@ -369,6 +371,9 @@ public class ZenModePanel extends LinearLayout {
}
tag.conditionId = condition != null ? condition.id : null;
tag.rb.setEnabled(enabled);
+ if (Objects.equals(tag.conditionId, mExitConditionId)) {
+ tag.rb.setChecked(true);
+ }
tag.rb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {