summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vlad Popa <pvlad@google.com> 2024-03-19 17:28:24 -0700
committer Vlad Popa <pvlad@google.com> 2024-03-19 17:28:24 -0700
commit9fbd064af91ee522c3cab118ef08e656c101133d (patch)
tree48a80df5c6cc847d6123ef3ff790dc2e34954e6f
parent4e2031f9120105eb314c6d3378ddc0b054f6cdb8 (diff)
Remove dead code in checkForRingerModeChange
If mIsSingleVolume is true the checkForRingerModeChange will exit early returning FLAG_ADJUST_VOLUME. Removed all if statements that cannot evaluate to true because of mIsSingleVolume. Test: manual check Bug: 330414704 Change-Id: Icfc6b317397248fb25deda227a1d565b112bb631
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java21
1 files changed, 3 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index de000bf64c38..53c0f58d0067 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -6854,15 +6854,6 @@ public class AudioService extends IAudioService.Stub
ringerMode = RINGER_MODE_SILENT;
}
}
- } else if (mIsSingleVolume && (direction == AudioManager.ADJUST_TOGGLE_MUTE
- || direction == AudioManager.ADJUST_MUTE)) {
- if (mHasVibrator) {
- ringerMode = RINGER_MODE_VIBRATE;
- } else {
- ringerMode = RINGER_MODE_SILENT;
- }
- // Setting the ringer mode will toggle mute
- result &= ~FLAG_ADJUST_VOLUME;
}
break;
case RINGER_MODE_VIBRATE:
@@ -6871,11 +6862,8 @@ public class AudioService extends IAudioService.Stub
"but no vibrator is present");
break;
}
- if ((direction == AudioManager.ADJUST_LOWER)) {
- // This is the case we were muted with the volume turned up
- if (mIsSingleVolume && oldIndex >= 2 * step && isMuted) {
- ringerMode = RINGER_MODE_NORMAL;
- } else if (mPrevVolDirection != AudioManager.ADJUST_LOWER) {
+ if (direction == AudioManager.ADJUST_LOWER) {
+ if (mPrevVolDirection != AudioManager.ADJUST_LOWER) {
if (mVolumePolicy.volumeDownToEnterSilent) {
final long diff = SystemClock.uptimeMillis()
- mLoweredFromNormalToVibrateTime;
@@ -6895,10 +6883,7 @@ public class AudioService extends IAudioService.Stub
result &= ~FLAG_ADJUST_VOLUME;
break;
case RINGER_MODE_SILENT:
- if (mIsSingleVolume && direction == AudioManager.ADJUST_LOWER && oldIndex >= 2 * step && isMuted) {
- // This is the case we were muted with the volume turned up
- ringerMode = RINGER_MODE_NORMAL;
- } else if (direction == AudioManager.ADJUST_RAISE
+ if (direction == AudioManager.ADJUST_RAISE
|| direction == AudioManager.ADJUST_TOGGLE_MUTE
|| direction == AudioManager.ADJUST_UNMUTE) {
if (!mVolumePolicy.volumeUpToExitSilent) {