Loading res/values/strings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -7151,6 +7151,18 @@ <!-- Sound: Title for the option managing notification volume. [CHAR LIMIT=30] --> <string name="notification_volume_option_title">Notification volume</string> <!-- Sound: Content description of ring volume title in silent mode. [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=8994620163934249882] --> <string name="ringer_content_description_silent_mode">Ringer silent</string> <!-- Sound: Content description of ring volume title in vibrate mode. [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=6261841170896561364] --> <string name="ringer_content_description_vibrate_mode">Ringer vibrate</string> <!-- Sound: Content description of notification volume title in vibrate mode. [CHAR LIMIT=NONE] --> <string name="notification_volume_content_description_vibrate_mode">Notification volume muted, notifications will vibrate</string> <!-- Sound: Content description of volume title in silent mode [CHAR LIMIT=NONE] --> <string name="volume_content_description_silent_mode"> <xliff:g id="volume type" example="notification volume">%1$s</xliff:g> muted</string> <!-- Sound: Summary for when notification volume is disabled. [CHAR LIMIT=100] --> <string name="notification_volume_disabled_summary">Unavailable because ring is muted</string> src/com/android/settings/notification/MediaVolumePreferenceController.java +13 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class MediaVolumePreferenceController extends VolumeSeekBarPreferenceCont public MediaVolumePreferenceController(Context context) { super(context, KEY_MEDIA_VOLUME); mVolumePreferenceListener = this::updateContentDescription; } @Override Loading Loading @@ -109,6 +110,18 @@ public class MediaVolumePreferenceController extends VolumeSeekBarPreferenceCont return false; } private void updateContentDescription() { if (mPreference != null) { if (mPreference.isMuted()) { mPreference.updateContentDescription( mContext.getString(R.string.volume_content_description_silent_mode, mPreference.getTitle())); } else { mPreference.updateContentDescription(mPreference.getTitle()); } } } @Override public SliceAction getSliceEndItem(Context context) { if (!isSupportEndItem()) { Loading src/com/android/settings/notification/NotificationVolumePreferenceController.java +33 −16 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.service.notification.NotificationListenerService; import android.view.View; import androidx.lifecycle.OnLifecycleEvent; import androidx.preference.PreferenceScreen; Loading Loading @@ -75,6 +76,7 @@ public class NotificationVolumePreferenceController extends updateEffectsSuppressor(); selectPreferenceIconState(); updateContentDescription(); updateEnabledState(); } Loading Loading @@ -120,23 +122,37 @@ public class NotificationVolumePreferenceController extends } @Override protected void selectPreferenceIconState() { if (mPreference != null) { if (mVibrator != null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mMuteIcon = mVibrateIconId; mPreference.showIcon(mVibrateIconId); } else if (mRingerMode == AudioManager.RINGER_MODE_SILENT || mVibrator == null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mMuteIcon = mSilentIconId; mPreference.showIcon(mSilentIconId); } else { // ringmode normal: could be that we are still silent protected int getEffectiveRingerMode() { if (mVibrator == null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { return AudioManager.RINGER_MODE_SILENT; } else if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { if (mHelper.getStreamVolume(AudioManager.STREAM_NOTIFICATION) == 0) { // ring is in normal, but notification is in silent mMuteIcon = mSilentIconId; mPreference.showIcon(mSilentIconId); } else { mPreference.showIcon(mNormalIconId); // Ring is in normal, but notification is in silent. return AudioManager.RINGER_MODE_SILENT; } } return mRingerMode; } @Override protected void updateContentDescription() { if (mPreference != null) { int ringerMode = getEffectiveRingerMode(); if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { mPreference.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); mPreference.updateContentDescription( mContext.getString( R.string.notification_volume_content_description_vibrate_mode)); } else if (ringerMode == AudioManager.RINGER_MODE_SILENT) { mPreference.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); mPreference.updateContentDescription( mContext.getString(R.string.volume_content_description_silent_mode, mPreference.getTitle())); } else { // Set a11y mode to none in order not to trigger talkback while changing // notification volume in normal mode. mPreference.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE); mPreference.updateContentDescription(mPreference.getTitle()); } } } Loading Loading @@ -169,6 +185,7 @@ public class NotificationVolumePreferenceController extends break; case NOTIFICATION_VOLUME_CHANGED: selectPreferenceIconState(); updateContentDescription(); updateEnabledState(); break; } Loading src/com/android/settings/notification/RingerModeAffectedVolumePreferenceController.java +28 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Vibrator; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.settings.R; import java.util.Objects; Loading Loading @@ -54,6 +55,7 @@ public abstract class RingerModeAffectedVolumePreferenceController extends if (mVibrator != null && !mVibrator.hasVibrator()) { mVibrator = null; } mVolumePreferenceListener = this::updateContentDescription; } protected void updateEffectsSuppressor() { Loading Loading @@ -123,6 +125,7 @@ public abstract class RingerModeAffectedVolumePreferenceController extends } mRingerMode = ringerMode; selectPreferenceIconState(); updateContentDescription(); return true; } Loading @@ -131,10 +134,11 @@ public abstract class RingerModeAffectedVolumePreferenceController extends */ protected void selectPreferenceIconState() { if (mPreference != null) { if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { int ringerMode = getEffectiveRingerMode(); if (ringerMode == AudioManager.RINGER_MODE_NORMAL) { mPreference.showIcon(mNormalIconId); } else { if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE && mVibrator != null) { if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { mMuteIcon = mVibrateIconId; } else { mMuteIcon = mSilentIconId; Loading @@ -144,6 +148,28 @@ public abstract class RingerModeAffectedVolumePreferenceController extends } } protected int getEffectiveRingerMode() { if (mVibrator == null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { return AudioManager.RINGER_MODE_SILENT; } return mRingerMode; } protected void updateContentDescription() { if (mPreference != null) { int ringerMode = getEffectiveRingerMode(); if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { mPreference.updateContentDescription( mContext.getString(R.string.ringer_content_description_vibrate_mode)); } else if (ringerMode == AudioManager.RINGER_MODE_SILENT) { mPreference.updateContentDescription( mContext.getString(R.string.ringer_content_description_silent_mode)); } else { mPreference.updateContentDescription(mPreference.getTitle()); } } } protected abstract boolean hintsMatch(int hints); } src/com/android/settings/notification/SeparateRingVolumePreferenceController.java +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public class SeparateRingVolumePreferenceController extends mReceiver.register(true); updateEffectsSuppressor(); selectPreferenceIconState(); updateContentDescription(); if (mPreference != null) { mPreference.setVisible(getAvailabilityStatus() == AVAILABLE); Loading Loading
res/values/strings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -7151,6 +7151,18 @@ <!-- Sound: Title for the option managing notification volume. [CHAR LIMIT=30] --> <string name="notification_volume_option_title">Notification volume</string> <!-- Sound: Content description of ring volume title in silent mode. [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=8994620163934249882] --> <string name="ringer_content_description_silent_mode">Ringer silent</string> <!-- Sound: Content description of ring volume title in vibrate mode. [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=6261841170896561364] --> <string name="ringer_content_description_vibrate_mode">Ringer vibrate</string> <!-- Sound: Content description of notification volume title in vibrate mode. [CHAR LIMIT=NONE] --> <string name="notification_volume_content_description_vibrate_mode">Notification volume muted, notifications will vibrate</string> <!-- Sound: Content description of volume title in silent mode [CHAR LIMIT=NONE] --> <string name="volume_content_description_silent_mode"> <xliff:g id="volume type" example="notification volume">%1$s</xliff:g> muted</string> <!-- Sound: Summary for when notification volume is disabled. [CHAR LIMIT=100] --> <string name="notification_volume_disabled_summary">Unavailable because ring is muted</string>
src/com/android/settings/notification/MediaVolumePreferenceController.java +13 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class MediaVolumePreferenceController extends VolumeSeekBarPreferenceCont public MediaVolumePreferenceController(Context context) { super(context, KEY_MEDIA_VOLUME); mVolumePreferenceListener = this::updateContentDescription; } @Override Loading Loading @@ -109,6 +110,18 @@ public class MediaVolumePreferenceController extends VolumeSeekBarPreferenceCont return false; } private void updateContentDescription() { if (mPreference != null) { if (mPreference.isMuted()) { mPreference.updateContentDescription( mContext.getString(R.string.volume_content_description_silent_mode, mPreference.getTitle())); } else { mPreference.updateContentDescription(mPreference.getTitle()); } } } @Override public SliceAction getSliceEndItem(Context context) { if (!isSupportEndItem()) { Loading
src/com/android/settings/notification/NotificationVolumePreferenceController.java +33 −16 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.service.notification.NotificationListenerService; import android.view.View; import androidx.lifecycle.OnLifecycleEvent; import androidx.preference.PreferenceScreen; Loading Loading @@ -75,6 +76,7 @@ public class NotificationVolumePreferenceController extends updateEffectsSuppressor(); selectPreferenceIconState(); updateContentDescription(); updateEnabledState(); } Loading Loading @@ -120,23 +122,37 @@ public class NotificationVolumePreferenceController extends } @Override protected void selectPreferenceIconState() { if (mPreference != null) { if (mVibrator != null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mMuteIcon = mVibrateIconId; mPreference.showIcon(mVibrateIconId); } else if (mRingerMode == AudioManager.RINGER_MODE_SILENT || mVibrator == null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mMuteIcon = mSilentIconId; mPreference.showIcon(mSilentIconId); } else { // ringmode normal: could be that we are still silent protected int getEffectiveRingerMode() { if (mVibrator == null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { return AudioManager.RINGER_MODE_SILENT; } else if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { if (mHelper.getStreamVolume(AudioManager.STREAM_NOTIFICATION) == 0) { // ring is in normal, but notification is in silent mMuteIcon = mSilentIconId; mPreference.showIcon(mSilentIconId); } else { mPreference.showIcon(mNormalIconId); // Ring is in normal, but notification is in silent. return AudioManager.RINGER_MODE_SILENT; } } return mRingerMode; } @Override protected void updateContentDescription() { if (mPreference != null) { int ringerMode = getEffectiveRingerMode(); if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { mPreference.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); mPreference.updateContentDescription( mContext.getString( R.string.notification_volume_content_description_vibrate_mode)); } else if (ringerMode == AudioManager.RINGER_MODE_SILENT) { mPreference.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); mPreference.updateContentDescription( mContext.getString(R.string.volume_content_description_silent_mode, mPreference.getTitle())); } else { // Set a11y mode to none in order not to trigger talkback while changing // notification volume in normal mode. mPreference.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE); mPreference.updateContentDescription(mPreference.getTitle()); } } } Loading Loading @@ -169,6 +185,7 @@ public class NotificationVolumePreferenceController extends break; case NOTIFICATION_VOLUME_CHANGED: selectPreferenceIconState(); updateContentDescription(); updateEnabledState(); break; } Loading
src/com/android/settings/notification/RingerModeAffectedVolumePreferenceController.java +28 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Vibrator; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.settings.R; import java.util.Objects; Loading Loading @@ -54,6 +55,7 @@ public abstract class RingerModeAffectedVolumePreferenceController extends if (mVibrator != null && !mVibrator.hasVibrator()) { mVibrator = null; } mVolumePreferenceListener = this::updateContentDescription; } protected void updateEffectsSuppressor() { Loading Loading @@ -123,6 +125,7 @@ public abstract class RingerModeAffectedVolumePreferenceController extends } mRingerMode = ringerMode; selectPreferenceIconState(); updateContentDescription(); return true; } Loading @@ -131,10 +134,11 @@ public abstract class RingerModeAffectedVolumePreferenceController extends */ protected void selectPreferenceIconState() { if (mPreference != null) { if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { int ringerMode = getEffectiveRingerMode(); if (ringerMode == AudioManager.RINGER_MODE_NORMAL) { mPreference.showIcon(mNormalIconId); } else { if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE && mVibrator != null) { if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { mMuteIcon = mVibrateIconId; } else { mMuteIcon = mSilentIconId; Loading @@ -144,6 +148,28 @@ public abstract class RingerModeAffectedVolumePreferenceController extends } } protected int getEffectiveRingerMode() { if (mVibrator == null && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { return AudioManager.RINGER_MODE_SILENT; } return mRingerMode; } protected void updateContentDescription() { if (mPreference != null) { int ringerMode = getEffectiveRingerMode(); if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { mPreference.updateContentDescription( mContext.getString(R.string.ringer_content_description_vibrate_mode)); } else if (ringerMode == AudioManager.RINGER_MODE_SILENT) { mPreference.updateContentDescription( mContext.getString(R.string.ringer_content_description_silent_mode)); } else { mPreference.updateContentDescription(mPreference.getTitle()); } } } protected abstract boolean hintsMatch(int hints); }
src/com/android/settings/notification/SeparateRingVolumePreferenceController.java +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public class SeparateRingVolumePreferenceController extends mReceiver.register(true); updateEffectsSuppressor(); selectPreferenceIconState(); updateContentDescription(); if (mPreference != null) { mPreference.setVisible(getAvailabilityStatus() == AVAILABLE); Loading