summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vlad Popa <pvlad@google.com> 2023-04-24 13:42:20 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-04-24 13:42:20 +0000
commit661518fc7096ae5e4dc5d508a45857a9ed820c49 (patch)
treee606eac57f3bdf6cb18a13bca82b60c7e525758a
parent353d5f1229674c2ba025d6c2f188b4f3c8845425 (diff)
parent5e7759ba5e699243cc2362edc8fd91ad6c6cf985 (diff)
Merge "CSD: Fix initial logic for mSafeMediaVolumeState" into udc-dev
-rw-r--r--services/core/java/com/android/server/audio/SoundDoseHelper.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/audio/SoundDoseHelper.java b/services/core/java/com/android/server/audio/SoundDoseHelper.java
index a57dd403c662..7cdea8d08c58 100644
--- a/services/core/java/com/android/server/audio/SoundDoseHelper.java
+++ b/services/core/java/com/android/server/audio/SoundDoseHelper.java
@@ -87,10 +87,11 @@ public class SoundDoseHelper {
private static final int SAFE_MEDIA_VOLUME_ACTIVE = 3; // unconfirmed
private static final int MSG_CONFIGURE_SAFE_MEDIA = SAFE_MEDIA_VOLUME_MSG_START + 1;
- private static final int MSG_PERSIST_SAFE_VOLUME_STATE = SAFE_MEDIA_VOLUME_MSG_START + 2;
- private static final int MSG_PERSIST_MUSIC_ACTIVE_MS = SAFE_MEDIA_VOLUME_MSG_START + 3;
- private static final int MSG_PERSIST_CSD_VALUES = SAFE_MEDIA_VOLUME_MSG_START + 4;
- /*package*/ static final int MSG_CSD_UPDATE_ATTENUATION = SAFE_MEDIA_VOLUME_MSG_START + 5;
+ private static final int MSG_CONFIGURE_SAFE_MEDIA_FORCED = SAFE_MEDIA_VOLUME_MSG_START + 2;
+ private static final int MSG_PERSIST_SAFE_VOLUME_STATE = SAFE_MEDIA_VOLUME_MSG_START + 3;
+ private static final int MSG_PERSIST_MUSIC_ACTIVE_MS = SAFE_MEDIA_VOLUME_MSG_START + 4;
+ private static final int MSG_PERSIST_CSD_VALUES = SAFE_MEDIA_VOLUME_MSG_START + 5;
+ /*package*/ static final int MSG_CSD_UPDATE_ATTENUATION = SAFE_MEDIA_VOLUME_MSG_START + 6;
private static final int UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX = (20 * 3600 * 1000); // 20 hours
@@ -611,8 +612,7 @@ public class SoundDoseHelper {
}
/*package*/ void configureSafeMedia(boolean forced, String caller) {
- int msg = MSG_CONFIGURE_SAFE_MEDIA;
-
+ int msg = forced ? MSG_CONFIGURE_SAFE_MEDIA_FORCED : MSG_CONFIGURE_SAFE_MEDIA;
mAudioHandler.removeMessages(msg);
long time = 0;
@@ -622,7 +622,7 @@ public class SoundDoseHelper {
}
mAudioHandler.sendMessageAtTime(
- mAudioHandler.obtainMessage(msg, /*arg1=*/forced ? 1 : 0, /*arg2=*/0, caller),
+ mAudioHandler.obtainMessage(msg, /*arg1=*/0, /*arg2=*/0, caller),
time);
}
@@ -664,8 +664,10 @@ public class SoundDoseHelper {
/*package*/ void handleMessage(Message msg) {
switch (msg.what) {
+ case MSG_CONFIGURE_SAFE_MEDIA_FORCED:
case MSG_CONFIGURE_SAFE_MEDIA:
- onConfigureSafeMedia((msg.arg1 == 1), (String) msg.obj);
+ onConfigureSafeMedia((msg.what == MSG_CONFIGURE_SAFE_MEDIA_FORCED),
+ (String) msg.obj);
break;
case MSG_PERSIST_SAFE_VOLUME_STATE:
onPersistSafeVolumeState(msg.arg1);