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

Commit 3bae4e5d authored by Beverly's avatar Beverly
Browse files

Zen upgrade notification

Test: runtest --path /extra/master/frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
Change-Id: Ia31f89af74d9bcee40e050bd6cc13f1e6a9a15d9
Fixes: 73000503
Fixes: 72876890
Fixes: 73110052
parent 85a6db68
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -12134,6 +12134,12 @@ public final class Settings {
         * @hide
         */
        public static final String SHOW_MUTE_IN_CRASH_DIALOG = "show_mute_in_crash_dialog";

        /**
         * If nonzero, will show the zen upgrade notification when the user toggles DND on/off.
         * @hide
         */
        public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification";
    }

    /**
+3 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ public class ZenModeConfig implements Parcelable {
    private static final boolean DEFAULT_ALLOW_SCREEN_OFF = true;
    private static final boolean DEFAULT_ALLOW_SCREEN_ON = true;

    private static final int XML_VERSION = 2;
    public static final int XML_VERSION = 3;
    public static final String ZEN_TAG = "zen";
    private static final String ZEN_ATT_VERSION = "version";
    private static final String ZEN_ATT_USER = "user";
@@ -145,6 +145,7 @@ public class ZenModeConfig implements Parcelable {
    public int user = UserHandle.USER_SYSTEM;
    public boolean allowWhenScreenOff = DEFAULT_ALLOW_SCREEN_OFF;
    public boolean allowWhenScreenOn = DEFAULT_ALLOW_SCREEN_ON;
    public int version;

    public ZenRule manualRule;
    public ArrayMap<String, ZenRule> automaticRules = new ArrayMap<>();
@@ -431,6 +432,7 @@ public class ZenModeConfig implements Parcelable {
        String tag = parser.getName();
        if (!ZEN_TAG.equals(tag)) return null;
        final ZenModeConfig rt = new ZenModeConfig();
        rt.version = safeInt(parser, ZEN_ATT_VERSION, XML_VERSION);
        rt.user = safeInt(parser, ZEN_ATT_USER, rt.user);
        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) {
            tag = parser.getName();
+6 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class SystemNotificationChannels {
    public static String USB = "USB";
    public static String FOREGROUND_SERVICE = "FOREGROUND_SERVICE";
    public static String HEAVY_WEIGHT_APP = "HEAVY_WEIGHT_APP";
    public static String SYSTEM_CHANGES = "SYSTEM_CHANGES";

    public static void createAll(Context context) {
        final NotificationManager nm = context.getSystemService(NotificationManager.class);
@@ -152,6 +153,11 @@ public class SystemNotificationChannels {
                .build());
        channelsList.add(heavyWeightChannel);

        NotificationChannel systemChanges = new NotificationChannel(SYSTEM_CHANGES,
                context.getString(R.string.notification_channel_system_changes),
                NotificationManager.IMPORTANCE_LOW);
        channelsList.add(systemChanges);

        nm.createNotificationChannels(channelsList);
    }

+2 −1
Original line number Diff line number Diff line
@@ -426,10 +426,11 @@ message GlobalSettingsProto {
    optional SettingProto show_first_crash_dialog = 349 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto show_restart_in_crash_dialog = 351 [ (android.privacy).dest = DEST_AUTOMATIC ];
    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 ];

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

message SecureSettingsProto {
+7 −0
Original line number Diff line number Diff line
@@ -4854,4 +4854,11 @@

    <!-- Notification action for editing a screenshot (drawing on it, cropping it, etc) -->
    <string name="screenshot_edit">Edit</string>

    <!-- Title for the notification channel notifying user of settings system changes (i.e. Do Not Disturb has changed). [CHAR LIMIT=NONE] -->
    <string name="notification_channel_system_changes">System changes</string>
    <!-- Title of notification indicating do not disturb settings have changed when upgrading to P -->
    <string name="zen_upgrade_notification_title">Do Not Disturb has changed</string>
    <!-- Content of notification indicating users can tap on the notification to go to dnd behavior settings -->
    <string name="zen_upgrade_notification_content">Tap to check your behavior settings for interruptions</string>
</resources>
Loading