Merge "CSD: Fix initial logic for mSafeMediaVolumeState" into udc-dev am: 661518fc70

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22810558

Change-Id: I59a25f00f85427c0138abc284dc9721637ee1acb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vlad Popa
2023-04-24 14:31:28 +00:00
committed by Automerger Merge Worker

View File

@@ -87,10 +87,11 @@ public class SoundDoseHelper {
private static final int SAFE_MEDIA_VOLUME_ACTIVE = 3; // unconfirmed 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_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_CONFIGURE_SAFE_MEDIA_FORCED = 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_SAFE_VOLUME_STATE = SAFE_MEDIA_VOLUME_MSG_START + 3;
private static final int MSG_PERSIST_CSD_VALUES = SAFE_MEDIA_VOLUME_MSG_START + 4; private static final int MSG_PERSIST_MUSIC_ACTIVE_MS = 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_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 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) { /*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); mAudioHandler.removeMessages(msg);
long time = 0; long time = 0;
@@ -622,7 +622,7 @@ public class SoundDoseHelper {
} }
mAudioHandler.sendMessageAtTime( mAudioHandler.sendMessageAtTime(
mAudioHandler.obtainMessage(msg, /*arg1=*/forced ? 1 : 0, /*arg2=*/0, caller), mAudioHandler.obtainMessage(msg, /*arg1=*/0, /*arg2=*/0, caller),
time); time);
} }
@@ -664,8 +664,10 @@ public class SoundDoseHelper {
/*package*/ void handleMessage(Message msg) { /*package*/ void handleMessage(Message msg) {
switch (msg.what) { switch (msg.what) {
case MSG_CONFIGURE_SAFE_MEDIA_FORCED:
case MSG_CONFIGURE_SAFE_MEDIA: case MSG_CONFIGURE_SAFE_MEDIA:
onConfigureSafeMedia((msg.arg1 == 1), (String) msg.obj); onConfigureSafeMedia((msg.what == MSG_CONFIGURE_SAFE_MEDIA_FORCED),
(String) msg.obj);
break; break;
case MSG_PERSIST_SAFE_VOLUME_STATE: case MSG_PERSIST_SAFE_VOLUME_STATE:
onPersistSafeVolumeState(msg.arg1); onPersistSafeVolumeState(msg.arg1);