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:
@@ -119,9 +119,7 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
if (Objects.equals(suppressor, mSuppressor)) return;
|
||||
mSuppressor = suppressor;
|
||||
if (mPreference != null) {
|
||||
final String text = suppressor != null ?
|
||||
mContext.getString(com.android.internal.R.string.muted_by,
|
||||
getSuppressorCaption(suppressor)) : null;
|
||||
final String text = SuppressorHelper.getSuppressionText(mContext, suppressor);
|
||||
mPreference.setSuppressionText(text);
|
||||
}
|
||||
updatePreferenceIcon();
|
||||
@@ -137,25 +135,6 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
}
|
||||
}
|
||||
|
||||
private String getSuppressorCaption(ComponentName suppressor) {
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
final ServiceInfo info = pm.getServiceInfo(suppressor, 0);
|
||||
if (info != null) {
|
||||
final CharSequence seq = info.loadLabel(pm);
|
||||
if (seq != null) {
|
||||
final String str = seq.toString().trim();
|
||||
if (str.length() > 0) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Log.w(TAG, "Error loading suppressor caption", e);
|
||||
}
|
||||
return suppressor.getPackageName();
|
||||
}
|
||||
|
||||
private final class H extends Handler {
|
||||
private static final int UPDATE_EFFECTS_SUPPRESSOR = 1;
|
||||
private static final int UPDATE_RINGER_MODE = 2;
|
||||
|
Reference in New Issue
Block a user