Notification settings updates

- Hide channels when a group is blocked
- Update importance strings
- Allow app blocking from 'recently seen'

Test: RoboSettingsTests
Fixes: 72879584
Fixes: 72882969
Fixes: 72831483
Change-Id: I99e001d3eb9eef52251cd50da191d33923335fcf
This commit is contained in:
Julia Reynolds
2018-02-05 12:49:44 -05:00
parent 7262d37c53
commit 18f14f10cf
10 changed files with 489 additions and 50 deletions

View File

@@ -74,6 +74,7 @@ import android.widget.Toast;
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -252,30 +253,6 @@ abstract public class NotificationSettingsBase extends DashboardFragment {
return null;
}
protected void populateGroupToggle(final PreferenceGroup parent,
NotificationChannelGroup group) {
RestrictedSwitchPreference preference = new RestrictedSwitchPreference(getPrefContext());
preference.setTitle(R.string.notification_switch_label);
preference.setEnabled(mSuspendedAppsAdmin == null
&& isChannelGroupBlockable(group));
preference.setChecked(!group.isBlocked());
preference.setOnPreferenceClickListener(preference1 -> {
final boolean allowGroup = ((SwitchPreference) preference1).isChecked();
group.setBlocked(!allowGroup);
mBackend.updateChannelGroup(mAppRow.pkg, mAppRow.uid, group);
for (int i = 0; i < parent.getPreferenceCount(); i++) {
Preference pref = parent.getPreference(i);
if (pref instanceof MasterSwitchPreference) {
((MasterSwitchPreference) pref).setSwitchEnabled(allowGroup);
}
}
return true;
});
parent.addPreference(preference);
}
protected Preference populateSingleChannelPrefs(PreferenceGroup parent,
final NotificationChannel channel, final boolean groupBlocked) {
MasterCheckBoxPreference channelPref = new MasterCheckBoxPreference(