DND Bypassing Apps redesign

- Add link in DND Conversations Page to the overall conversations list
Settings page
- Add custom_rule xml pages for custom schedule rule settings for
messages and calls (so the UI is the same as before the message/calls
redesign)
- Change app exceptions to display apps with subtext indicating which
notitfication channels are allowed to bypass dnd (previously, would
display each channel individually)
- Add individual AppBypassDnd channel pages where users can decide which
channels will bypass DND for an app on a single page
(AppChannelsBypassingDndSettings)
- Only remove dnd bypassing apps preferences from the preference list if the list changed,
else just update the preference itself to avoid the list from flashing

Test: make RunSettingsRoboTests7
Bug: 151845457
Change-Id: If12d8921e1405aefb1066acc2ef5c55d216fe47a
This commit is contained in:
Beverly
2020-03-24 08:54:30 -04:00
committed by Beverly Tai
parent cb90ffafbb
commit f707950ee7
26 changed files with 1128 additions and 523 deletions

View File

@@ -6,6 +6,7 @@ import android.content.Context;
import android.icu.text.ListFormatter;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArraySet;
import androidx.core.text.BidiFormatter;
import androidx.fragment.app.Fragment;
@@ -21,6 +22,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Controls the summary for preference found at:
@@ -102,7 +104,7 @@ public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePre
return;
}
List<String> appsBypassingDnd = new ArrayList<>();
Set<String> appsBypassingDnd = new ArraySet<>();
for (ApplicationsState.AppEntry entry : apps) {
String pkg = entry.info.packageName;
for (NotificationChannel channel : mNotificationBackend
@@ -116,7 +118,8 @@ public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePre
}
}
if (appsBypassingDnd.size() == 0) {
final int numAppsBypassingDnd = appsBypassingDnd.size();
if (numAppsBypassingDnd == 0) {
mSummary = mContext.getResources().getString(
R.string.zen_mode_bypassing_apps_subtext_none);
refreshSummary(mPreference);
@@ -124,18 +127,20 @@ public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePre
}
List<String> displayAppsBypassing = new ArrayList<>();
if (appsBypassingDnd.size() <= 2) {
displayAppsBypassing = appsBypassingDnd;
if (numAppsBypassingDnd <= 2) {
displayAppsBypassing.addAll(appsBypassingDnd);
} else {
displayAppsBypassing.add(appsBypassingDnd.get(0));
displayAppsBypassing.add(appsBypassingDnd.get(1));
String[] appsBypassingDndArr =
appsBypassingDnd.toArray(new String[numAppsBypassingDnd]);
displayAppsBypassing.add(appsBypassingDndArr[0]);
displayAppsBypassing.add(appsBypassingDndArr[1]);
displayAppsBypassing.add(mContext.getResources().getString(
R.string.zen_mode_apps_bypassing_list_count,
appsBypassingDnd.size() - 2));
numAppsBypassingDnd - 2));
}
mSummary = mContext.getResources().getQuantityString(
R.plurals.zen_mode_bypassing_apps_subtext,
appsBypassingDnd.size(),
numAppsBypassingDnd,
ListFormatter.getInstance().format(displayAppsBypassing));
refreshSummary(mPreference);
}