Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 513f2602 authored by John Spurlock's avatar John Spurlock Committed by android-build-merger
Browse files

Merge "Zen: Create a new exit condition for "next alarm"." into lmp-mr1-dev

automerge: 0bdefb99

* commit '0bdefb99':
  Zen: Create a new exit condition for "next alarm".
parents 055acca7 0bdefb99
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ public class ZenModeConfig implements Parcelable {
    }

    // For built-in conditions
    private static final String SYSTEM_AUTHORITY = "android";
    public static final String SYSTEM_AUTHORITY = "android";

    // Built-in countdown conditions, e.g. condition://android/countdown/1399917958951
    private static final String COUNTDOWN_PATH = "countdown";
+3 −0
Original line number Diff line number Diff line
@@ -1907,4 +1907,7 @@
           1. Lenient threshold
    -->
    <integer name="config_LTE_RSRP_threshold_type">1</integer>

    <!-- Show the next-alarm as a zen exit condition if it occurs in the next n hours. -->
    <integer name="config_next_alarm_condition_lookahead_threshold_hrs">12</integer>
</resources>
+10 −1
Original line number Diff line number Diff line
@@ -4879,7 +4879,10 @@
    <string name="battery_saver_description">To help improve battery life, battery saver reduces your device’s performance and limits vibration and most background data. Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging.</string>

    <!-- [CHAR_LIMIT=NONE] Zen mode: Condition summary for built-in downtime condition, if active -->
    <string name="downtime_condition_summary">Until your downtime ends at <xliff:g id="formattedTime" example="10.00 PM">%1$s</xliff:g></string>
    <string name="downtime_condition_summary">Until your downtime ends at <xliff:g id="formattedTime" example="10:00 PM">%1$s</xliff:g></string>

    <!-- [CHAR_LIMIT=NONE] Zen mode: Condition line one for built-in downtime condition, if active -->
    <string name="downtime_condition_line_one">Until your downtime ends</string>

    <!-- Zen mode condition - summary: time duration in minutes. [CHAR LIMIT=NONE] -->
    <plurals name="zen_mode_duration_minutes_summary">
@@ -4913,4 +4916,10 @@

    <!-- Content description for the Toolbar icon used to collapse an expanded action mode. [CHAR LIMIT=NONE] -->
    <string name="toolbar_collapse_description">Collapse</string>

    <!-- Zen mode condition - summary: until next alarm. [CHAR LIMIT=NONE] -->
    <string name="zen_mode_next_alarm_summary">Until next alarm at <xliff:g id="formattedTime" example="7:30 AM">%1$s</xliff:g></string>

    <!-- Zen mode condition - line one: until next alarm. [CHAR LIMIT=NONE] -->
    <string name="zen_mode_next_alarm_line_one">Until next alarm</string>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -1984,12 +1984,16 @@
  <java-symbol type="string" name="timepicker_transition_end_radius_multiplier" />
  <java-symbol type="string" name="battery_saver_description" />
  <java-symbol type="string" name="downtime_condition_summary" />
  <java-symbol type="string" name="downtime_condition_line_one" />
  <java-symbol type="string" name="zen_mode_forever" />
  <java-symbol type="plurals" name="zen_mode_duration_minutes" />
  <java-symbol type="plurals" name="zen_mode_duration_hours" />
  <java-symbol type="plurals" name="zen_mode_duration_minutes_summary" />
  <java-symbol type="plurals" name="zen_mode_duration_hours_summary" />
  <java-symbol type="string" name="zen_mode_until" />
  <java-symbol type="string" name="zen_mode_next_alarm_summary" />
  <java-symbol type="string" name="zen_mode_next_alarm_line_one" />
  <java-symbol type="integer" name="config_next_alarm_condition_lookahead_threshold_hrs" />

  <java-symbol type="string" name="item_is_selected" />
  <java-symbol type="string" name="day_of_week_label_typeface" />
+9 −3
Original line number Diff line number Diff line
@@ -69,6 +69,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 long SELECT_DEFAULT_DELAY = 300;

    public static final Intent ZEN_SETTINGS = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);

@@ -373,8 +374,9 @@ public class ZenModePanel extends LinearLayout {
        if (isDowntime(mSessionExitCondition) && !foundDowntime) {
            bind(mSessionExitCondition, null);
        }
        // ensure something is selected
        checkForDefault();
        // ensure something is selected, after waiting for providers to respond
        mHandler.removeMessages(H.SELECT_DEFAULT);
        mHandler.sendEmptyMessageDelayed(H.SELECT_DEFAULT, SELECT_DEFAULT_DELAY);
    }

    private static boolean isDowntime(Condition c) {
@@ -385,7 +387,8 @@ public class ZenModePanel extends LinearLayout {
        return (ConditionTag) mZenConditions.getChildAt(index).getTag();
    }

    private void checkForDefault() {
    private void handleSelectDefault() {
        if (!mExpanded) return;
        // are we left without anything selected?  if so, set a default
        for (int i = 0; i < mZenConditions.getChildCount(); i++) {
            if (getConditionTagAt(i).rb.isChecked()) {
@@ -638,6 +641,7 @@ public class ZenModePanel extends LinearLayout {
        private static final int UPDATE_CONDITIONS = 1;
        private static final int EXIT_CONDITION_CHANGED = 2;
        private static final int UPDATE_ZEN = 3;
        private static final int SELECT_DEFAULT = 4;

        private H() {
            super(Looper.getMainLooper());
@@ -651,6 +655,8 @@ public class ZenModePanel extends LinearLayout {
                handleExitConditionChanged((Condition) msg.obj);
            } else if (msg.what == UPDATE_ZEN) {
                handleUpdateZen(msg.arg1);
            } else if (msg.what == SELECT_DEFAULT) {
                handleSelectDefault();
            }
        }
    }
Loading