Add suppressor text in SummaryProvider of Sound when it exists.

When suppressor exists for the sound effect, the sound summary
should show "muted by ...", not the "Ring volume at ..."

Bug: 31461022
Test: make -j40 RunSettingsRoboTests
Change-Id: I5d6895a7a330c993aac40bdca3bb1c79f8b7fbfe
This commit is contained in:
jackqdyulei
2016-10-03 17:44:59 -07:00
parent d5afb5a60c
commit d2c0eef222
4 changed files with 133 additions and 24 deletions

View File

@@ -19,6 +19,8 @@ package com.android.settings.notification;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -40,7 +42,6 @@ import com.android.settings.core.lifecycle.Lifecycle;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.drawer.CategoryKey;
import java.text.NumberFormat;
import java.util.ArrayList;
@@ -251,7 +252,15 @@ public class SoundSettings extends DashboardFragment {
AudioManager.STREAM_RING) / maxVolume);
resId = R.string.sound_settings_summary;
}
mSummaryLoader.setSummary(this, mContext.getString(resId, percent));
final ComponentName suppressor = NotificationManager.from(mContext)
.getEffectsSuppressor();
if (suppressor != null) {
String suppressText = SuppressorHelper.getSuppressionText(mContext, suppressor);
mSummaryLoader.setSummary(this, suppressText);
} else {
mSummaryLoader.setSummary(this, mContext.getString(resId, percent));
}
}
}