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

Commit 6f526fca authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Migrate package level notification settings to topic level.

Bug: 22854014
Change-Id: If0c20bec3b3f8b01b86d195d2e7ff7aa1e15882e
parent a88265ef
Loading
Loading
Loading
Loading
+8 −13
Original line number Diff line number Diff line
@@ -6011,6 +6011,9 @@
    <!-- Sound & notification > Notification section: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
    <string name="app_notifications_title">App notifications</string>
    <!-- Sound & notification > Notification section: Title for the option managing notifications per topic. [CHAR LIMIT=30] -->
    <string name="topic_notifications_title">Topic notifications</string>
    <!-- Sound & notification > Sound section: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
    <string name="other_sound_settings">Other sounds</string>
@@ -6093,17 +6096,17 @@
    <!-- [CHAR LIMIT=NONE] App notification settings: Block option description-->
    <string name="app_notification_block_summary">Never show notifications from this app</string>
    <!-- [CHAR LIMIT=NONE] App notification settings: Priority option title -->
    <string name="app_notification_priority_title">Treat as priority</string>
    <!-- [CHAR LIMIT=NONE] App notification settings: Override DND option title -->
    <string name="app_notification_override_dnd_title">Override Do Not Disturb</string>
    <!-- [CHAR LIMIT=NONE] App notification settings: Priority option description-->
    <string name="app_notification_priority_summary">Let this app\u2019s notifications be heard when Do not disturb is set to Priority only</string>
    <!-- [CHAR LIMIT=NONE] App notification settings: Override DND option description-->
    <string name="app_notification_override_dnd_summary">Let these notifications continue to interrupt when Do Not Disturb is set to Priority Only</string>
    <!-- [CHAR LIMIT=NONE] App notification settings: Sensitive option title -->
    <string name="app_notification_sensitive_title">Hide sensitive content</string>
    <!-- [CHAR LIMIT=NONE] App notification settings: Sensitive option description-->
    <string name="app_notification_sensitive_summary">When the device is locked, hide content in this app\u2019s notifications that might reveal private information</string>
    <string name="app_notification_sensitive_summary">When the device is locked, hide content in these notifications that might reveal private information</string>
    <!-- [CHAR LIMIT=20] Notification settings: App notifications row summary when banned -->
    <string name="app_notification_row_banned">Blocked</string>
@@ -6484,10 +6487,6 @@
   <string name="notifications_enabled">Normal</string>
   <!-- App notification summary with notifications disabled [CHAR LIMIT=40] -->
   <string name="notifications_disabled">Block</string>
   <!-- App notification summary with notifications sensitive [CHAR LIMIT=40] -->
   <string name="notifications_sensitive">Sensitive content hidden</string>
   <!-- App notification summary with notifications priority [CHAR LIMIT=40] -->
   <string name="notifications_priority">Priority</string>
   <!-- App notification summary with 2 items [CHAR LIMIT=15] -->
   <string name="notifications_two_items"><xliff:g id="notif_state" example="Priority">%1$s</xliff:g> / <xliff:g id="notif_state" example="Priority">%2$s</xliff:g></string>
   <!-- App notification summary with 3 items [CHAR LIMIT=15] -->
@@ -6528,10 +6527,6 @@
    <string name="filter_work_apps">Work</string>
    <!-- Label for showing apps with blocked notifications in list [CHAR LIMIT=30] -->
    <string name="filter_notif_blocked_apps">Blocked</string>
    <!-- Label for showing apps with priority notifications in list [CHAR LIMIT=30] -->
    <string name="filter_notif_priority_apps">Priority</string>
    <!-- Label for showing apps with sensitive notifications in list [CHAR LIMIT=30] -->
    <string name="filter_notif_sensitive_apps">Sensitive content hidden</string>
    <!-- Label for showing apps with domain URLs (data URI with http or https) in list [CHAR LIMIT=30] -->
    <string name="filter_with_domain_urls_apps">With domain URLs</string>
+0 −16
Original line number Diff line number Diff line
@@ -26,22 +26,6 @@
            android:order="1"
            android:persistent="false" />

    <!-- Priority -->
    <SwitchPreference
            android:key="priority"
            android:title="@string/app_notification_priority_title"
            android:summary="@string/app_notification_priority_summary"
            android:order="2"
            android:persistent="false" />

    <!-- Sensitive -->
    <SwitchPreference
            android:key="sensitive"
            android:title="@string/app_notification_sensitive_title"
            android:summary="@string/app_notification_sensitive_summary"
            android:order="4"
            android:persistent="false" />

    <!-- App notification preferences -->
    <Preference
            android:key="app_settings"
+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/topic_notifications_title"
        android:key="topic_notification_settings">

    <!-- Bypass DND -->
    <SwitchPreference
            android:key="bypass_dnd"
            android:title="@string/app_notification_override_dnd_title"
            android:summary="@string/app_notification_override_dnd_summary"
            android:order="2"
            android:persistent="false" />

    <!-- Sensitive -->
    <SwitchPreference
            android:key="sensitive"
            android:title="@string/app_notification_sensitive_title"
            android:summary="@string/app_notification_sensitive_summary"
            android:order="4"
            android:persistent="false" />

</PreferenceScreen>
+0 −22
Original line number Diff line number Diff line
@@ -66,26 +66,4 @@ public class AppStateNotificationBridge extends AppStateBaseBridge {
            return info.extraInfo != null && ((AppRow) info.extraInfo).banned;
        }
    };

    public static final AppFilter FILTER_APP_NOTIFICATION_PRIORITY = new AppFilter() {
        @Override
        public void init() {
        }

        @Override
        public boolean filterApp(AppEntry info) {
            return info.extraInfo != null && ((AppRow) info.extraInfo).priority;
        }
    };

    public static final AppFilter FILTER_APP_NOTIFICATION_SENSITIVE = new AppFilter() {
        @Override
        public void init() {
        }

        @Override
        public boolean filterApp(AppEntry info) {
            return info.extraInfo != null && ((AppRow) info.extraInfo).sensitive;
        }
    };
}
+1 −19
Original line number Diff line number Diff line
@@ -814,26 +814,8 @@ public class InstalledAppDetails extends AppInfoBase
        if (appRow.banned) {
            return context.getString(R.string.notifications_disabled);
        }
        ArrayList<CharSequence> notifSummary = new ArrayList<>();
        if (appRow.priority) {
            notifSummary.add(context.getString(R.string.notifications_priority));
        }
        if (appRow.sensitive) {
            notifSummary.add(context.getString(R.string.notifications_sensitive));
        }
        switch (notifSummary.size()) {
            case 3:
                return context.getString(R.string.notifications_three_items,
                        notifSummary.get(0), notifSummary.get(1), notifSummary.get(2));
            case 2:
                return context.getString(R.string.notifications_two_items,
                        notifSummary.get(0), notifSummary.get(1));
            case 1:
                return notifSummary.get(0);
            default:
        return context.getString(R.string.notifications_enabled);
    }
    }

    private class MemoryUpdater extends AsyncTask<Void, Void, ProcStatsPackageEntry> {

Loading