Limit unconfigurability to specified channels.

Bug: 62426259
Test: Unit test in NotificationBackendTest.java
Change-Id: I79d069cee0b641d520b02f8a25751ec3e0d4632d
This commit is contained in:
Alison Cichowlas
2017-06-08 16:17:23 -04:00
parent c37e0c1e47
commit bbd4fc124a
5 changed files with 164 additions and 9 deletions

View File

@@ -213,7 +213,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
private void setupVibrate() {
mVibrate = (RestrictedSwitchPreference) findPreference(KEY_VIBRATE);
mVibrate.setDisabledByAdmin(mSuspendedAppsAdmin);
mVibrate.setEnabled(!(mAppRow.lockedImportance || mVibrate.isDisabledByAdmin()));
mVibrate.setEnabled(!mVibrate.isDisabledByAdmin() && isChannelConfigurable(mChannel));
mVibrate.setChecked(mChannel.shouldVibrate());
mVibrate.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
@@ -230,7 +230,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
private void setupRingtone() {
mRingtone = (NotificationSoundPreference) findPreference(KEY_RINGTONE);
mRingtone.setRingtone(mChannel.getSound());
mRingtone.setEnabled(!(mAppRow.lockedImportance));
mRingtone.setEnabled(isChannelConfigurable(mChannel));
mRingtone.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -286,7 +286,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
channelArgs.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, true);
channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mPkg);
channelArgs.putString(Settings.EXTRA_CHANNEL_ID, mChannel.getId());
mImportance.setEnabled(mSuspendedAppsAdmin == null && !mAppRow.lockedImportance);
mImportance.setEnabled(mSuspendedAppsAdmin == null && isChannelConfigurable(mChannel));
// Set up intent to show importance selection only if this setting is enabled.
if (mImportance.isEnabled()) {
Intent channelIntent = Utils.onBuildStartFragmentIntent(getActivity(),