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

Commit 75431913 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Using zen duration preference" into pi-dev

parents 197ea9e3 09da25f0
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -11194,6 +11194,20 @@ public final class Settings {
         */
        public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";

        /**
         * If 0, turning on dnd manually will last indefinitely.
         * Else if non-negative, turning on dnd manually will last for this many minutes.
         * Else (if negative), turning on dnd manually will surface a dialog that prompts
         * user to specify a duration.
         * @hide
         */
        public static final String ZEN_DURATION = "zen_duration";

        private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR;

        /** @hide */ public static final int ZEN_DURATION_PROMPT = -1;
        /** @hide */ public static final int ZEN_DURATION_FOREVER = 0;

        /**
         * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
         *
@@ -11575,7 +11589,8 @@ public final class Settings {
            BLUETOOTH_ON,
            PRIVATE_DNS_MODE,
            PRIVATE_DNS_SPECIFIER,
            SOFT_AP_TIMEOUT_ENABLED
            SOFT_AP_TIMEOUT_ENABLED,
            ZEN_DURATION,
        };

        /**
@@ -11616,6 +11631,7 @@ public final class Settings {
            VALIDATORS.put(WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON,
                    WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR);
            VALIDATORS.put(APP_AUTO_RESTRICTION_ENABLED, APP_AUTO_RESTRICTION_ENABLED_VALIDATOR);
            VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR);
        }

        /**
+3 −1
Original line number Diff line number Diff line
@@ -433,9 +433,11 @@ message GlobalSettingsProto {
    optional SettingProto show_mute_in_crash_dialog = 352 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingsProto show_zen_upgrade_notification = 354  [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingsProto app_auto_restriction_enabled = 359  [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingsProto zen_duration = 360  [ (android.privacy).dest = DEST_AUTOMATIC ];

    // Please insert fields in the same order as in
    // frameworks/base/core/java/android/provider/Settings.java.
    // Next tag = 360;
    // Next tag = 361;
}

message SecureSettingsProto {
+2 −2
Original line number Diff line number Diff line
@@ -4490,7 +4490,7 @@

    <!-- Zen mode condition - summary: time duration in hours. [CHAR LIMIT=NONE] -->
    <plurals name="zen_mode_duration_hours_summary">
        <item quantity="one">For one hour (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
        <item quantity="one">For 1 hour (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
        <item quantity="other">For %1$d hours (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
    </plurals>

@@ -4514,7 +4514,7 @@

    <!-- Zen mode condition - line one: time duration in hours. [CHAR LIMIT=NONE] -->
    <plurals name="zen_mode_duration_hours">
        <item quantity="one">For one hour</item>
        <item quantity="one">For 1 hour</item>
        <item quantity="other">For %d hours</item>
    </plurals>

+52 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/zen_duration_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport ="true"
            android:orientation="vertical">

    <LinearLayout
        android:id="@+id/zen_duration_dialog_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <com.android.settingslib.notification.ZenRadioLayout
            android:id="@+id/zen_duration_conditions"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="4dp"
            android:layout_marginStart="4dp"
            android:paddingBottom="4dp"
            android:orientation="horizontal">
            <RadioGroup
                android:id="@+id/zen_radio_buttons"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
            <LinearLayout
                android:id="@+id/zen_radio_buttons_content"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"/>
        </com.android.settingslib.notification.ZenRadioLayout>
    </LinearLayout>

</ScrollView>
 No newline at end of file
+9 −2
Original line number Diff line number Diff line
@@ -1062,10 +1062,13 @@
    <!-- Content description of zen mode time condition minus button (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_manual_zen_less_time">Less time.</string>

    <!--  Do not disturb: Label for button in enable zen dialog that will turn on zen mode. [CHAR LIMIT=30] -->
    <string name="zen_mode_enable_dialog_turn_on">Turn on</string>
    <!-- Button label for generic cancel action [CHAR LIMIT=20] -->
    <string name="cancel">Cancel</string>
    <!-- Button label for generic OK action [CHAR LIMIT=20] -->
    <string name="okay">OK</string>

    <!--  Do not disturb: Label for button in enable zen dialog that will turn on zen mode. [CHAR LIMIT=30] -->
    <string name="zen_mode_enable_dialog_turn_on">Turn on</string>
    <!-- Do not disturb: Title for the Do not Disturb dialog to turn on Do not disturb. [CHAR LIMIT=50]-->
    <string name="zen_mode_settings_turn_on_dialog_title">Turn on Do Not Disturb</string>
    <!-- Sound: Summary for the Do not Disturb option when there is no automatic rules turned on. [CHAR LIMIT=NONE]-->
@@ -1083,4 +1086,8 @@
    <!-- Alarm template for far in the future alarms [CHAR LIMIT=25] -->
    <string name="alarm_template_far">on <xliff:g id="when" example="Fri 7:00 AM">%1$s</xliff:g></string>

    <!-- Do not disturb: Title for the dnd duration setting (user can specify how long dnd will last when toggling dnd on from qs or settings) [CHAR LIMIT=30] -->
    <string name="zen_mode_duration_settings_title">Duration</string>
    <!-- Do not disturb: Duration option to always prompt for the duration of dnd -->
    <string name="zen_mode_duration_always_prompt_title">Ask every time</string>
</resources>
Loading